version 1.1.2.1, 2001/11/30 02:53:56
|
version 1.1.2.2, 2001/12/01 18:38:16
|
|
|
# include <alloca.h> | # include <alloca.h> |
#endif | #endif |
| |
|
#if 0 |
|
# define WQL_TRACE(X) printf(X) |
|
#else |
|
# define WQL_TRACE(X) |
|
#endif |
|
|
extern int WQL_lex(); | extern int WQL_lex(); |
extern int WQL_error(char*); | extern int WQL_error(char*); |
| |
|
|
| |
%token <intValue> TOK_INTEGER | %token <intValue> TOK_INTEGER |
%token <doubleValue> TOK_DOUBLE | %token <doubleValue> TOK_DOUBLE |
%token <strValue> STRING_LITERAL |
%token <strValue> TOK_STRING |
%token <intValue> EQ |
%token <intValue> TOK_TRUE |
%token <intValue> NE |
%token <intValue> TOK_FALSE |
%token <intValue> LT |
|
%token <intValue> LE |
%token <intValue> TOK_EQ |
%token <intValue> GT |
%token <intValue> TOK_NE |
%token <intValue> GE |
%token <intValue> TOK_LT |
%token <intValue> TOK_SELECT |
%token <intValue> TOK_LE |
%token <intValue> WHERE |
%token <intValue> TOK_GT |
%token <intValue> FROM |
%token <intValue> TOK_GE |
|
|
|
%token <intValue> TOK_NOT |
|
%token <intValue> TOK_OR |
|
%token <intValue> TOK_AND |
|
%token <intValue> TOK_ISA |
|
|
%token <strValue> TOK_IDENTIFIER | %token <strValue> TOK_IDENTIFIER |
%token <intValue> NOT |
%token <intValue> TOK_SELECT |
%token <intValue> OR |
%token <intValue> TOK_WHERE |
%token <intValue> AND |
%token <intValue> TOK_FROM |
%token <intValue> ISA |
|
%token <intValue> WQL_TRUE |
%token <strValue> TOK_UNEXPECTED_CHAR |
%token <intValue> WQL_FALSE |
|
| |
%type <nodeValue> constant | %type <nodeValue> constant |
%type <nodeValue> property | %type <nodeValue> property |
|
|
%type <nodeValue> functionParameterList | %type <nodeValue> functionParameterList |
%type <nodeValue> functionParameter | %type <nodeValue> functionParameter |
| |
%left OR |
%left TOK_OR |
%left AND |
%left TOK_AND |
%nonassoc NOT |
%nonassoc TOK_NOT |
|
|
|
%% |
| |
/* | /* |
**============================================================================== | **============================================================================== |
|
|
**============================================================================== | **============================================================================== |
*/ | */ |
| |
%% |
|
|
|
/* |
|
**------------------------------------------------------------------------------ |
|
** |
|
** start rule: |
|
** |
|
**------------------------------------------------------------------------------ |
|
*/ |
|
|
|
start | start |
: selectStatement | : selectStatement |
{ | { |
|
WQL_TRACE(("YACC: start: selectStatement\n")); |
} | } |
| |
/* BOOKMARK */ |
|
|
|
/* |
|
**------------------------------------------------------------------------------ |
|
** |
|
** Select Statement |
|
** |
|
**------------------------------------------------------------------------------ |
|
*/ |
|
|
|
selectStatement | selectStatement |
: TOK_SELECT propertyListOrStar fromClass | : TOK_SELECT propertyListOrStar fromClass |
{ | { |
|
WQL_TRACE(("YACC: selectStatement\n")); |
} | } |
| TOK_SELECT propertyListOrStar fromClass whereClause | | TOK_SELECT propertyListOrStar fromClass whereClause |
{ | { |
|
WQL_TRACE(("YACC: selectStatement\n")); |
} | } |
| |
fromClass : FROM className |
fromClass : TOK_FROM className |
{ | { |
|
WQL_TRACE(("YACC: fromClass : TOK_FROM %s\n", $2)); |
$$ = $2; | $$ = $2; |
} | } |
| |
className : TOK_IDENTIFIER | className : TOK_IDENTIFIER |
{ | { |
|
WQL_TRACE(("YACC: className : %s\n", $1)); |
$$ = $1 | $$ = $1 |
} | } |
| |
whereClause : WHERE expression |
whereClause : TOK_WHERE expression |
{ | { |
|
WQL_TRACE(("YACC: whereClause : TOK_WHERE expression\n")); |
} | } |
| |
propertyListOrStar | propertyListOrStar |
|
|
} | } |
| '*' | | '*' |
{ | { |
|
WQL_TRACE(("YACC: propertyListOrStar: '*'\n")); |
} | } |
| |
propertyList : property | propertyList : property |
|
|
} | } |
| |
expression | expression |
: expression OR expression |
: expression TOK_OR expression |
{ | { |
| |
} | } |
| expression AND expression |
| expression TOK_AND expression |
{ | { |
| |
} | } |
| NOT expression |
| TOK_NOT expression |
{ | { |
| |
} | } |
|
|
} | } |
| |
expressionTerm | expressionTerm |
: property LT constant |
: property TOK_LT constant |
{ | { |
| |
} | } |
| property GT constant |
| property TOK_GT constant |
{ | { |
| |
} | } |
| property LE constant |
| property TOK_LE constant |
{ | { |
| |
} | } |
| property GE constant |
| property TOK_GE constant |
{ | { |
| |
} | } |
| property EQ constant |
| property TOK_EQ constant |
{ | { |
| |
} | } |
| property NE constant |
| property TOK_NE constant |
{ | { |
| |
} | } |
| constant LT property |
| constant TOK_LT property |
{ | { |
| |
} | } |
| constant GT property |
| constant TOK_GT property |
{ | { |
| |
} | } |
| constant LE property |
| constant TOK_LE property |
{ | { |
| |
} | } |
| constant GE property |
| constant TOK_GE property |
{ | { |
| |
} | } |
| constant EQ property |
| constant TOK_EQ property |
{ | { |
| |
} | } |
| constant NE property |
| constant TOK_NE property |
{ | { |
| |
} | } |
| function LT constant |
| function TOK_LT constant |
{ | { |
| |
} | } |
| function GT constant |
| function TOK_GT constant |
{ | { |
| |
} | } |
| function LE constant |
| function TOK_LE constant |
{ | { |
| |
} | } |
| function GE constant |
| function TOK_GE constant |
{ | { |
| |
} | } |
| function EQ constant |
| function TOK_EQ constant |
{ | { |
| |
} | } |
| function NE constant |
| function TOK_NE constant |
{ | { |
| |
} | } |
| constant LT function |
| constant TOK_LT function |
{ | { |
| |
} | } |
| constant GT function |
| constant TOK_GT function |
{ | { |
| |
} | } |
| constant LE function |
| constant TOK_LE function |
{ | { |
| |
} | } |
| constant GE function |
| constant TOK_GE function |
{ | { |
| |
} | } |
| constant EQ function |
| constant TOK_EQ function |
{ | { |
| |
} | } |
| constant NE function |
| constant TOK_NE function |
{ | { |
| |
} | } |
| className ISA className |
| className TOK_ISA className |
{ | { |
| |
} | } |
|
|
{ | { |
| |
} | } |
| STRING_LITERAL |
| TOK_STRING |
{ | { |
|
WQL_TRACE(("YACC: TOK_STRING: %s\n", $1)); |
|
$$ = $1; |
} | } |
| |
%% | %% |