1 karl 1.14 //%2006////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
4 // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
5 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
6 // IBM Corp.; EMC Corporation, The Open Group.
7 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
8 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
9 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
11 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
12 // EMC Corporation; Symantec Corporation; The Open Group.
13 //
14 // Permission is hereby granted, free of charge, to any person obtaining a copy
15 // of this software and associated documentation files (the "Software"), to
16 // deal in the Software without restriction, including without limitation the
17 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
18 // sell copies of the Software, and to permit persons to whom the Software is
19 // furnished to do so, subject to the following conditions:
20 //
21 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
22 karl 1.14 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
23 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
24 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
25 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
26 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
27 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
30 //==============================================================================
|
31 chuck 1.2 #ifndef lint
32 static char const
33 yyrcsid[] = "$FreeBSD: src/usr.bin/yacc/skeleton.c,v 1.28 2000/01/17 02:04:06 bde Exp $";
34 #endif
35 #include <stdlib.h>
36 #define YYBYACC 1
37 #define YYMAJOR 1
38 #define YYMINOR 9
39 #define YYLEX yylex()
40 #define YYEMPTY -1
41 #define yyclearin (yychar=(YYEMPTY))
42 #define yyerrok (yyerrflag=0)
43 #define YYRECOVERING() (yyerrflag!=0)
44 static int yygrowstack();
45 #define yyparse CQL_parse
46 #define yylex CQL_lex
47 #define yyerror CQL_error
48 #define yychar CQL_char
49 #define yyval CQL_val
50 #define yylval CQL_lval
51 #define yydebug CQL_debug
52 chuck 1.2 #define yynerrs CQL_nerrs
53 #define yyerrflag CQL_errflag
54 #define yyss CQL_ss
55 #define yyssp CQL_ssp
56 #define yyvs CQL_vs
57 #define yyvsp CQL_vsp
58 #define yylhs CQL_lhs
59 #define yylen CQL_len
60 #define yydefred CQL_defred
61 #define yydgoto CQL_dgoto
62 #define yysindex CQL_sindex
63 #define yyrindex CQL_rindex
64 #define yygindex CQL_gindex
65 #define yytable CQL_table
66 #define yycheck CQL_check
67 #define yyname CQL_name
68 #define yyrule CQL_rule
69 #define yysslim CQL_sslim
70 #define yystacksize CQL_stacksize
71 #define YYPREFIX "CQL_"
|
72 lucier 1.13 #line 30 "CQL.y"
|
73 chuck 1.2 #include <Pegasus/Common/Config.h>
74 #include <Pegasus/Common/String.h>
75 #include <Pegasus/Common/CommonUTF.h>
76 #include <Pegasus/Query/QueryCommon/QueryException.h>
77 #include <Pegasus/Common/MessageLoader.h>
78 #include <Pegasus/CQL/CQLFactory.h>
79 #include "CQLObjects.h"
80 #include <stdio.h>
81
82 #define yyparse CQL_parse
83 #define CQLPREDICATE 0
84 #define CQLVALUE 1
85 #define CQLIDENTIFIER 2
86 #define CQLFUNCTION 3
87 #define CQLCHAINEDIDENTIFIER 4
88
89 #ifdef CQL_DEBUG_GRAMMAR
90 #define DEBUG_GRAMMAR 1
91 #else
92 #define DEBUG_GRAMMAR 0
93 #endif
94 chuck 1.2
95 int yylex();
|
96 lucier 1.13 static char msg[100];
|
97 chuck 1.2 void printf_(char * msg){
|
98 humberto 1.7 if(DEBUG_GRAMMAR == 1)
|
99 chuck 1.2 printf("%s\n",msg);
100 }
101 extern char * yytext;
102 int chain_state;
103 CQLFactory _factory = CQLFactory();
104 extern int CQL_error(const char *err);
|
105 humberto 1.8
106 enum CQLType { Id, CId, Val, Func, Fact, Trm, Expr, SPred, Pred, Str };
107
108 typedef struct CQLObjPtr {
109 void* _ptr;
110 CQLType type;
111 } CQLOBJPTR;
112
113 Array<CQLObjPtr> _ptrs;
114 CQLOBJPTR _ObjPtr;
115
|
116 humberto 1.10
117 void CQL_Bison_Cleanup(){
|
118 humberto 1.8 for(Uint32 i = 0; i < _ptrs.size(); i++){
119 if(_ptrs[i]._ptr){
120 switch(_ptrs[i].type){
121 case Id:
122 delete (CQLIdentifier*)_ptrs[i]._ptr;
123 break;
124 case CId:
125 delete (CQLChainedIdentifier*)_ptrs[i]._ptr;
126 break;
127 case Val:
128 delete (CQLValue*)_ptrs[i]._ptr;
129 break;
130 case Func:
131 delete (CQLFunction*)_ptrs[i]._ptr;
132 break;
133 case Fact:
134 delete (CQLFactor*)_ptrs[i]._ptr;
135 break;
136 case Trm:
137 delete (CQLTerm*)_ptrs[i]._ptr;
138 break;
139 humberto 1.8 case Expr:
140 delete (CQLExpression*)_ptrs[i]._ptr;
141 break;
142 case SPred:
143 delete (CQLSimplePredicate*)_ptrs[i]._ptr;
144 break;
145 case Pred:
146 delete (CQLPredicate*)_ptrs[i]._ptr;
147 break;
148 case Str:
149 delete (String*)_ptrs[i]._ptr;
150 }
151 }
152 }
153 _ptrs.clear();
154 _factory.cleanup();
|
155 humberto 1.10 _factory = CQLFactory();
|
156 humberto 1.8 }
157
|
158 humberto 1.10 PEGASUS_NAMESPACE_BEGIN
159
160 extern CQLParserState* CQL_globalParserState;
161 Array<CQLPredicate> _arglist;
162
163
|
164 chuck 1.2 PEGASUS_NAMESPACE_END
165
166
|
167 lucier 1.13 #line 125 "CQL.y"
|
168 chuck 1.2 typedef union {
169 char * strValue;
170 String * _string;
171 CQLValue * _value;
172 CQLIdentifier * _identifier;
173 CQLChainedIdentifier * _chainedIdentifier;
174 CQLPredicate * _predicate;
175 ExpressionOpType _opType;
176 void * _node;
177 } YYSTYPE;
|
178 humberto 1.10 #line 149 "y.tab.c"
|
179 chuck 1.2 #define YYERRCODE 256
180 #define IDENTIFIER 257
181 #define STRING_LITERAL 258
182 #define BINARY 259
183 #define NEGATIVE_BINARY 260
184 #define HEXADECIMAL 261
185 #define NEGATIVE_HEXADECIMAL 262
186 #define INTEGER 263
187 #define NEGATIVE_INTEGER 264
188 #define REAL 265
189 #define NEGATIVE_REAL 266
190 #define _TRUE 267
191 #define _FALSE 268
192 #define SCOPED_PROPERTY 269
193 #define LPAR 270
194 #define RPAR 271
195 #define HASH 272
196 #define DOT 273
197 #define LBRKT 274
198 #define RBRKT 275
199 #define UNDERSCORE 276
200 chuck 1.2 #define COMMA 277
201 #define CONCAT 278
202 #define DBL_PIPE 279
203 #define PLUS 280
204 #define MINUS 281
205 #define TIMES 282
206 #define DIV 283
207 #define IS 284
208 #define _NULL 285
209 #define _EQ 286
210 #define _NE 287
211 #define _GT 288
212 #define _LT 289
213 #define _GE 290
214 #define _LE 291
215 #define _ISA 292
216 #define _LIKE 293
217 #define NOT 294
218 #define _AND 295
219 #define _OR 296
220 #define SCOPE 297
221 chuck 1.2 #define ANY 298
222 #define EVERY 299
223 #define IN 300
224 #define SATISFIES 301
225 #define STAR 302
226 #define DOTDOT 303
227 #define SHARP 304
228 #define DISTINCT 305
229 #define SELECT 306
230 #define FIRST 307
231 #define FROM 308
232 #define WHERE 309
233 #define ORDER 310
234 #define BY 311
235 #define ASC 312
236 #define DESC 313
237 #define AS 314
238 #define UNEXPECTED_CHAR 315
239 const short CQL_lhs[] = { -1,
240 1, 2, 3, 4, 5, 6, 6, 7, 7, 8,
241 8, 9, 9, 10, 10, 10, 10, 10, 10, 10,
242 chuck 1.2 11, 12, 13, 13, 13, 13, 13, 13, 13, 13,
243 13, 13, 14, 14, 15, 16, 17, 18, 19, 19,
244 20, 20, 20, 20, 20, 20, 21, 21, 21, 21,
|
245 humberto 1.10 21, 21, 21, 22, 22, 23, 23, 24, 24, 25,
246 25, 26, 26, 26, 27, 28, 28, 29, 29, 30,
247 31, 31, 32, 33, 33, 0,
|
248 chuck 1.2 };
249 const short CQL_len[] = { 2,
250 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
251 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
252 1, 1, 1, 3, 1, 3, 1, 4, 3, 3,
253 5, 4, 1, 3, 1, 1, 1, 2, 1, 1,
254 1, 1, 1, 1, 1, 1, 1, 4, 3, 3,
|
255 humberto 1.10 3, 3, 3, 1, 2, 1, 3, 1, 3, 0,
256 1, 1, 3, 2, 1, 1, 3, 1, 1, 2,
257 0, 3, 1, 0, 2, 5,
|
258 chuck 1.2 };
259 const short CQL_defred[] = { 0,
260 0, 0, 1, 5, 6, 7, 8, 9, 10, 11,
|
261 humberto 1.10 12, 13, 19, 20, 4, 0, 0, 0, 66, 0,
|
262 chuck 1.2 27, 14, 16, 17, 15, 18, 23, 0, 0, 36,
|
263 humberto 1.10 37, 0, 0, 54, 56, 0, 0, 69, 0, 0,
264 0, 0, 38, 55, 0, 0, 0, 0, 0, 0,
|
265 chuck 1.2 41, 42, 43, 44, 45, 46, 0, 0, 0, 0,
|
266 humberto 1.10 0, 0, 0, 70, 0, 0, 24, 0, 0, 26,
267 67, 0, 29, 22, 0, 0, 34, 49, 0, 52,
268 53, 39, 40, 50, 51, 57, 0, 0, 2, 3,
269 0, 65, 0, 28, 0, 32, 48, 72, 0, 64,
270 0, 76, 31, 63, 0, 75,
|
271 chuck 1.2 };
272 const short CQL_dgoto[] = { 2,
|
273 humberto 1.10 20, 90, 91, 21, 22, 23, 24, 25, 26, 27,
274 74, 75, 41, 29, 30, 31, 32, 33, 84, 59,
275 34, 35, 36, 37, 69, 92, 93, 38, 39, 40,
276 64, 106, 102,
|
277 chuck 1.2 };
278 const short CQL_sindex[] = { -295,
|
279 humberto 1.10 -152, 0, 0, 0, 0, 0, 0, 0, 0, 0,
280 0, 0, 0, 0, 0, -136, -241, -98, 0, -256,
|
281 chuck 1.2 0, 0, 0, 0, 0, 0, 0, -255, -257, 0,
|
282 humberto 1.10 0, -196, -247, 0, 0, -265, -264, 0, -240, -260,
283 -227, -261, 0, 0, -136, -241, -249, -136, -241, -273,
284 0, 0, 0, 0, 0, 0, -207, -241, -98, -82,
285 -136, -136, -152, 0, -207, -244, 0, -264, -220, 0,
286 0, -218, 0, 0, -216, -264, 0, 0, -230, 0,
287 0, 0, 0, 0, 0, 0, -265, -240, 0, 0,
288 -251, 0, -253, 0, -241, 0, 0, 0, -207, 0,
289 -136, 0, 0, 0, -264, 0,
|
290 chuck 1.2 };
291 const short CQL_rindex[] = { 0,
292 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
293 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
|
294 humberto 1.10 0, 0, 0, 0, 0, 0, 0, -219, 75, 0,
295 0, 78, 0, 0, 0, 101, -270, 0, -242, 0,
296 52, 0, 0, 0, -210, 0, 0, 0, 0, 0,
|
297 chuck 1.2 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
298 humberto 1.10 0, 0, 0, 0, 0, 0, 0, -192, 0, 0,
299 0, 29, 0, 0, 0, -211, 0, 0, 0, 0,
300 0, 0, 0, 0, 0, 0, 104, -242, 0, 0,
301 1, 0, 80, 0, 0, 0, 0, 0, 0, 0,
302 0, 0, 0, 0, 81, 0,
|
303 chuck 1.2 };
304 const short CQL_gindex[] = { 0,
305 -42, 0, 0, -38, -13, 0, 0, 0, 0, 0,
|
306 humberto 1.10 0, 0, -1, 0, 0, 0, -33, 24, 0, 51,
307 67, 25, 36, -14, 0, 0, 0, 0, 37, 0,
308 11, 0, 0,
|
309 chuck 1.2 };
|
310 humberto 1.10 #define YYTABLESIZE 412
|
311 chuck 1.2 const short CQL_table[] = { 28,
|
312 humberto 1.10 62, 42, 25, 43, 72, 3, 68, 3, 73, 67,
313 1, 78, 3, 45, 80, 46, 4, 47, 48, 15,
314 79, 49, 89, 72, 15, 82, 85, 73, 30, 61,
315 68, 62, 70, 76, 62, 77, 63, 68, 51, 52,
316 53, 54, 55, 56, 81, 66, 48, 65, 100, 3,
317 94, 33, 71, 95, 97, 101, 104, 33, 96, 33,
318 60, 28, 99, 21, 33, 71, 33, 33, 33, 33,
319 33, 33, 33, 33, 35, 33, 33, 47, 61, 74,
320 73, 103, 83, 60, 44, 86, 105, 50, 33, 51,
321 52, 53, 54, 55, 56, 57, 58, 87, 98, 88,
322 58, 0, 0, 59, 3, 4, 5, 6, 7, 8,
323 9, 10, 11, 12, 13, 14, 15, 16, 0, 17,
324 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
325 13, 14, 15, 16, 0, 17, 0, 0, 0, 0,
326 0, 18, 0, 0, 0, 0, 0, 0, 0, 19,
327 0, 0, 0, 0, 0, 0, 0, 18, 3, 4,
328 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
329 15, 16, 0, 17, 3, 4, 5, 6, 7, 8,
|
330 chuck 1.2 9, 10, 11, 12, 13, 14, 15, 16, 0, 0,
331 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
332 humberto 1.10 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
333 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
334 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
335 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
336 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
337 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
338 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
339 chuck 1.2 0, 0, 0, 25, 0, 25, 25, 25, 0, 25,
340 0, 25, 0, 0, 0, 0, 25, 0, 25, 25,
341 25, 25, 25, 25, 25, 25, 0, 25, 25, 30,
|
342 humberto 1.10 0, 30, 30, 30, 0, 30, 0, 30, 0, 62,
|
343 chuck 1.2 25, 0, 30, 0, 30, 30, 30, 30, 30, 30,
344 30, 30, 33, 30, 30, 0, 33, 0, 33, 0,
345 33, 0, 0, 0, 0, 33, 30, 33, 33, 33,
|
346 humberto 1.10 33, 33, 33, 33, 33, 35, 33, 33, 47, 35,
347 0, 35, 47, 0, 47, 0, 0, 0, 35, 33,
348 35, 35, 35, 35, 35, 35, 35, 35, 0, 35,
349 35, 58, 47, 47, 59, 58, 0, 58, 59, 0,
350 59, 0, 35, 0, 0, 47, 0, 0, 0, 0,
351 0, 0, 0, 0, 0, 0, 58, 0, 0, 59,
352 0, 0, 0, 0, 0, 0, 0, 0, 58, 0,
353 0, 59,
|
354 chuck 1.2 };
355 const short CQL_check[] = { 1,
356 0, 16, 0, 17, 47, 257, 277, 257, 47, 271,
357 306, 285, 257, 270, 57, 272, 258, 273, 274, 269,
358 294, 279, 65, 66, 269, 59, 60, 66, 0, 295,
|
359 humberto 1.10 45, 296, 46, 48, 296, 49, 277, 308, 286, 287,
360 288, 289, 290, 291, 58, 273, 274, 308, 91, 257,
361 271, 0, 302, 272, 285, 309, 99, 277, 275, 279,
362 271, 63, 314, 275, 284, 308, 286, 287, 288, 289,
363 290, 291, 292, 293, 0, 295, 296, 0, 271, 0,
364 0, 95, 59, 33, 18, 61, 101, 284, 308, 286,
365 287, 288, 289, 290, 291, 292, 293, 62, 88, 63,
366 0, -1, -1, 0, 257, 258, 259, 260, 261, 262,
367 263, 264, 265, 266, 267, 268, 269, 270, -1, 272,
368 257, 258, 259, 260, 261, 262, 263, 264, 265, 266,
369 267, 268, 269, 270, -1, 272, -1, -1, -1, -1,
370 -1, 294, -1, -1, -1, -1, -1, -1, -1, 302,
371 -1, -1, -1, -1, -1, -1, -1, 294, 257, 258,
372 259, 260, 261, 262, 263, 264, 265, 266, 267, 268,
373 269, 270, -1, 272, 257, 258, 259, 260, 261, 262,
|
374 chuck 1.2 263, 264, 265, 266, 267, 268, 269, 270, -1, -1,
375 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
376 humberto 1.10 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
377 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
378 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
379 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
380 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
381 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
382 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
383 chuck 1.2 -1, -1, -1, 271, -1, 273, 274, 275, -1, 277,
384 -1, 279, -1, -1, -1, -1, 284, -1, 286, 287,
385 288, 289, 290, 291, 292, 293, -1, 295, 296, 271,
386 -1, 273, 274, 275, -1, 277, -1, 279, -1, 309,
387 308, -1, 284, -1, 286, 287, 288, 289, 290, 291,
388 292, 293, 271, 295, 296, -1, 275, -1, 277, -1,
389 279, -1, -1, -1, -1, 284, 308, 286, 287, 288,
|
390 humberto 1.10 289, 290, 291, 292, 293, 271, 295, 296, 271, 275,
391 -1, 277, 275, -1, 277, -1, -1, -1, 284, 308,
392 286, 287, 288, 289, 290, 291, 292, 293, -1, 295,
393 296, 271, 295, 296, 271, 275, -1, 277, 275, -1,
394 277, -1, 308, -1, -1, 308, -1, -1, -1, -1,
395 -1, -1, -1, -1, -1, -1, 296, -1, -1, 296,
396 -1, -1, -1, -1, -1, -1, -1, -1, 308, -1,
397 -1, 308,
|
398 chuck 1.2 };
399 #define YYFINAL 2
400 #ifndef YYDEBUG
401 #define YYDEBUG 0
402 #endif
403 #define YYMAXTOKEN 315
404 #if YYDEBUG
405 const char * const CQL_name[] = {
406 "end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
407 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
408 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
409 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
410 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
411 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
412 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"IDENTIFIER","STRING_LITERAL",
413 "BINARY","NEGATIVE_BINARY","HEXADECIMAL","NEGATIVE_HEXADECIMAL","INTEGER",
414 "NEGATIVE_INTEGER","REAL","NEGATIVE_REAL","_TRUE","_FALSE","SCOPED_PROPERTY",
415 "LPAR","RPAR","HASH","DOT","LBRKT","RBRKT","UNDERSCORE","COMMA","CONCAT",
416 "DBL_PIPE","PLUS","MINUS","TIMES","DIV","IS","_NULL","_EQ","_NE","_GT","_LT",
417 "_GE","_LE","_ISA","_LIKE","NOT","_AND","_OR","SCOPE","ANY","EVERY","IN",
418 "SATISFIES","STAR","DOTDOT","SHARP","DISTINCT","SELECT","FIRST","FROM","WHERE",
419 chuck 1.2 "ORDER","BY","ASC","DESC","AS","UNEXPECTED_CHAR",
420 };
421 const char * const CQL_rule[] = {
422 "$accept : select_statement",
423 "identifier : IDENTIFIER",
424 "class_name : identifier",
425 "class_path : class_name",
426 "scoped_property : SCOPED_PROPERTY",
427 "literal_string : STRING_LITERAL",
428 "binary_value : BINARY",
429 "binary_value : NEGATIVE_BINARY",
430 "hex_value : HEXADECIMAL",
431 "hex_value : NEGATIVE_HEXADECIMAL",
432 "decimal_value : INTEGER",
433 "decimal_value : NEGATIVE_INTEGER",
434 "real_value : REAL",
435 "real_value : NEGATIVE_REAL",
436 "literal : literal_string",
437 "literal : decimal_value",
438 "literal : binary_value",
439 "literal : hex_value",
440 chuck 1.2 "literal : real_value",
441 "literal : _TRUE",
442 "literal : _FALSE",
443 "array_index : expr",
444 "array_index_list : array_index",
445 "chain : literal",
446 "chain : LPAR expr RPAR",
447 "chain : identifier",
448 "chain : identifier HASH literal_string",
449 "chain : scoped_property",
450 "chain : identifier LPAR arg_list RPAR",
451 "chain : chain DOT scoped_property",
452 "chain : chain DOT identifier",
453 "chain : chain DOT identifier HASH literal_string",
454 "chain : chain LBRKT array_index_list RBRKT",
455 "concat : chain",
|
456 humberto 1.10 "concat : concat DBL_PIPE literal_string",
|
457 chuck 1.2 "factor : concat",
458 "term : factor",
459 "arith : term",
460 "value_symbol : HASH literal_string",
461 "arith_or_value_symbol : arith",
462 "arith_or_value_symbol : value_symbol",
463 "comp_op : _EQ",
464 "comp_op : _NE",
465 "comp_op : _GT",
466 "comp_op : _LT",
467 "comp_op : _GE",
468 "comp_op : _LE",
469 "comp : arith",
470 "comp : arith IS NOT _NULL",
471 "comp : arith IS _NULL",
472 "comp : arith comp_op arith_or_value_symbol",
473 "comp : value_symbol comp_op arith",
474 "comp : arith _ISA identifier",
475 "comp : arith _LIKE literal_string",
476 "expr_factor : comp",
477 "expr_factor : NOT comp",
478 chuck 1.2 "expr_term : expr_factor",
479 "expr_term : expr_term _AND expr_factor",
480 "expr : expr_term",
481 "expr : expr _OR expr_term",
482 "arg_list :",
483 "arg_list : expr",
484 "from_specifier : class_path",
485 "from_specifier : class_path AS identifier",
486 "from_specifier : class_path identifier",
487 "from_criteria : from_specifier",
488 "star_expr : STAR",
489 "star_expr : chain DOT STAR",
490 "selected_entry : expr",
491 "selected_entry : star_expr",
492 "select_list : selected_entry select_list_tail",
493 "select_list_tail :",
494 "select_list_tail : COMMA selected_entry select_list_tail",
495 "search_condition : expr",
496 "optional_where :",
497 "optional_where : WHERE search_condition",
498 "select_statement : SELECT select_list FROM from_criteria optional_where",
499 chuck 1.2 };
500 #endif
501 #if YYDEBUG
502 #include <stdio.h>
503 #endif
504 #ifdef YYSTACKSIZE
505 #undef YYMAXDEPTH
506 #define YYMAXDEPTH YYSTACKSIZE
507 #else
508 #ifdef YYMAXDEPTH
509 #define YYSTACKSIZE YYMAXDEPTH
510 #else
511 #define YYSTACKSIZE 10000
512 #define YYMAXDEPTH 10000
513 #endif
514 #endif
515 #define YYINITSTACKSIZE 200
516 int yydebug;
517 int yynerrs;
518 int yyerrflag;
519 int yychar;
520 chuck 1.2 short *yyssp;
521 YYSTYPE *yyvsp;
522 YYSTYPE yyval;
523 YYSTYPE yylval;
524 short *yyss;
525 short *yysslim;
526 YYSTYPE *yyvs;
527 int yystacksize;
|
528 lucier 1.13 #line 1372 "CQL.y"
|
529 chuck 1.2
530 /*int yyerror(char * err){yyclearin; yyerrok;throw Exception(String(err));return 1;}*/
|
531 humberto 1.10 #line 502 "y.tab.c"
|
532 chuck 1.2 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
533 static int yygrowstack()
534 {
535 int newsize, i;
536 short *newss;
537 YYSTYPE *newvs;
538
539 if ((newsize = yystacksize) == 0)
540 newsize = YYINITSTACKSIZE;
541 else if (newsize >= YYMAXDEPTH)
542 return -1;
543 else if ((newsize *= 2) > YYMAXDEPTH)
544 newsize = YYMAXDEPTH;
545 i = yyssp - yyss;
546 newss = yyss ? (short *)realloc(yyss, newsize * sizeof *newss) :
547 (short *)malloc(newsize * sizeof *newss);
548 if (newss == NULL)
549 return -1;
550 yyss = newss;
551 yyssp = newss + i;
552 newvs = yyvs ? (YYSTYPE *)realloc(yyvs, newsize * sizeof *newvs) :
553 chuck 1.2 (YYSTYPE *)malloc(newsize * sizeof *newvs);
554 if (newvs == NULL)
555 return -1;
556 yyvs = newvs;
557 yyvsp = newvs + i;
558 yystacksize = newsize;
559 yysslim = yyss + newsize - 1;
560 return 0;
561 }
562
563 #define YYABORT goto yyabort
564 #define YYREJECT goto yyabort
565 #define YYACCEPT goto yyaccept
566 #define YYERROR goto yyerrlab
567
568 #ifndef YYPARSE_PARAM
569 #if defined(__cplusplus) || __STDC__
570 #define YYPARSE_PARAM_ARG void
571 #define YYPARSE_PARAM_DECL
572 #else /* ! ANSI-C/C++ */
573 #define YYPARSE_PARAM_ARG
574 chuck 1.2 #define YYPARSE_PARAM_DECL
575 #endif /* ANSI-C/C++ */
576 #else /* YYPARSE_PARAM */
577 #ifndef YYPARSE_PARAM_TYPE
578 #define YYPARSE_PARAM_TYPE void *
579 #endif
580 #if defined(__cplusplus) || __STDC__
581 #define YYPARSE_PARAM_ARG YYPARSE_PARAM_TYPE YYPARSE_PARAM
582 #define YYPARSE_PARAM_DECL
583 #else /* ! ANSI-C/C++ */
584 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
585 #define YYPARSE_PARAM_DECL YYPARSE_PARAM_TYPE YYPARSE_PARAM;
586 #endif /* ANSI-C/C++ */
587 #endif /* ! YYPARSE_PARAM */
588
589 int
590 yyparse (YYPARSE_PARAM_ARG)
591 YYPARSE_PARAM_DECL
592 {
593 register int yym, yyn, yystate;
594 #if YYDEBUG
595 chuck 1.2 register const char *yys;
596
597 if ((yys = getenv("YYDEBUG")))
598 {
599 yyn = *yys;
600 if (yyn >= '0' && yyn <= '9')
601 yydebug = yyn - '0';
602 }
603 #endif
604
605 yynerrs = 0;
606 yyerrflag = 0;
607 yychar = (-1);
608
609 if (yyss == NULL && yygrowstack()) goto yyoverflow;
610 yyssp = yyss;
611 yyvsp = yyvs;
612 *yyssp = yystate = 0;
613
614 yyloop:
615 if ((yyn = yydefred[yystate])) goto yyreduce;
616 chuck 1.2 if (yychar < 0)
617 {
618 if ((yychar = yylex()) < 0) yychar = 0;
619 #if YYDEBUG
620 if (yydebug)
621 {
622 yys = 0;
623 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
624 if (!yys) yys = "illegal-symbol";
625 printf("%sdebug: state %d, reading %d (%s)\n",
626 YYPREFIX, yystate, yychar, yys);
627 }
628 #endif
629 }
630 if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
631 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
632 {
633 #if YYDEBUG
634 if (yydebug)
635 printf("%sdebug: state %d, shifting to state %d\n",
636 YYPREFIX, yystate, yytable[yyn]);
637 chuck 1.2 #endif
638 if (yyssp >= yysslim && yygrowstack())
639 {
640 goto yyoverflow;
641 }
642 *++yyssp = yystate = yytable[yyn];
643 *++yyvsp = yylval;
644 yychar = (-1);
645 if (yyerrflag > 0) --yyerrflag;
646 goto yyloop;
647 }
648 if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
649 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
650 {
651 yyn = yytable[yyn];
652 goto yyreduce;
653 }
654 if (yyerrflag) goto yyinrecovery;
655 #if defined(lint) || defined(__GNUC__)
656 goto yynewerror;
657 #endif
658 chuck 1.2 yynewerror:
659 yyerror("syntax error");
660 #if defined(lint) || defined(__GNUC__)
661 goto yyerrlab;
662 #endif
663 yyerrlab:
664 ++yynerrs;
665 yyinrecovery:
666 if (yyerrflag < 3)
667 {
668 yyerrflag = 3;
669 for (;;)
670 {
671 if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
672 yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
673 {
674 #if YYDEBUG
675 if (yydebug)
676 printf("%sdebug: state %d, error recovery shifting\
677 to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
678 #endif
679 chuck 1.2 if (yyssp >= yysslim && yygrowstack())
680 {
681 goto yyoverflow;
682 }
683 *++yyssp = yystate = yytable[yyn];
684 *++yyvsp = yylval;
685 goto yyloop;
686 }
687 else
688 {
689 #if YYDEBUG
690 if (yydebug)
691 printf("%sdebug: error recovery discarding state %d\n",
692 YYPREFIX, *yyssp);
693 #endif
694 if (yyssp <= yyss) goto yyabort;
695 --yyssp;
696 --yyvsp;
697 }
698 }
699 }
700 chuck 1.2 else
701 {
702 if (yychar == 0) goto yyabort;
703 #if YYDEBUG
704 if (yydebug)
705 {
706 yys = 0;
707 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
708 if (!yys) yys = "illegal-symbol";
709 printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
710 YYPREFIX, yystate, yychar, yys);
711 }
712 #endif
713 yychar = (-1);
714 goto yyloop;
715 }
716 yyreduce:
717 #if YYDEBUG
718 if (yydebug)
719 printf("%sdebug: state %d, reducing by rule %d (%s)\n",
720 YYPREFIX, yystate, yyn, yyrule[yyn]);
721 chuck 1.2 #endif
722 yym = yylen[yyn];
723 yyval = yyvsp[1-yym];
724 switch (yyn)
725 {
726 case 1:
|
727 lucier 1.13 #line 247 "CQL.y"
|
728 chuck 1.2 {
|
729 humberto 1.9 CQL_globalParserState->currentRule = "identifier";
|
730 chuck 1.2 sprintf(msg,"BISON::identifier\n");
731 printf_(msg);
|
732 humberto 1.10 if(isUTF8Str(CQL_lval.strValue)){
733 yyval._identifier = new CQLIdentifier(String(CQL_lval.strValue));
734 _ObjPtr._ptr = yyval._identifier;
735 _ObjPtr.type = Id;
736 _ptrs.append(_ObjPtr);
737 }else{
738 sprintf(msg,"BISON::identifier-> BAD UTF\n");
739 printf_(msg);
740 throw CQLSyntaxErrorException(
741 MessageLoaderParms(String("CQL.CQL_y.BAD_UTF8"),
742 String("Bad UTF8 encountered parsing rule $0 in position $1."),
743 String("identifier"),
744 CQL_globalParserState->currentTokenPos)
745 );
746 }
|
747 chuck 1.2 }
748 break;
749 case 2:
|
750 lucier 1.13 #line 270 "CQL.y"
|
751 chuck 1.2 {
|
752 humberto 1.9 CQL_globalParserState->currentRule = "class_name";
|
753 chuck 1.2 sprintf(msg,"BISON::class_name = %s\n", (const char *)(yyvsp[0]._identifier->getName().getString().getCString()));
754 printf_(msg);
755 yyval._identifier = yyvsp[0]._identifier;
756 }
757 break;
758 case 3:
|
759 lucier 1.13 #line 279 "CQL.y"
|
760 chuck 1.2 {
|
761 humberto 1.9 CQL_globalParserState->currentRule = "class_path";
|
762 chuck 1.2 sprintf(msg,"BISON::class_path\n");
763 printf_(msg);
764 yyval._identifier = yyvsp[0]._identifier;
765 }
766 break;
767 case 4:
|
768 lucier 1.13 #line 298 "CQL.y"
|
769 chuck 1.2 {
|
770 humberto 1.8 /*
771 SCOPED_PROPERTY can be:
772 - "A::prop"
773 - "A::class.prop"
774 - "A::class.prop#'OK'
775 - "A::class.prop[4]"
776 */
|
777 humberto 1.9 CQL_globalParserState->currentRule = "scoped_property";
|
778 humberto 1.8 sprintf(msg,"BISON::scoped_property = %s\n",CQL_lval.strValue);
779 printf_(msg);
|
780 humberto 1.10 if(isUTF8Str(CQL_lval.strValue)){
781 String tmp(CQL_lval.strValue);
782 yyval._identifier = new CQLIdentifier(tmp);
783 _ObjPtr._ptr = yyval._identifier;
784 _ObjPtr.type = Id;
785 _ptrs.append(_ObjPtr);
786
787 }else{
788 sprintf(msg,"BISON::scoped_property-> BAD UTF\n");
789 printf_(msg);
790 throw CQLSyntaxErrorException(
791 MessageLoaderParms(String("CQL.CQL_y.BAD_UTF8"),
792 String("Bad UTF8 encountered parsing rule $0 in position $1."),
793 String("scoped_property"),
794 CQL_globalParserState->currentTokenPos)
795 );
796 }
797 }
|
798 chuck 1.2 break;
799 case 5:
|
800 lucier 1.13 #line 331 "CQL.y"
|
801 chuck 1.2 {
802 /*
803 We make sure the literal is valid UTF8, then make a String
804 */
|
805 humberto 1.9 CQL_globalParserState->currentRule = "literal_string";
|
806 chuck 1.2 sprintf(msg,"BISON::literal_string-> %s\n",CQL_lval.strValue);
807 printf_(msg);
808
809 if(isUTF8Str(CQL_lval.strValue)){
810 yyval._string = new String(CQL_lval.strValue);
|
811 humberto 1.8 _ObjPtr._ptr = yyval._string;
812 _ObjPtr.type = Str;
813 _ptrs.append(_ObjPtr);
|
814 chuck 1.2 }else{
815 sprintf(msg,"BISON::literal_string-> BAD UTF\n");
816 printf_(msg);
817 throw CQLSyntaxErrorException(
818 MessageLoaderParms(String("CQL.CQL_y.BAD_UTF8"),
819 String("Bad UTF8 encountered parsing rule $0 in position $1."),
820 String("literal_string"),
|
821 humberto 1.9 CQL_globalParserState->currentTokenPos)
|
822 chuck 1.2 );
823 }
824 }
825 break;
826 case 6:
|
827 lucier 1.13 #line 359 "CQL.y"
|
828 chuck 1.2 {
|
829 humberto 1.9 CQL_globalParserState->currentRule = "binary_value->BINARY";
|
830 chuck 1.2 sprintf(msg,"BISON::binary_value-> %s\n",CQL_lval.strValue);
831 printf_(msg);
832
833 yyval._value = new CQLValue(CQL_lval.strValue, CQLValue::Binary);
|
834 humberto 1.8 _ObjPtr._ptr = yyval._value;
835 _ObjPtr.type = Val;
836 _ptrs.append(_ObjPtr);
|
837 chuck 1.2 }
838 break;
839 case 7:
|
840 lucier 1.13 #line 370 "CQL.y"
|
841 chuck 1.2 {
|
842 humberto 1.9 CQL_globalParserState->currentRule = "binary_value->NEGATIVE_BINARY";
|
843 chuck 1.2 sprintf(msg,"BISON::binary_value-> %s\n",CQL_lval.strValue);
844 printf_(msg);
845
846 yyval._value = new CQLValue(CQL_lval.strValue, CQLValue::Binary, false);
|
847 humberto 1.8 _ObjPtr._ptr = yyval._value;
848 _ObjPtr.type = Val;
849 _ptrs.append(_ObjPtr);
|
850 chuck 1.2 }
851 break;
852 case 8:
|
853 lucier 1.13 #line 384 "CQL.y"
|
854 chuck 1.2 {
|
855 humberto 1.9 CQL_globalParserState->currentRule = "hex_value->HEXADECIMAL";
|
856 chuck 1.2 sprintf(msg,"BISON::hex_value-> %s\n",CQL_lval.strValue);
857 printf_(msg);
858
859 yyval._value = new CQLValue(CQL_lval.strValue, CQLValue::Hex);
|
860 humberto 1.8 _ObjPtr._ptr = yyval._value;
861 _ObjPtr.type = Val;
862 _ptrs.append(_ObjPtr);
|
863 chuck 1.2 }
864 break;
865 case 9:
|
866 lucier 1.13 #line 395 "CQL.y"
|
867 chuck 1.2 {
|
868 humberto 1.9 CQL_globalParserState->currentRule = "hex_value->NEGATIVE_HEXADECIMAL";
|
869 chuck 1.2 sprintf(msg,"BISON::hex_value-> %s\n",CQL_lval.strValue);
870 printf_(msg);
871
872 yyval._value = new CQLValue(CQL_lval.strValue, CQLValue::Hex, false);
|
873 humberto 1.8 _ObjPtr._ptr = yyval._value;
874 _ObjPtr.type = Val;
875 _ptrs.append(_ObjPtr);
|
876 chuck 1.2 }
877 break;
878 case 10:
|
879 lucier 1.13 #line 409 "CQL.y"
|
880 chuck 1.2 {
|
881 humberto 1.9 CQL_globalParserState->currentRule = "decimal_value->INTEGER";
|
882 chuck 1.2 sprintf(msg,"BISON::decimal_value-> %s\n",CQL_lval.strValue);
883 printf_(msg);
884
885 yyval._value = new CQLValue(CQL_lval.strValue, CQLValue::Decimal);
|
886 humberto 1.8 _ObjPtr._ptr = yyval._value;
887 _ObjPtr.type = Val;
888 _ptrs.append(_ObjPtr);
|
889 chuck 1.2 }
890 break;
891 case 11:
|
892 lucier 1.13 #line 420 "CQL.y"
|
893 chuck 1.2 {
|
894 humberto 1.9 CQL_globalParserState->currentRule = "decimal_value->NEGATIVE_INTEGER";
|
895 chuck 1.2 sprintf(msg,"BISON::decimal_value-> %s\n",CQL_lval.strValue);
896 printf_(msg);
897
898 yyval._value = new CQLValue(CQL_lval.strValue, CQLValue::Decimal, false);
|
899 humberto 1.8 _ObjPtr._ptr = yyval._value;
900 _ObjPtr.type = Val;
901 _ptrs.append(_ObjPtr);
|
902 chuck 1.2 }
903 break;
904 case 12:
|
905 lucier 1.13 #line 434 "CQL.y"
|
906 chuck 1.2 {
|
907 humberto 1.9 CQL_globalParserState->currentRule = "real_value->REAL";
|
908 chuck 1.2 sprintf(msg,"BISON::real_value-> %s\n",CQL_lval.strValue);
909 printf_(msg);
910 yyval._value = new CQLValue(CQL_lval.strValue, CQLValue::Real);
|
911 humberto 1.8 _ObjPtr._ptr = yyval._value;
912 _ObjPtr.type = Val;
913 _ptrs.append(_ObjPtr);
|
914 chuck 1.2 }
915 break;
916 case 13:
|
917 lucier 1.13 #line 444 "CQL.y"
|
918 chuck 1.2 {
|
919 humberto 1.9 CQL_globalParserState->currentRule = "real_value->NEGATIVE_REAL";
|
920 chuck 1.2 sprintf(msg,"BISON::real_value-> %s\n",CQL_lval.strValue);
921 printf_(msg);
922 yyval._value = new CQLValue(CQL_lval.strValue, CQLValue::Real, false);
|
923 humberto 1.8 _ObjPtr._ptr = yyval._value;
924 _ObjPtr.type = Val;
925 _ptrs.append(_ObjPtr);
|
926 chuck 1.2 }
927 break;
928 case 14:
|
929 lucier 1.13 #line 457 "CQL.y"
|
930 chuck 1.2 {
|
931 humberto 1.9 CQL_globalParserState->currentRule = "literal->literal_string";
|
932 chuck 1.2 sprintf(msg,"BISON::literal->literal_string\n");
933 printf_(msg);
934 yyval._value = new CQLValue(*yyvsp[0]._string);
|
935 humberto 1.8 _ObjPtr._ptr = yyval._value;
936 _ObjPtr.type = Val;
937 _ptrs.append(_ObjPtr);
|
938 chuck 1.2 }
939 break;
940 case 15:
|
941 lucier 1.13 #line 467 "CQL.y"
|
942 chuck 1.2 {
|
943 humberto 1.9 CQL_globalParserState->currentRule = "literal->decimal_value";
|
944 chuck 1.2 sprintf(msg,"BISON::literal->decimal_value\n");
945 printf_(msg);
946
947 }
948 break;
949 case 16:
|
950 lucier 1.13 #line 474 "CQL.y"
|
951 chuck 1.2 {
|
952 humberto 1.9 CQL_globalParserState->currentRule = "literal->binary_value";
|
953 chuck 1.2 sprintf(msg,"BISON::literal->binary_value\n");
954 printf_(msg);
955
956 }
957 break;
958 case 17:
|
959 lucier 1.13 #line 481 "CQL.y"
|
960 chuck 1.2 {
|
961 humberto 1.9 CQL_globalParserState->currentRule = "literal->hex_value";
|
962 chuck 1.2 sprintf(msg,"BISON::literal->hex_value\n");
963 printf_(msg);
964
965 }
966 break;
967 case 18:
|
968 lucier 1.13 #line 488 "CQL.y"
|
969 chuck 1.2 {
|
970 humberto 1.9 CQL_globalParserState->currentRule = "literal->real_value";
|
971 chuck 1.2 sprintf(msg,"BISON::literal->real_value\n");
972 printf_(msg);
973
974 }
975 break;
976 case 19:
|
977 lucier 1.13 #line 495 "CQL.y"
|
978 chuck 1.2 {
|
979 humberto 1.9 CQL_globalParserState->currentRule = "literal->_TRUE";
|
980 chuck 1.2 sprintf(msg,"BISON::literal->_TRUE\n");
981 printf_(msg);
982
983 yyval._value = new CQLValue(Boolean(true));
|
984 humberto 1.8 _ObjPtr._ptr = yyval._value;
985 _ObjPtr.type = Val;
986 _ptrs.append(_ObjPtr);
|
987 chuck 1.2 }
988 break;
989 case 20:
|
990 lucier 1.13 #line 506 "CQL.y"
|
991 chuck 1.2 {
|
992 humberto 1.9 CQL_globalParserState->currentRule = "literal->_FALSE";
|
993 chuck 1.2 sprintf(msg,"BISON::literal->_FALSE\n");
994 printf_(msg);
995
996 yyval._value = new CQLValue(Boolean(false));
|
997 humberto 1.8 _ObjPtr._ptr = yyval._value;
998 _ObjPtr.type = Val;
999 _ptrs.append(_ObjPtr);
|
1000 chuck 1.2 }
1001 break;
1002 case 21:
|
1003 lucier 1.13 #line 520 "CQL.y"
|
1004 chuck 1.2 {
|
1005 humberto 1.9 CQL_globalParserState->currentRule = "array_index->expr";
|
1006 chuck 1.2 sprintf(msg,"BISON::array_index->expr\n");
1007 printf_(msg);
1008
1009 CQLValue* _val = (CQLValue*)_factory.getObject(yyvsp[0]._predicate,Predicate,Value);
1010 yyval._string = new String(_val->toString());
|
1011 humberto 1.8 _ObjPtr._ptr = yyval._string;
1012 _ObjPtr.type = Str;
1013 _ptrs.append(_ObjPtr);
|
1014 chuck 1.2 }
1015 break;
1016 case 22:
|
1017 lucier 1.13 #line 535 "CQL.y"
|
1018 chuck 1.2 {
|
1019 humberto 1.9 CQL_globalParserState->currentRule = "array_index_list->array_index";
|
1020 chuck 1.2 sprintf(msg,"BISON::array_index_list->array_index\n");
1021 printf_(msg);
1022 yyval._string = yyvsp[0]._string;
1023 }
1024 break;
1025 case 23:
|
1026 lucier 1.13 #line 545 "CQL.y"
|
1027 chuck 1.2 {
|
1028 humberto 1.9 CQL_globalParserState->currentRule = "chain->literal";
|
1029 chuck 1.2 sprintf(msg,"BISON::chain->literal\n");
1030 printf_(msg);
1031
1032 chain_state = CQLVALUE;
1033 yyval._node = _factory.makeObject(yyvsp[0]._value,Predicate);
1034 }
1035 break;
1036 case 24:
|
1037 lucier 1.13 #line 554 "CQL.y"
|
1038 chuck 1.2 {
|
1039 humberto 1.9 CQL_globalParserState->currentRule = "chain-> ( expr )";
|
1040 chuck 1.2 sprintf(msg,"BISON::chain-> ( expr )\n");
1041 printf_(msg);
1042
1043 chain_state = CQLPREDICATE;
1044 yyval._node = yyvsp[-1]._predicate;
1045 }
1046 break;
1047 case 25:
|
1048 lucier 1.13 #line 563 "CQL.y"
|
1049 chuck 1.2 {
|
1050 humberto 1.9 CQL_globalParserState->currentRule = "chain->identifier";
|
1051 chuck 1.2 sprintf(msg,"BISON::chain->identifier\n");
1052 printf_(msg);
1053
1054 chain_state = CQLIDENTIFIER;
1055 yyval._node = _factory.makeObject(yyvsp[0]._identifier,Predicate);
1056 }
1057 break;
1058 case 26:
|
1059 lucier 1.13 #line 572 "CQL.y"
|
1060 chuck 1.2 {
|
1061 humberto 1.9 CQL_globalParserState->currentRule = "chain->identifier#literal_string";
|
1062 chuck 1.2 sprintf(msg,"BISON::chain->identifier#literal_string\n");
1063 printf_(msg);
1064
1065 String tmp = yyvsp[-2]._identifier->getName().getString();
1066 tmp.append("#").append(*yyvsp[0]._string);
1067 CQLIdentifier _id(tmp);
1068 yyval._node = _factory.makeObject(&_id,Predicate);
1069 chain_state = CQLIDENTIFIER;
1070 }
1071 break;
1072 case 27:
|
1073 lucier 1.13 #line 584 "CQL.y"
|
1074 chuck 1.2 {
|
1075 humberto 1.9 CQL_globalParserState->currentRule = "chain->scoped_property";
|
1076 chuck 1.2 sprintf(msg,"BISON::chain-> scoped_property\n");
1077 printf_(msg);
1078
1079 chain_state = CQLIDENTIFIER;
1080 yyval._node = _factory.makeObject(yyvsp[0]._identifier,Predicate);
1081 }
1082 break;
1083 case 28:
|
1084 lucier 1.13 #line 593 "CQL.y"
|
1085 chuck 1.2 {
|
1086 humberto 1.9 CQL_globalParserState->currentRule = "chain->identifier( arg_list )";
|
1087 chuck 1.2 sprintf(msg,"BISON::chain-> identifier( arg_list )\n");
1088 printf_(msg);
1089 chain_state = CQLFUNCTION;
1090 CQLFunction _func(*yyvsp[-3]._identifier,_arglist);
1091 yyval._node = (CQLPredicate*)(_factory.makeObject(&_func,Predicate));
1092 _arglist.clear();
1093 }
1094 break;
1095 case 29:
|
1096 lucier 1.13 #line 603 "CQL.y"
|
1097 chuck 1.2 {
|
1098 humberto 1.9 CQL_globalParserState->currentRule = "chain->chain.scoped_property";
|
1099 chuck 1.2 sprintf(msg,"BISON::chain-> chain DOT scoped_property : chain_state = %d\n",chain_state);
1100 printf_(msg);
1101
1102 CQLIdentifier *_id;
1103 if(chain_state == CQLIDENTIFIER){
1104 _id = ((CQLIdentifier*)(_factory.getObject(yyvsp[-2]._node,Predicate,Identifier)));
1105 CQLChainedIdentifier _cid(*_id);
1106 _cid.append(*yyvsp[0]._identifier);
1107 yyval._node = _factory.makeObject(&_cid,Predicate);
1108 }else if(chain_state == CQLCHAINEDIDENTIFIER){
1109 CQLChainedIdentifier *_cid;
1110 _cid = ((CQLChainedIdentifier*)(_factory.getObject(yyvsp[-2]._node,Predicate,ChainedIdentifier)));
1111 _cid->append(*yyvsp[0]._identifier);
1112 _factory.setObject(((CQLPredicate*)yyvsp[-2]._node),_cid,ChainedIdentifier);
1113 yyval._node = yyvsp[-2]._node;
1114 }else{
1115 /* error */
1116 String _msg("chain-> chain DOT scoped_property : chain state not CQLIDENTIFIER or CQLCHAINEDIDENTIFIER");
1117 throw CQLSyntaxErrorException(
1118 MessageLoaderParms(String("CQL.CQL_y.NOT_CHAINID_OR_IDENTIFIER"),
1119 String("Chain state not a CQLIdentifier or a CQLChainedIdentifier while parsing rule $0 in position $1."),
1120 chuck 1.2 String("chain.scoped_property"),
|
1121 humberto 1.9 CQL_globalParserState->currentTokenPos)
|
1122 chuck 1.2 );
1123 }
1124
1125 chain_state = CQLCHAINEDIDENTIFIER;
1126 }
1127 break;
1128 case 30:
|
1129 lucier 1.13 #line 634 "CQL.y"
|
1130 chuck 1.2 {
|
1131 humberto 1.9 CQL_globalParserState->currentRule = "chain->chain.identifier";
|
1132 chuck 1.2 sprintf(msg,"BISON::chain->chain.identifier : chain_state = %d\n",chain_state);
1133 printf_(msg);
1134
1135 if(chain_state == CQLIDENTIFIER){
1136 CQLIdentifier *_id = ((CQLIdentifier*)(_factory.getObject(yyvsp[-2]._node,Predicate,Identifier)));
1137 CQLChainedIdentifier _cid(*_id);
1138 _cid.append(*yyvsp[0]._identifier);
1139 yyval._node = _factory.makeObject(&_cid,Predicate);
1140 }else if(chain_state == CQLCHAINEDIDENTIFIER){
1141 CQLChainedIdentifier *_cid = ((CQLChainedIdentifier*)(_factory.getObject(yyvsp[-2]._node,Predicate,ChainedIdentifier)));
1142 _cid->append(*yyvsp[0]._identifier);
1143 _factory.setObject(((CQLPredicate*)yyvsp[-2]._node),_cid,ChainedIdentifier);
1144 yyval._node = yyvsp[-2]._node;
1145 }else{
1146 /* error */
1147 String _msg("chain-> chain DOT identifier : chain state not CQLIDENTIFIER or CQLCHAINEDIDENTIFIER");
1148 throw CQLSyntaxErrorException(
1149 MessageLoaderParms(String("CQL.CQL_y.NOT_CHAINID_OR_IDENTIFIER"),
1150 String("Chain state not a CQLIdentifier or a CQLChainedIdentifier while parsing rule $0 in position $1."),
1151 String("chain.identifier"),
|
1152 humberto 1.9 CQL_globalParserState->currentTokenPos)
|
1153 chuck 1.2 );
1154 }
1155 chain_state = CQLCHAINEDIDENTIFIER;
1156
1157 }
1158 break;
1159 case 31:
|
1160 lucier 1.13 #line 663 "CQL.y"
|
1161 chuck 1.2 {
|
1162 humberto 1.9 CQL_globalParserState->currentRule = "chain->chain.identifier#literal_string";
|
1163 chuck 1.2 sprintf(msg,"BISON::chain->chain.identifier#literal_string : chain_state = %d\n",chain_state);
1164 printf_(msg);
1165
1166 if(chain_state == CQLIDENTIFIER){
|
1167 chuck 1.3 CQLIdentifier *_id = ((CQLIdentifier*)(_factory.getObject(yyvsp[-4]._node,Predicate,Identifier)));
1168 CQLChainedIdentifier _cid(*_id);
|
1169 chuck 1.2 String tmp(yyvsp[-2]._identifier->getName().getString());
|
1170 chuck 1.3 tmp.append("#").append(*yyvsp[0]._string);
|
1171 chuck 1.2 CQLIdentifier _id1(tmp);
1172 _cid.append(_id1);
|
1173 chuck 1.3 _factory.setObject(((CQLPredicate*)yyvsp[-4]._node),&_cid,ChainedIdentifier);
|
1174 chuck 1.2 yyval._node = yyvsp[-4]._node;
1175 }else if(chain_state == CQLCHAINEDIDENTIFIER){
|
1176 chuck 1.3 CQLChainedIdentifier *_cid = ((CQLChainedIdentifier*)(_factory.getObject(yyvsp[-4]._node,Predicate,ChainedIdentifier)));
1177 String tmp(yyvsp[-2]._identifier->getName().getString());
|
1178 chuck 1.2 tmp.append("#").append(*yyvsp[0]._string);
1179 CQLIdentifier _id1(tmp);
1180 _cid->append(_id1);
|
1181 chuck 1.3 _factory.setObject(((CQLPredicate*)yyvsp[-4]._node),_cid,ChainedIdentifier);
1182 yyval._node = yyvsp[-4]._node;
|
1183 chuck 1.2 }else{
1184 /* error */
1185 String _msg("chain->chain.identifier#literal_string : chain state not CQLIDENTIFIER or CQLCHAINEDIDENTIFIER");
1186 throw CQLSyntaxErrorException(
1187 MessageLoaderParms(String("CQL.CQL_y.NOT_CHAINID_OR_IDENTIFIER"),
1188 String("Chain state not a CQLIdentifier or a CQLChainedIdentifier while parsing rule $0 in position $1."),
1189 String("chain.identifier#literal_string"),
|
1190 humberto 1.9 CQL_globalParserState->currentTokenPos)
|
1191 chuck 1.2 );
1192 }
1193
1194 chain_state = CQLCHAINEDIDENTIFIER;
1195
1196 }
1197 break;
1198 case 32:
|
1199 lucier 1.13 #line 700 "CQL.y"
|
1200 chuck 1.2 {
|
1201 humberto 1.9 CQL_globalParserState->currentRule = "chain->chain[ array_index_list ]";
|
1202 chuck 1.2 sprintf(msg,"BISON::chain->chain[ array_index_list ] : chain_state = %d\n",chain_state);
1203 printf_(msg);
1204
1205 if(chain_state == CQLIDENTIFIER){
1206 CQLIdentifier *_id = ((CQLIdentifier*)(_factory.getObject(yyvsp[-3]._node,Predicate,Identifier)));
1207 String tmp = _id->getName().getString();
1208 tmp.append("[").append(*yyvsp[-1]._string).append("]");
1209 CQLIdentifier _id1(tmp);
1210 CQLChainedIdentifier _cid(_id1);
1211 _factory.setObject(((CQLPredicate*)yyvsp[-3]._node),&_cid,ChainedIdentifier);
1212 yyval._node = yyvsp[-3]._node;
1213 }else if(chain_state == CQLCHAINEDIDENTIFIER || chain_state == CQLVALUE){
1214 CQLPredicate* _pred = (CQLPredicate*)yyvsp[-3]._node;
1215 CQLChainedIdentifier *_cid = ((CQLChainedIdentifier*)(_factory.getObject(yyvsp[-3]._node,Predicate,ChainedIdentifier)));
1216 CQLIdentifier tmpid = _cid->getLastIdentifier();
1217 String tmp = tmpid.getName().getString();
1218 tmp.append("[").append(*yyvsp[-1]._string).append("]");
1219 CQLIdentifier _id1(tmp);
1220 CQLChainedIdentifier _tmpcid(_id1);
1221 if(_cid->size() == 1){
1222 _cid = &_tmpcid;
1223 chuck 1.2 }else{
1224 _cid->append(_id1);
1225 }
1226 _factory.setObject(((CQLPredicate*)yyvsp[-3]._node),_cid,ChainedIdentifier);
1227 yyval._node = yyvsp[-3]._node;
1228 }else{
1229 /* error */
1230 String _msg("chain->chain[ array_index_list ] : chain state not CQLIDENTIFIER or CQLCHAINEDIDENTIFIER or CQLVALUE");
1231 throw CQLSyntaxErrorException(
1232 MessageLoaderParms(String("CQL.CQL_y.NOT_CHAINID_OR_IDENTIFIER_OR_VALUE"),
1233 String("Chain state not a CQLIdentifier or a CQLChainedIdentifier or a CQLValue while parsing rule $0 in position $1."),
1234 String("chain->chain[ array_index_list ]"),
|
1235 humberto 1.9 CQL_globalParserState->currentTokenPos)
|
1236 chuck 1.2 );
1237 }
1238 }
1239 break;
1240 case 33:
|
1241 lucier 1.13 #line 742 "CQL.y"
|
1242 chuck 1.2 {
|
1243 humberto 1.9 CQL_globalParserState->currentRule = "concat->chain";
|
1244 chuck 1.2 sprintf(msg,"BISON::concat->chain\n");
1245 printf_(msg);
1246
1247 yyval._predicate = ((CQLPredicate*)yyvsp[0]._node);
1248 }
1249 break;
1250 case 34:
|
1251 lucier 1.13 #line 750 "CQL.y"
|
1252 chuck 1.2 {
|
1253 humberto 1.10 CQL_globalParserState->currentRule = "concat->concat || literal_string";
1254 sprintf(msg,"BISON::concat||literal_string\n");
1255 printf_(msg);
1256
1257 CQLValue* tmpval = new CQLValue(*yyvsp[0]._string);
1258 _ObjPtr._ptr = tmpval;
1259 _ObjPtr.type = Val;
1260 _ptrs.append(_ObjPtr);
|
1261 chuck 1.2
|
1262 humberto 1.10 if((CQLPredicate*)yyvsp[-2]._predicate->isSimple())
1263 {
1264 CQLSimplePredicate sp = ((CQLPredicate*)yyvsp[-2]._predicate)->getSimplePredicate();
1265 if(sp.isSimple())
1266 {
1267 CQLExpression exp = sp.getLeftExpression();
1268 if(exp.isSimple())
1269 {
1270 CQLTerm* _term = ((CQLTerm*)(_factory.getObject(yyvsp[-2]._predicate, Predicate, Term)));
1271 /* check for simple literal values*/
1272 Array<CQLFactor> factors = _term->getFactors();
1273 for(Uint32 i = 0; i < factors.size(); i++){
1274 if(!factors[i].isSimpleValue()){
1275 MessageLoaderParms mparms("CQL.CQL_y.CONCAT_PRODUCTION_FACTORS_NOT_SIMPLE",
1276 "The CQLFactors are not simple while processing rule $0.",
1277 CQL_globalParserState->currentRule);
1278 throw CQLSyntaxErrorException(mparms);
1279 }else{
1280 CQLValue val = factors[i].getValue();
1281 if(val.getValueType() != CQLValue::String_type){
1282 MessageLoaderParms mparms("CQL.CQL_y.CONCAT_PRODUCTION_VALUE_NOT_LITERAL",
1283 humberto 1.10 "The CQLValue is not a string literal while processing rule $0.",
1284 CQL_globalParserState->currentRule);
1285 throw CQLSyntaxErrorException(mparms);
1286 }
1287 }
1288 }
1289 CQLFactor* _fctr2 = ((CQLFactor*)(_factory.makeObject(tmpval, Factor)));
1290 _term->appendOperation(concat,*_fctr2);
1291 yyval._predicate = (CQLPredicate*)(_factory.makeObject(_term,Predicate));
1292 }
1293 else
1294 {
1295 MessageLoaderParms mparms("CQL.CQL_y.CONCAT_PRODUCTION_NOT_SIMPLE",
1296 "The $0 is not simple while processing rule $1.",
1297 String("CQLExpression"),
1298 CQL_globalParserState->currentRule);
1299 throw CQLSyntaxErrorException(mparms);
1300 }
1301 }
1302 else
1303 {
1304 humberto 1.10 MessageLoaderParms mparms("CQL.CQL_y.CONCAT_PRODUCTION_NOT_SIMPLE",
1305 "The $0 is not simple while processing rule $1.",
1306 String("CQLSimplePredicate"),
1307 CQL_globalParserState->currentRule);
1308 throw CQLSyntaxErrorException(mparms);
1309 }
1310 }
1311 else
1312 {
1313 MessageLoaderParms mparms("CQL.CQL_y.CONCAT_PRODUCTION_NOT_SIMPLE",
1314 "The $0 is not simple while processing rule $1.",
1315 String("CQLPredicate"),
1316 CQL_globalParserState->currentRule);
1317 throw CQLSyntaxErrorException(mparms);
1318 }
1319 }
|
1320 chuck 1.2 break;
1321 case 35:
|
1322 lucier 1.13 #line 821 "CQL.y"
|
1323 chuck 1.2 {
|
1324 humberto 1.9 CQL_globalParserState->currentRule = "factor->concat";
|
1325 chuck 1.2 sprintf(msg,"BISON::factor->concat\n");
1326 printf_(msg);
1327
1328 yyval._predicate = yyvsp[0]._predicate;
1329 }
1330 break;
1331 case 36:
|
1332 lucier 1.13 #line 848 "CQL.y"
|
1333 chuck 1.2 {
|
1334 humberto 1.9 CQL_globalParserState->currentRule = "term->factor";
|
1335 chuck 1.2 sprintf(msg,"BISON::term->factor\n");
1336 printf_(msg);
1337
1338 yyval._predicate = yyvsp[0]._predicate;
1339 }
1340 break;
1341 case 37:
|
1342 lucier 1.13 #line 874 "CQL.y"
|
1343 chuck 1.2 {
|
1344 humberto 1.9 CQL_globalParserState->currentRule = "arith->term";
|
1345 chuck 1.2 sprintf(msg,"BISON::arith->term\n");
1346 printf_(msg);
1347
1348 /*CQLPredicate* _pred = new CQLPredicate(*$1);*/
1349 /* _factory._predicates.append(_pred);*/
1350 yyval._predicate = yyvsp[0]._predicate;
1351 }
1352 break;
1353 case 38:
|
1354 lucier 1.13 #line 902 "CQL.y"
|
1355 chuck 1.2 {
|
1356 humberto 1.9 CQL_globalParserState->currentRule = "value_symbol->#literal_string";
|
1357 chuck 1.2 sprintf(msg,"BISON::value_symbol->#literal_string\n");
1358 printf_(msg);
1359
1360 String tmp("#");
1361 tmp.append(*yyvsp[0]._string);
1362 CQLIdentifier tmpid(tmp);
1363 yyval._value = new CQLValue(tmpid);
|
1364 humberto 1.8 _ObjPtr._ptr = yyval._value;
1365 _ObjPtr.type = Val;
1366 _ptrs.append(_ObjPtr);
|
1367 chuck 1.2 }
1368 break;
1369 case 39:
|
1370 lucier 1.13 #line 918 "CQL.y"
|
1371 chuck 1.2 {
|
1372 humberto 1.9 CQL_globalParserState->currentRule = "arith_or_value_symbol->arith";
|
1373 chuck 1.2 sprintf(msg,"BISON::arith_or_value_symbol->arith\n");
1374 printf_(msg);
1375
1376 yyval._predicate = yyvsp[0]._predicate;
1377 }
1378 break;
1379 case 40:
|
1380 lucier 1.13 #line 926 "CQL.y"
|
1381 chuck 1.2 {
1382 /* make into predicate */
|
1383 humberto 1.9 CQL_globalParserState->currentRule = "arith_or_value_symbol->value_symbol";
|
1384 chuck 1.2 sprintf(msg,"BISON::arith_or_value_symbol->value_symbol\n");
1385 printf_(msg);
1386
1387 CQLFactor _fctr(*yyvsp[0]._value);
1388 yyval._predicate = (CQLPredicate*)(_factory.makeObject(&_fctr, Predicate));
1389 }
1390 break;
1391 case 41:
|
1392 lucier 1.13 #line 938 "CQL.y"
|
1393 chuck 1.2 {
|
1394 humberto 1.9 CQL_globalParserState->currentRule = "comp_op->_EQ";
|
1395 chuck 1.2 sprintf(msg,"BISON::comp_op->_EQ\n");
1396 printf_(msg);
1397 yyval._opType = EQ;
1398 }
1399 break;
1400 case 42:
|
1401 lucier 1.13 #line 945 "CQL.y"
|
1402 chuck 1.2 {
|
1403 humberto 1.9 CQL_globalParserState->currentRule = "comp_op->_NE";
|
1404 chuck 1.2 sprintf(msg,"BISON::comp_op->_NE\n");
1405 printf_(msg);
1406 yyval._opType = NE;
1407 }
1408 break;
1409 case 43:
|
1410 lucier 1.13 #line 952 "CQL.y"
|
1411 chuck 1.2 {
|
1412 humberto 1.9 CQL_globalParserState->currentRule = "comp_op->_GT";
|
1413 chuck 1.2 sprintf(msg,"BISON::comp_op->_GT\n");
1414 printf_(msg);
1415 yyval._opType = GT;
1416 }
1417 break;
1418 case 44:
|
1419 lucier 1.13 #line 959 "CQL.y"
|
1420 chuck 1.2 {
|
1421 humberto 1.9 CQL_globalParserState->currentRule = "comp_op->_LT";
|
1422 chuck 1.2 sprintf(msg,"BISON::comp_op->_LT\n");
1423 printf_(msg);
1424 yyval._opType = LT;
1425 }
1426 break;
1427 case 45:
|
1428 lucier 1.13 #line 966 "CQL.y"
|
1429 chuck 1.2 {
|
1430 humberto 1.9 CQL_globalParserState->currentRule = "comp_op->_GE";
|
1431 chuck 1.2 sprintf(msg,"BISON::comp_op->_GE\n");
1432 printf_(msg);
1433 yyval._opType = GE;
1434 }
1435 break;
1436 case 46:
|
1437 lucier 1.13 #line 973 "CQL.y"
|
1438 chuck 1.2 {
|
1439 humberto 1.9 CQL_globalParserState->currentRule = "comp_op->_LE";
|
1440 chuck 1.2 sprintf(msg,"BISON::comp_op->_LE\n");
1441 printf_(msg);
1442 yyval._opType = LE;
1443 }
1444 break;
1445 case 47:
|
1446 lucier 1.13 #line 982 "CQL.y"
|
1447 chuck 1.2 {
|
1448 humberto 1.9 CQL_globalParserState->currentRule = "comp->arith";
|
1449 chuck 1.2 sprintf(msg,"BISON::comp->arith\n");
1450 printf_(msg);
1451
1452 yyval._predicate = yyvsp[0]._predicate;
1453 }
1454 break;
1455 case 48:
|
1456 lucier 1.13 #line 990 "CQL.y"
|
1457 chuck 1.2 {
|
1458 humberto 1.9 CQL_globalParserState->currentRule = "comp->arith IS NOT _NULL";
|
1459 chuck 1.2 sprintf(msg,"BISON::comp->arith IS NOT _NULL\n");
1460 printf_(msg);
1461
1462 CQLExpression *_expr = (CQLExpression*)(_factory.getObject(yyvsp[-3]._predicate,Expression));
1463 CQLSimplePredicate _sp(*_expr, IS_NOT_NULL);
1464 _factory.setObject(yyvsp[-3]._predicate,&_sp,SimplePredicate);
1465 yyval._predicate = yyvsp[-3]._predicate;
1466 }
1467 break;
1468 case 49:
|
1469 lucier 1.13 #line 1001 "CQL.y"
|
1470 chuck 1.2 {
|
1471 humberto 1.9 CQL_globalParserState->currentRule = "comp->arith IS _NULL";
|
1472 chuck 1.2 sprintf(msg,"BISON::comp->arith IS _NULL\n");
1473 printf_(msg);
1474
1475 CQLExpression *_expr = (CQLExpression*)(_factory.getObject(yyvsp[-2]._predicate,Expression));
1476 CQLSimplePredicate _sp(*_expr, IS_NULL);
1477 _factory.setObject(yyvsp[-2]._predicate,&_sp,SimplePredicate);
1478 yyval._predicate = yyvsp[-2]._predicate;
1479 }
1480 break;
1481 case 50:
|
1482 lucier 1.13 #line 1012 "CQL.y"
|
1483 chuck 1.2 {
|
1484 humberto 1.9 CQL_globalParserState->currentRule = "comp->arith comp_op arith_or_value_symbol";
|
1485 chuck 1.2 sprintf(msg,"BISON::comp->arith comp_op arith_or_value_symbol\n");
1486 printf_(msg);
1487 if(yyvsp[-2]._predicate->isSimple() && yyvsp[0]._predicate->isSimple()){
1488 CQLExpression* _exp1 = (CQLExpression*)(_factory.getObject(yyvsp[-2]._predicate,Predicate,Expression));
1489 CQLExpression* _exp2 = (CQLExpression*)(_factory.getObject(yyvsp[0]._predicate,Predicate,Expression));
1490 CQLSimplePredicate _sp(*_exp1, *_exp2, yyvsp[-1]._opType);
1491 yyval._predicate = new CQLPredicate(_sp);
|
1492 humberto 1.8 _ObjPtr._ptr = yyval._predicate;
1493 _ObjPtr.type = Pred;
1494 _ptrs.append(_ObjPtr);
|
1495 chuck 1.2 }else{
1496 /* error */
1497 String _msg("comp->arith comp_op arith_or_value_symbol : $1 is not simple OR $3 is not simple");
1498 throw CQLSyntaxErrorException(
1499 MessageLoaderParms(String("CQL.CQL_y.NOT_SIMPLE"),
1500 String("The CQLSimplePredicate is not simple while parsing rule $0 in position $1."),
1501 String("comp->arith comp_op arith_or_value_symbol"),
|
1502 humberto 1.9 CQL_globalParserState->currentTokenPos)
|
1503 chuck 1.2 );
1504 }
1505 }
1506 break;
1507 case 51:
|
1508 lucier 1.13 #line 1036 "CQL.y"
|
1509 chuck 1.2 {
|
1510 humberto 1.9 CQL_globalParserState->currentRule = "comp->value_symbol comp_op arith";
|
1511 chuck 1.2 sprintf(msg,"BISON::comp->value_symbol comp_op arith\n");
1512 printf_(msg);
1513
1514 if(yyvsp[0]._predicate->isSimple()){
1515 CQLExpression* _exp1 = (CQLExpression*)(_factory.makeObject(yyvsp[-2]._value, Expression));
1516 CQLExpression* _exp2 = (CQLExpression*)(_factory.getObject(yyvsp[0]._predicate,Predicate,Expression));
1517 CQLSimplePredicate _sp(*_exp1, *_exp2, yyvsp[-1]._opType);
1518 yyval._predicate = new CQLPredicate(_sp);
|
1519 humberto 1.8 _ObjPtr._ptr = yyval._predicate;
1520 _ObjPtr.type = Pred;
1521 _ptrs.append(_ObjPtr);
|
1522 chuck 1.2 }else{
1523 /* error */
1524 String _msg("comp->value_symbol comp_op arith : $3 is not simple");
1525 throw CQLSyntaxErrorException(
1526 MessageLoaderParms(String("CQL.CQL_y.NOT_SIMPLE"),
1527 String("The CQLSimplePredicate is not simple while parsing rule $0 in position $1."),
1528 String("comp->value_symbol comp_op arith"),
|
1529 humberto 1.9 CQL_globalParserState->currentTokenPos)
|
1530 chuck 1.2 );
1531
1532 }
1533 }
1534 break;
1535 case 52:
|
1536 lucier 1.13 #line 1062 "CQL.y"
|
1537 chuck 1.2 {
|
1538 humberto 1.9 CQL_globalParserState->currentRule = "comp->arith _ISA identifier";
|
1539 chuck 1.2 /* make sure $1 isSimple(), get its expression, make simplepred->predicate */
1540 sprintf(msg,"BISON::comp->arith _ISA identifier\n");
1541 printf_(msg);
1542
1543 CQLExpression *_expr1 = (CQLExpression*)(_factory.getObject(yyvsp[-2]._predicate,Predicate,Expression));
1544 CQLChainedIdentifier _cid(*yyvsp[0]._identifier);
1545 CQLExpression *_expr2 = (CQLExpression*)(_factory.makeObject(&_cid,Expression));
1546 CQLSimplePredicate _sp(*_expr1, *_expr2, ISA);
1547 _factory.setObject(yyvsp[-2]._predicate,&_sp,SimplePredicate);
1548 yyval._predicate = yyvsp[-2]._predicate;
1549 }
1550 break;
|
1551 humberto 1.10 case 53:
|
1552 lucier 1.13 #line 1076 "CQL.y"
|
1553 chuck 1.2 {
|
1554 humberto 1.9 CQL_globalParserState->currentRule = "comp->arith _LIKE literal_string";
|
1555 chuck 1.2 sprintf(msg,"BISON::comp->arith _LIKE literal_string\n");
1556 printf_(msg);
1557
1558 CQLExpression *_expr1 = (CQLExpression*)(_factory.getObject(yyvsp[-2]._predicate,Predicate,Expression));
1559 CQLValue _val(*yyvsp[0]._string);
1560 CQLExpression *_expr2 = (CQLExpression*)(_factory.makeObject(&_val,Expression));
1561 CQLSimplePredicate _sp(*_expr1, *_expr2, LIKE);
1562 _factory.setObject(yyvsp[-2]._predicate,&_sp,SimplePredicate);
1563 yyval._predicate = yyvsp[-2]._predicate;
1564 }
1565 break;
|
1566 humberto 1.10 case 54:
|
1567 lucier 1.13 #line 1090 "CQL.y"
|
1568 chuck 1.2 {
|
1569 humberto 1.9 CQL_globalParserState->currentRule = "expr_factor->comp";
|
1570 chuck 1.2 sprintf(msg,"BISON::expr_factor->comp\n");
1571 printf_(msg);
1572
1573 yyval._predicate = yyvsp[0]._predicate;
1574 }
1575 break;
|
1576 humberto 1.10 case 55:
|
1577 lucier 1.13 #line 1098 "CQL.y"
|
1578 chuck 1.2 {
|
1579 humberto 1.11 CQL_globalParserState->currentRule = "expr_factor->NOT comp";
1580 sprintf(msg,"BISON::expr_factor->NOT comp\n");
1581 printf_(msg);
1582
1583 yyvsp[0]._predicate->setInverted(!(yyvsp[0]._predicate->getInverted()));
1584 yyval._predicate = yyvsp[0]._predicate;
|
1585 chuck 1.2 }
1586 break;
|
1587 humberto 1.10 case 56:
|
1588 lucier 1.13 #line 1109 "CQL.y"
|
1589 chuck 1.2 {
|
1590 humberto 1.9 CQL_globalParserState->currentRule = "expr_term->expr_factor";
|
1591 chuck 1.2 sprintf(msg,"BISON::expr_term->expr_factor\n");
1592 printf_(msg);
1593
1594 yyval._predicate = yyvsp[0]._predicate;
1595 }
1596 break;
|
1597 humberto 1.10 case 57:
|
1598 lucier 1.13 #line 1117 "CQL.y"
|
1599 chuck 1.2 {
|
1600 humberto 1.9 CQL_globalParserState->currentRule = "expr_term->expr_term AND expr_factor";
|
1601 chuck 1.2 sprintf(msg,"BISON::expr_term->expr_term AND expr_factor\n");
1602 printf_(msg);
1603
1604 yyval._predicate = new CQLPredicate();
1605 yyval._predicate->appendPredicate(*yyvsp[-2]._predicate);
1606 yyval._predicate->appendPredicate(*yyvsp[0]._predicate, AND);
|
1607 humberto 1.8 _ObjPtr._ptr = yyval._predicate;
1608 _ObjPtr.type = Pred;
1609 _ptrs.append(_ObjPtr);
|
1610 chuck 1.2 }
1611 break;
|
1612 humberto 1.10 case 58:
|
1613 lucier 1.13 #line 1132 "CQL.y"
|
1614 chuck 1.2 {
|
1615 humberto 1.9 CQL_globalParserState->currentRule = "expr->expr_term";
|
1616 chuck 1.2 sprintf(msg,"BISON::expr->expr_term\n");
1617 printf_(msg);
1618
1619 yyval._predicate = yyvsp[0]._predicate;
1620 }
1621 break;
|
1622 humberto 1.10 case 59:
|
1623 lucier 1.13 #line 1140 "CQL.y"
|
1624 chuck 1.2 {
|
1625 humberto 1.9 CQL_globalParserState->currentRule = "expr->expr OR expr_term";
|
1626 chuck 1.2 sprintf(msg,"BISON::expr->expr OR expr_term\n");
1627 printf_(msg);
1628 yyval._predicate = new CQLPredicate();
1629 yyval._predicate->appendPredicate(*yyvsp[-2]._predicate);
1630 yyval._predicate->appendPredicate(*yyvsp[0]._predicate, OR);
|
1631 humberto 1.8 _ObjPtr._ptr = yyval._predicate;
1632 _ObjPtr.type = Pred;
1633 _ptrs.append(_ObjPtr);
|
1634 chuck 1.2 }
1635 break;
|
1636 humberto 1.10 case 60:
|
1637 lucier 1.13 #line 1153 "CQL.y"
|
1638 chuck 1.2 {;}
1639 break;
|
1640 humberto 1.10 case 61:
|
1641 lucier 1.13 #line 1171 "CQL.y"
|
1642 chuck 1.2 {
|
1643 humberto 1.9 CQL_globalParserState->currentRule = "arg_list->arg_list_sub->expr";
|
1644 chuck 1.2 sprintf(msg,"BISON::arg_list_sub->expr\n");
1645 printf_(msg);
1646
|
1647 humberto 1.5 _arglist.append(*yyvsp[0]._predicate);/*
1648 since arg_list can loop back on itself,
1649 we need to store away previous solutions
1650 production. We keep track of previous productions
1651 in the _arglist array and later pass that to CQLFunction
1652 as part of chain: identifier LPAR arg_list RPAR
1653 */
|
1654 chuck 1.2 }
1655 break;
|
1656 humberto 1.10 case 62:
|
1657 lucier 1.13 #line 1232 "CQL.y"
|
1658 chuck 1.2 {
|
1659 humberto 1.9 CQL_globalParserState->currentRule = "from_specifier->class_path";
|
1660 chuck 1.2 sprintf(msg,"BISON::from_specifier->class_path\n");
1661 printf_(msg);
1662
|
1663 humberto 1.9 CQL_globalParserState->statement->appendClassPath(*yyvsp[0]._identifier);
|
1664 chuck 1.2 }
1665 break;
|
1666 humberto 1.10 case 63:
|
1667 lucier 1.13 #line 1241 "CQL.y"
|
1668 chuck 1.2 {
|
1669 humberto 1.9 CQL_globalParserState->currentRule = "from_specifier->class_path AS identifier";
|
1670 chuck 1.2 sprintf(msg,"BISON::from_specifier->class_path AS identifier\n");
1671 printf_(msg);
1672
1673 CQLIdentifier _class(*yyvsp[-2]._identifier);
1674 String _alias(yyvsp[0]._identifier->getName().getString());
|
1675 humberto 1.9 CQL_globalParserState->statement->insertClassPathAlias(_class,_alias);
1676 CQL_globalParserState->statement->appendClassPath(_class);
|
1677 chuck 1.2 }
1678 break;
|
1679 humberto 1.10 case 64:
|
1680 lucier 1.13 #line 1252 "CQL.y"
|
1681 chuck 1.2 {
|
1682 humberto 1.9 CQL_globalParserState->currentRule = "from_specifier->class_path identifier";
|
1683 chuck 1.2 sprintf(msg,"BISON::from_specifier->class_path identifier\n");
1684 printf_(msg);
1685
1686 CQLIdentifier _class(*yyvsp[-1]._identifier);
1687 String _alias(yyvsp[0]._identifier->getName().getString());
|
1688 humberto 1.9 CQL_globalParserState->statement->insertClassPathAlias(_class,_alias);
1689 CQL_globalParserState->statement->appendClassPath(_class);
|
1690 chuck 1.2 }
1691 break;
|
1692 humberto 1.10 case 65:
|
1693 lucier 1.13 #line 1265 "CQL.y"
|
1694 chuck 1.2 {
|
1695 humberto 1.9 CQL_globalParserState->currentRule = "from_criteria->from_specifier";
|
1696 chuck 1.2 sprintf(msg,"BISON::from_criteria->from_specifier\n");
1697 printf_(msg);
1698 }
1699 break;
|
1700 humberto 1.10 case 66:
|
1701 lucier 1.13 #line 1273 "CQL.y"
|
1702 chuck 1.2 {
|
1703 humberto 1.9 CQL_globalParserState->currentRule = "star_expr->STAR";
|
1704 chuck 1.2 sprintf(msg,"BISON::star_expr->STAR\n");
1705 printf_(msg);
1706
1707 CQLIdentifier _id("*");
1708 yyval._chainedIdentifier = (CQLChainedIdentifier*)(_factory.makeObject(&_id,ChainedIdentifier));
1709 }
1710 break;
|
1711 humberto 1.10 case 67:
|
1712 lucier 1.13 #line 1282 "CQL.y"
|
1713 chuck 1.2 {
|
1714 humberto 1.9 CQL_globalParserState->currentRule = "star_expr->chain.*";
|
1715 chuck 1.2 sprintf(msg,"BISON::star_expr->chain.*\n");
1716 printf_(msg);
1717 CQLChainedIdentifier* _tmp = (CQLChainedIdentifier*)(_factory.getObject(yyvsp[-2]._node,Predicate,ChainedIdentifier));
1718 CQLChainedIdentifier* _cid = new CQLChainedIdentifier(*_tmp);
1719 CQLIdentifier _id("*");
1720 _cid->append(_id);
1721 yyval._chainedIdentifier = _cid;
|
1722 humberto 1.8 _ObjPtr._ptr = yyval._chainedIdentifier;
1723 _ObjPtr.type = CId;
1724 _ptrs.append(_ObjPtr);
|
1725 chuck 1.2 }
1726 break;
|
1727 humberto 1.10 case 68:
|
1728 lucier 1.13 #line 1298 "CQL.y"
|
1729 chuck 1.2 {
|
1730 humberto 1.9 CQL_globalParserState->currentRule = "selected_entry->expr";
|
1731 chuck 1.2 sprintf(msg,"BISON::selected_entry->expr\n");
1732 printf_(msg);
1733 if(yyvsp[0]._predicate->isSimpleValue()){
1734 CQLChainedIdentifier *_cid = (CQLChainedIdentifier*)(_factory.getObject(yyvsp[0]._predicate,Predicate,ChainedIdentifier));
|
1735 humberto 1.9 CQL_globalParserState->statement->appendSelectIdentifier(*_cid);
|
1736 chuck 1.2 }else{
1737 /* error */
1738 String _msg("selected_entry->expr : $1 is not a simple value");
1739 throw CQLSyntaxErrorException(
1740 MessageLoaderParms(String("CQL.CQL_y.NOT_SIMPLE_VALUE"),
1741 String("The CQLPredicate is not a simple value while parsing rule $0 in position $1."),
1742 String("selected_entry->expr"),
|
1743 humberto 1.9 CQL_globalParserState->currentTokenPos)
|
1744 chuck 1.2 );
1745 }
1746 }
1747 break;
|
1748 humberto 1.10 case 69:
|
1749 lucier 1.13 #line 1317 "CQL.y"
|
1750 chuck 1.2 {
|
1751 humberto 1.9 CQL_globalParserState->currentRule = "selected_entry->star_expr";
|
1752 chuck 1.2 sprintf(msg,"BISON::selected_entry->star_expr\n");
1753 printf_(msg);
|
1754 humberto 1.9 CQL_globalParserState->statement->appendSelectIdentifier(*yyvsp[0]._chainedIdentifier);
|
1755 chuck 1.2 }
1756 break;
|
1757 humberto 1.10 case 70:
|
1758 lucier 1.13 #line 1326 "CQL.y"
|
1759 chuck 1.2 {
|
1760 humberto 1.9 CQL_globalParserState->currentRule = "select_list->selected_entry select_list_tail";
|
1761 chuck 1.2 sprintf(msg,"BISON::select_list->selected_entry select_list_tail\n");
1762 printf_(msg);
1763 }
1764 break;
|
1765 humberto 1.10 case 71:
|
1766 lucier 1.13 #line 1333 "CQL.y"
|
1767 chuck 1.2 {;}
1768 break;
|
1769 humberto 1.10 case 72:
|
1770 lucier 1.13 #line 1335 "CQL.y"
|
1771 chuck 1.2 {
|
1772 humberto 1.9 CQL_globalParserState->currentRule = "select_list_tail->COMMA selected_entry select_list_tail";
|
1773 chuck 1.2 sprintf(msg,"BISON::select_list_tail->COMMA selected_entry select_list_tail\n");
1774 printf_(msg);
1775 }
1776 break;
|
1777 humberto 1.10 case 73:
|
1778 lucier 1.13 #line 1343 "CQL.y"
|
1779 chuck 1.2 {
|
1780 humberto 1.9 CQL_globalParserState->currentRule = "search_condition->expr";
|
1781 chuck 1.2 sprintf(msg,"BISON::search_condition->expr\n");
1782 printf_(msg);
|
1783 humberto 1.9 CQL_globalParserState->statement->setPredicate(*yyvsp[0]._predicate);
|
1784 chuck 1.2 }
1785 break;
|
1786 humberto 1.10 case 74:
|
1787 lucier 1.13 #line 1351 "CQL.y"
|
1788 humberto 1.8 {}
|
1789 chuck 1.2 break;
|
1790 humberto 1.10 case 75:
|
1791 lucier 1.13 #line 1353 "CQL.y"
|
1792 chuck 1.2 {
|
1793 humberto 1.9 CQL_globalParserState->currentRule = "optional_where->WHERE search_condition";
|
1794 chuck 1.2 sprintf(msg,"BISON::optional_where->WHERE search_condition\n");
1795 printf_(msg);
|
1796 humberto 1.9 CQL_globalParserState->statement->setHasWhereClause();
|
1797 chuck 1.2 }
1798 break;
|
1799 humberto 1.10 case 76:
|
1800 lucier 1.13 #line 1362 "CQL.y"
|
1801 chuck 1.2 {
|
1802 humberto 1.9 CQL_globalParserState->currentRule = "select_statement";
|
1803 chuck 1.2 sprintf(msg,"select_statement\n\n");
1804 printf_(msg);
|
1805 humberto 1.10 CQL_Bison_Cleanup();
|
1806 chuck 1.2 }
1807 break;
|
1808 humberto 1.10 #line 1779 "y.tab.c"
|
1809 chuck 1.2 }
1810 yyssp -= yym;
1811 yystate = *yyssp;
1812 yyvsp -= yym;
1813 yym = yylhs[yyn];
1814 if (yystate == 0 && yym == 0)
1815 {
1816 #if YYDEBUG
1817 if (yydebug)
1818 printf("%sdebug: after reduction, shifting from state 0 to\
1819 state %d\n", YYPREFIX, YYFINAL);
1820 #endif
1821 yystate = YYFINAL;
1822 *++yyssp = YYFINAL;
1823 *++yyvsp = yyval;
1824 if (yychar < 0)
1825 {
1826 if ((yychar = yylex()) < 0) yychar = 0;
1827 #if YYDEBUG
1828 if (yydebug)
1829 {
1830 chuck 1.2 yys = 0;
1831 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
1832 if (!yys) yys = "illegal-symbol";
1833 printf("%sdebug: state %d, reading %d (%s)\n",
1834 YYPREFIX, YYFINAL, yychar, yys);
1835 }
1836 #endif
1837 }
1838 if (yychar == 0) goto yyaccept;
1839 goto yyloop;
1840 }
1841 if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
1842 yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
1843 yystate = yytable[yyn];
1844 else
1845 yystate = yydgoto[yym];
1846 #if YYDEBUG
1847 if (yydebug)
1848 printf("%sdebug: after reduction, shifting from state %d \
1849 to state %d\n", YYPREFIX, *yyssp, yystate);
1850 #endif
1851 chuck 1.2 if (yyssp >= yysslim && yygrowstack())
1852 {
1853 goto yyoverflow;
1854 }
1855 *++yyssp = yystate;
1856 *++yyvsp = yyval;
1857 goto yyloop;
1858 yyoverflow:
1859 yyerror("yacc stack overflow");
1860 yyabort:
1861 return (1);
1862 yyaccept:
1863 return (0);
1864 }
|