1 mike 1.2
2 /* A Bison parser, made from wql.y with Bison version GNU Bison version 1.24
3 */
4
5 #define YYBISON 1 /* Identify Bison output. */
6
7 #define yyparse WQL_parse
8 #define yylex WQL_lex
9 #define yyerror WQL_error
10 #define yylval WQL_lval
11 #define yychar WQL_char
12 #define yydebug WQL_debug
13 #define yynerrs WQL_nerrs
14 #define TOK_INTEGER 258
15 #define TOK_DOUBLE 259
16 #define TOK_STRING 260
17 #define TOK_TRUE 261
18 #define TOK_FALSE 262
19 #define TOK_NULL 263
20 #define TOK_EQ 264
21 #define TOK_NE 265
22 mike 1.2 #define TOK_LT 266
23 #define TOK_LE 267
24 #define TOK_GT 268
25 #define TOK_GE 269
26 #define TOK_NOT 270
27 #define TOK_OR 271
28 #define TOK_AND 272
29 #define TOK_IS 273
30 #define TOK_IDENTIFIER 274
31 #define TOK_SELECT 275
32 #define TOK_WHERE 276
33 #define TOK_FROM 277
34 #define TOK_UNEXPECTED_CHAR 278
35
36 #line 9 "wql.y"
37
38
39 #include <Pegasus/Common/Config.h>
40 #include <Pegasus/WQL/WQLOperation.h>
41 #include <Pegasus/WQL/WQLOperand.h>
42 #include <Pegasus/WQL/WQLParserState.h>
43 mike 1.2 #include <Pegasus/WQL/WQLSelectStatement.h>
44 #include <string.h>
45 #include <stdlib.h>
46
47 #ifdef PEGASUS_OS_TYPE_WINDOWS
48 # include <malloc.h>
49 #endif
50
51 #if defined(PEGASUS_COMPILER_ACC) && defined(PEGASUS_OS_HPUX)
52 # include <alloca.h>
53 #endif
54
55 #if 0
56 # define WQL_TRACE(X) printf X
57 #else
58 # define WQL_TRACE(X)
59 #endif
60
61 extern int WQL_lex();
62 extern int WQL_error(char*);
63
64 mike 1.2 //
65 // Define the global parser state object:
66 //
67
68 PEGASUS_USING_PEGASUS;
69
70 PEGASUS_NAMESPACE_BEGIN
71
72 extern WQLParserState* globalParserState;
73
74 PEGASUS_NAMESPACE_END
75
76
77 #line 58 "wql.y"
78 typedef union
79 {
80 int intValue;
81 double doubleValue;
82 char* strValue;
83 void* nodeValue;
84 } YYSTYPE;
85 mike 1.2
86 #ifndef YYLTYPE
87 typedef
88 struct yyltype
89 {
90 int timestamp;
91 int first_line;
92 int first_column;
93 int last_line;
94 int last_column;
95 char *text;
96 }
97 yyltype;
98
99 #define YYLTYPE yyltype
100 #endif
101
102 #include <stdio.h>
103
104 #ifndef __cplusplus
105 #ifndef __STDC__
106 mike 1.2 #define const
107 #endif
108 #endif
109
110
111
112 #define YYFINAL 60
113 #define YYFLAG -32768
114 #define YYNTBASE 28
115
116 #define YYTRANSLATE(x) ((unsigned)(x) <= 278 ? yytranslate[x] : 43)
117
118 static const char yytranslate[] = { 0,
119 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
120 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
121 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
122 2, 2, 2, 2, 2, 2, 2, 2, 2, 26,
123 27, 24, 2, 25, 2, 2, 2, 2, 2, 2,
124 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
125 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
126 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
127 mike 1.2 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
128 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
129 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
130 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
131 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
132 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
133 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
134 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
135 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
136 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
137 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
138 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
139 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
140 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
141 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
142 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
143 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
144 2, 2, 2, 2, 2, 1, 2, 3, 4, 5,
145 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
146 16, 17, 18, 19, 20, 21, 22, 23
147 };
148 mike 1.2
149 #if YYDEBUG != 0
150 static const short yyprhs[] = { 0,
151 0, 2, 6, 8, 10, 12, 16, 19, 21, 24,
152 27, 31, 35, 38, 42, 44, 48, 53, 55, 57,
153 61, 65, 69, 73, 77, 81, 85, 90, 92, 94,
154 96, 98, 100, 102, 104, 106
155 };
156
157 static const short yyrhs[] = { 29,
158 0, 20, 30, 32, 0, 24, 0, 31, 0, 40,
159 0, 31, 25, 40, 0, 33, 34, 0, 33, 0,
160 22, 41, 0, 21, 35, 0, 35, 16, 35, 0,
161 35, 17, 35, 0, 15, 35, 0, 26, 35, 27,
162 0, 36, 0, 36, 18, 39, 0, 36, 18, 15,
163 39, 0, 37, 0, 38, 0, 42, 11, 42, 0,
164 42, 13, 42, 0, 42, 12, 42, 0, 42, 14,
165 42, 0, 42, 9, 42, 0, 42, 10, 42, 0,
166 42, 18, 8, 0, 42, 18, 15, 8, 0, 6,
167 0, 7, 0, 19, 0, 19, 0, 40, 0, 3,
168 0, 4, 0, 5, 0, 39, 0
169 mike 1.2 };
170
171 #endif
172
173 #if YYDEBUG != 0
174 static const short yyrline[] = { 0,
175 130, 136, 142, 146, 152, 156, 162, 166, 172, 179,
176 185, 190, 195, 201, 205, 209, 214, 223, 227, 233,
177 238, 243, 248, 253, 258, 265, 270, 277, 281, 287,
178 293, 300, 306, 311, 316, 321
179 };
180
181 static const char * const yytname[] = { "$","error","$undefined.","TOK_INTEGER",
182 "TOK_DOUBLE","TOK_STRING","TOK_TRUE","TOK_FALSE","TOK_NULL","TOK_EQ","TOK_NE",
183 "TOK_LT","TOK_LE","TOK_GT","TOK_GE","TOK_NOT","TOK_OR","TOK_AND","TOK_IS","TOK_IDENTIFIER",
184 "TOK_SELECT","TOK_WHERE","TOK_FROM","TOK_UNEXPECTED_CHAR","'*'","','","'('",
185 "')'","start","selectStatement","selectList","propertyList","selectExpression",
186 "fromClause","whereClause","searchCondition","predicate","comparisonPredicate",
187 "nullPredicate","truthValue","propertyName","className","comparisonTerm",""
188 };
189 #endif
190 mike 1.2
191 static const short yyr1[] = { 0,
192 28, 29, 30, 30, 31, 31, 32, 32, 33, 34,
193 35, 35, 35, 35, 35, 35, 35, 36, 36, 37,
194 37, 37, 37, 37, 37, 38, 38, 39, 39, 40,
195 41, 42, 42, 42, 42, 42
196 };
197
198 static const short yyr2[] = { 0,
199 1, 3, 1, 1, 1, 3, 2, 1, 2, 2,
200 3, 3, 2, 3, 1, 3, 4, 1, 1, 3,
201 3, 3, 3, 3, 3, 3, 4, 1, 1, 1,
202 1, 1, 1, 1, 1, 1
203 };
204
205 static const short yydefact[] = { 0,
206 0, 1, 30, 3, 0, 4, 5, 0, 2, 8,
207 0, 31, 9, 0, 7, 6, 33, 34, 35, 28,
208 29, 0, 0, 10, 15, 18, 19, 36, 32, 0,
209 13, 0, 0, 0, 0, 0, 0, 0, 0, 0,
210 0, 0, 14, 11, 12, 0, 16, 24, 25, 20,
211 mike 1.2 22, 21, 23, 26, 0, 17, 27, 0, 0, 0
212 };
213
214 static const short yydefgoto[] = { 58,
215 2, 5, 6, 9, 10, 15, 24, 25, 26, 27,
216 28, 29, 13, 30
217 };
218
219 static const short yypact[] = { -5,
220 18,-32768,-32768,-32768, 5, 16,-32768, 24,-32768, 33,
221 26,-32768,-32768, -3,-32768,-32768,-32768,-32768,-32768,-32768,
222 -32768, -3, -3, 23, 37,-32768,-32768,-32768,-32768, 20,
223 -32768, 1, -3, -3, 29, 2, 2, 2, 2, 2,
224 2, 11,-32768, 39,-32768, 46,-32768,-32768,-32768,-32768,
225 -32768,-32768,-32768,-32768, 49,-32768,-32768, 58, 59,-32768
226 };
227
228 static const short yypgoto[] = {-32768,
229 -32768,-32768,-32768,-32768,-32768,-32768, -9,-32768,-32768,-32768,
230 -24, 9,-32768, 10
231 };
232 mike 1.2
233
234 #define YYLAST 59
235
236
237 static const short yytable[] = { 17,
238 18, 19, 20, 21, 17, 18, 19, 20, 21, 7,
239 47, 22, 31, 32, 1, 3, 33, 34, 54, 16,
240 3, 56, 23, 44, 45, 55, 8, 43, 36, 37,
241 38, 39, 40, 41, 20, 21, 3, 42, 33, 34,
242 11, 4, 12, 46, 3, 48, 49, 50, 51, 52,
243 53, 20, 21, 14, 35, 34, 57, 59, 60
244 };
245
246 static const short yycheck[] = { 3,
247 4, 5, 6, 7, 3, 4, 5, 6, 7, 1,
248 35, 15, 22, 23, 20, 19, 16, 17, 8, 11,
249 19, 46, 26, 33, 34, 15, 22, 27, 9, 10,
250 11, 12, 13, 14, 6, 7, 19, 18, 16, 17,
251 25, 24, 19, 15, 19, 36, 37, 38, 39, 40,
252 41, 6, 7, 21, 18, 17, 8, 0, 0
253 mike 1.2 };
254 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
255 #line 3 "bison.simple"
256 /* This file comes from bison-@bison_version@. */
257
258 /* Skeleton output parser for bison,
259 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
260
261 This program is free software; you can redistribute it and/or modify
262 it under the terms of the GNU General Public License as published by
263 the Free Software Foundation; either version 2, or (at your option)
264 any later version.
265
266 This program is distributed in the hope that it will be useful,
267 but WITHOUT ANY WARRANTY; without even the implied warranty of
268 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
269 GNU General Public License for more details.
270
271 You should have received a copy of the GNU General Public License
272 along with this program; if not, write to the Free Software
273 Foundation, Inc., 59 Temple Place - Suite 330,
274 mike 1.2 Boston, MA 02111-1307, USA. */
275
276 /* As a special exception, when this file is copied by Bison into a
277 Bison output file, you may use that output file without restriction.
278 This special exception was added by the Free Software Foundation
279 in version 1.24 of Bison. */
280
281 /* This is the parser code that is written into each bison parser
282 when the %semantic_parser declaration is not specified in the grammar.
283 It was written by Richard Stallman by simplifying the hairy parser
284 used when %semantic_parser is specified. */
285
286 #ifndef YYSTACK_USE_ALLOCA
287 #ifdef alloca
288 #define YYSTACK_USE_ALLOCA
289 #else /* alloca not defined */
290 #ifdef __GNUC__
291 #define YYSTACK_USE_ALLOCA
292 #define alloca __builtin_alloca
293 #else /* not GNU C. */
294 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
295 mike 1.2 #define YYSTACK_USE_ALLOCA
296 #include <alloca.h>
297 #else /* not sparc */
298 /* We think this test detects Watcom and Microsoft C. */
299 /* This used to test MSDOS, but that is a bad idea
300 since that symbol is in the user namespace. */
301 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
302 #if 0 /* No need for malloc.h, which pollutes the namespace;
303 instead, just don't use alloca. */
304 #include <malloc.h>
305 #endif
306 #else /* not MSDOS, or __TURBOC__ */
307 #if defined(_AIX)
308 /* I don't know what this was needed for, but it pollutes the namespace.
309 So I turned it off. rms, 2 May 1997. */
310 /* #include <malloc.h> */
311 #pragma alloca
312 #define YYSTACK_USE_ALLOCA
313 #else /* not MSDOS, or __TURBOC__, or _AIX */
314 #if 0
315 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
316 mike 1.2 and on HPUX 10. Eventually we can turn this on. */
317 #define YYSTACK_USE_ALLOCA
318 #define alloca __builtin_alloca
319 #endif /* __hpux */
320 #endif
321 #endif /* not _AIX */
322 #endif /* not MSDOS, or __TURBOC__ */
323 #endif /* not sparc */
324 #endif /* not GNU C */
325 #endif /* alloca not defined */
326 #endif /* YYSTACK_USE_ALLOCA not defined */
327
328 #ifdef YYSTACK_USE_ALLOCA
329 #define YYSTACK_ALLOC alloca
330 #else
331 #define YYSTACK_ALLOC malloc
332 #endif
333
334 /* Note: there must be only one dollar sign in this file.
335 It is replaced by the list of actions, each action
336 as one case of the switch. */
337 mike 1.2
338 #define yyerrok (yyerrstatus = 0)
339 #define yyclearin (yychar = YYEMPTY)
340 #define YYEMPTY -2
341 #define YYEOF 0
342 #define YYACCEPT goto yyacceptlab
343 #define YYABORT goto yyabortlab
344 #define YYERROR goto yyerrlab1
345 /* Like YYERROR except do call yyerror.
346 This remains here temporarily to ease the
347 transition to the new meaning of YYERROR, for GCC.
348 Once GCC version 2 has supplanted version 1, this can go. */
349 #define YYFAIL goto yyerrlab
350 #define YYRECOVERING() (!!yyerrstatus)
351 #define YYBACKUP(token, value) \
352 do \
353 if (yychar == YYEMPTY && yylen == 1) \
354 { yychar = (token), yylval = (value); \
355 yychar1 = YYTRANSLATE (yychar); \
356 YYPOPSTACK; \
357 goto yybackup; \
358 mike 1.2 } \
359 else \
360 { yyerror ("syntax error: cannot back up"); YYERROR; } \
361 while (0)
362
363 #define YYTERROR 1
364 #define YYERRCODE 256
365
366 #ifndef YYPURE
367 #define YYLEX yylex()
368 #endif
369
370 #ifdef YYPURE
371 #ifdef YYLSP_NEEDED
372 #ifdef YYLEX_PARAM
373 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
374 #else
375 #define YYLEX yylex(&yylval, &yylloc)
376 #endif
377 #else /* not YYLSP_NEEDED */
378 #ifdef YYLEX_PARAM
379 mike 1.2 #define YYLEX yylex(&yylval, YYLEX_PARAM)
380 #else
381 #define YYLEX yylex(&yylval)
382 #endif
383 #endif /* not YYLSP_NEEDED */
384 #endif
385
386 /* If nonreentrant, generate the variables here */
387
388 #ifndef YYPURE
389
390 int yychar; /* the lookahead symbol */
391 YYSTYPE yylval; /* the semantic value of the */
392 /* lookahead symbol */
393
394 #ifdef YYLSP_NEEDED
395 YYLTYPE yylloc; /* location data for the lookahead */
396 /* symbol */
397 #endif
398
399 int yynerrs; /* number of parse errors so far */
400 mike 1.2 #endif /* not YYPURE */
401
402 #if YYDEBUG != 0
403 int yydebug; /* nonzero means print parse trace */
404 /* Since this is uninitialized, it does not stop multiple parsers
405 from coexisting. */
406 #endif
407
408 /* YYINITDEPTH indicates the initial size of the parser's stacks */
409
410 #ifndef YYINITDEPTH
411 #define YYINITDEPTH 200
412 #endif
413
414 /* YYMAXDEPTH is the maximum size the stacks can grow to
415 (effective only if the built-in stack extension method is used). */
416
417 #if YYMAXDEPTH == 0
418 #undef YYMAXDEPTH
419 #endif
420
421 mike 1.2 #ifndef YYMAXDEPTH
422 #define YYMAXDEPTH 10000
423 #endif
424
425 /* Define __yy_memcpy. Note that the size argument
426 should be passed with type unsigned int, because that is what the non-GCC
427 definitions require. With GCC, __builtin_memcpy takes an arg
428 of type size_t, but it can handle unsigned int. */
429
430 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
431 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
432 #else /* not GNU C or C++ */
433 #ifndef __cplusplus
434
435 /* This is the most reliable way to avoid incompatibilities
436 in available built-in functions on various systems. */
437 static void
438 __yy_memcpy (to, from, count)
439 char *to;
440 char *from;
441 unsigned int count;
442 mike 1.2 {
443 register char *f = from;
444 register char *t = to;
445 register int i = count;
446
447 while (i-- > 0)
448 *t++ = *f++;
449 }
450
451 #else /* __cplusplus */
452
453 /* This is the most reliable way to avoid incompatibilities
454 in available built-in functions on various systems. */
455 static void
456 __yy_memcpy (char *to, char *from, unsigned int count)
457 {
458 register char *t = to;
459 register char *f = from;
460 register int i = count;
461
462 while (i-- > 0)
463 mike 1.2 *t++ = *f++;
464 }
465
466 #endif
467 #endif
468
469 #line 217 "bison.simple"
470
471 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
472 into yyparse. The argument should have type void *.
473 It should actually point to an object.
474 Grammar actions can access the variable by casting it
475 to the proper pointer type. */
476
477 #ifdef YYPARSE_PARAM
478 #ifdef __cplusplus
479 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
480 #define YYPARSE_PARAM_DECL
481 #else /* not __cplusplus */
482 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
483 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
484 mike 1.2 #endif /* not __cplusplus */
485 #else /* not YYPARSE_PARAM */
486 #define YYPARSE_PARAM_ARG
487 #define YYPARSE_PARAM_DECL
488 #endif /* not YYPARSE_PARAM */
489
490 /* Prevent warning if -Wstrict-prototypes. */
491 #ifdef __GNUC__
492 #ifdef YYPARSE_PARAM
493 int yyparse (void *);
494 #else
495 int yyparse (void);
496 #endif
497 #endif
498
499 int
500 yyparse(YYPARSE_PARAM_ARG)
501 YYPARSE_PARAM_DECL
502 {
503 register int yystate;
504 register int yyn;
505 mike 1.2 register short *yyssp;
506 register YYSTYPE *yyvsp;
507 int yyerrstatus; /* number of tokens to shift before error messages enabled */
508 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
509
510 short yyssa[YYINITDEPTH]; /* the state stack */
511 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
512
513 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
514 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
515
516 #ifdef YYLSP_NEEDED
517 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
518 YYLTYPE *yyls = yylsa;
519 YYLTYPE *yylsp;
520
521 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
522 #else
523 #define YYPOPSTACK (yyvsp--, yyssp--)
524 #endif
525
526 mike 1.2 int yystacksize = YYINITDEPTH;
527 int yyfree_stacks = 0;
528
529 #ifdef YYPURE
530 int yychar;
531 YYSTYPE yylval;
532 int yynerrs;
533 #ifdef YYLSP_NEEDED
534 YYLTYPE yylloc;
535 #endif
536 #endif
537
538 YYSTYPE yyval; /* the variable used to return */
539 /* semantic values from the action */
540 /* routines */
541
542 int yylen;
543
544 #if YYDEBUG != 0
545 if (yydebug)
546 fprintf(stderr, "Starting parse\n");
547 mike 1.2 #endif
548
549 yystate = 0;
550 yyerrstatus = 0;
551 yynerrs = 0;
552 yychar = YYEMPTY; /* Cause a token to be read. */
553
554 /* Initialize stack pointers.
555 Waste one element of value and location stack
556 so that they stay on the same level as the state stack.
557 The wasted elements are never initialized. */
558
559 yyssp = yyss - 1;
560 yyvsp = yyvs;
561 #ifdef YYLSP_NEEDED
562 yylsp = yyls;
563 #endif
564
565 /* Push a new state, which is found in yystate . */
566 /* In all cases, when you get here, the value and location stacks
567 have just been pushed. so pushing a state here evens the stacks. */
568 mike 1.2 yynewstate:
569
570 *++yyssp = yystate;
571
572 if (yyssp >= yyss + yystacksize - 1)
573 {
574 /* Give user a chance to reallocate the stack */
575 /* Use copies of these so that the &'s don't force the real ones into memory. */
576 YYSTYPE *yyvs1 = yyvs;
577 short *yyss1 = yyss;
578 #ifdef YYLSP_NEEDED
579 YYLTYPE *yyls1 = yyls;
580 #endif
581
582 /* Get the current used size of the three stacks, in elements. */
583 int size = yyssp - yyss + 1;
584
585 #ifdef yyoverflow
586 /* Each stack pointer address is followed by the size of
587 the data in use in that stack, in bytes. */
588 #ifdef YYLSP_NEEDED
589 mike 1.2 /* This used to be a conditional around just the two extra args,
590 but that might be undefined if yyoverflow is a macro. */
591 yyoverflow("parser stack overflow",
592 &yyss1, size * sizeof (*yyssp),
593 &yyvs1, size * sizeof (*yyvsp),
594 &yyls1, size * sizeof (*yylsp),
595 &yystacksize);
596 #else
597 yyoverflow("parser stack overflow",
598 &yyss1, size * sizeof (*yyssp),
599 &yyvs1, size * sizeof (*yyvsp),
600 &yystacksize);
601 #endif
602
603 yyss = yyss1; yyvs = yyvs1;
604 #ifdef YYLSP_NEEDED
605 yyls = yyls1;
606 #endif
607 #else /* no yyoverflow */
608 /* Extend the stack our own way. */
609 if (yystacksize >= YYMAXDEPTH)
610 mike 1.2 {
611 yyerror("parser stack overflow");
612 if (yyfree_stacks)
613 {
614 free (yyss);
615 free (yyvs);
616 #ifdef YYLSP_NEEDED
617 free (yyls);
618 #endif
619 }
620 return 2;
621 }
622 yystacksize *= 2;
623 if (yystacksize > YYMAXDEPTH)
624 yystacksize = YYMAXDEPTH;
625 #ifndef YYSTACK_USE_ALLOCA
626 yyfree_stacks = 1;
627 #endif
628 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
629 __yy_memcpy ((char *)yyss, (char *)yyss1,
630 size * (unsigned int) sizeof (*yyssp));
631 mike 1.2 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
632 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
633 size * (unsigned int) sizeof (*yyvsp));
634 #ifdef YYLSP_NEEDED
635 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
636 __yy_memcpy ((char *)yyls, (char *)yyls1,
637 size * (unsigned int) sizeof (*yylsp));
638 #endif
639 #endif /* no yyoverflow */
640
641 yyssp = yyss + size - 1;
642 yyvsp = yyvs + size - 1;
643 #ifdef YYLSP_NEEDED
644 yylsp = yyls + size - 1;
645 #endif
646
647 #if YYDEBUG != 0
648 if (yydebug)
649 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
650 #endif
651
652 mike 1.2 if (yyssp >= yyss + yystacksize - 1)
653 YYABORT;
654 }
655
656 #if YYDEBUG != 0
657 if (yydebug)
658 fprintf(stderr, "Entering state %d\n", yystate);
659 #endif
660
661 goto yybackup;
662 yybackup:
663
664 /* Do appropriate processing given the current state. */
665 /* Read a lookahead token if we need one and don't already have one. */
666 /* yyresume: */
667
668 /* First try to decide what to do without reference to lookahead token. */
669
670 yyn = yypact[yystate];
671 if (yyn == YYFLAG)
672 goto yydefault;
673 mike 1.2
674 /* Not known => get a lookahead token if don't already have one. */
675
676 /* yychar is either YYEMPTY or YYEOF
677 or a valid token in external form. */
678
679 if (yychar == YYEMPTY)
680 {
681 #if YYDEBUG != 0
682 if (yydebug)
683 fprintf(stderr, "Reading a token: ");
684 #endif
685 yychar = YYLEX;
686 }
687
688 /* Convert token to internal form (in yychar1) for indexing tables with */
689
690 if (yychar <= 0) /* This means end of input. */
691 {
692 yychar1 = 0;
693 yychar = YYEOF; /* Don't call YYLEX any more */
694 mike 1.2
695 #if YYDEBUG != 0
696 if (yydebug)
697 fprintf(stderr, "Now at end of input.\n");
698 #endif
699 }
700 else
701 {
702 yychar1 = YYTRANSLATE(yychar);
703
704 #if YYDEBUG != 0
705 if (yydebug)
706 {
707 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
708 /* Give the individual parser a way to print the precise meaning
709 of a token, for further debugging info. */
710 #ifdef YYPRINT
711 YYPRINT (stderr, yychar, yylval);
712 #endif
713 fprintf (stderr, ")\n");
714 }
715 mike 1.2 #endif
716 }
717
718 yyn += yychar1;
719 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
720 goto yydefault;
721
722 yyn = yytable[yyn];
723
724 /* yyn is what to do for this token type in this state.
725 Negative => reduce, -yyn is rule number.
726 Positive => shift, yyn is new state.
727 New state is final state => don't bother to shift,
728 just return success.
729 0, or most negative number => error. */
730
731 if (yyn < 0)
732 {
733 if (yyn == YYFLAG)
734 goto yyerrlab;
735 yyn = -yyn;
736 mike 1.2 goto yyreduce;
737 }
738 else if (yyn == 0)
739 goto yyerrlab;
740
741 if (yyn == YYFINAL)
742 YYACCEPT;
743
744 /* Shift the lookahead token. */
745
746 #if YYDEBUG != 0
747 if (yydebug)
748 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
749 #endif
750
751 /* Discard the token being shifted unless it is eof. */
752 if (yychar != YYEOF)
753 yychar = YYEMPTY;
754
755 *++yyvsp = yylval;
756 #ifdef YYLSP_NEEDED
757 mike 1.2 *++yylsp = yylloc;
758 #endif
759
760 /* count tokens shifted since error; after three, turn off error status. */
761 if (yyerrstatus) yyerrstatus--;
762
763 yystate = yyn;
764 goto yynewstate;
765
766 /* Do the default action for the current state. */
767 yydefault:
768
769 yyn = yydefact[yystate];
770 if (yyn == 0)
771 goto yyerrlab;
772
773 /* Do a reduction. yyn is the number of a rule to reduce with. */
774 yyreduce:
775 yylen = yyr2[yyn];
776 if (yylen > 0)
777 yyval = yyvsp[1-yylen]; /* implement default value of the action */
778 mike 1.2
779 #if YYDEBUG != 0
780 if (yydebug)
781 {
782 int i;
783
784 fprintf (stderr, "Reducing via rule %d (line %d), ",
785 yyn, yyrline[yyn]);
786
787 /* Print the symbols being reduced, and their result. */
788 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
789 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
790 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
791 }
792 #endif
793
794
795 switch (yyn) {
796
797 case 1:
798 #line 131 "wql.y"
799 mike 1.2 {
800 WQL_TRACE(("YACC: start\n"));
801 ;
802 break;}
803 case 2:
804 #line 137 "wql.y"
805 {
806
807 ;
808 break;}
809 case 3:
810 #line 143 "wql.y"
811 {
812 globalParserState->statement->appendSelectPropertyName("*");
813 ;
814 break;}
815 case 4:
816 #line 147 "wql.y"
817 {
818
819 ;
820 mike 1.2 break;}
821 case 5:
822 #line 153 "wql.y"
823 {
824 globalParserState->statement->appendSelectPropertyName(yyvsp[0].strValue);
825 ;
826 break;}
827 case 6:
828 #line 157 "wql.y"
829 {
830 globalParserState->statement->appendSelectPropertyName(yyvsp[0].strValue);
831 ;
832 break;}
833 case 7:
834 #line 163 "wql.y"
835 {
836
837 ;
838 break;}
839 case 8:
840 #line 167 "wql.y"
841 mike 1.2 {
842
843 ;
844 break;}
845 case 9:
846 #line 173 "wql.y"
847 {
848 WQL_TRACE(("YACC: fromClause: TOK_FROM className(%s)\n", yyvsp[0].strValue));
849 globalParserState->statement->setClassName(yyvsp[0].strValue);
850 ;
851 break;}
852 case 10:
853 #line 180 "wql.y"
854 {
855
856 ;
857 break;}
858 case 11:
859 #line 186 "wql.y"
860 {
861 WQL_TRACE(("YACC: TOK_OR\n"));
862 mike 1.2 globalParserState->statement->appendOperation(WQL_OR);
863 ;
864 break;}
865 case 12:
866 #line 191 "wql.y"
867 {
868 WQL_TRACE(("YACC: TOK_AND\n"));
869 globalParserState->statement->appendOperation(WQL_AND);
870 ;
871 break;}
872 case 13:
873 #line 196 "wql.y"
874 {
875 WQL_TRACE(("YACC: TOK_NOT\n"));
876
877 globalParserState->statement->appendOperation(WQL_NOT);
878 ;
879 break;}
880 case 14:
881 #line 202 "wql.y"
882 {
883 mike 1.2
884 ;
885 break;}
886 case 15:
887 #line 206 "wql.y"
888 {
889
890 ;
891 break;}
892 case 16:
893 #line 210 "wql.y"
894 {
895 WQLOperation op = yyvsp[0].intValue ? WQL_IS_TRUE : WQL_IS_FALSE;
896 globalParserState->statement->appendOperation(op);
897 ;
898 break;}
899 case 17:
900 #line 215 "wql.y"
901 {
902 WQLOperation op = yyvsp[0].intValue ? WQL_IS_NOT_TRUE : WQL_IS_NOT_FALSE;
903 globalParserState->statement->appendOperation(op);
904 mike 1.2 ;
905 break;}
906 case 18:
907 #line 224 "wql.y"
908 {
909
910 ;
911 break;}
912 case 19:
913 #line 228 "wql.y"
914 {
915
916 ;
917 break;}
918 case 20:
919 #line 234 "wql.y"
920 {
921 WQL_TRACE(("YACC: TOK_LT\n"));
922 globalParserState->statement->appendOperation(WQL_LT);
923 ;
924 break;}
925 mike 1.2 case 21:
926 #line 239 "wql.y"
927 {
928 WQL_TRACE(("YACC: TOK_GT\n"));
929 globalParserState->statement->appendOperation(WQL_GT);
930 ;
931 break;}
932 case 22:
933 #line 244 "wql.y"
934 {
935 WQL_TRACE(("YACC: TOK_LE\n"));
936 globalParserState->statement->appendOperation(WQL_LE);
937 ;
938 break;}
939 case 23:
940 #line 249 "wql.y"
941 {
942 WQL_TRACE(("YACC: TOK_GE\n"));
943 globalParserState->statement->appendOperation(WQL_GE);
944 ;
945 break;}
946 mike 1.2 case 24:
947 #line 254 "wql.y"
948 {
949 WQL_TRACE(("YACC: TOK_EQ\n"));
950 globalParserState->statement->appendOperation(WQL_EQ);
951 ;
952 break;}
953 case 25:
954 #line 259 "wql.y"
955 {
956 WQL_TRACE(("YACC: TOK_NE\n"));
957 globalParserState->statement->appendOperation(WQL_NE);
958 ;
959 break;}
960 case 26:
961 #line 266 "wql.y"
962 {
963 WQL_TRACE(("YACC: nullPredicate : comparisonTerm IS NULL\n"));
964 globalParserState->statement->appendOperation(WQL_IS_NULL);
965 ;
966 break;}
967 mike 1.2 case 27:
968 #line 271 "wql.y"
969 {
970 WQL_TRACE(("YACC: nullPredicate : comparisonTerm IS NOT NULL\n"));
971 globalParserState->statement->appendOperation(WQL_IS_NOT_NULL);
972 ;
973 break;}
974 case 28:
975 #line 278 "wql.y"
976 {
977 yyval.intValue = 1;
978 ;
979 break;}
980 case 29:
981 #line 282 "wql.y"
982 {
983 yyval.intValue = 0;
984 ;
985 break;}
986 case 30:
987 #line 288 "wql.y"
988 mike 1.2 {
989 WQL_TRACE(("YACC: propertyName : TOK_IDENTIFIER(%s)\n", yyvsp[0].strValue));
990 yyval.strValue = yyvsp[0].strValue;
991 ;
992 break;}
993 case 31:
994 #line 294 "wql.y"
995 {
996 WQL_TRACE(("YACC: TOK_IDENTIFIER %s\n", yyvsp[0].strValue));
997 yyval.strValue = yyvsp[0].strValue;
998 ;
999 break;}
1000 case 32:
1001 #line 301 "wql.y"
1002 {
1003 globalParserState->statement->appendOperand(
1004 WQLOperand(yyvsp[0].strValue, WQL_PROPERTY_NAME_TAG));
1005 globalParserState->statement->appendWherePropertyName(yyvsp[0].strValue);
1006 ;
1007 break;}
1008 case 33:
1009 mike 1.2 #line 307 "wql.y"
1010 {
1011 globalParserState->statement->appendOperand(
1012 WQLOperand(yyvsp[0].intValue, WQL_INTEGER_VALUE_TAG));
1013 ;
1014 break;}
1015 case 34:
1016 #line 312 "wql.y"
1017 {
1018 globalParserState->statement->appendOperand(
1019 WQLOperand(yyvsp[0].doubleValue, WQL_DOUBLE_VALUE_TAG));
1020 ;
1021 break;}
1022 case 35:
1023 #line 317 "wql.y"
1024 {
1025 globalParserState->statement->appendOperand(
1026 WQLOperand(yyvsp[0].strValue, WQL_STRING_VALUE_TAG));
1027 ;
1028 break;}
1029 case 36:
1030 mike 1.2 #line 322 "wql.y"
1031 {
1032 globalParserState->statement->appendOperand(
1033 WQLOperand(yyvsp[0].intValue != 0, WQL_BOOLEAN_VALUE_TAG));
1034 ;
1035 break;}
1036 }
1037 /* the action file gets copied in in place of this dollarsign */
1038 #line 543 "bison.simple"
1039
1040 yyvsp -= yylen;
1041 yyssp -= yylen;
1042 #ifdef YYLSP_NEEDED
1043 yylsp -= yylen;
1044 #endif
1045
1046 #if YYDEBUG != 0
1047 if (yydebug)
1048 {
1049 short *ssp1 = yyss - 1;
1050 fprintf (stderr, "state stack now");
1051 mike 1.2 while (ssp1 != yyssp)
1052 fprintf (stderr, " %d", *++ssp1);
1053 fprintf (stderr, "\n");
1054 }
1055 #endif
1056
1057 *++yyvsp = yyval;
1058
1059 #ifdef YYLSP_NEEDED
1060 yylsp++;
1061 if (yylen == 0)
1062 {
1063 yylsp->first_line = yylloc.first_line;
1064 yylsp->first_column = yylloc.first_column;
1065 yylsp->last_line = (yylsp-1)->last_line;
1066 yylsp->last_column = (yylsp-1)->last_column;
1067 yylsp->text = 0;
1068 }
1069 else
1070 {
1071 yylsp->last_line = (yylsp+yylen-1)->last_line;
1072 mike 1.2 yylsp->last_column = (yylsp+yylen-1)->last_column;
1073 }
1074 #endif
1075
1076 /* Now "shift" the result of the reduction.
1077 Determine what state that goes to,
1078 based on the state we popped back to
1079 and the rule number reduced by. */
1080
1081 yyn = yyr1[yyn];
1082
1083 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1084 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1085 yystate = yytable[yystate];
1086 else
1087 yystate = yydefgoto[yyn - YYNTBASE];
1088
1089 goto yynewstate;
1090
1091 yyerrlab: /* here on detecting error */
1092
1093 mike 1.2 if (! yyerrstatus)
1094 /* If not already recovering from an error, report this error. */
1095 {
1096 ++yynerrs;
1097
1098 #ifdef YYERROR_VERBOSE
1099 yyn = yypact[yystate];
1100
1101 if (yyn > YYFLAG && yyn < YYLAST)
1102 {
1103 int size = 0;
1104 char *msg;
1105 int x, count;
1106
1107 count = 0;
1108 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
1109 for (x = (yyn < 0 ? -yyn : 0);
1110 x < (sizeof(yytname) / sizeof(char *)); x++)
1111 if (yycheck[x + yyn] == x)
1112 size += strlen(yytname[x]) + 15, count++;
1113 msg = (char *) malloc(size + 15);
1114 mike 1.2 if (msg != 0)
1115 {
1116 strcpy(msg, "parse error");
1117
1118 if (count < 5)
1119 {
1120 count = 0;
1121 for (x = (yyn < 0 ? -yyn : 0);
1122 x < (sizeof(yytname) / sizeof(char *)); x++)
1123 if (yycheck[x + yyn] == x)
1124 {
1125 strcat(msg, count == 0 ? ", expecting `" : " or `");
1126 strcat(msg, yytname[x]);
1127 strcat(msg, "'");
1128 count++;
1129 }
1130 }
1131 yyerror(msg);
1132 free(msg);
1133 }
1134 else
1135 mike 1.2 yyerror ("parse error; also virtual memory exceeded");
1136 }
1137 else
1138 #endif /* YYERROR_VERBOSE */
1139 yyerror("parse error");
1140 }
1141
1142 goto yyerrlab1;
1143 yyerrlab1: /* here on error raised explicitly by an action */
1144
1145 if (yyerrstatus == 3)
1146 {
1147 /* if just tried and failed to reuse lookahead token after an error, discard it. */
1148
1149 /* return failure if at end of input */
1150 if (yychar == YYEOF)
1151 YYABORT;
1152
1153 #if YYDEBUG != 0
1154 if (yydebug)
1155 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
1156 mike 1.2 #endif
1157
1158 yychar = YYEMPTY;
1159 }
1160
1161 /* Else will try to reuse lookahead token
1162 after shifting the error token. */
1163
1164 yyerrstatus = 3; /* Each real token shifted decrements this */
1165
1166 goto yyerrhandle;
1167
1168 yyerrdefault: /* current state does not do anything special for the error token. */
1169
1170 #if 0
1171 /* This is wrong; only states that explicitly want error tokens
1172 should shift them. */
1173 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
1174 if (yyn) goto yydefault;
1175 #endif
1176
1177 mike 1.2 yyerrpop: /* pop the current state because it cannot handle the error token */
1178
1179 if (yyssp == yyss) YYABORT;
1180 yyvsp--;
1181 yystate = *--yyssp;
1182 #ifdef YYLSP_NEEDED
1183 yylsp--;
1184 #endif
1185
1186 #if YYDEBUG != 0
1187 if (yydebug)
1188 {
1189 short *ssp1 = yyss - 1;
1190 fprintf (stderr, "Error: state stack now");
1191 while (ssp1 != yyssp)
1192 fprintf (stderr, " %d", *++ssp1);
1193 fprintf (stderr, "\n");
1194 }
1195 #endif
1196
1197 yyerrhandle:
1198 mike 1.2
1199 yyn = yypact[yystate];
1200 if (yyn == YYFLAG)
1201 goto yyerrdefault;
1202
1203 yyn += YYTERROR;
1204 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1205 goto yyerrdefault;
1206
1207 yyn = yytable[yyn];
1208 if (yyn < 0)
1209 {
1210 if (yyn == YYFLAG)
1211 goto yyerrpop;
1212 yyn = -yyn;
1213 goto yyreduce;
1214 }
1215 else if (yyn == 0)
1216 goto yyerrpop;
1217
1218 if (yyn == YYFINAL)
1219 mike 1.2 YYACCEPT;
1220
1221 #if YYDEBUG != 0
1222 if (yydebug)
1223 fprintf(stderr, "Shifting error token, ");
1224 #endif
1225
1226 *++yyvsp = yylval;
1227 #ifdef YYLSP_NEEDED
1228 *++yylsp = yylloc;
1229 #endif
1230
1231 yystate = yyn;
1232 goto yynewstate;
1233
1234 yyacceptlab:
1235 /* YYACCEPT comes here. */
1236 if (yyfree_stacks)
1237 {
1238 free (yyss);
1239 free (yyvs);
1240 mike 1.2 #ifdef YYLSP_NEEDED
1241 free (yyls);
1242 #endif
1243 }
1244 return 0;
1245
1246 yyabortlab:
1247 /* YYABORT comes here. */
1248 if (yyfree_stacks)
1249 {
1250 free (yyss);
1251 free (yyvs);
1252 #ifdef YYLSP_NEEDED
1253 free (yyls);
1254 #endif
1255 }
1256 return 1;
1257 }
1258 #line 327 "wql.y"
1259
|