version 1.12, 2006/01/30 16:16:38
|
version 1.13, 2007/06/05 18:17:23
|
|
|
#define CQLFUNCTION 3 | #define CQLFUNCTION 3 |
#define CQLCHAINEDIDENTIFIER 4 | #define CQLCHAINEDIDENTIFIER 4 |
| |
|
//#define CQL_DEBUG_GRAMMAR |
|
|
#ifdef CQL_DEBUG_GRAMMAR | #ifdef CQL_DEBUG_GRAMMAR |
#define DEBUG_GRAMMAR 1 | #define DEBUG_GRAMMAR 1 |
#else | #else |
|
|
#endif | #endif |
| |
int yylex(); | int yylex(); |
static char msg[100]; |
static char msg[200]; |
void printf_(char * msg){ |
void printf_(const char * msg) |
|
{ |
if(DEBUG_GRAMMAR == 1) | if(DEBUG_GRAMMAR == 1) |
printf("%s\n",msg); | printf("%s\n",msg); |
} | } |
|
|
|
|
|
#define CQL_DEBUG_GRAMMAR |
|
|
|
#ifdef CQL_DEBUG_GRAMMAR |
|
#define CQLTRACE(X){ \ |
|
CQL_globalParserState->currentRule = X; \ |
|
sprintf(msg,"BISON::%s", X ); \ |
|
printf_(msg); \ |
|
} |
|
#else |
|
#define CQLTRACE(X) |
|
#endif |
|
|
|
#ifdef CQL_DEBUG_GRAMMAR |
|
#define CQLTRACE2( X, Y ){ \ |
|
CQL_globalParserState->currentRule = X; \ |
|
sprintf(msg,msg,"BISON::%s = %s\n", X, Y ); \ |
|
printf_(msg); \ |
|
} |
|
#else |
|
#define CQLTRACE2( X,Y ) |
|
#endif |
|
|
|
#define CQLTRACEMSG(X, Y) { \ |
|
sprintf(msg,"BISON::%s-> %s\n", X, Y); \ |
|
printf_(msg); \ |
|
} |
|
|
|
#define CQLTRACEDECIMAL(X, Y) { \ |
|
CQL_globalParserState->currentRule = X; \ |
|
sprintf(msg,"BISON::chain-> X : Y = %d\n",Y); \ |
|
} |
|
|
|
|
extern char * yytext; | extern char * yytext; |
int chain_state; | int chain_state; |
CQLFactory _factory = CQLFactory(); | CQLFactory _factory = CQLFactory(); |
|
|
Array<CQLObjPtr> _ptrs; | Array<CQLObjPtr> _ptrs; |
CQLOBJPTR _ObjPtr; | CQLOBJPTR _ObjPtr; |
| |
|
PEGASUS_NAMESPACE_BEGIN |
|
|
|
extern CQLParserState* CQL_globalParserState; |
|
Array<CQLPredicate> _arglist; |
|
|
|
|
|
PEGASUS_NAMESPACE_END |
|
|
| |
void CQL_Bison_Cleanup(){ | void CQL_Bison_Cleanup(){ |
for(Uint32 i = 0; i < _ptrs.size(); i++){ |
for(Uint32 i = 0; i < _ptrs.size(); i++) |
if(_ptrs[i]._ptr){ |
{ |
switch(_ptrs[i].type){ |
if(_ptrs[i]._ptr) |
|
{ |
|
switch(_ptrs[i].type) |
|
{ |
case Id: | case Id: |
delete (CQLIdentifier*)_ptrs[i]._ptr; | delete (CQLIdentifier*)_ptrs[i]._ptr; |
break; | break; |
|
|
_factory = CQLFactory(); | _factory = CQLFactory(); |
} | } |
| |
PEGASUS_NAMESPACE_BEGIN |
|
|
|
extern CQLParserState* CQL_globalParserState; |
|
Array<CQLPredicate> _arglist; |
|
| |
| |
PEGASUS_NAMESPACE_END |
|
| |
| |
%} | %} |
|
|
} | } |
| |
/* terminals */ | /* terminals */ |
%token <strValue> IDENTIFIER |
%token <strValue> TOK_IDENTIFIER |
%token <strValue> STRING_LITERAL |
%token <strValue> TOK_STRING_LITERAL |
%token <strValue> BINARY |
%token <strValue> TOK_BINARY |
%token <strValue> NEGATIVE_BINARY |
%token <strValue> TOK_NEGATIVE_BINARY |
%token <strValue> HEXADECIMAL |
%token <strValue> TOK_HEXADECIMAL |
%token <strValue> NEGATIVE_HEXADECIMAL |
%token <strValue> TOK_NEGATIVE_HEXADECIMAL |
%token <strValue> INTEGER |
%token <strValue> TOK_INTEGER |
%token <strValue> NEGATIVE_INTEGER |
%token <strValue> TOK_NEGATIVE_INTEGER |
%token <strValue> REAL |
%token <strValue> TOK_REAL |
%token <strValue> NEGATIVE_REAL |
%token <strValue> TOK_NEGATIVE_REAL |
%token <strValue> _TRUE |
%token <strValue> TOK_TRUE |
%token <strValue> _FALSE |
%token <strValue> TOK_FALSE |
%token <strValue> SCOPED_PROPERTY |
%token <strValue> TOK_SCOPED_PROPERTY |
%token <strValue> LPAR |
%token <strValue> TOK_LPAR |
%token <strValue> RPAR |
%token <strValue> TOK_RPAR |
%token <strValue> HASH |
%token <strValue> TOK_HASH |
%token <strValue> DOT |
%token <strValue> TOK_DOT |
%token <strValue> LBRKT |
%token <strValue> TOK_LBRKT |
%token <strValue> RBRKT |
%token <strValue> TOK_RBRKT |
%token <strValue> UNDERSCORE |
%token <strValue> TOK_UNDERSCORE |
%token <strValue> COMMA |
%token <strValue> TOK_COMMA |
%token <strValue> CONCAT |
%token <strValue> TOK_CONCAT |
%token <strValue> DBL_PIPE |
%token <strValue> TOK_DBL_PIPE |
%token <strValue> PLUS |
%token <strValue> TOK_PLUS |
%token <strValue> MINUS |
%token <strValue> TOK_MINUS |
%token <strValue> TIMES |
%token <strValue> TOK_TIMES |
%token <strValue> DIV |
%token <strValue> TOK_DIV |
%token <strValue> IS |
%token <strValue> TOK_IS |
%token <strValue> _NULL |
%token <strValue> TOK_NULL |
%token <_opType> _EQ |
%token <_opType> TOK_EQ |
%token <_opType> _NE |
%token <_opType> TOK_NE |
%token <_opType> _GT |
%token <_opType> TOK_GT |
%token <_opType> _LT |
%token <_opType> TOK_LT |
%token <_opType> _GE |
%token <_opType> TOK_GE |
%token <_opType> _LE |
%token <_opType> TOK_LE |
%token <_opType> _ISA |
%token <_opType> TOK_ISA |
%token <_opType> _LIKE |
%token <_opType> TOK_LIKE |
%token <strValue> NOT _AND _OR |
%token <strValue> TOK_NOT TOK_AND TOK_OR |
%token <strValue> SCOPE |
%token <strValue> TOK_SCOPE |
%token <strValue> ANY EVERY IN SATISFIES |
%token <strValue> TOK_ANY TOK_EVERY TOK_IN TOK_SATISFIES |
%token <strValue> STAR |
%token <strValue> TOK_STAR |
%token <strValue> DOTDOT |
%token <strValue> TOK_DOTDOT |
%token <strValue> SHARP DISTINCT |
%token <strValue> TOK_SHARP TOK_DISTINCT |
%token <strValue> SELECT |
%token <strValue> TOK_SELECT |
%token <strValue> FIRST |
%token <strValue> TOK_FIRST |
%token <strValue> FROM |
%token <strValue> TOK_FROM |
%token <strValue> WHERE |
%token <strValue> TOK_WHERE |
%token <strValue> ORDER |
%token <strValue> TOK_ORDER |
%token <strValue> BY |
%token <strValue> TOK_BY |
%token <strValue> ASC |
%token <strValue> TOK_ASC |
%token <strValue> DESC |
%token <strValue> TOK_DESC |
%token <strValue> AS |
%token <strValue> TOK_AS |
%token <strValue> UNEXPECTED_CHAR |
%token <strValue> TOK_UNEXPECTED_CHAR |
| |
| |
/* grammar - non terminals */ | /* grammar - non terminals */ |
|
|
%% | %% |
| |
/** | /** |
The general pattern: We construct small objects first (CQLIdentifiers, CQLValues etc) which |
The general pattern: We construct small objects first (CQLIdentifiers, |
get forwared to more complex rules where more complex objects are made. Eventually we have constructed |
CQLValues etc) which get forwared to more complex rules where more |
a top level CQLPredicate that gets added to the CQL_globalParserState select statement. |
complex objects are made. Eventually we have constructed a top level |
|
CQLPredicate that gets added to the CQL_globalParserState select |
Along the way we keep track of which rule we are processing so that any errors encountered are specific |
statement. |
enough to actually do us some good. |
|
|
Along the way we keep track of which rule we are processing so that |
The CQLFactory object is used primarily to save space/coding efforts. It enables us to build complex CQL |
any errors encountered are specific enough to actually do us some good. |
objects with one simple call, or query complex objects through one simple call. |
|
|
The CQLFactory object is used primarily to save space/coding efforts. |
|
It enables us to build complex CQL objects with one simple call, |
|
or query complex objects through one simple call. |
| |
*/ | */ |
| |
/* CQLIdentifier */ | /* CQLIdentifier */ |
identifier : IDENTIFIER |
identifier : TOK_IDENTIFIER |
|
{ |
|
CQLTRACE("identifier"); |
|
|
|
|
|
if(isUTF8Str(CQL_lval.strValue)) |
{ | { |
CQL_globalParserState->currentRule = "identifier"; |
|
sprintf(msg,"BISON::identifier\n"); |
|
printf_(msg); |
|
if(isUTF8Str(CQL_lval.strValue)){ |
|
$$ = new CQLIdentifier(String(CQL_lval.strValue)); | $$ = new CQLIdentifier(String(CQL_lval.strValue)); |
_ObjPtr._ptr = $$; | _ObjPtr._ptr = $$; |
_ObjPtr.type = Id; | _ObjPtr.type = Id; |
_ptrs.append(_ObjPtr); | _ptrs.append(_ObjPtr); |
}else{ |
} |
|
else |
|
{ |
sprintf(msg,"BISON::identifier-> BAD UTF\n"); | sprintf(msg,"BISON::identifier-> BAD UTF\n"); |
printf_(msg); | printf_(msg); |
|
CQLTRACEMSG("identifier", "BAD UTF"); |
|
|
throw CQLSyntaxErrorException( | throw CQLSyntaxErrorException( |
MessageLoaderParms(String("CQL.CQL_y.BAD_UTF8"), |
MessageLoaderParms("CQL.CQL_y.BAD_UTF8", |
String("Bad UTF8 encountered parsing rule $0 in position $1."), |
"Bad UTF8 encountered parsing rule $0" |
String("identifier"), |
" in position $1.", |
CQL_globalParserState->currentTokenPos) |
"identifier", |
); |
CQL_globalParserState->currentTokenPos) ); |
} | } |
} | } |
; | ; |
| |
class_name : identifier | class_name : identifier |
{ | { |
CQL_globalParserState->currentRule = "class_name"; |
|
sprintf(msg,"BISON::class_name = %s\n", (const char *)($1->getName().getString().getCString())); |
CQLTRACE2("class_name",(const char *)($1->getName().getString().getCString()) ); |
printf_(msg); |
|
$$ = $1; | $$ = $1; |
} | } |
; | ; |
| |
class_path : class_name | class_path : class_name |
{ | { |
CQL_globalParserState->currentRule = "class_path"; |
CQLTRACE("class_path"); |
sprintf(msg,"BISON::class_path\n"); |
|
printf_(msg); |
|
$$ = $1; | $$ = $1; |
} | } |
; | ; |
/* | /* |
property_scope : class_path SCOPE |
property_scope : class_path TOK_SCOPE |
{ | { |
sprintf(msg,"BISON::property_scope = %s\n",$1); | sprintf(msg,"BISON::property_scope = %s\n",$1); |
printf_(msg); | printf_(msg); |
|
} |
|
*/ |
}*/ |
|
; | ; |
| |
/* CQLIdentifier */ | /* CQLIdentifier */ |
scoped_property : SCOPED_PROPERTY |
scoped_property : TOK_SCOPED_PROPERTY |
{ | { |
/* | /* |
SCOPED_PROPERTY can be: |
TOK_SCOPED_PROPERTY can be: |
- "A::prop" | - "A::prop" |
- "A::class.prop" | - "A::class.prop" |
- "A::class.prop#'OK' | - "A::class.prop#'OK' |
- "A::class.prop[4]" | - "A::class.prop[4]" |
*/ | */ |
CQL_globalParserState->currentRule = "scoped_property"; |
CQLTRACE2("scoped_property",CQL_lval.strValue ); |
sprintf(msg,"BISON::scoped_property = %s\n",CQL_lval.strValue); |
|
printf_(msg); |
if(isUTF8Str(CQL_lval.strValue)) |
if(isUTF8Str(CQL_lval.strValue)){ |
{ |
String tmp(CQL_lval.strValue); | String tmp(CQL_lval.strValue); |
$$ = new CQLIdentifier(tmp); | $$ = new CQLIdentifier(tmp); |
_ObjPtr._ptr = $$; | _ObjPtr._ptr = $$; |
_ObjPtr.type = Id; | _ObjPtr.type = Id; |
_ptrs.append(_ObjPtr); | _ptrs.append(_ObjPtr); |
| |
}else{ |
} |
|
else |
|
{ |
sprintf(msg,"BISON::scoped_property-> BAD UTF\n"); | sprintf(msg,"BISON::scoped_property-> BAD UTF\n"); |
printf_(msg); | printf_(msg); |
throw CQLSyntaxErrorException( | throw CQLSyntaxErrorException( |
MessageLoaderParms(String("CQL.CQL_y.BAD_UTF8"), |
MessageLoaderParms("CQL.CQL_y.BAD_UTF8", |
String("Bad UTF8 encountered parsing rule $0 in position $1."), |
"Bad UTF8 encountered parsing rule $0 in position $1.", |
String("scoped_property"), |
"scoped_property", |
CQL_globalParserState->currentTokenPos) |
CQL_globalParserState->currentTokenPos) ); |
); |
|
} | } |
} | } |
; | ; |
| |
/* String */ | /* String */ |
literal_string : STRING_LITERAL |
literal_string : TOK_STRING_LITERAL |
{ | { |
/* | /* |
We make sure the literal is valid UTF8, then make a String | We make sure the literal is valid UTF8, then make a String |
*/ | */ |
CQL_globalParserState->currentRule = "literal_string"; |
CQLTRACE2("literal_string",CQL_lval.strValue ); |
sprintf(msg,"BISON::literal_string-> %s\n",CQL_lval.strValue); |
|
printf_(msg); |
|
| |
if(isUTF8Str(CQL_lval.strValue)){ |
if(isUTF8Str(CQL_lval.strValue)) |
|
{ |
$$ = new String(CQL_lval.strValue); | $$ = new String(CQL_lval.strValue); |
_ObjPtr._ptr = $$; | _ObjPtr._ptr = $$; |
_ObjPtr.type = Str; | _ObjPtr.type = Str; |
_ptrs.append(_ObjPtr); | _ptrs.append(_ObjPtr); |
}else{ |
} |
|
else |
|
{ |
sprintf(msg,"BISON::literal_string-> BAD UTF\n"); | sprintf(msg,"BISON::literal_string-> BAD UTF\n"); |
printf_(msg); | printf_(msg); |
|
CQLTRACEMSG("literal_string", "BAD UTF"); |
|
|
throw CQLSyntaxErrorException( | throw CQLSyntaxErrorException( |
MessageLoaderParms(String("CQL.CQL_y.BAD_UTF8"), |
MessageLoaderParms("CQL.CQL_y.BAD_UTF8", |
String("Bad UTF8 encountered parsing rule $0 in position $1."), |
"Bad UTF8 encountered parsing rule $0 in position $1.", |
String("literal_string"), |
"literal_string", |
CQL_globalParserState->currentTokenPos) |
CQL_globalParserState->currentTokenPos)); |
); |
|
} | } |
} | } |
; | ; |
| |
/* CQLValue */ | /* CQLValue */ |
binary_value : BINARY |
binary_value : TOK_BINARY |
{ | { |
CQL_globalParserState->currentRule = "binary_value->BINARY"; |
CQLTRACE2("binary_value->TOK_BINARY", CQL_lval.strValue); |
sprintf(msg,"BISON::binary_value-> %s\n",CQL_lval.strValue); |
|
printf_(msg); |
|
| |
$$ = new CQLValue(CQL_lval.strValue, CQLValue::Binary); | $$ = new CQLValue(CQL_lval.strValue, CQLValue::Binary); |
_ObjPtr._ptr = $$; | _ObjPtr._ptr = $$; |
_ObjPtr.type = Val; | _ObjPtr.type = Val; |
_ptrs.append(_ObjPtr); | _ptrs.append(_ObjPtr); |
} | } |
| NEGATIVE_BINARY |
| TOK_NEGATIVE_BINARY |
{ | { |
CQL_globalParserState->currentRule = "binary_value->NEGATIVE_BINARY"; |
|
sprintf(msg,"BISON::binary_value-> %s\n",CQL_lval.strValue); |
|
printf_(msg); | printf_(msg); |
| |
|
CQLTRACE2("binary_value->TOK_NEGATIVE_BINARY", CQL_lval.strValue); |
|
|
$$ = new CQLValue(CQL_lval.strValue, CQLValue::Binary, false); | $$ = new CQLValue(CQL_lval.strValue, CQLValue::Binary, false); |
_ObjPtr._ptr = $$; | _ObjPtr._ptr = $$; |
_ObjPtr.type = Val; | _ObjPtr.type = Val; |
|
|
; | ; |
| |
/* CQLValue */ | /* CQLValue */ |
hex_value : HEXADECIMAL |
hex_value : TOK_HEXADECIMAL |
{ | { |
CQL_globalParserState->currentRule = "hex_value->HEXADECIMAL"; |
CQLTRACE2("hex_value->TOK_HEXADECIMAL", CQL_lval.strValue); |
sprintf(msg,"BISON::hex_value-> %s\n",CQL_lval.strValue); |
|
printf_(msg); |
|
| |
$$ = new CQLValue(CQL_lval.strValue, CQLValue::Hex); | $$ = new CQLValue(CQL_lval.strValue, CQLValue::Hex); |
_ObjPtr._ptr = $$; | _ObjPtr._ptr = $$; |
_ObjPtr.type = Val; | _ObjPtr.type = Val; |
_ptrs.append(_ObjPtr); | _ptrs.append(_ObjPtr); |
} | } |
| NEGATIVE_HEXADECIMAL |
| TOK_NEGATIVE_HEXADECIMAL |
{ | { |
CQL_globalParserState->currentRule = "hex_value->NEGATIVE_HEXADECIMAL"; |
CQLTRACE2("hex_value->TOK_NEGATIVE_HEXADECIMAL", CQL_lval.strValue); |
sprintf(msg,"BISON::hex_value-> %s\n",CQL_lval.strValue); |
|
printf_(msg); |
|
| |
$$ = new CQLValue(CQL_lval.strValue, CQLValue::Hex, false); | $$ = new CQLValue(CQL_lval.strValue, CQLValue::Hex, false); |
_ObjPtr._ptr = $$; | _ObjPtr._ptr = $$; |
|
|
; | ; |
| |
/* CQLValue */ | /* CQLValue */ |
decimal_value : INTEGER |
decimal_value : TOK_INTEGER |
{ | { |
CQL_globalParserState->currentRule = "decimal_value->INTEGER"; |
CQLTRACE2("decimal_value->TOK_INTEGER", CQL_lval.strValue); |
sprintf(msg,"BISON::decimal_value-> %s\n",CQL_lval.strValue); |
|
printf_(msg); |
|
| |
$$ = new CQLValue(CQL_lval.strValue, CQLValue::Decimal); | $$ = new CQLValue(CQL_lval.strValue, CQLValue::Decimal); |
_ObjPtr._ptr = $$; | _ObjPtr._ptr = $$; |
_ObjPtr.type = Val; | _ObjPtr.type = Val; |
_ptrs.append(_ObjPtr); | _ptrs.append(_ObjPtr); |
} | } |
| NEGATIVE_INTEGER |
| TOK_NEGATIVE_INTEGER |
{ | { |
CQL_globalParserState->currentRule = "decimal_value->NEGATIVE_INTEGER"; |
CQLTRACE2("decimal_value->TOK_NEGATIVE_INTEGER", CQL_lval.strValue); |
sprintf(msg,"BISON::decimal_value-> %s\n",CQL_lval.strValue); |
|
printf_(msg); |
|
| |
$$ = new CQLValue(CQL_lval.strValue, CQLValue::Decimal, false); | $$ = new CQLValue(CQL_lval.strValue, CQLValue::Decimal, false); |
_ObjPtr._ptr = $$; | _ObjPtr._ptr = $$; |
|
|
; | ; |
| |
/* CQLValue */ | /* CQLValue */ |
real_value : REAL |
real_value : TOK_REAL |
{ | { |
CQL_globalParserState->currentRule = "real_value->REAL"; |
CQLTRACE2("real_value->TOK_REAL", CQL_lval.strValue); |
sprintf(msg,"BISON::real_value-> %s\n",CQL_lval.strValue); |
|
printf_(msg); |
|
$$ = new CQLValue(CQL_lval.strValue, CQLValue::Real); | $$ = new CQLValue(CQL_lval.strValue, CQLValue::Real); |
_ObjPtr._ptr = $$; | _ObjPtr._ptr = $$; |
_ObjPtr.type = Val; | _ObjPtr.type = Val; |
_ptrs.append(_ObjPtr); | _ptrs.append(_ObjPtr); |
} | } |
| NEGATIVE_REAL |
| TOK_NEGATIVE_REAL |
{ | { |
CQL_globalParserState->currentRule = "real_value->NEGATIVE_REAL"; |
CQLTRACE2("real_value->TOK_NEGATIVE_REAL", CQL_lval.strValue); |
sprintf(msg,"BISON::real_value-> %s\n",CQL_lval.strValue); |
|
printf_(msg); |
|
$$ = new CQLValue(CQL_lval.strValue, CQLValue::Real, false); | $$ = new CQLValue(CQL_lval.strValue, CQLValue::Real, false); |
_ObjPtr._ptr = $$; | _ObjPtr._ptr = $$; |
_ObjPtr.type = Val; | _ObjPtr.type = Val; |
|
|
/* CQLValue */ | /* CQLValue */ |
literal : literal_string | literal : literal_string |
{ | { |
CQL_globalParserState->currentRule = "literal->literal_string"; |
|
sprintf(msg,"BISON::literal->literal_string\n"); |
|
printf_(msg); |
|
$$ = new CQLValue(*$1); | $$ = new CQLValue(*$1); |
_ObjPtr._ptr = $$; | _ObjPtr._ptr = $$; |
_ObjPtr.type = Val; | _ObjPtr.type = Val; |
|
|
} | } |
| decimal_value | | decimal_value |
{ | { |
CQL_globalParserState->currentRule = "literal->decimal_value"; |
CQLTRACE("literal->decimal_value"); |
sprintf(msg,"BISON::literal->decimal_value\n"); |
|
printf_(msg); |
|
|
|
} | } |
| binary_value | | binary_value |
{ | { |
CQL_globalParserState->currentRule = "literal->binary_value"; |
CQLTRACE("literal->binary_value"); |
sprintf(msg,"BISON::literal->binary_value\n"); |
|
printf_(msg); |
|
|
|
} | } |
| hex_value | | hex_value |
{ | { |
CQL_globalParserState->currentRule = "literal->hex_value"; |
CQLTRACE("literal->hex_value"); |
sprintf(msg,"BISON::literal->hex_value\n"); |
|
printf_(msg); |
|
|
|
} | } |
| real_value | | real_value |
{ | { |
CQL_globalParserState->currentRule = "literal->real_value"; |
CQLTRACE("literal->real_value"); |
sprintf(msg,"BISON::literal->real_value\n"); |
|
printf_(msg); |
|
|
|
} | } |
| _TRUE |
| TOK_TRUE |
{ | { |
CQL_globalParserState->currentRule = "literal->_TRUE"; |
CQLTRACE("literal->TOK_TRUE"); |
sprintf(msg,"BISON::literal->_TRUE\n"); |
|
printf_(msg); |
|
| |
$$ = new CQLValue(Boolean(true)); | $$ = new CQLValue(Boolean(true)); |
_ObjPtr._ptr = $$; | _ObjPtr._ptr = $$; |
_ObjPtr.type = Val; | _ObjPtr.type = Val; |
_ptrs.append(_ObjPtr); | _ptrs.append(_ObjPtr); |
} | } |
| _FALSE |
| TOK_FALSE |
{ | { |
CQL_globalParserState->currentRule = "literal->_FALSE"; |
CQLTRACE("literal->TOK_FALSE"); |
sprintf(msg,"BISON::literal->_FALSE\n"); |
|
printf_(msg); |
|
| |
$$ = new CQLValue(Boolean(false)); | $$ = new CQLValue(Boolean(false)); |
_ObjPtr._ptr = $$; | _ObjPtr._ptr = $$; |
|
|
/* String */ | /* String */ |
array_index : expr | array_index : expr |
{ | { |
CQL_globalParserState->currentRule = "array_index->expr"; |
CQLTRACE("array_index->expr"); |
sprintf(msg,"BISON::array_index->expr\n"); |
|
printf_(msg); |
|
| |
CQLValue* _val = (CQLValue*)_factory.getObject($1,Predicate,Value); | CQLValue* _val = (CQLValue*)_factory.getObject($1,Predicate,Value); |
$$ = new String(_val->toString()); | $$ = new String(_val->toString()); |
|
|
/* String */ | /* String */ |
array_index_list : array_index | array_index_list : array_index |
{ | { |
CQL_globalParserState->currentRule = "array_index_list->array_index"; |
CQLTRACE("array_index_list->array_index"); |
sprintf(msg,"BISON::array_index_list->array_index\n"); |
|
printf_(msg); |
|
$$ = $1; | $$ = $1; |
} | } |
; | ; |
|
|
/* void* */ | /* void* */ |
chain : literal | chain : literal |
{ | { |
CQL_globalParserState->currentRule = "chain->literal"; |
CQLTRACE("chain->literal"); |
sprintf(msg,"BISON::chain->literal\n"); |
|
printf_(msg); |
|
| |
chain_state = CQLVALUE; | chain_state = CQLVALUE; |
$$ = _factory.makeObject($1,Predicate); | $$ = _factory.makeObject($1,Predicate); |
} | } |
| LPAR expr RPAR |
| TOK_LPAR expr TOK_RPAR |
{ | { |
CQL_globalParserState->currentRule = "chain-> ( expr )"; |
CQLTRACE("chain-> ( expr )"); |
sprintf(msg,"BISON::chain-> ( expr )\n"); |
|
printf_(msg); |
|
|
|
chain_state = CQLPREDICATE; | chain_state = CQLPREDICATE; |
$$ = $2; | $$ = $2; |
} | } |
| identifier | | identifier |
{ | { |
CQL_globalParserState->currentRule = "chain->identifier"; |
CQLTRACE("chain->identifier"); |
sprintf(msg,"BISON::chain->identifier\n"); |
|
printf_(msg); |
|
| |
chain_state = CQLIDENTIFIER; | chain_state = CQLIDENTIFIER; |
$$ = _factory.makeObject($1,Predicate); | $$ = _factory.makeObject($1,Predicate); |
} | } |
| identifier HASH literal_string |
| identifier TOK_HASH literal_string |
{ | { |
CQL_globalParserState->currentRule = "chain->identifier#literal_string"; |
CQLTRACE("chain->identifier#literal_string"); |
sprintf(msg,"BISON::chain->identifier#literal_string\n"); |
|
printf_(msg); |
|
| |
String tmp = $1->getName().getString(); | String tmp = $1->getName().getString(); |
tmp.append("#").append(*$3); | tmp.append("#").append(*$3); |
|
|
} | } |
| scoped_property | | scoped_property |
{ | { |
CQL_globalParserState->currentRule = "chain->scoped_property"; |
CQLTRACE("chain->scoped_property"); |
sprintf(msg,"BISON::chain-> scoped_property\n"); |
|
printf_(msg); |
|
| |
chain_state = CQLIDENTIFIER; | chain_state = CQLIDENTIFIER; |
$$ = _factory.makeObject($1,Predicate); | $$ = _factory.makeObject($1,Predicate); |
} | } |
| identifier LPAR arg_list RPAR |
| identifier TOK_LPAR arg_list TOK_RPAR |
{ | { |
CQL_globalParserState->currentRule = "chain->identifier( arg_list )"; |
CQLTRACE("chain->identifier( arg_list )"); |
sprintf(msg,"BISON::chain-> identifier( arg_list )\n"); |
|
printf_(msg); |
|
chain_state = CQLFUNCTION; | chain_state = CQLFUNCTION; |
CQLFunction _func(*$1,_arglist); | CQLFunction _func(*$1,_arglist); |
$$ = (CQLPredicate*)(_factory.makeObject(&_func,Predicate)); | $$ = (CQLPredicate*)(_factory.makeObject(&_func,Predicate)); |
_arglist.clear(); | _arglist.clear(); |
} | } |
| chain DOT scoped_property |
| chain TOK_DOT scoped_property |
{ | { |
CQL_globalParserState->currentRule = "chain->chain.scoped_property"; |
CQLTRACEDECIMAL("chain TOK_DOT scoped_property", chain_state); |
sprintf(msg,"BISON::chain-> chain DOT scoped_property : chain_state = %d\n",chain_state); |
|
printf_(msg); |
|
| |
CQLIdentifier *_id; | CQLIdentifier *_id; |
if(chain_state == CQLIDENTIFIER){ |
if(chain_state == CQLIDENTIFIER) |
_id = ((CQLIdentifier*)(_factory.getObject($1,Predicate,Identifier))); |
{ |
|
_id = ((CQLIdentifier*)(_factory.getObject( |
|
$1,Predicate,Identifier))); |
CQLChainedIdentifier _cid(*_id); | CQLChainedIdentifier _cid(*_id); |
_cid.append(*$3); | _cid.append(*$3); |
$$ = _factory.makeObject(&_cid,Predicate); | $$ = _factory.makeObject(&_cid,Predicate); |
}else if(chain_state == CQLCHAINEDIDENTIFIER){ |
} |
|
else if(chain_state == CQLCHAINEDIDENTIFIER) |
|
{ |
CQLChainedIdentifier *_cid; | CQLChainedIdentifier *_cid; |
_cid = ((CQLChainedIdentifier*)(_factory.getObject($1,Predicate,ChainedIdentifier))); |
_cid = ((CQLChainedIdentifier*)(_factory.getObject( |
|
$1,Predicate,ChainedIdentifier))); |
_cid->append(*$3); | _cid->append(*$3); |
_factory.setObject(((CQLPredicate*)$1),_cid,ChainedIdentifier); | _factory.setObject(((CQLPredicate*)$1),_cid,ChainedIdentifier); |
$$ = $1; | $$ = $1; |
}else{ |
} |
|
else |
|
{ |
/* error */ | /* error */ |
String _msg("chain-> chain DOT scoped_property : chain state not CQLIDENTIFIER or CQLCHAINEDIDENTIFIER"); |
String _msg("chain-> chain TOK_DOT scoped_property :" |
|
" chain state not CQLIDENTIFIER or CQLCHAINEDIDENTIFIER"); |
throw CQLSyntaxErrorException( | throw CQLSyntaxErrorException( |
MessageLoaderParms(String("CQL.CQL_y.NOT_CHAINID_OR_IDENTIFIER"), |
MessageLoaderParms("CQL.CQL_y.NOT_CHAINID_OR_IDENTIFIER", |
String("Chain state not a CQLIdentifier or a CQLChainedIdentifier while parsing rule $0 in position $1."), |
"Chain state not a CQLIdentifier or a" |
String("chain.scoped_property"), |
" CQLChainedIdentifier while parsing rule $0 in" |
CQL_globalParserState->currentTokenPos) |
" position $1.", |
); |
"chain.scoped_property", |
|
CQL_globalParserState->currentTokenPos)); |
} | } |
| |
chain_state = CQLCHAINEDIDENTIFIER; | chain_state = CQLCHAINEDIDENTIFIER; |
} | } |
| chain DOT identifier |
| chain TOK_DOT identifier |
{ | { |
CQL_globalParserState->currentRule = "chain->chain.identifier"; |
CQLTRACEDECIMAL("chain->chain.identifier", chain_state); |
sprintf(msg,"BISON::chain->chain.identifier : chain_state = %d\n",chain_state); |
|
printf_(msg); |
|
| |
if(chain_state == CQLIDENTIFIER){ |
if(chain_state == CQLIDENTIFIER) |
CQLIdentifier *_id = ((CQLIdentifier*)(_factory.getObject($1,Predicate,Identifier))); |
{ |
|
CQLIdentifier *_id = ((CQLIdentifier*)(_factory.getObject( |
|
$1,Predicate,Identifier))); |
CQLChainedIdentifier _cid(*_id); | CQLChainedIdentifier _cid(*_id); |
_cid.append(*$3); | _cid.append(*$3); |
$$ = _factory.makeObject(&_cid,Predicate); | $$ = _factory.makeObject(&_cid,Predicate); |
}else if(chain_state == CQLCHAINEDIDENTIFIER){ |
} |
CQLChainedIdentifier *_cid = ((CQLChainedIdentifier*)(_factory.getObject($1,Predicate,ChainedIdentifier))); |
else if(chain_state == CQLCHAINEDIDENTIFIER) |
|
{ |
|
CQLChainedIdentifier *_cid = |
|
((CQLChainedIdentifier*)(_factory.getObject( |
|
$1,Predicate,ChainedIdentifier))); |
_cid->append(*$3); | _cid->append(*$3); |
_factory.setObject(((CQLPredicate*)$1),_cid,ChainedIdentifier); | _factory.setObject(((CQLPredicate*)$1),_cid,ChainedIdentifier); |
$$ = $1; | $$ = $1; |
}else{ |
} |
|
else |
|
{ |
/* error */ | /* error */ |
String _msg("chain-> chain DOT identifier : chain state not CQLIDENTIFIER or CQLCHAINEDIDENTIFIER"); |
String _msg("chain-> chain TOK_DOT identifier : chain state not" |
|
" CQLIDENTIFIER or CQLCHAINEDIDENTIFIER"); |
throw CQLSyntaxErrorException( | throw CQLSyntaxErrorException( |
MessageLoaderParms(String("CQL.CQL_y.NOT_CHAINID_OR_IDENTIFIER"), |
MessageLoaderParms("CQL.CQL_y.NOT_CHAINID_OR_IDENTIFIER", |
String("Chain state not a CQLIdentifier or a CQLChainedIdentifier while parsing rule $0 in position $1."), |
"Chain state not a CQLIdentifier or a CQLChainedId" |
String("chain.identifier"), |
"Identifier while parsing rule $0 in position $1.", |
CQL_globalParserState->currentTokenPos) |
"chain.identifier", |
); |
CQL_globalParserState->currentTokenPos)); |
} | } |
chain_state = CQLCHAINEDIDENTIFIER; | chain_state = CQLCHAINEDIDENTIFIER; |
| |
} | } |
| chain DOT identifier HASH literal_string |
| chain TOK_DOT identifier TOK_HASH literal_string |
{ | { |
CQL_globalParserState->currentRule = "chain->chain.identifier#literal_string"; |
CQLTRACEDECIMAL("chain->chain.identifier#literal_string", chain_state); |
sprintf(msg,"BISON::chain->chain.identifier#literal_string : chain_state = %d\n",chain_state); |
|
printf_(msg); |
|
| |
if(chain_state == CQLIDENTIFIER){ |
if(chain_state == CQLIDENTIFIER) |
CQLIdentifier *_id = ((CQLIdentifier*)(_factory.getObject($1,Predicate,Identifier))); |
{ |
|
CQLIdentifier *_id = ((CQLIdentifier*)(_factory.getObject( |
|
$1,Predicate,Identifier))); |
CQLChainedIdentifier _cid(*_id); | CQLChainedIdentifier _cid(*_id); |
String tmp($3->getName().getString()); | String tmp($3->getName().getString()); |
tmp.append("#").append(*$5); | tmp.append("#").append(*$5); |
|
|
_cid.append(_id1); | _cid.append(_id1); |
_factory.setObject(((CQLPredicate*)$1),&_cid,ChainedIdentifier); | _factory.setObject(((CQLPredicate*)$1),&_cid,ChainedIdentifier); |
$$ = $1; | $$ = $1; |
}else if(chain_state == CQLCHAINEDIDENTIFIER){ |
} |
CQLChainedIdentifier *_cid = ((CQLChainedIdentifier*)(_factory.getObject($1,Predicate,ChainedIdentifier))); |
else if(chain_state == CQLCHAINEDIDENTIFIER) |
|
{ |
|
CQLChainedIdentifier *_cid = ((CQLChainedIdentifier*)( |
|
_factory.getObject($1,Predicate,ChainedIdentifier))); |
String tmp($3->getName().getString()); | String tmp($3->getName().getString()); |
tmp.append("#").append(*$5); | tmp.append("#").append(*$5); |
CQLIdentifier _id1(tmp); | CQLIdentifier _id1(tmp); |
_cid->append(_id1); | _cid->append(_id1); |
_factory.setObject(((CQLPredicate*)$1),_cid,ChainedIdentifier); | _factory.setObject(((CQLPredicate*)$1),_cid,ChainedIdentifier); |
$$ = $1; | $$ = $1; |
}else{ |
} |
|
else |
|
{ |
/* error */ | /* error */ |
String _msg("chain->chain.identifier#literal_string : chain state not CQLIDENTIFIER or CQLCHAINEDIDENTIFIER"); |
String _msg("chain->chain.identifier#literal_string : chain" |
|
" state not CQLIDENTIFIER or CQLCHAINEDIDENTIFIER"); |
throw CQLSyntaxErrorException( | throw CQLSyntaxErrorException( |
MessageLoaderParms(String("CQL.CQL_y.NOT_CHAINID_OR_IDENTIFIER"), |
MessageLoaderParms("CQL.CQL_y.NOT_CHAINID_OR_IDENTIFIER", |
String("Chain state not a CQLIdentifier or a CQLChainedIdentifier while parsing rule $0 in position $1."), |
"Chain state not a CQLIdentifier or a CQLChained" |
String("chain.identifier#literal_string"), |
"Identifier while parsing rule $0 in position $1.", |
CQL_globalParserState->currentTokenPos) |
"chain.identifier#literal_string", |
); |
CQL_globalParserState->currentTokenPos) ); |
} | } |
| |
chain_state = CQLCHAINEDIDENTIFIER; | chain_state = CQLCHAINEDIDENTIFIER; |
| |
} | } |
| chain LBRKT array_index_list RBRKT |
| chain TOK_LBRKT array_index_list TOK_RBRKT |
{ | { |
CQL_globalParserState->currentRule = "chain->chain[ array_index_list ]"; |
CQLTRACEDECIMAL("chain->chain[ array_index_list ]", chain_state); |
sprintf(msg,"BISON::chain->chain[ array_index_list ] : chain_state = %d\n",chain_state); |
|
printf_(msg); |
|
| |
if(chain_state == CQLIDENTIFIER){ |
if(chain_state == CQLIDENTIFIER) |
CQLIdentifier *_id = ((CQLIdentifier*)(_factory.getObject($1,Predicate,Identifier))); |
{ |
|
CQLIdentifier *_id = ((CQLIdentifier*) |
|
(_factory.getObject($1,Predicate,Identifier))); |
String tmp = _id->getName().getString(); | String tmp = _id->getName().getString(); |
tmp.append("[").append(*$3).append("]"); | tmp.append("[").append(*$3).append("]"); |
CQLIdentifier _id1(tmp); | CQLIdentifier _id1(tmp); |
CQLChainedIdentifier _cid(_id1); | CQLChainedIdentifier _cid(_id1); |
_factory.setObject(((CQLPredicate*)$1),&_cid,ChainedIdentifier); | _factory.setObject(((CQLPredicate*)$1),&_cid,ChainedIdentifier); |
$$ = $1; | $$ = $1; |
}else if(chain_state == CQLCHAINEDIDENTIFIER || chain_state == CQLVALUE){ |
} |
|
else if(chain_state == CQLCHAINEDIDENTIFIER || chain_state == CQLVALUE) |
|
{ |
CQLPredicate* _pred = (CQLPredicate*)$1; | CQLPredicate* _pred = (CQLPredicate*)$1; |
CQLChainedIdentifier *_cid = ((CQLChainedIdentifier*)(_factory.getObject($1,Predicate,ChainedIdentifier))); |
CQLChainedIdentifier *_cid = ((CQLChainedIdentifier*) |
|
(_factory.getObject |
|
($1,Predicate,ChainedIdentifier))); |
CQLIdentifier tmpid = _cid->getLastIdentifier(); | CQLIdentifier tmpid = _cid->getLastIdentifier(); |
String tmp = tmpid.getName().getString(); | String tmp = tmpid.getName().getString(); |
tmp.append("[").append(*$3).append("]"); | tmp.append("[").append(*$3).append("]"); |
CQLIdentifier _id1(tmp); | CQLIdentifier _id1(tmp); |
CQLChainedIdentifier _tmpcid(_id1); | CQLChainedIdentifier _tmpcid(_id1); |
if(_cid->size() == 1){ |
if(_cid->size() == 1) |
|
{ |
_cid = &_tmpcid; | _cid = &_tmpcid; |
}else{ |
} |
|
else |
|
{ |
_cid->append(_id1); | _cid->append(_id1); |
} | } |
_factory.setObject(((CQLPredicate*)$1),_cid,ChainedIdentifier); | _factory.setObject(((CQLPredicate*)$1),_cid,ChainedIdentifier); |
$$ = $1; | $$ = $1; |
}else{ |
} |
|
else |
|
{ |
/* error */ | /* error */ |
String _msg("chain->chain[ array_index_list ] : chain state not CQLIDENTIFIER or CQLCHAINEDIDENTIFIER or CQLVALUE"); |
String _msg("chain->chain[ array_index_list ] : chain state not" |
|
" CQLIDENTIFIER or CQLCHAINEDIDENTIFIER or CQLVALUE"); |
throw CQLSyntaxErrorException( | throw CQLSyntaxErrorException( |
MessageLoaderParms(String("CQL.CQL_y.NOT_CHAINID_OR_IDENTIFIER_OR_VALUE"), |
MessageLoaderParms( |
String("Chain state not a CQLIdentifier or a CQLChainedIdentifier or a CQLValue while parsing rule $0 in position $1."), |
"CQL.CQL_y.NOT_CHAINID_OR_IDENTIFIER_OR_VALUE", |
String("chain->chain[ array_index_list ]"), |
"Chain state not a CQLIdentifier or a " |
CQL_globalParserState->currentTokenPos) |
"CQLChainedIdentifier or a CQLValue while parsing rule" |
); |
" $0 in position $1.", |
|
"chain->chain[ array_index_list ]", |
|
CQL_globalParserState->currentTokenPos) ); |
} | } |
} | } |
; | ; |
| |
concat : chain | concat : chain |
{ | { |
CQL_globalParserState->currentRule = "concat->chain"; |
CQLTRACE("concat->chain"); |
sprintf(msg,"BISON::concat->chain\n"); |
|
printf_(msg); |
|
| |
$$ = ((CQLPredicate*)$1); | $$ = ((CQLPredicate*)$1); |
} | } |
| concat DBL_PIPE literal_string |
| concat TOK_DBL_PIPE literal_string |
{ | { |
CQL_globalParserState->currentRule = "concat->concat || literal_string"; |
CQLTRACE("concat->concat || literal_string"); |
sprintf(msg,"BISON::concat||literal_string\n"); |
|
printf_(msg); |
|
| |
CQLValue* tmpval = new CQLValue(*$3); | CQLValue* tmpval = new CQLValue(*$3); |
_ObjPtr._ptr = tmpval; | _ObjPtr._ptr = tmpval; |
|
|
CQLExpression exp = sp.getLeftExpression(); | CQLExpression exp = sp.getLeftExpression(); |
if(exp.isSimple()) | if(exp.isSimple()) |
{ | { |
CQLTerm* _term = ((CQLTerm*)(_factory.getObject($1, Predicate, Term))); |
CQLTerm* _term = ((CQLTerm*) |
|
(_factory.getObject($1, Predicate, Term))); |
// check for simple literal values | // check for simple literal values |
Array<CQLFactor> factors = _term->getFactors(); | Array<CQLFactor> factors = _term->getFactors(); |
for(Uint32 i = 0; i < factors.size(); i++){ |
for(Uint32 i = 0; i < factors.size(); i++) |
if(!factors[i].isSimpleValue()){ |
{ |
MessageLoaderParms mparms("CQL.CQL_y.CONCAT_PRODUCTION_FACTORS_NOT_SIMPLE", |
if(!factors[i].isSimpleValue()) |
"The CQLFactors are not simple while processing rule $0.", |
{ |
|
MessageLoaderParms mparms( |
|
"CQL.CQL_y.CONCAT_PRODUCTION_FACTORS_NOT" |
|
"_SIMPLE", |
|
"The CQLFactors are not simple while" |
|
" processing rule $0.", |
CQL_globalParserState->currentRule); | CQL_globalParserState->currentRule); |
throw CQLSyntaxErrorException(mparms); | throw CQLSyntaxErrorException(mparms); |
}else{ |
} |
|
else /* !factors[i].isSimpleValue() */ |
|
{ |
CQLValue val = factors[i].getValue(); | CQLValue val = factors[i].getValue(); |
if(val.getValueType() != CQLValue::String_type){ |
if(val.getValueType() != CQLValue::String_type) |
MessageLoaderParms mparms("CQL.CQL_y.CONCAT_PRODUCTION_VALUE_NOT_LITERAL", |
{ |
|
MessageLoaderParms mparms( |
|
"CQL.CQL_y.CONCAT_PRODUCTION_VALUE_NOT_LITERAL", |
"The CQLValue is not a string literal while processing rule $0.", | "The CQLValue is not a string literal while processing rule $0.", |
CQL_globalParserState->currentRule); | CQL_globalParserState->currentRule); |
throw CQLSyntaxErrorException(mparms); | throw CQLSyntaxErrorException(mparms); |
} | } |
} | } |
} | } |
CQLFactor* _fctr2 = ((CQLFactor*)(_factory.makeObject(tmpval, Factor))); |
CQLFactor* _fctr2 = ((CQLFactor*) |
|
(_factory.makeObject(tmpval, Factor))); |
_term->appendOperation(concat,*_fctr2); | _term->appendOperation(concat,*_fctr2); |
$$ = (CQLPredicate*)(_factory.makeObject(_term,Predicate)); |
$$ = (CQLPredicate*)(_factory.makeObject |
|
(_term,Predicate)); |
} | } |
else |
else /* exp.isSimple() */ |
{ | { |
MessageLoaderParms mparms("CQL.CQL_y.CONCAT_PRODUCTION_NOT_SIMPLE", |
MessageLoaderParms mparms( |
|
"CQL.CQL_y.CONCAT_PRODUCTION_NOT_SIMPLE", |
"The $0 is not simple while processing rule $1.", | "The $0 is not simple while processing rule $1.", |
String("CQLExpression"), |
"CQLExpression", |
CQL_globalParserState->currentRule); | CQL_globalParserState->currentRule); |
throw CQLSyntaxErrorException(mparms); | throw CQLSyntaxErrorException(mparms); |
} | } |
} | } |
else |
else /*sp.isSimple() */ |
{ | { |
MessageLoaderParms mparms("CQL.CQL_y.CONCAT_PRODUCTION_NOT_SIMPLE", |
MessageLoaderParms mparms( |
|
"CQL.CQL_y.CONCAT_PRODUCTION_NOT_SIMPLE", |
"The $0 is not simple while processing rule $1.", | "The $0 is not simple while processing rule $1.", |
String("CQLSimplePredicate"), |
"CQLSimplePredicate", |
CQL_globalParserState->currentRule); | CQL_globalParserState->currentRule); |
throw CQLSyntaxErrorException(mparms); | throw CQLSyntaxErrorException(mparms); |
} | } |
} | } |
else |
else /* end if((CQLPredicate*)$1->isSimple()) */ |
{ | { |
MessageLoaderParms mparms("CQL.CQL_y.CONCAT_PRODUCTION_NOT_SIMPLE", |
MessageLoaderParms mparms( |
|
"CQL.CQL_y.CONCAT_PRODUCTION_NOT_SIMPLE", |
"The $0 is not simple while processing rule $1.", | "The $0 is not simple while processing rule $1.", |
String("CQLPredicate"), |
"CQLPredicate", |
CQL_globalParserState->currentRule); | CQL_globalParserState->currentRule); |
throw CQLSyntaxErrorException(mparms); | throw CQLSyntaxErrorException(mparms); |
} | } |
|
|
| |
factor : concat | factor : concat |
{ | { |
CQL_globalParserState->currentRule = "factor->concat"; |
CQLTRACE("factor->concat"); |
sprintf(msg,"BISON::factor->concat\n"); |
|
printf_(msg); |
|
| |
$$ = $1; | $$ = $1; |
} | } |
/* | PLUS concat |
/* |
|
| TOK_PLUS concat |
{ | { |
add enum instead of _invert to CQLFactor,has to be either nothing, + or - |
add enum instead of _invert to CQLFactor,has to be either nothing, |
|
+ or - |
get the factor and set the optype appropriately | get the factor and set the optype appropriately |
CQL_globalParserState->currentRule = "concat->PLUS concat"; |
CQL_globalParserState->currentRule = "concat->TOK_PLUS concat"; |
printf("BISON::factor->PLUS concat\n"); |
printf("BISON::factor->TOK_PLUS concat\n"); |
|
... |
$$ = new CQLFactor(*(CQLValue*)$2); | $$ = new CQLFactor(*(CQLValue*)$2); |
} | } |
| MINUS concat |
| TOK_MINUS concat |
{ | { |
get the factor and set the optype appropriately | get the factor and set the optype appropriately |
CQL_globalParserState->currentRule = "concat->MINUS concat"; |
CQL_globalParserState->currentRule = "concat->TOK_MINUS concat"; |
printf("BISON::factor->MINUS concat\n"); |
printf("BISON::factor->TOK_MINUS concat\n"); |
|
... |
CQLValue *tmp = (CQLValue*)$2; | CQLValue *tmp = (CQLValue*)$2; |
tmp->invert(); | tmp->invert(); |
$$ = new CQLFactor(*tmp); | $$ = new CQLFactor(*tmp); |
}*/ |
} |
|
*/ |
; | ; |
| |
term : factor | term : factor |
|
|
sprintf(msg,"BISON::term->factor\n"); | sprintf(msg,"BISON::term->factor\n"); |
printf_(msg); | printf_(msg); |
| |
|
CQLTRACE("term->factor"); |
|
|
$$ = $1; | $$ = $1; |
} | } |
/* | term STAR factor |
/* |
|
| term TOK_STAR factor |
{ | { |
get factor out of $1, get factor out of $3, appendoperation, then construct predicate and forward it |
get factor out of $1, get factor out of $3, appendoperation, |
printf("BISON::term->term STAR factor\n"); |
then construct predicate and forward it |
CQL_globalParserState->currentRule = "term->term STAR factor"; |
printf("BISON::term->term TOK_STAR factor\n"); |
|
CQL_globalParserState->currentRule = "term->term TOK_STAR factor"; |
$1->appendOperation(mult, *$3); | $1->appendOperation(mult, *$3); |
$$ = $1; | $$ = $1; |
} | } |
| term DIV factor |
| term TOK_DIV factor |
{ | { |
get factor out of $1, get factor out of $3, appendoperation, then construct predicate and forward it |
get factor out of $1, get factor out of $3, appendoperation, |
CQL_globalParserState->currentRule = "term->term DIV factor"; |
then construct predicate and forward it |
printf("BISON::term->term DIV factor\n"); |
CQL_globalParserState->currentRule = "term->term TOK_DIV factor"; |
|
printf("BISON::term->term TOK_DIV factor\n"); |
$1->appendOperation(divide, *$3); | $1->appendOperation(divide, *$3); |
$$ = $1; | $$ = $1; |
}*/ |
} |
|
*/ |
; | ; |
| |
arith : term | arith : term |
|
|
sprintf(msg,"BISON::arith->term\n"); | sprintf(msg,"BISON::arith->term\n"); |
printf_(msg); | printf_(msg); |
| |
|
CQLTRACE("arith->term"); |
|
|
//CQLPredicate* _pred = new CQLPredicate(*$1); | //CQLPredicate* _pred = new CQLPredicate(*$1); |
// _factory._predicates.append(_pred); | // _factory._predicates.append(_pred); |
$$ = $1; | $$ = $1; |
} | } |
/* | arith PLUS term |
/* |
|
| arith TOK_PLUS term |
{ | { |
get term out of $1, get term out of $3, appendoperation, then construct predicate and forward it |
get term out of $1, get term out of $3, appendoperation, then |
CQL_globalParserState->currentRule = "arith->arith PLUS term"; |
construct predicate and forward it |
printf("BISON::arith->arith PLUS term\n"); |
CQL_globalParserState->currentRule = "arith->arith TOK_PLUS term"; |
|
printf("BISON::arith->arith TOK_PLUS term\n"); |
$1->appendOperation(TERM_ADD, *$3); | $1->appendOperation(TERM_ADD, *$3); |
$$ = $1; | $$ = $1; |
} | } |
| arith MINUS term |
| arith TOK_MINUS term |
{ | { |
get term out of $1, get term out of $3, appendoperation, then construct predicate and forward it |
get term out of $1, get term out of $3, append operation, then |
CQL_globalParserState->currentRule = "arith->arith MINUS term"; |
construct predicate and forward it |
printf("BISON::arith->arith MINUS term\n"); |
CQL_globalParserState->currentRule = "arith->arith TOK_MINUS term"; |
|
printf("BISON::arith->arith TOK_MINUS term\n"); |
$1->appendOperation(TERM_SUBTRACT, *$3); | $1->appendOperation(TERM_SUBTRACT, *$3); |
$$ = $1; | $$ = $1; |
}*/ |
} |
|
*/ |
; | ; |
| |
value_symbol : HASH literal_string |
value_symbol : TOK_HASH literal_string |
{ | { |
CQL_globalParserState->currentRule = "value_symbol->#literal_string"; |
CQLTRACE("value_symbol->#literal_string"); |
sprintf(msg,"BISON::value_symbol->#literal_string\n"); |
|
printf_(msg); |
|
| |
String tmp("#"); | String tmp("#"); |
tmp.append(*$2); | tmp.append(*$2); |
|
|
| |
arith_or_value_symbol : arith | arith_or_value_symbol : arith |
{ | { |
CQL_globalParserState->currentRule = "arith_or_value_symbol->arith"; |
CQLTRACE("arith_or_value_symbol->arith"); |
sprintf(msg,"BISON::arith_or_value_symbol->arith\n"); |
|
printf_(msg); |
|
| |
$$ = $1; | $$ = $1; |
} | } |
| value_symbol | | value_symbol |
{ | { |
/* make into predicate */ | /* make into predicate */ |
CQL_globalParserState->currentRule = "arith_or_value_symbol->value_symbol"; |
CQLTRACE("arith_or_value_symbol->value_symbol"); |
sprintf(msg,"BISON::arith_or_value_symbol->value_symbol\n"); |
|
printf_(msg); |
|
| |
CQLFactor _fctr(*$1); | CQLFactor _fctr(*$1); |
$$ = (CQLPredicate*)(_factory.makeObject(&_fctr, Predicate)); | $$ = (CQLPredicate*)(_factory.makeObject(&_fctr, Predicate)); |
} | } |
; | ; |
| |
comp_op : _EQ |
comp_op : TOK_EQ |
{ | { |
CQL_globalParserState->currentRule = "comp_op->_EQ"; |
CQLTRACE("comp_op->TOK_EQ"); |
sprintf(msg,"BISON::comp_op->_EQ\n"); |
|
printf_(msg); |
|
$$ = EQ; | $$ = EQ; |
} | } |
| _NE |
| TOK_NE |
{ | { |
CQL_globalParserState->currentRule = "comp_op->_NE"; |
CQLTRACE("comp_op->TOK_NE"); |
sprintf(msg,"BISON::comp_op->_NE\n"); |
|
printf_(msg); |
|
$$ = NE; | $$ = NE; |
} | } |
| _GT |
| TOK_GT |
{ | { |
CQL_globalParserState->currentRule = "comp_op->_GT"; |
CQLTRACE("comp_op->TOK_GT"); |
sprintf(msg,"BISON::comp_op->_GT\n"); |
|
printf_(msg); |
|
$$ = GT; | $$ = GT; |
} | } |
| _LT |
| TOK_LT |
{ | { |
CQL_globalParserState->currentRule = "comp_op->_LT"; |
CQLTRACE("comp_op->TOK_LT"); |
sprintf(msg,"BISON::comp_op->_LT\n"); |
|
printf_(msg); |
|
$$ = LT; | $$ = LT; |
} | } |
| _GE |
| TOK_GE |
{ | { |
CQL_globalParserState->currentRule = "comp_op->_GE"; |
CQLTRACE("comp_op->TOK_GE"); |
sprintf(msg,"BISON::comp_op->_GE\n"); |
|
printf_(msg); |
|
$$ = GE; | $$ = GE; |
} | } |
| _LE |
| TOK_LE |
{ | { |
CQL_globalParserState->currentRule = "comp_op->_LE"; |
CQLTRACE("comp_op->TOK_LE"); |
sprintf(msg,"BISON::comp_op->_LE\n"); |
|
printf_(msg); |
|
$$ = LE; | $$ = LE; |
} | } |
; | ; |
| |
comp : arith | comp : arith |
{ | { |
CQL_globalParserState->currentRule = "comp->arith"; |
CQLTRACE("comp->arith"); |
sprintf(msg,"BISON::comp->arith\n"); |
|
printf_(msg); |
|
| |
$$ = $1; | $$ = $1; |
} | } |
| arith IS NOT _NULL |
| arith TOK_IS TOK_NOT TOK_NULL |
{ | { |
CQL_globalParserState->currentRule = "comp->arith IS NOT _NULL"; |
CQLTRACE("comp->arith TOK_IS TOK_NOT TOK_NULL"); |
sprintf(msg,"BISON::comp->arith IS NOT _NULL\n"); |
|
printf_(msg); |
|
| |
CQLExpression *_expr = (CQLExpression*)(_factory.getObject($1,Expression)); |
CQLExpression *_expr = |
|
(CQLExpression*)(_factory.getObject($1,Expression)); |
CQLSimplePredicate _sp(*_expr, IS_NOT_NULL); | CQLSimplePredicate _sp(*_expr, IS_NOT_NULL); |
_factory.setObject($1,&_sp,SimplePredicate); | _factory.setObject($1,&_sp,SimplePredicate); |
$$ = $1; | $$ = $1; |
} | } |
| arith IS _NULL |
| arith TOK_IS TOK_NULL |
{ | { |
CQL_globalParserState->currentRule = "comp->arith IS _NULL"; |
CQLTRACE("comp->arith TOK_IS TOK_NULL"); |
sprintf(msg,"BISON::comp->arith IS _NULL\n"); |
|
printf_(msg); |
|
| |
CQLExpression *_expr = (CQLExpression*)(_factory.getObject($1,Expression)); | CQLExpression *_expr = (CQLExpression*)(_factory.getObject($1,Expression)); |
CQLSimplePredicate _sp(*_expr, IS_NULL); | CQLSimplePredicate _sp(*_expr, IS_NULL); |
|
|
} | } |
| arith comp_op arith_or_value_symbol | | arith comp_op arith_or_value_symbol |
{ | { |
CQL_globalParserState->currentRule = "comp->arith comp_op arith_or_value_symbol"; |
CQLTRACE("comp->arith comp_op arith_or_value_symbol"); |
sprintf(msg,"BISON::comp->arith comp_op arith_or_value_symbol\n"); |
|
printf_(msg); |
if($1->isSimple() && $3->isSimple()) |
if($1->isSimple() && $3->isSimple()){ |
{ |
CQLExpression* _exp1 = (CQLExpression*)(_factory.getObject($1,Predicate,Expression)); |
CQLExpression* _exp1 = (CQLExpression*) |
CQLExpression* _exp2 = (CQLExpression*)(_factory.getObject($3,Predicate,Expression)); |
(_factory.getObject($1,Predicate,Expression)); |
|
CQLExpression* _exp2 = (CQLExpression*) |
|
(_factory.getObject($3,Predicate,Expression)); |
CQLSimplePredicate _sp(*_exp1, *_exp2, $2); | CQLSimplePredicate _sp(*_exp1, *_exp2, $2); |
$$ = new CQLPredicate(_sp); | $$ = new CQLPredicate(_sp); |
_ObjPtr._ptr = $$; | _ObjPtr._ptr = $$; |
_ObjPtr.type = Pred; | _ObjPtr.type = Pred; |
_ptrs.append(_ObjPtr); | _ptrs.append(_ObjPtr); |
}else{ |
} |
|
else |
|
{ |
/* error */ | /* error */ |
String _msg("comp->arith comp_op arith_or_value_symbol : $1 is not simple OR $3 is not simple"); |
String _msg("comp->arith comp_op arith_or_value_symbol : $1 is " |
|
"not simple OR $3 is not simple"); |
throw CQLSyntaxErrorException( | throw CQLSyntaxErrorException( |
MessageLoaderParms(String("CQL.CQL_y.NOT_SIMPLE"), |
MessageLoaderParms("CQL.CQL_y.NOT_SIMPLE", |
String("The CQLSimplePredicate is not simple while parsing rule $0 in position $1."), |
"The CQLSimplePredicate is not simple while parsing " |
String("comp->arith comp_op arith_or_value_symbol"), |
"rule $0 in position $1.", |
CQL_globalParserState->currentTokenPos) |
"comp->arith comp_op arith_or_value_symbol", |
); |
CQL_globalParserState->currentTokenPos) ); |
} | } |
} | } |
| value_symbol comp_op arith | | value_symbol comp_op arith |
{ | { |
CQL_globalParserState->currentRule = "comp->value_symbol comp_op arith"; |
CQLTRACE("comp->value_symbol comp_op arith"); |
sprintf(msg,"BISON::comp->value_symbol comp_op arith\n"); |
|
printf_(msg); |
|
| |
if($3->isSimple()){ |
if($3->isSimple()) |
CQLExpression* _exp1 = (CQLExpression*)(_factory.makeObject($1, Expression)); |
{ |
CQLExpression* _exp2 = (CQLExpression*)(_factory.getObject($3,Predicate,Expression)); |
CQLExpression* _exp1 = (CQLExpression*) |
|
(_factory.makeObject($1, Expression)); |
|
CQLExpression* _exp2 = (CQLExpression*) |
|
(_factory.getObject($3,Predicate,Expression)); |
CQLSimplePredicate _sp(*_exp1, *_exp2, $2); | CQLSimplePredicate _sp(*_exp1, *_exp2, $2); |
$$ = new CQLPredicate(_sp); | $$ = new CQLPredicate(_sp); |
_ObjPtr._ptr = $$; | _ObjPtr._ptr = $$; |
_ObjPtr.type = Pred; | _ObjPtr.type = Pred; |
_ptrs.append(_ObjPtr); | _ptrs.append(_ObjPtr); |
}else{ |
} |
|
else |
|
{ |
/* error */ | /* error */ |
String _msg("comp->value_symbol comp_op arith : $3 is not simple"); | String _msg("comp->value_symbol comp_op arith : $3 is not simple"); |
throw CQLSyntaxErrorException( | throw CQLSyntaxErrorException( |
MessageLoaderParms(String("CQL.CQL_y.NOT_SIMPLE"), |
MessageLoaderParms("CQL.CQL_y.NOT_SIMPLE", |
String("The CQLSimplePredicate is not simple while parsing rule $0 in position $1."), |
"The CQLSimplePredicate is not simple while parsing" |
String("comp->value_symbol comp_op arith"), |
" rule $0 in position $1.", |
CQL_globalParserState->currentTokenPos) |
"comp->value_symbol comp_op arith", |
); |
CQL_globalParserState->currentTokenPos) ); |
| |
} | } |
} | } |
| arith _ISA identifier |
| arith TOK_ISA identifier |
{ | { |
CQL_globalParserState->currentRule = "comp->arith _ISA identifier"; |
/* make sure $1 isSimple(), get its expression, make |
/* make sure $1 isSimple(), get its expression, make simplepred->predicate */ |
simplepred->predicate |
sprintf(msg,"BISON::comp->arith _ISA identifier\n"); |
*/ |
printf_(msg); |
CQLTRACE("comp->arith _TOK_ISA identifier"); |
| |
CQLExpression *_expr1 = (CQLExpression*)(_factory.getObject($1,Predicate,Expression)); |
CQLExpression *_expr1 = (CQLExpression*) |
|
(_factory.getObject($1,Predicate,Expression)); |
CQLChainedIdentifier _cid(*$3); | CQLChainedIdentifier _cid(*$3); |
CQLExpression *_expr2 = (CQLExpression*)(_factory.makeObject(&_cid,Expression)); |
CQLExpression *_expr2 = (CQLExpression*) |
|
(_factory.makeObject(&_cid,Expression)); |
CQLSimplePredicate _sp(*_expr1, *_expr2, ISA); | CQLSimplePredicate _sp(*_expr1, *_expr2, ISA); |
_factory.setObject($1,&_sp,SimplePredicate); | _factory.setObject($1,&_sp,SimplePredicate); |
$$ = $1; | $$ = $1; |
} | } |
| arith _LIKE literal_string |
| arith TOK_LIKE literal_string |
{ | { |
CQL_globalParserState->currentRule = "comp->arith _LIKE literal_string"; |
CQLTRACE("comp->arith TOK_LIKE literal_string"); |
sprintf(msg,"BISON::comp->arith _LIKE literal_string\n"); |
|
printf_(msg); |
|
| |
CQLExpression *_expr1 = (CQLExpression*)(_factory.getObject($1,Predicate,Expression)); |
CQLExpression *_expr1 = (CQLExpression*) |
|
(_factory.getObject($1,Predicate,Expression)); |
CQLValue _val(*$3); | CQLValue _val(*$3); |
CQLExpression *_expr2 = (CQLExpression*)(_factory.makeObject(&_val,Expression)); |
CQLExpression *_expr2 = (CQLExpression*) |
|
(_factory.makeObject(&_val,Expression)); |
CQLSimplePredicate _sp(*_expr1, *_expr2, LIKE); | CQLSimplePredicate _sp(*_expr1, *_expr2, LIKE); |
_factory.setObject($1,&_sp,SimplePredicate); | _factory.setObject($1,&_sp,SimplePredicate); |
$$ = $1; | $$ = $1; |
|
|
; | ; |
expr_factor : comp | expr_factor : comp |
{ | { |
CQL_globalParserState->currentRule = "expr_factor->comp"; |
CQLTRACE("expr_factor->comp"); |
sprintf(msg,"BISON::expr_factor->comp\n"); |
|
printf_(msg); |
|
| |
$$ = $1; | $$ = $1; |
} | } |
| NOT comp |
| TOK_NOT comp |
{ | { |
CQL_globalParserState->currentRule = "expr_factor->NOT comp"; |
CQLTRACE("expr_factor->TOK_NOT comp"); |
sprintf(msg,"BISON::expr_factor->NOT comp\n"); |
|
printf_(msg); |
|
| |
$2->setInverted(!($2->getInverted())); | $2->setInverted(!($2->getInverted())); |
$$ = $2; | $$ = $2; |
|
|
| |
expr_term : expr_factor | expr_term : expr_factor |
{ | { |
CQL_globalParserState->currentRule = "expr_term->expr_factor"; |
CQLTRACE("expr_term->expr_factor"); |
sprintf(msg,"BISON::expr_term->expr_factor\n"); |
|
printf_(msg); |
|
| |
$$ = $1; | $$ = $1; |
} | } |
| expr_term _AND expr_factor |
| expr_term TOK_AND expr_factor |
{ | { |
CQL_globalParserState->currentRule = "expr_term->expr_term AND expr_factor"; |
CQLTRACE("expr_term->expr_term AND expr_factor"); |
sprintf(msg,"BISON::expr_term->expr_term AND expr_factor\n"); |
|
printf_(msg); |
|
| |
$$ = new CQLPredicate(); | $$ = new CQLPredicate(); |
$$->appendPredicate(*$1); | $$->appendPredicate(*$1); |
|
|
| |
expr : expr_term | expr : expr_term |
{ | { |
CQL_globalParserState->currentRule = "expr->expr_term"; |
CQLTRACE("expr->expr_term"); |
sprintf(msg,"BISON::expr->expr_term\n"); |
|
printf_(msg); |
|
| |
$$ = $1; | $$ = $1; |
} | } |
| expr _OR expr_term |
| expr TOK_OR expr_term |
{ | { |
CQL_globalParserState->currentRule = "expr->expr OR expr_term"; |
CQLTRACE("expr->expr OR expr_term"); |
sprintf(msg,"BISON::expr->expr OR expr_term\n"); |
|
printf_(msg); |
|
$$ = new CQLPredicate(); | $$ = new CQLPredicate(); |
$$->appendPredicate(*$1); | $$->appendPredicate(*$1); |
$$->appendPredicate(*$3, OR); | $$->appendPredicate(*$3, OR); |
|
|
; | ; |
| |
arg_list : {;} | arg_list : {;} |
/* | STAR |
/**************** |
|
| TOK_STAR |
{ | { |
CQL_globalParserState->currentRule = "arg_list->STAR"; |
CQLTRACE("arg_list->TOK_STAR"); |
sprintf(msg,"BISON::arg_list->STAR\n"); |
|
printf_(msg); |
|
| |
CQLIdentifier _id("*"); | CQLIdentifier _id("*"); |
CQLPredicate* _pred = (CQLPredicate*)(_factory.makeObject(&_id,Predicate)); |
CQLPredicate* _pred = (CQLPredicate*) |
|
(_factory.makeObject(&_id,Predicate)); |
_arglist.append(*_pred); | _arglist.append(*_pred); |
since arg_list can loop back on itself, | since arg_list can loop back on itself, |
we need to store away previous solutions | we need to store away previous solutions |
production. We keep track of previous productions | production. We keep track of previous productions |
in the _arglist array and later pass that to CQLFunction | in the _arglist array and later pass that to CQLFunction |
as part of chain: identifier LPAR arg_list RPAR |
as part of chain: identifier TOK_LPAR arg_list TOK_RPAR |
| |
}*/ |
} |
|
*******************/ |
| expr | | expr |
{ | { |
CQL_globalParserState->currentRule = "arg_list->arg_list_sub->expr"; |
CQLTRACE("arg_list->arg_list_sub->expr"); |
sprintf(msg,"BISON::arg_list_sub->expr\n"); |
|
printf_(msg); |
|
| |
_arglist.append(*$1);/* |
_arglist.append(*$1); |
|
/* |
since arg_list can loop back on itself, | since arg_list can loop back on itself, |
we need to store away previous solutions | we need to store away previous solutions |
production. We keep track of previous productions | production. We keep track of previous productions |
in the _arglist array and later pass that to CQLFunction | in the _arglist array and later pass that to CQLFunction |
as part of chain: identifier LPAR arg_list RPAR |
as part of chain: identifier TOK_LPAR arg_list TOK_RPAR |
*/ | */ |
} | } |
/* |
/**************************** |
| DISTINCT STAR |
| TOK_DISTINCT TOK_STAR |
{ | { |
sprintf(msg,"BISON::arg_list->DISTINCT STAR\n"); |
CQLTRACE("arg_list->TOK_DISTINCT TOK_STAR"); |
printf_(msg); |
|
| |
CQLIdentifier _id("DISTINCTSTAR"); | CQLIdentifier _id("DISTINCTSTAR"); |
CQLPredicate* _pred = (CQLPredicate*)(_factory.makeObject(&_id,Predicate)); |
CQLPredicate* _pred = (CQLPredicate*) |
|
(_factory.makeObject(&_id,Predicate)); |
_arglist.append(*_pred); | _arglist.append(*_pred); |
} | } |
| arg_list_sub arg_list_tail | | arg_list_sub arg_list_tail |
|
|
| |
_arlist.append(*$1); | _arlist.append(*$1); |
} | } |
| DISTINCT expr |
| TOK_DISTINCT expr |
{ | { |
sprintf(msg,"BISON::arg_list_sub->DISTINCT expr\n"); |
sprintf(msg,"BISON::arg_list_sub->TOK_DISTINCT expr\n"); |
printf_(msg); | printf_(msg); |
| |
String tmp1("DISTINCT"); |
String tmp1("TOK_DISTINCT"); |
CQLIdentifier* _id = (CQLIdentifier*)(_factory.getObject($1,Predicate,Identifier)); |
CQLIdentifier* _id = (CQLIdentifier*) |
|
(_factory.getObject($1,Predicate,Identifier)); |
String tmp2(_id->getName().getString()); | String tmp2(_id->getName().getString()); |
tmp1.append(tmp2); | tmp1.append(tmp2); |
CQLIdentifier _id1(tmp1); | CQLIdentifier _id1(tmp1); |
|
|
|
|
} | } |
; | ; |
| |
arg_list_tail : {;} | arg_list_tail : {;} |
| COMMA arg_list_sub arg_list_tail |
| TOK_COMMA arg_list_sub arg_list_tail |
{ | { |
sprintf(msg,"BISON::arg_list_tail->COMMA arg_list_sub arg_list_tail\n"); |
sprintf(msg,"BISON::arg_list_tail->TOK_COMMA arg_list_sub arg_list_tail\n"); |
printf_(msg); | printf_(msg); |
} | } |
; | ; |
*/ |
*******************/ |
|
|
from_specifier : class_path | from_specifier : class_path |
{ | { |
CQL_globalParserState->currentRule = "from_specifier->class_path"; |
CQLTRACE("from_specifier->class_path"); |
sprintf(msg,"BISON::from_specifier->class_path\n"); |
|
printf_(msg); |
|
| |
CQL_globalParserState->statement->appendClassPath(*$1); | CQL_globalParserState->statement->appendClassPath(*$1); |
} | } |
|
| class_path TOK_AS identifier |
| class_path AS identifier |
|
{ | { |
CQL_globalParserState->currentRule = "from_specifier->class_path AS identifier"; |
CQL_globalParserState->currentRule = "from_specifier->class_path TOK_AS identifier"; |
sprintf(msg,"BISON::from_specifier->class_path AS identifier\n"); |
CQLTRACE("from_specifier->class_path TOK_AS identifier"); |
printf_(msg); |
|
| |
CQLIdentifier _class(*$1); | CQLIdentifier _class(*$1); |
String _alias($3->getName().getString()); | String _alias($3->getName().getString()); |
|
|
} | } |
| class_path identifier | | class_path identifier |
{ | { |
CQL_globalParserState->currentRule = "from_specifier->class_path identifier"; |
CQLTRACE("from_specifier->class_path identifier"); |
sprintf(msg,"BISON::from_specifier->class_path identifier\n"); |
|
printf_(msg); |
|
| |
CQLIdentifier _class(*$1); | CQLIdentifier _class(*$1); |
String _alias($2->getName().getString()); | String _alias($2->getName().getString()); |
|
|
| |
from_criteria : from_specifier | from_criteria : from_specifier |
{ | { |
CQL_globalParserState->currentRule = "from_criteria->from_specifier"; |
CQLTRACE("from_criteria->from_specifier"); |
sprintf(msg,"BISON::from_criteria->from_specifier\n"); |
|
printf_(msg); |
|
} | } |
; | ; |
| |
star_expr : STAR |
star_expr : TOK_STAR |
{ | { |
CQL_globalParserState->currentRule = "star_expr->STAR"; |
CQLTRACE("star_expr->TOK_STAR"); |
sprintf(msg,"BISON::star_expr->STAR\n"); |
|
printf_(msg); |
|
| |
CQLIdentifier _id("*"); | CQLIdentifier _id("*"); |
$$ = (CQLChainedIdentifier*)(_factory.makeObject(&_id,ChainedIdentifier)); | $$ = (CQLChainedIdentifier*)(_factory.makeObject(&_id,ChainedIdentifier)); |
} | } |
| chain DOT STAR |
| chain TOK_DOT TOK_STAR |
{ | { |
CQL_globalParserState->currentRule = "star_expr->chain.*"; |
CQLTRACE("star_expr->chain.*"); |
sprintf(msg,"BISON::star_expr->chain.*\n"); |
|
printf_(msg); |
CQLChainedIdentifier* _tmp = (CQLChainedIdentifier*) |
CQLChainedIdentifier* _tmp = (CQLChainedIdentifier*)(_factory.getObject($1,Predicate,ChainedIdentifier)); |
(_factory.getObject($1,Predicate,ChainedIdentifier)); |
CQLChainedIdentifier* _cid = new CQLChainedIdentifier(*_tmp); | CQLChainedIdentifier* _cid = new CQLChainedIdentifier(*_tmp); |
CQLIdentifier _id("*"); | CQLIdentifier _id("*"); |
_cid->append(_id); | _cid->append(_id); |
|
|
| |
selected_entry : expr | selected_entry : expr |
{ | { |
CQL_globalParserState->currentRule = "selected_entry->expr"; |
CQLTRACE("selected_entry->expr"); |
sprintf(msg,"BISON::selected_entry->expr\n"); |
|
printf_(msg); |
if($1->isSimpleValue()) |
if($1->isSimpleValue()){ |
{ |
CQLChainedIdentifier *_cid = (CQLChainedIdentifier*)(_factory.getObject($1,Predicate,ChainedIdentifier)); |
CQLChainedIdentifier *_cid = (CQLChainedIdentifier*) |
|
(_factory.getObject($1,Predicate,ChainedIdentifier)); |
CQL_globalParserState->statement->appendSelectIdentifier(*_cid); | CQL_globalParserState->statement->appendSelectIdentifier(*_cid); |
}else{ |
} |
|
else |
|
{ |
/* error */ | /* error */ |
String _msg("selected_entry->expr : $1 is not a simple value"); | String _msg("selected_entry->expr : $1 is not a simple value"); |
throw CQLSyntaxErrorException( | throw CQLSyntaxErrorException( |
MessageLoaderParms(String("CQL.CQL_y.NOT_SIMPLE_VALUE"), |
MessageLoaderParms("CQL.CQL_y.NOT_SIMPLE_VALUE", |
String("The CQLPredicate is not a simple value while parsing rule $0 in position $1."), |
"The CQLPredicate is not a simple value while " |
String("selected_entry->expr"), |
"parsing rule $0 in position $1.", |
CQL_globalParserState->currentTokenPos) |
"selected_entry->expr", |
); |
CQL_globalParserState->currentTokenPos) ); |
} | } |
} | } |
| star_expr | | star_expr |
{ | { |
CQL_globalParserState->currentRule = "selected_entry->star_expr"; |
CQLTRACE("selected_entry->star_expr"); |
sprintf(msg,"BISON::selected_entry->star_expr\n"); |
|
printf_(msg); |
|
CQL_globalParserState->statement->appendSelectIdentifier(*$1); | CQL_globalParserState->statement->appendSelectIdentifier(*$1); |
} | } |
; | ; |
| |
select_list : selected_entry select_list_tail | select_list : selected_entry select_list_tail |
{ | { |
CQL_globalParserState->currentRule = "select_list->selected_entry select_list_tail"; |
CQLTRACE("select_list->selected_entry select_list_tail"); |
sprintf(msg,"BISON::select_list->selected_entry select_list_tail\n"); |
|
printf_(msg); |
|
} | } |
; | ; |
| |
select_list_tail : {;} /* empty */ | select_list_tail : {;} /* empty */ |
| COMMA selected_entry select_list_tail |
| TOK_COMMA selected_entry select_list_tail |
{ | { |
CQL_globalParserState->currentRule = "select_list_tail->COMMA selected_entry select_list_tail"; |
CQLTRACE("select_list_tail->TOK_COMMA selected_entry select_list_tail"); |
sprintf(msg,"BISON::select_list_tail->COMMA selected_entry select_list_tail\n"); |
|
printf_(msg); |
|
} | } |
; | ; |
| |
search_condition : expr | search_condition : expr |
{ | { |
CQL_globalParserState->currentRule = "search_condition->expr"; |
CQLTRACE("search_condition->expr"); |
sprintf(msg,"BISON::search_condition->expr\n"); |
|
printf_(msg); |
|
CQL_globalParserState->statement->setPredicate(*$1); | CQL_globalParserState->statement->setPredicate(*$1); |
} | } |
; | ; |
| |
optional_where : {} | optional_where : {} |
| WHERE search_condition |
| TOK_WHERE search_condition |
{ | { |
CQL_globalParserState->currentRule = "optional_where->WHERE search_condition"; |
CQLTRACE( "optional_where->TOK_WHERE search_condition"); |
sprintf(msg,"BISON::optional_where->WHERE search_condition\n"); |
|
printf_(msg); |
|
CQL_globalParserState->statement->setHasWhereClause(); | CQL_globalParserState->statement->setHasWhereClause(); |
} | } |
; | ; |
| |
select_statement : SELECT select_list FROM from_criteria optional_where |
select_statement : TOK_SELECT select_list TOK_FROM from_criteria optional_where |
{ | { |
CQL_globalParserState->currentRule = "select_statement"; |
CQLTRACE("select_statement"); |
sprintf(msg,"select_statement\n\n"); |
|
printf_(msg); |
|
CQL_Bison_Cleanup(); | CQL_Bison_Cleanup(); |
} | } |
| |