version 1.1.2.10, 2001/12/07 00:37:56
|
version 1.7, 2005/01/31 11:57:23
|
|
|
|
//%2004//////////////////////////////////////////////////////////////////////// |
|
// |
|
// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development |
|
// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. |
|
// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.; |
|
// IBM Corp.; EMC Corporation, The Open Group. |
|
// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.; |
|
// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. |
|
// |
|
// Permission is hereby granted, free of charge, to any person obtaining a copy |
|
// of this software and associated documentation files (the "Software"), to |
|
// deal in the Software without restriction, including without limitation the |
|
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
|
// sell copies of the Software, and to permit persons to whom the Software is |
|
// furnished to do so, subject to the following conditions: |
|
// |
|
// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN |
|
// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED |
|
// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT |
|
// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR |
|
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
|
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
|
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
|
// |
|
//============================================================================== |
| |
/* A Bison parser, made from wql.y with Bison version GNU Bison version 1.24 |
/* A Bison parser, made from WQL.y |
*/ |
by GNU Bison version 1.28 */ |
| |
#define YYBISON 1 /* Identify Bison output. */ | #define YYBISON 1 /* Identify Bison output. */ |
| |
|
|
#define yychar WQL_char | #define yychar WQL_char |
#define yydebug WQL_debug | #define yydebug WQL_debug |
#define yynerrs WQL_nerrs | #define yynerrs WQL_nerrs |
#define TOK_INTEGER 258 |
#define TOK_INTEGER 257 |
#define TOK_DOUBLE 259 |
#define TOK_DOUBLE 258 |
#define TOK_STRING 260 |
#define TOK_STRING 259 |
#define TOK_TRUE 261 |
#define TOK_TRUE 260 |
#define TOK_FALSE 262 |
#define TOK_FALSE 261 |
#define TOK_NULL 263 |
#define TOK_NULL 262 |
#define TOK_EQ 264 |
#define TOK_EQ 263 |
#define TOK_NE 265 |
#define TOK_NE 264 |
#define TOK_LT 266 |
#define TOK_LT 265 |
#define TOK_LE 267 |
#define TOK_LE 266 |
#define TOK_GT 268 |
#define TOK_GT 267 |
#define TOK_GE 269 |
#define TOK_GE 268 |
#define TOK_NOT 270 |
#define TOK_NOT 269 |
#define TOK_OR 271 |
#define TOK_OR 270 |
#define TOK_AND 272 |
#define TOK_AND 271 |
#define TOK_IS 273 |
#define TOK_IS 272 |
#define TOK_IDENTIFIER 274 |
#define TOK_IDENTIFIER 273 |
#define TOK_SELECT 275 |
#define TOK_SELECT 274 |
#define TOK_WHERE 276 |
#define TOK_WHERE 275 |
#define TOK_FROM 277 |
#define TOK_FROM 276 |
#define TOK_UNEXPECTED_CHAR 278 |
#define TOK_UNEXPECTED_CHAR 277 |
| |
#line 9 "wql.y" |
#line 9 "WQL.y" |
| |
| |
#include <Pegasus/Common/Config.h> | #include <Pegasus/Common/Config.h> |
|
|
#endif | #endif |
| |
extern int WQL_lex(); | extern int WQL_lex(); |
extern int WQL_error(char*); |
extern int WQL_error(const char*); |
| |
// | // |
// Define the global parser state object: | // Define the global parser state object: |
|
|
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
extern WQLParserState* globalParserState; |
extern AutoPtr<WQLParserState> globalParserState; |
| |
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |
| |
| |
#line 58 "wql.y" |
#line 58 "WQL.y" |
typedef union | typedef union |
{ | { |
int intValue; | int intValue; |
|
|
char* strValue; | char* strValue; |
void* nodeValue; | void* nodeValue; |
} YYSTYPE; | } YYSTYPE; |
|
|
#ifndef YYLTYPE |
|
typedef |
|
struct yyltype |
|
{ |
|
int timestamp; |
|
int first_line; |
|
int first_column; |
|
int last_line; |
|
int last_column; |
|
char *text; |
|
} |
|
yyltype; |
|
|
|
#define YYLTYPE yyltype |
|
#endif |
|
|
|
#include <stdio.h> | #include <stdio.h> |
| |
#ifndef __cplusplus | #ifndef __cplusplus |
|
|
#define YYFLAG -32768 | #define YYFLAG -32768 |
#define YYNTBASE 28 | #define YYNTBASE 28 |
| |
#define YYTRANSLATE(x) ((unsigned)(x) <= 278 ? yytranslate[x] : 43) |
#define YYTRANSLATE(x) ((unsigned)(x) <= 277 ? yytranslate[x] : 43) |
| |
static const char yytranslate[] = { 0, | static const char yytranslate[] = { 0, |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
|
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
2, 2, 2, 2, 2, 1, 2, 3, 4, 5, |
2, 2, 2, 2, 2, 1, 3, 4, 5, 6, |
6, 7, 8, 9, 10, 11, 12, 13, 14, 15, |
7, 8, 9, 10, 11, 12, 13, 14, 15, 16, |
16, 17, 18, 19, 20, 21, 22, 23 |
17, 18, 19, 20, 21, 22, 23 |
}; | }; |
| |
#if YYDEBUG != 0 | #if YYDEBUG != 0 |
|
|
130, 136, 142, 146, 152, 156, 162, 166, 172, 179, | 130, 136, 142, 146, 152, 156, 162, 166, 172, 179, |
185, 190, 195, 201, 205, 209, 214, 223, 227, 233, | 185, 190, 195, 201, 205, 209, 214, 223, 227, 233, |
238, 243, 248, 253, 258, 265, 270, 277, 281, 287, | 238, 243, 248, 253, 258, 265, 270, 277, 281, 287, |
293, 300, 305, 310, 315, 320 |
293, 300, 306, 311, 316, 321 |
}; | }; |
|
#endif |
|
|
|
|
|
#if YYDEBUG != 0 || defined (YYERROR_VERBOSE) |
| |
static const char * const yytname[] = { "$","error","$undefined.","TOK_INTEGER", | static const char * const yytname[] = { "$","error","$undefined.","TOK_INTEGER", |
"TOK_DOUBLE","TOK_STRING","TOK_TRUE","TOK_FALSE","TOK_NULL","TOK_EQ","TOK_NE", | "TOK_DOUBLE","TOK_STRING","TOK_TRUE","TOK_FALSE","TOK_NULL","TOK_EQ","TOK_NE", |
|
|
"TOK_SELECT","TOK_WHERE","TOK_FROM","TOK_UNEXPECTED_CHAR","'*'","','","'('", | "TOK_SELECT","TOK_WHERE","TOK_FROM","TOK_UNEXPECTED_CHAR","'*'","','","'('", |
"')'","start","selectStatement","selectList","propertyList","selectExpression", | "')'","start","selectStatement","selectList","propertyList","selectExpression", |
"fromClause","whereClause","searchCondition","predicate","comparisonPredicate", | "fromClause","whereClause","searchCondition","predicate","comparisonPredicate", |
"nullPredicate","truthValue","propertyName","className","comparisonTerm","" |
"nullPredicate","truthValue","propertyName","className","comparisonTerm", NULL |
}; | }; |
#endif | #endif |
| |
|
|
switch (yyn) { | switch (yyn) { |
| |
case 1: | case 1: |
#line 131 "wql.y" |
#line 131 "WQL.y" |
{ | { |
WQL_TRACE(("YACC: start\n")); | WQL_TRACE(("YACC: start\n")); |
; | ; |
break;} | break;} |
case 2: | case 2: |
#line 137 "wql.y" |
#line 137 "WQL.y" |
{ | { |
| |
; | ; |
break;} | break;} |
case 3: | case 3: |
#line 143 "wql.y" |
#line 143 "WQL.y" |
{ | { |
globalParserState->statement->appendPropertyName("*"); |
globalParserState->statement->setAllProperties(true); |
; | ; |
break;} | break;} |
case 4: | case 4: |
#line 147 "wql.y" |
#line 147 "WQL.y" |
{ | { |
| |
; | ; |
break;} | break;} |
case 5: | case 5: |
#line 153 "wql.y" |
#line 153 "WQL.y" |
{ | { |
globalParserState->statement->appendPropertyName(yyvsp[0].strValue); |
globalParserState->statement->appendSelectPropertyName(CIMName(yyvsp[0].strValue)); |
; | ; |
break;} | break;} |
case 6: | case 6: |
#line 157 "wql.y" |
#line 157 "WQL.y" |
{ | { |
globalParserState->statement->appendPropertyName(yyvsp[0].strValue); |
globalParserState->statement->appendSelectPropertyName(CIMName(yyvsp[0].strValue)); |
; | ; |
break;} | break;} |
case 7: | case 7: |
#line 163 "wql.y" |
#line 163 "WQL.y" |
{ | { |
| |
; | ; |
break;} | break;} |
case 8: | case 8: |
#line 167 "wql.y" |
#line 167 "WQL.y" |
{ | { |
| |
; | ; |
break;} | break;} |
case 9: | case 9: |
#line 173 "wql.y" |
#line 173 "WQL.y" |
{ | { |
WQL_TRACE(("YACC: fromClause: TOK_FROM className(%s)\n", yyvsp[0].strValue)); | WQL_TRACE(("YACC: fromClause: TOK_FROM className(%s)\n", yyvsp[0].strValue)); |
globalParserState->statement->setClassName(yyvsp[0].strValue); |
globalParserState->statement->setClassName(CIMName(yyvsp[0].strValue)); |
; | ; |
break;} | break;} |
case 10: | case 10: |
#line 180 "wql.y" |
#line 180 "WQL.y" |
{ | { |
| |
; | ; |
break;} | break;} |
case 11: | case 11: |
#line 186 "wql.y" |
#line 186 "WQL.y" |
{ | { |
WQL_TRACE(("YACC: TOK_OR\n")); | WQL_TRACE(("YACC: TOK_OR\n")); |
globalParserState->statement->appendOperation(WQL_OR); | globalParserState->statement->appendOperation(WQL_OR); |
; | ; |
break;} | break;} |
case 12: | case 12: |
#line 191 "wql.y" |
#line 191 "WQL.y" |
{ | { |
WQL_TRACE(("YACC: TOK_AND\n")); | WQL_TRACE(("YACC: TOK_AND\n")); |
globalParserState->statement->appendOperation(WQL_AND); | globalParserState->statement->appendOperation(WQL_AND); |
; | ; |
break;} | break;} |
case 13: | case 13: |
#line 196 "wql.y" |
#line 196 "WQL.y" |
{ | { |
WQL_TRACE(("YACC: TOK_NOT\n")); | WQL_TRACE(("YACC: TOK_NOT\n")); |
| |
|
|
; | ; |
break;} | break;} |
case 14: | case 14: |
#line 202 "wql.y" |
#line 202 "WQL.y" |
{ | { |
| |
; | ; |
break;} | break;} |
case 15: | case 15: |
#line 206 "wql.y" |
#line 206 "WQL.y" |
{ | { |
| |
; | ; |
break;} | break;} |
case 16: | case 16: |
#line 210 "wql.y" |
#line 210 "WQL.y" |
{ | { |
WQLOperation op = yyvsp[0].intValue ? WQL_IS_TRUE : WQL_IS_FALSE; | WQLOperation op = yyvsp[0].intValue ? WQL_IS_TRUE : WQL_IS_FALSE; |
globalParserState->statement->appendOperation(op); | globalParserState->statement->appendOperation(op); |
; | ; |
break;} | break;} |
case 17: | case 17: |
#line 215 "wql.y" |
#line 215 "WQL.y" |
{ | { |
WQLOperation op = yyvsp[0].intValue ? WQL_IS_NOT_TRUE : WQL_IS_NOT_FALSE; | WQLOperation op = yyvsp[0].intValue ? WQL_IS_NOT_TRUE : WQL_IS_NOT_FALSE; |
globalParserState->statement->appendOperation(op); | globalParserState->statement->appendOperation(op); |
; | ; |
break;} | break;} |
case 18: | case 18: |
#line 224 "wql.y" |
#line 224 "WQL.y" |
{ | { |
| |
; | ; |
break;} | break;} |
case 19: | case 19: |
#line 228 "wql.y" |
#line 228 "WQL.y" |
{ | { |
| |
; | ; |
break;} | break;} |
case 20: | case 20: |
#line 234 "wql.y" |
#line 234 "WQL.y" |
{ | { |
WQL_TRACE(("YACC: TOK_LT\n")); | WQL_TRACE(("YACC: TOK_LT\n")); |
globalParserState->statement->appendOperation(WQL_LT); | globalParserState->statement->appendOperation(WQL_LT); |
; | ; |
break;} | break;} |
case 21: | case 21: |
#line 239 "wql.y" |
#line 239 "WQL.y" |
{ | { |
WQL_TRACE(("YACC: TOK_GT\n")); | WQL_TRACE(("YACC: TOK_GT\n")); |
globalParserState->statement->appendOperation(WQL_GT); | globalParserState->statement->appendOperation(WQL_GT); |
; | ; |
break;} | break;} |
case 22: | case 22: |
#line 244 "wql.y" |
#line 244 "WQL.y" |
{ | { |
WQL_TRACE(("YACC: TOK_LE\n")); | WQL_TRACE(("YACC: TOK_LE\n")); |
globalParserState->statement->appendOperation(WQL_LE); | globalParserState->statement->appendOperation(WQL_LE); |
; | ; |
break;} | break;} |
case 23: | case 23: |
#line 249 "wql.y" |
#line 249 "WQL.y" |
{ | { |
WQL_TRACE(("YACC: TOK_GE\n")); | WQL_TRACE(("YACC: TOK_GE\n")); |
globalParserState->statement->appendOperation(WQL_GE); | globalParserState->statement->appendOperation(WQL_GE); |
; | ; |
break;} | break;} |
case 24: | case 24: |
#line 254 "wql.y" |
#line 254 "WQL.y" |
{ | { |
WQL_TRACE(("YACC: TOK_EQ\n")); | WQL_TRACE(("YACC: TOK_EQ\n")); |
globalParserState->statement->appendOperation(WQL_EQ); | globalParserState->statement->appendOperation(WQL_EQ); |
; | ; |
break;} | break;} |
case 25: | case 25: |
#line 259 "wql.y" |
#line 259 "WQL.y" |
{ | { |
WQL_TRACE(("YACC: TOK_NE\n")); | WQL_TRACE(("YACC: TOK_NE\n")); |
globalParserState->statement->appendOperation(WQL_NE); | globalParserState->statement->appendOperation(WQL_NE); |
; | ; |
break;} | break;} |
case 26: | case 26: |
#line 266 "wql.y" |
#line 266 "WQL.y" |
{ | { |
WQL_TRACE(("YACC: nullPredicate : comparisonTerm IS NULL\n")); | WQL_TRACE(("YACC: nullPredicate : comparisonTerm IS NULL\n")); |
globalParserState->statement->appendOperation(WQL_IS_NULL); | globalParserState->statement->appendOperation(WQL_IS_NULL); |
; | ; |
break;} | break;} |
case 27: | case 27: |
#line 271 "wql.y" |
#line 271 "WQL.y" |
{ | { |
WQL_TRACE(("YACC: nullPredicate : comparisonTerm IS NOT NULL\n")); | WQL_TRACE(("YACC: nullPredicate : comparisonTerm IS NOT NULL\n")); |
globalParserState->statement->appendOperation(WQL_IS_NOT_NULL); | globalParserState->statement->appendOperation(WQL_IS_NOT_NULL); |
; | ; |
break;} | break;} |
case 28: | case 28: |
#line 278 "wql.y" |
#line 278 "WQL.y" |
{ | { |
yyval.intValue = 1; | yyval.intValue = 1; |
; | ; |
break;} | break;} |
case 29: | case 29: |
#line 282 "wql.y" |
#line 282 "WQL.y" |
{ | { |
yyval.intValue = 0; | yyval.intValue = 0; |
; | ; |
break;} | break;} |
case 30: | case 30: |
#line 288 "wql.y" |
#line 288 "WQL.y" |
{ | { |
WQL_TRACE(("YACC: propertyName : TOK_IDENTIFIER(%s)\n", yyvsp[0].strValue)); | WQL_TRACE(("YACC: propertyName : TOK_IDENTIFIER(%s)\n", yyvsp[0].strValue)); |
yyval.strValue = yyvsp[0].strValue; | yyval.strValue = yyvsp[0].strValue; |
; | ; |
break;} | break;} |
case 31: | case 31: |
#line 294 "wql.y" |
#line 294 "WQL.y" |
{ | { |
WQL_TRACE(("YACC: TOK_IDENTIFIER %s\n", yyvsp[0].strValue)); | WQL_TRACE(("YACC: TOK_IDENTIFIER %s\n", yyvsp[0].strValue)); |
yyval.strValue = yyvsp[0].strValue; | yyval.strValue = yyvsp[0].strValue; |
; | ; |
break;} | break;} |
case 32: | case 32: |
#line 301 "wql.y" |
#line 301 "WQL.y" |
{ | { |
globalParserState->statement->appendOperand( | globalParserState->statement->appendOperand( |
WQLOperand(yyvsp[0].strValue, WQLOperand::PROPERTY_NAME_TAG)); |
WQLOperand(yyvsp[0].strValue, WQL_PROPERTY_NAME_TAG)); |
|
globalParserState->statement->appendWherePropertyName(CIMName(yyvsp[0].strValue)); |
; | ; |
break;} | break;} |
case 33: | case 33: |
#line 306 "wql.y" |
#line 307 "WQL.y" |
{ | { |
globalParserState->statement->appendOperand( | globalParserState->statement->appendOperand( |
WQLOperand(yyvsp[0].intValue, WQLOperand::INTEGER_VALUE_TAG)); |
WQLOperand(yyvsp[0].intValue, WQL_INTEGER_VALUE_TAG)); |
; | ; |
break;} | break;} |
case 34: | case 34: |
#line 311 "wql.y" |
#line 312 "WQL.y" |
{ | { |
globalParserState->statement->appendOperand( | globalParserState->statement->appendOperand( |
WQLOperand(yyvsp[0].doubleValue, WQLOperand::DOUBLE_VALUE_TAG)); |
WQLOperand(yyvsp[0].doubleValue, WQL_DOUBLE_VALUE_TAG)); |
; | ; |
break;} | break;} |
case 35: | case 35: |
#line 316 "wql.y" |
#line 317 "WQL.y" |
{ | { |
globalParserState->statement->appendOperand( | globalParserState->statement->appendOperand( |
WQLOperand(yyvsp[0].strValue, WQLOperand::STRING_VALUE_TAG)); |
WQLOperand(yyvsp[0].strValue, WQL_STRING_VALUE_TAG)); |
; | ; |
break;} | break;} |
case 36: | case 36: |
#line 321 "wql.y" |
#line 322 "WQL.y" |
{ | { |
globalParserState->statement->appendOperand( | globalParserState->statement->appendOperand( |
WQLOperand(yyvsp[0].intValue != 0, WQLOperand::BOOLEAN_VALUE_TAG)); |
WQLOperand(yyvsp[0].intValue != 0, WQL_BOOLEAN_VALUE_TAG)); |
; | ; |
break;} | break;} |
} | } |
|
|
} | } |
return 1; | return 1; |
} | } |
#line 326 "wql.y" |
#line 327 "WQL.y" |
| |