version 1.1.2.5, 2001/12/02 20:36:49
|
version 1.1.2.6, 2001/12/02 22:03:23
|
|
|
#include <Pegasus/Common/Config.h> | #include <Pegasus/Common/Config.h> |
#include <Pegasus/WQL/WQLOperation.h> | #include <Pegasus/WQL/WQLOperation.h> |
#include <Pegasus/WQL/WQLOperand.h> | #include <Pegasus/WQL/WQLOperand.h> |
|
#include <Pegasus/WQL/WQLParserState.h> |
#include <Pegasus/WQL/WQLSelectStatement.h> | #include <Pegasus/WQL/WQLSelectStatement.h> |
#include <string.h> | #include <string.h> |
#include <stdlib.h> | #include <stdlib.h> |
|
|
#endif | #endif |
| |
#if 1 | #if 1 |
# define WQL_TRACE(X) printf(X) |
# define WQL_TRACE(X) printf X |
#else | #else |
# define WQL_TRACE(X) | # define WQL_TRACE(X) |
#endif | #endif |
|
|
extern int WQL_lex(); | extern int WQL_lex(); |
extern int WQL_error(char*); | extern int WQL_error(char*); |
| |
|
PEGASUS_USING_PEGASUS; |
|
|
|
PEGASUS_NAMESPACE_BEGIN |
|
|
|
extern WQLParserState* globalParserState; |
|
|
|
PEGASUS_NAMESPACE_END |
|
|
%} | %} |
| |
/* | /* |
|
|
%token <intValue> TOK_WHERE | %token <intValue> TOK_WHERE |
%token <intValue> TOK_FROM | %token <intValue> TOK_FROM |
| |
%token <strValue> TOK_UNEXPECTED_CHAR |
%token <intValue> TOK_UNEXPECTED_CHAR |
| |
%type <nodeValue> propertyName |
%type <strValue> propertyName |
%type <nodeValue> propertyList | %type <nodeValue> propertyList |
%type <nodeValue> predicate | %type <nodeValue> predicate |
%type <nodeValue> comparisonPredicate | %type <nodeValue> comparisonPredicate |
|
|
selectList | selectList |
: '*' | : '*' |
{ | { |
|
globalParserState->statement->appendPropertyName("*"); |
} | } |
| propertyList | | propertyList |
{ | { |
|
|
propertyList | propertyList |
: propertyName | : propertyName |
{ | { |
|
globalParserState->statement->appendPropertyName($1); |
} | } |
| propertyList ',' propertyName | | propertyList ',' propertyName |
{ | { |
|
globalParserState->statement->appendPropertyName($3); |
} | } |
| |
selectExpression | selectExpression |
|
|
fromClause | fromClause |
: TOK_FROM className | : TOK_FROM className |
{ | { |
|
WQL_TRACE(("YACC: fromClause: TOK_FROM className(%s)\n", $2)); |
|
globalParserState->statement->setClassName($2); |
|
delete [] $2; |
} | } |
| |
whereClause | whereClause |
|
|
propertyName | propertyName |
: TOK_IDENTIFIER | : TOK_IDENTIFIER |
{ | { |
|
WQL_TRACE(("YACC: propertyName : TOK_IDENTIFIER(%s)\n", $1)); |
|
$$ = $1; |
} | } |
| |
className : TOK_IDENTIFIER | className : TOK_IDENTIFIER |
{ | { |
|
WQL_TRACE(("YACC: TOK_IDENTIFIER %s\n", $1)); |
|
$$ = $1; |
} | } |
| |
comparisonTerm | comparisonTerm |
|
|
} | } |
| |
%% | %% |
|
|
int WQL_error(char* errorMessage) |
|
{ |
|
fprintf(stderr, "WQL_error: %s\n", errorMessage); |
|
return -1; |
|
} |
|