[WBEMPROX]
[reactos.git] / reactos / dll / win32 / wbemprox / wql.tab.c
1 /* A Bison parser, made by GNU Bison 2.5. */
2
3 /* Bison implementation for Yacc-like parsers in C
4
5 Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
6
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
20 /* As a special exception, you may create a larger work that contains
21 part or all of the Bison parser skeleton and distribute that work
22 under terms of your choice, so long as that work isn't itself a
23 parser generator using the skeleton or a modified version thereof
24 as a parser skeleton. Alternatively, if you modify or redistribute
25 the parser skeleton itself, you may (at your option) remove this
26 special exception, which will cause the skeleton and the resulting
27 Bison output files to be licensed under the GNU General Public
28 License without this special exception.
29
30 This special exception was added by the Free Software Foundation in
31 version 2.2 of Bison. */
32
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34 simplifying the original so-called "semantic" parser. */
35
36 /* All symbols defined below should begin with yy or YY, to avoid
37 infringing on user name space. This should be done even for local
38 variables, as they might otherwise be expanded by user macros.
39 There are some unavoidable exceptions within include files to
40 define necessary library symbols; they are noted "INFRINGES ON
41 USER NAME SPACE" below. */
42
43 /* Identify Bison output. */
44 #define YYBISON 1
45
46 /* Bison version. */
47 #define YYBISON_VERSION "2.5"
48
49 /* Skeleton name. */
50 #define YYSKELETON_NAME "yacc.c"
51
52 /* Pure parsers. */
53 #define YYPURE 1
54
55 /* Push parsers. */
56 #define YYPUSH 0
57
58 /* Pull parsers. */
59 #define YYPULL 1
60
61 /* Using locations. */
62 #define YYLSP_NEEDED 0
63
64 /* Substitute the variable and function names. */
65 #define yyparse wql_parse
66 #define yylex wql_lex
67 #define yyerror wql_error
68 #define yylval wql_lval
69 #define yychar wql_char
70 #define yydebug wql_debug
71 #define yynerrs wql_nerrs
72
73
74 /* Copy the first part of user declarations. */
75
76 /* Line 268 of yacc.c */
77 #line 1 "wql.y"
78
79
80 /*
81 * Copyright 2012 Hans Leidekker for CodeWeavers
82 *
83 * This library is free software; you can redistribute it and/or
84 * modify it under the terms of the GNU Lesser General Public
85 * License as published by the Free Software Foundation; either
86 * version 2.1 of the License, or (at your option) any later version.
87 *
88 * This library is distributed in the hope that it will be useful,
89 * but WITHOUT ANY WARRANTY; without even the implied warranty of
90 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
91 * Lesser General Public License for more details.
92 *
93 * You should have received a copy of the GNU Lesser General Public
94 * License along with this library; if not, write to the Free Software
95 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
96 */
97
98 #include "wbemprox_private.h"
99
100 struct parser
101 {
102 const WCHAR *cmd;
103 UINT idx;
104 UINT len;
105 HRESULT error;
106 struct view **view;
107 struct list *mem;
108 };
109
110 struct string
111 {
112 const WCHAR *data;
113 int len;
114 };
115
116 static void *alloc_mem( struct parser *parser, UINT size )
117 {
118 struct list *mem = heap_alloc( sizeof(struct list) + size );
119 list_add_tail( parser->mem, mem );
120 return &mem[1];
121 }
122
123 static struct property *alloc_property( struct parser *parser, const WCHAR *class, const WCHAR *name )
124 {
125 struct property *prop = alloc_mem( parser, sizeof(*prop) );
126 if (prop)
127 {
128 prop->name = name;
129 prop->class = class;
130 prop->next = NULL;
131 }
132 return prop;
133 }
134
135 static WCHAR *get_string( struct parser *parser, const struct string *str )
136 {
137 const WCHAR *p = str->data;
138 int len = str->len;
139 WCHAR *ret;
140
141 if ((p[0] == '\"' && p[len - 1] != '\"') ||
142 (p[0] == '\'' && p[len - 1] != '\'')) return NULL;
143 if ((p[0] == '\"' && p[len - 1] == '\"') ||
144 (p[0] == '\'' && p[len - 1] == '\''))
145 {
146 p++;
147 len -= 2;
148 }
149 if (!(ret = alloc_mem( parser, (len + 1) * sizeof(WCHAR) ))) return NULL;
150 memcpy( ret, p, len * sizeof(WCHAR) );
151 ret[len] = 0;
152 return ret;
153 }
154
155 static int get_int( struct parser *parser )
156 {
157 const WCHAR *p = &parser->cmd[parser->idx];
158 int i, ret = 0;
159
160 for (i = 0; i < parser->len; i++)
161 {
162 if (p[i] < '0' || p[i] > '9')
163 {
164 ERR("should only be numbers here!\n");
165 break;
166 }
167 ret = (p[i] - '0') + ret * 10;
168 }
169 return ret;
170 }
171
172 static struct expr *expr_complex( struct parser *parser, struct expr *l, UINT op, struct expr *r )
173 {
174 struct expr *e = alloc_mem( parser, sizeof(*e) );
175 if (e)
176 {
177 e->type = EXPR_COMPLEX;
178 e->u.expr.left = l;
179 e->u.expr.op = op;
180 e->u.expr.right = r;
181 }
182 return e;
183 }
184
185 static struct expr *expr_unary( struct parser *parser, struct expr *l, UINT op )
186 {
187 struct expr *e = alloc_mem( parser, sizeof(*e) );
188 if (e)
189 {
190 e->type = EXPR_UNARY;
191 e->u.expr.left = l;
192 e->u.expr.op = op;
193 e->u.expr.right = NULL;
194 }
195 return e;
196 }
197
198 static struct expr *expr_ival( struct parser *parser, int val )
199 {
200 struct expr *e = alloc_mem( parser, sizeof *e );
201 if (e)
202 {
203 e->type = EXPR_IVAL;
204 e->u.ival = val;
205 }
206 return e;
207 }
208
209 static struct expr *expr_sval( struct parser *parser, const struct string *str )
210 {
211 struct expr *e = alloc_mem( parser, sizeof *e );
212 if (e)
213 {
214 e->type = EXPR_SVAL;
215 e->u.sval = get_string( parser, str );
216 if (!e->u.sval)
217 return NULL; /* e will be freed by query destructor */
218 }
219 return e;
220 }
221
222 static struct expr *expr_bval( struct parser *parser, int val )
223 {
224 struct expr *e = alloc_mem( parser, sizeof *e );
225 if (e)
226 {
227 e->type = EXPR_BVAL;
228 e->u.ival = val;
229 }
230 return e;
231 }
232
233 static struct expr *expr_propval( struct parser *parser, const struct property *prop )
234 {
235 struct expr *e = alloc_mem( parser, sizeof *e );
236 if (e)
237 {
238 e->type = EXPR_PROPVAL;
239 e->u.propval = prop;
240 }
241 return e;
242 }
243
244 static int wql_error( struct parser *parser, const char *str );
245 static int wql_lex( void *val, struct parser *parser );
246
247 #define PARSER_BUBBLE_UP_VIEW( parser, result, current_view ) \
248 *parser->view = current_view; \
249 result = current_view
250
251
252
253 /* Line 268 of yacc.c */
254 #line 267 "wql.tab.c"
255
256 /* Enabling traces. */
257 #ifndef YYDEBUG
258 # define YYDEBUG 0
259 #endif
260
261 /* Enabling verbose error messages. */
262 #ifdef YYERROR_VERBOSE
263 # undef YYERROR_VERBOSE
264 # define YYERROR_VERBOSE 1
265 #else
266 # define YYERROR_VERBOSE 1
267 #endif
268
269 /* Enabling the token table. */
270 #ifndef YYTOKEN_TABLE
271 # define YYTOKEN_TABLE 0
272 #endif
273
274
275 /* Tokens. */
276 #ifndef YYTOKENTYPE
277 # define YYTOKENTYPE
278 /* Put the tokens into the symbol table, so that GDB and other debuggers
279 know about them. */
280 enum yytokentype {
281 TK_SELECT = 258,
282 TK_FROM = 259,
283 TK_STAR = 260,
284 TK_COMMA = 261,
285 TK_DOT = 262,
286 TK_IS = 263,
287 TK_LP = 264,
288 TK_RP = 265,
289 TK_NULL = 266,
290 TK_FALSE = 267,
291 TK_TRUE = 268,
292 TK_INTEGER = 269,
293 TK_WHERE = 270,
294 TK_SPACE = 271,
295 TK_MINUS = 272,
296 TK_ILLEGAL = 273,
297 TK_BY = 274,
298 TK_STRING = 275,
299 TK_ID = 276,
300 TK_OR = 277,
301 TK_AND = 278,
302 TK_NOT = 279,
303 TK_LIKE = 280,
304 TK_GE = 281,
305 TK_LE = 282,
306 TK_GT = 283,
307 TK_LT = 284,
308 TK_NE = 285,
309 TK_EQ = 286
310 };
311 #endif
312
313
314
315 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
316 typedef union YYSTYPE
317 {
318
319 /* Line 293 of yacc.c */
320 #line 194 "wql.y"
321
322 struct string str;
323 WCHAR *string;
324 struct property *proplist;
325 struct view *view;
326 struct expr *expr;
327 int integer;
328
329
330
331 /* Line 293 of yacc.c */
332 #line 345 "wql.tab.c"
333 } YYSTYPE;
334 # define YYSTYPE_IS_TRIVIAL 1
335 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
336 # define YYSTYPE_IS_DECLARED 1
337 #endif
338
339
340 /* Copy the second part of user declarations. */
341
342
343 /* Line 343 of yacc.c */
344 #line 357 "wql.tab.c"
345
346 #ifdef short
347 # undef short
348 #endif
349
350 #ifdef YYTYPE_UINT8
351 typedef YYTYPE_UINT8 yytype_uint8;
352 #else
353 typedef unsigned char yytype_uint8;
354 #endif
355
356 #ifdef YYTYPE_INT8
357 typedef YYTYPE_INT8 yytype_int8;
358 #elif (defined __STDC__ || defined __C99__FUNC__ \
359 || defined __cplusplus || defined _MSC_VER)
360 typedef signed char yytype_int8;
361 #else
362 typedef short int yytype_int8;
363 #endif
364
365 #ifdef YYTYPE_UINT16
366 typedef YYTYPE_UINT16 yytype_uint16;
367 #else
368 typedef unsigned short int yytype_uint16;
369 #endif
370
371 #ifdef YYTYPE_INT16
372 typedef YYTYPE_INT16 yytype_int16;
373 #else
374 typedef short int yytype_int16;
375 #endif
376
377 #ifndef YYSIZE_T
378 # ifdef __SIZE_TYPE__
379 # define YYSIZE_T __SIZE_TYPE__
380 # elif defined size_t
381 # define YYSIZE_T size_t
382 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
383 || defined __cplusplus || defined _MSC_VER)
384 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
385 # define YYSIZE_T size_t
386 # else
387 # define YYSIZE_T unsigned int
388 # endif
389 #endif
390
391 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
392
393 #ifndef YY_
394 # if defined YYENABLE_NLS && YYENABLE_NLS
395 # if ENABLE_NLS
396 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
397 # define YY_(msgid) dgettext ("bison-runtime", msgid)
398 # endif
399 # endif
400 # ifndef YY_
401 # define YY_(msgid) msgid
402 # endif
403 #endif
404
405 /* Suppress unused-variable warnings by "using" E. */
406 #if ! defined lint || defined __GNUC__
407 # define YYUSE(e) ((void) (e))
408 #else
409 # define YYUSE(e) /* empty */
410 #endif
411
412 /* Identity function, used to suppress warnings about constant conditions. */
413 #ifndef lint
414 # define YYID(n) (n)
415 #else
416 #if (defined __STDC__ || defined __C99__FUNC__ \
417 || defined __cplusplus || defined _MSC_VER)
418 static int
419 YYID (int yyi)
420 #else
421 static int
422 YYID (yyi)
423 int yyi;
424 #endif
425 {
426 return yyi;
427 }
428 #endif
429
430 #if ! defined yyoverflow || YYERROR_VERBOSE
431
432 /* The parser invokes alloca or malloc; define the necessary symbols. */
433
434 # ifdef YYSTACK_USE_ALLOCA
435 # if YYSTACK_USE_ALLOCA
436 # ifdef __GNUC__
437 # define YYSTACK_ALLOC __builtin_alloca
438 # elif defined __BUILTIN_VA_ARG_INCR
439 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
440 # elif defined _AIX
441 # define YYSTACK_ALLOC __alloca
442 # elif defined _MSC_VER
443 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
444 # define alloca _alloca
445 # else
446 # define YYSTACK_ALLOC alloca
447 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
448 || defined __cplusplus || defined _MSC_VER)
449 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
450 # ifndef EXIT_SUCCESS
451 # define EXIT_SUCCESS 0
452 # endif
453 # endif
454 # endif
455 # endif
456 # endif
457
458 # ifdef YYSTACK_ALLOC
459 /* Pacify GCC's `empty if-body' warning. */
460 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
461 # ifndef YYSTACK_ALLOC_MAXIMUM
462 /* The OS might guarantee only one guard page at the bottom of the stack,
463 and a page size can be as small as 4096 bytes. So we cannot safely
464 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
465 to allow for a few compiler-allocated temporary stack slots. */
466 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
467 # endif
468 # else
469 # define YYSTACK_ALLOC YYMALLOC
470 # define YYSTACK_FREE YYFREE
471 # ifndef YYSTACK_ALLOC_MAXIMUM
472 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
473 # endif
474 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
475 && ! ((defined YYMALLOC || defined malloc) \
476 && (defined YYFREE || defined free)))
477 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
478 # ifndef EXIT_SUCCESS
479 # define EXIT_SUCCESS 0
480 # endif
481 # endif
482 # ifndef YYMALLOC
483 # define YYMALLOC malloc
484 # if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
485 || defined __cplusplus || defined _MSC_VER)
486 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
487 # endif
488 # endif
489 # ifndef YYFREE
490 # define YYFREE free
491 # if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
492 || defined __cplusplus || defined _MSC_VER)
493 void free (void *); /* INFRINGES ON USER NAME SPACE */
494 # endif
495 # endif
496 # endif
497 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
498
499
500 #if (! defined yyoverflow \
501 && (! defined __cplusplus \
502 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
503
504 /* A type that is properly aligned for any stack member. */
505 union yyalloc
506 {
507 yytype_int16 yyss_alloc;
508 YYSTYPE yyvs_alloc;
509 };
510
511 /* The size of the maximum gap between one aligned stack and the next. */
512 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
513
514 /* The size of an array large to enough to hold all stacks, each with
515 N elements. */
516 # define YYSTACK_BYTES(N) \
517 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
518 + YYSTACK_GAP_MAXIMUM)
519
520 # define YYCOPY_NEEDED 1
521
522 /* Relocate STACK from its old location to the new one. The
523 local variables YYSIZE and YYSTACKSIZE give the old and new number of
524 elements in the stack, and YYPTR gives the new location of the
525 stack. Advance YYPTR to a properly aligned location for the next
526 stack. */
527 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
528 do \
529 { \
530 YYSIZE_T yynewbytes; \
531 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
532 Stack = &yyptr->Stack_alloc; \
533 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
534 yyptr += yynewbytes / sizeof (*yyptr); \
535 } \
536 while (YYID (0))
537
538 #endif
539
540 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
541 /* Copy COUNT objects from FROM to TO. The source and destination do
542 not overlap. */
543 # ifndef YYCOPY
544 # if defined __GNUC__ && 1 < __GNUC__
545 # define YYCOPY(To, From, Count) \
546 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
547 # else
548 # define YYCOPY(To, From, Count) \
549 do \
550 { \
551 YYSIZE_T yyi; \
552 for (yyi = 0; yyi < (Count); yyi++) \
553 (To)[yyi] = (From)[yyi]; \
554 } \
555 while (YYID (0))
556 # endif
557 # endif
558 #endif /* !YYCOPY_NEEDED */
559
560 /* YYFINAL -- State number of the termination state. */
561 #define YYFINAL 9
562 /* YYLAST -- Last index in YYTABLE. */
563 #define YYLAST 67
564
565 /* YYNTOKENS -- Number of terminals. */
566 #define YYNTOKENS 32
567 /* YYNNTS -- Number of nonterminals. */
568 #define YYNNTS 10
569 /* YYNRULES -- Number of rules. */
570 #define YYNRULES 35
571 /* YYNRULES -- Number of states. */
572 #define YYNSTATES 65
573
574 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
575 #define YYUNDEFTOK 2
576 #define YYMAXUTOK 286
577
578 #define YYTRANSLATE(YYX) \
579 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
580
581 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
582 static const yytype_uint8 yytranslate[] =
583 {
584 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
585 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
586 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
587 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
588 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
589 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
590 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
591 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
592 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
593 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
594 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
595 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
596 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
597 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
598 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
599 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
600 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
601 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
602 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
603 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
604 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
605 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
606 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
607 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
608 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
609 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
610 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
611 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
612 25, 26, 27, 28, 29, 30, 31
613 };
614
615 #if YYDEBUG
616 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
617 YYRHS. */
618 static const yytype_uint8 yyprhs[] =
619 {
620 0, 0, 3, 7, 12, 19, 21, 25, 27, 31,
621 33, 35, 37, 41, 45, 49, 53, 57, 61, 65,
622 69, 73, 77, 81, 85, 89, 93, 97, 101, 105,
623 110, 112, 114, 116, 118, 120
624 };
625
626 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
627 static const yytype_int8 yyrhs[] =
628 {
629 33, 0, -1, 3, 4, 36, -1, 3, 34, 4,
630 36, -1, 3, 34, 4, 36, 15, 38, -1, 35,
631 -1, 35, 6, 34, -1, 5, -1, 36, 7, 36,
632 -1, 36, -1, 21, -1, 14, -1, 9, 38, 10,
633 -1, 38, 23, 38, -1, 38, 22, 38, -1, 40,
634 31, 41, -1, 40, 28, 41, -1, 40, 29, 41,
635 -1, 40, 27, 41, -1, 40, 26, 41, -1, 40,
636 30, 41, -1, 41, 31, 40, -1, 41, 28, 40,
637 -1, 41, 29, 40, -1, 41, 27, 40, -1, 41,
638 26, 40, -1, 41, 30, 40, -1, 40, 25, 39,
639 -1, 40, 8, 11, -1, 40, 8, 24, 11, -1,
640 20, -1, 35, -1, 37, -1, 20, -1, 13, -1,
641 12, -1
642 };
643
644 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
645 static const yytype_uint16 yyrline[] =
646 {
647 0, 221, 221, 233, 245, 260, 261, 265, 272, 278,
648 287, 296, 303, 309, 315, 321, 327, 333, 339, 345,
649 351, 357, 363, 369, 375, 381, 387, 393, 399, 405,
650 414, 423, 432, 438, 444, 450
651 };
652 #endif
653
654 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
655 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
656 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
657 static const char *const yytname[] =
658 {
659 "$end", "error", "$undefined", "TK_SELECT", "TK_FROM", "TK_STAR",
660 "TK_COMMA", "TK_DOT", "TK_IS", "TK_LP", "TK_RP", "TK_NULL", "TK_FALSE",
661 "TK_TRUE", "TK_INTEGER", "TK_WHERE", "TK_SPACE", "TK_MINUS",
662 "TK_ILLEGAL", "TK_BY", "TK_STRING", "TK_ID", "TK_OR", "TK_AND", "TK_NOT",
663 "TK_LIKE", "TK_GE", "TK_LE", "TK_GT", "TK_LT", "TK_NE", "TK_EQ",
664 "$accept", "select", "proplist", "prop", "id", "number", "expr",
665 "string_val", "prop_val", "const_val", 0
666 };
667 #endif
668
669 # ifdef YYPRINT
670 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
671 token YYLEX-NUM. */
672 static const yytype_uint16 yytoknum[] =
673 {
674 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
675 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
676 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
677 285, 286
678 };
679 # endif
680
681 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
682 static const yytype_uint8 yyr1[] =
683 {
684 0, 32, 33, 33, 33, 34, 34, 34, 35, 35,
685 36, 37, 38, 38, 38, 38, 38, 38, 38, 38,
686 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
687 39, 40, 41, 41, 41, 41
688 };
689
690 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
691 static const yytype_uint8 yyr2[] =
692 {
693 0, 2, 3, 4, 6, 1, 3, 1, 3, 1,
694 1, 1, 3, 3, 3, 3, 3, 3, 3, 3,
695 3, 3, 3, 3, 3, 3, 3, 3, 3, 4,
696 1, 1, 1, 1, 1, 1
697 };
698
699 /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
700 Performed when YYTABLE doesn't specify something else to do. Zero
701 means the default is an error. */
702 static const yytype_uint8 yydefact[] =
703 {
704 0, 0, 0, 0, 7, 10, 0, 5, 9, 1,
705 2, 0, 0, 0, 3, 6, 8, 0, 0, 35,
706 34, 11, 33, 31, 32, 4, 0, 0, 0, 0,
707 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
708 0, 0, 0, 0, 0, 12, 14, 13, 28, 0,
709 30, 27, 19, 18, 16, 17, 20, 15, 25, 24,
710 22, 23, 26, 21, 29
711 };
712
713 /* YYDEFGOTO[NTERM-NUM]. */
714 static const yytype_int8 yydefgoto[] =
715 {
716 -1, 2, 6, 23, 8, 24, 25, 51, 26, 27
717 };
718
719 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
720 STATE-NUM. */
721 #define YYPACT_NINF -20
722 static const yytype_int8 yypact[] =
723 {
724 2, 3, 6, -10, -20, -20, 24, 31, 33, -20,
725 -20, -10, 4, -10, 26, -20, -20, 18, 18, -20,
726 -20, -20, -20, -20, -20, -19, -8, 20, -9, 18,
727 18, 5, 23, 22, 22, 22, 22, 22, 22, -10,
728 -10, -10, -10, -10, -10, -20, 41, -20, -20, 54,
729 -20, -20, -20, -20, -20, -20, -20, -20, -20, -20,
730 -20, -20, -20, -20, -20
731 };
732
733 /* YYPGOTO[NTERM-NUM]. */
734 static const yytype_int8 yypgoto[] =
735 {
736 -20, -20, 55, 14, -1, -20, 15, -20, 13, 25
737 };
738
739 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
740 positive, shift that token. If negative, reduce the rule which
741 number is the opposite. If YYTABLE_NINF, syntax error. */
742 #define YYTABLE_NINF -1
743 static const yytype_uint8 yytable[] =
744 {
745 31, 45, 10, 29, 30, 1, 9, 3, 4, 4,
746 14, 5, 16, 29, 30, 7, 48, 32, 33, 34,
747 35, 36, 37, 38, 5, 5, 7, 18, 11, 49,
748 19, 20, 21, 28, 19, 20, 21, 12, 22, 5,
749 13, 17, 22, 50, 46, 47, 39, 40, 41, 42,
750 43, 44, 58, 59, 60, 61, 62, 63, 52, 53,
751 54, 55, 56, 57, 30, 64, 0, 15
752 };
753
754 #define yypact_value_is_default(yystate) \
755 ((yystate) == (-20))
756
757 #define yytable_value_is_error(yytable_value) \
758 YYID (0)
759
760 static const yytype_int8 yycheck[] =
761 {
762 8, 10, 3, 22, 23, 3, 0, 4, 5, 5,
763 11, 21, 13, 22, 23, 1, 11, 25, 26, 27,
764 28, 29, 30, 31, 21, 21, 12, 9, 4, 24,
765 12, 13, 14, 18, 12, 13, 14, 6, 20, 21,
766 7, 15, 20, 20, 29, 30, 26, 27, 28, 29,
767 30, 31, 39, 40, 41, 42, 43, 44, 33, 34,
768 35, 36, 37, 38, 23, 11, -1, 12
769 };
770
771 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
772 symbol of state STATE-NUM. */
773 static const yytype_uint8 yystos[] =
774 {
775 0, 3, 33, 4, 5, 21, 34, 35, 36, 0,
776 36, 4, 6, 7, 36, 34, 36, 15, 9, 12,
777 13, 14, 20, 35, 37, 38, 40, 41, 38, 22,
778 23, 8, 25, 26, 27, 28, 29, 30, 31, 26,
779 27, 28, 29, 30, 31, 10, 38, 38, 11, 24,
780 20, 39, 41, 41, 41, 41, 41, 41, 40, 40,
781 40, 40, 40, 40, 11
782 };
783
784 #define yyerrok (yyerrstatus = 0)
785 #define yyclearin (yychar = YYEMPTY)
786 #define YYEMPTY (-2)
787 #define YYEOF 0
788
789 #define YYACCEPT goto yyacceptlab
790 #define YYABORT goto yyabortlab
791 #define YYERROR goto yyerrorlab
792
793
794 /* Like YYERROR except do call yyerror. This remains here temporarily
795 to ease the transition to the new meaning of YYERROR, for GCC.
796 Once GCC version 2 has supplanted version 1, this can go. However,
797 YYFAIL appears to be in use. Nevertheless, it is formally deprecated
798 in Bison 2.4.2's NEWS entry, where a plan to phase it out is
799 discussed. */
800
801 #define YYFAIL goto yyerrlab
802 #if defined YYFAIL
803 /* This is here to suppress warnings from the GCC cpp's
804 -Wunused-macros. Normally we don't worry about that warning, but
805 some users do, and we want to make it easy for users to remove
806 YYFAIL uses, which will produce warnings from Bison 2.5. */
807 #endif
808
809 #define YYRECOVERING() (!!yyerrstatus)
810
811 #define YYBACKUP(Token, Value) \
812 do \
813 if (yychar == YYEMPTY && yylen == 1) \
814 { \
815 yychar = (Token); \
816 yylval = (Value); \
817 YYPOPSTACK (1); \
818 goto yybackup; \
819 } \
820 else \
821 { \
822 yyerror (ctx, YY_("syntax error: cannot back up")); \
823 YYERROR; \
824 } \
825 while (YYID (0))
826
827
828 #define YYTERROR 1
829 #define YYERRCODE 256
830
831
832 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
833 If N is 0, then set CURRENT to the empty location which ends
834 the previous symbol: RHS[0] (always defined). */
835
836 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
837 #ifndef YYLLOC_DEFAULT
838 # define YYLLOC_DEFAULT(Current, Rhs, N) \
839 do \
840 if (YYID (N)) \
841 { \
842 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
843 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
844 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
845 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
846 } \
847 else \
848 { \
849 (Current).first_line = (Current).last_line = \
850 YYRHSLOC (Rhs, 0).last_line; \
851 (Current).first_column = (Current).last_column = \
852 YYRHSLOC (Rhs, 0).last_column; \
853 } \
854 while (YYID (0))
855 #endif
856
857
858 /* This macro is provided for backward compatibility. */
859
860 #ifndef YY_LOCATION_PRINT
861 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
862 #endif
863
864
865 /* YYLEX -- calling `yylex' with the right arguments. */
866
867 #ifdef YYLEX_PARAM
868 # define YYLEX yylex (&yylval, YYLEX_PARAM)
869 #else
870 # define YYLEX yylex (&yylval, ctx)
871 #endif
872
873 /* Enable debugging if requested. */
874 #if YYDEBUG
875
876 # ifndef YYFPRINTF
877 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
878 # define YYFPRINTF fprintf
879 # endif
880
881 # define YYDPRINTF(Args) \
882 do { \
883 if (yydebug) \
884 YYFPRINTF Args; \
885 } while (YYID (0))
886
887 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
888 do { \
889 if (yydebug) \
890 { \
891 YYFPRINTF (stderr, "%s ", Title); \
892 yy_symbol_print (stderr, \
893 Type, Value, ctx); \
894 YYFPRINTF (stderr, "\n"); \
895 } \
896 } while (YYID (0))
897
898
899 /*--------------------------------.
900 | Print this symbol on YYOUTPUT. |
901 `--------------------------------*/
902
903 /*ARGSUSED*/
904 #if (defined __STDC__ || defined __C99__FUNC__ \
905 || defined __cplusplus || defined _MSC_VER)
906 static void
907 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, struct parser *ctx)
908 #else
909 static void
910 yy_symbol_value_print (yyoutput, yytype, yyvaluep, ctx)
911 FILE *yyoutput;
912 int yytype;
913 YYSTYPE const * const yyvaluep;
914 struct parser *ctx;
915 #endif
916 {
917 if (!yyvaluep)
918 return;
919 YYUSE (ctx);
920 # ifdef YYPRINT
921 if (yytype < YYNTOKENS)
922 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
923 # else
924 YYUSE (yyoutput);
925 # endif
926 switch (yytype)
927 {
928 default:
929 break;
930 }
931 }
932
933
934 /*--------------------------------.
935 | Print this symbol on YYOUTPUT. |
936 `--------------------------------*/
937
938 #if (defined __STDC__ || defined __C99__FUNC__ \
939 || defined __cplusplus || defined _MSC_VER)
940 static void
941 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, struct parser *ctx)
942 #else
943 static void
944 yy_symbol_print (yyoutput, yytype, yyvaluep, ctx)
945 FILE *yyoutput;
946 int yytype;
947 YYSTYPE const * const yyvaluep;
948 struct parser *ctx;
949 #endif
950 {
951 if (yytype < YYNTOKENS)
952 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
953 else
954 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
955
956 yy_symbol_value_print (yyoutput, yytype, yyvaluep, ctx);
957 YYFPRINTF (yyoutput, ")");
958 }
959
960 /*------------------------------------------------------------------.
961 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
962 | TOP (included). |
963 `------------------------------------------------------------------*/
964
965 #if (defined __STDC__ || defined __C99__FUNC__ \
966 || defined __cplusplus || defined _MSC_VER)
967 static void
968 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
969 #else
970 static void
971 yy_stack_print (yybottom, yytop)
972 yytype_int16 *yybottom;
973 yytype_int16 *yytop;
974 #endif
975 {
976 YYFPRINTF (stderr, "Stack now");
977 for (; yybottom <= yytop; yybottom++)
978 {
979 int yybot = *yybottom;
980 YYFPRINTF (stderr, " %d", yybot);
981 }
982 YYFPRINTF (stderr, "\n");
983 }
984
985 # define YY_STACK_PRINT(Bottom, Top) \
986 do { \
987 if (yydebug) \
988 yy_stack_print ((Bottom), (Top)); \
989 } while (YYID (0))
990
991
992 /*------------------------------------------------.
993 | Report that the YYRULE is going to be reduced. |
994 `------------------------------------------------*/
995
996 #if (defined __STDC__ || defined __C99__FUNC__ \
997 || defined __cplusplus || defined _MSC_VER)
998 static void
999 yy_reduce_print (YYSTYPE *yyvsp, int yyrule, struct parser *ctx)
1000 #else
1001 static void
1002 yy_reduce_print (yyvsp, yyrule, ctx)
1003 YYSTYPE *yyvsp;
1004 int yyrule;
1005 struct parser *ctx;
1006 #endif
1007 {
1008 int yynrhs = yyr2[yyrule];
1009 int yyi;
1010 unsigned long int yylno = yyrline[yyrule];
1011 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1012 yyrule - 1, yylno);
1013 /* The symbols being reduced. */
1014 for (yyi = 0; yyi < yynrhs; yyi++)
1015 {
1016 YYFPRINTF (stderr, " $%d = ", yyi + 1);
1017 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1018 &(yyvsp[(yyi + 1) - (yynrhs)])
1019 , ctx);
1020 YYFPRINTF (stderr, "\n");
1021 }
1022 }
1023
1024 # define YY_REDUCE_PRINT(Rule) \
1025 do { \
1026 if (yydebug) \
1027 yy_reduce_print (yyvsp, Rule, ctx); \
1028 } while (YYID (0))
1029
1030 /* Nonzero means print parse trace. It is left uninitialized so that
1031 multiple parsers can coexist. */
1032 int yydebug;
1033 #else /* !YYDEBUG */
1034 # define YYDPRINTF(Args)
1035 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1036 # define YY_STACK_PRINT(Bottom, Top)
1037 # define YY_REDUCE_PRINT(Rule)
1038 #endif /* !YYDEBUG */
1039
1040
1041 /* YYINITDEPTH -- initial size of the parser's stacks. */
1042 #ifndef YYINITDEPTH
1043 # define YYINITDEPTH 200
1044 #endif
1045
1046 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1047 if the built-in stack extension method is used).
1048
1049 Do not make this value too large; the results are undefined if
1050 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1051 evaluated with infinite-precision integer arithmetic. */
1052
1053 #ifndef YYMAXDEPTH
1054 # define YYMAXDEPTH 10000
1055 #endif
1056
1057
1058 #if YYERROR_VERBOSE
1059
1060 # ifndef yystrlen
1061 # if defined __GLIBC__ && defined _STRING_H
1062 # define yystrlen strlen
1063 # else
1064 /* Return the length of YYSTR. */
1065 #if (defined __STDC__ || defined __C99__FUNC__ \
1066 || defined __cplusplus || defined _MSC_VER)
1067 static YYSIZE_T
1068 yystrlen (const char *yystr)
1069 #else
1070 static YYSIZE_T
1071 yystrlen (yystr)
1072 const char *yystr;
1073 #endif
1074 {
1075 YYSIZE_T yylen;
1076 for (yylen = 0; yystr[yylen]; yylen++)
1077 continue;
1078 return yylen;
1079 }
1080 # endif
1081 # endif
1082
1083 # ifndef yystpcpy
1084 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1085 # define yystpcpy stpcpy
1086 # else
1087 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1088 YYDEST. */
1089 #if (defined __STDC__ || defined __C99__FUNC__ \
1090 || defined __cplusplus || defined _MSC_VER)
1091 static char *
1092 yystpcpy (char *yydest, const char *yysrc)
1093 #else
1094 static char *
1095 yystpcpy (yydest, yysrc)
1096 char *yydest;
1097 const char *yysrc;
1098 #endif
1099 {
1100 char *yyd = yydest;
1101 const char *yys = yysrc;
1102
1103 while ((*yyd++ = *yys++) != '\0')
1104 continue;
1105
1106 return yyd - 1;
1107 }
1108 # endif
1109 # endif
1110
1111 # ifndef yytnamerr
1112 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1113 quotes and backslashes, so that it's suitable for yyerror. The
1114 heuristic is that double-quoting is unnecessary unless the string
1115 contains an apostrophe, a comma, or backslash (other than
1116 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1117 null, do not copy; instead, return the length of what the result
1118 would have been. */
1119 static YYSIZE_T
1120 yytnamerr (char *yyres, const char *yystr)
1121 {
1122 if (*yystr == '"')
1123 {
1124 YYSIZE_T yyn = 0;
1125 char const *yyp = yystr;
1126
1127 for (;;)
1128 switch (*++yyp)
1129 {
1130 case '\'':
1131 case ',':
1132 goto do_not_strip_quotes;
1133
1134 case '\\':
1135 if (*++yyp != '\\')
1136 goto do_not_strip_quotes;
1137 /* Fall through. */
1138 default:
1139 if (yyres)
1140 yyres[yyn] = *yyp;
1141 yyn++;
1142 break;
1143
1144 case '"':
1145 if (yyres)
1146 yyres[yyn] = '\0';
1147 return yyn;
1148 }
1149 do_not_strip_quotes: ;
1150 }
1151
1152 if (! yyres)
1153 return yystrlen (yystr);
1154
1155 return yystpcpy (yyres, yystr) - yyres;
1156 }
1157 # endif
1158
1159 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1160 about the unexpected token YYTOKEN for the state stack whose top is
1161 YYSSP.
1162
1163 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1164 not large enough to hold the message. In that case, also set
1165 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1166 required number of bytes is too large to store. */
1167 static int
1168 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1169 yytype_int16 *yyssp, int yytoken)
1170 {
1171 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
1172 YYSIZE_T yysize = yysize0;
1173 YYSIZE_T yysize1;
1174 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1175 /* Internationalized format string. */
1176 const char *yyformat = 0;
1177 /* Arguments of yyformat. */
1178 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1179 /* Number of reported tokens (one for the "unexpected", one per
1180 "expected"). */
1181 int yycount = 0;
1182
1183 /* There are many possibilities here to consider:
1184 - Assume YYFAIL is not used. It's too flawed to consider. See
1185 <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
1186 for details. YYERROR is fine as it does not invoke this
1187 function.
1188 - If this state is a consistent state with a default action, then
1189 the only way this function was invoked is if the default action
1190 is an error action. In that case, don't check for expected
1191 tokens because there are none.
1192 - The only way there can be no lookahead present (in yychar) is if
1193 this state is a consistent state with a default action. Thus,
1194 detecting the absence of a lookahead is sufficient to determine
1195 that there is no unexpected or expected token to report. In that
1196 case, just report a simple "syntax error".
1197 - Don't assume there isn't a lookahead just because this state is a
1198 consistent state with a default action. There might have been a
1199 previous inconsistent state, consistent state with a non-default
1200 action, or user semantic action that manipulated yychar.
1201 - Of course, the expected token list depends on states to have
1202 correct lookahead information, and it depends on the parser not
1203 to perform extra reductions after fetching a lookahead from the
1204 scanner and before detecting a syntax error. Thus, state merging
1205 (from LALR or IELR) and default reductions corrupt the expected
1206 token list. However, the list is correct for canonical LR with
1207 one exception: it will still contain any token that will not be
1208 accepted due to an error action in a later state.
1209 */
1210 if (yytoken != YYEMPTY)
1211 {
1212 int yyn = yypact[*yyssp];
1213 yyarg[yycount++] = yytname[yytoken];
1214 if (!yypact_value_is_default (yyn))
1215 {
1216 /* Start YYX at -YYN if negative to avoid negative indexes in
1217 YYCHECK. In other words, skip the first -YYN actions for
1218 this state because they are default actions. */
1219 int yyxbegin = yyn < 0 ? -yyn : 0;
1220 /* Stay within bounds of both yycheck and yytname. */
1221 int yychecklim = YYLAST - yyn + 1;
1222 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1223 int yyx;
1224
1225 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1226 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1227 && !yytable_value_is_error (yytable[yyx + yyn]))
1228 {
1229 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1230 {
1231 yycount = 1;
1232 yysize = yysize0;
1233 break;
1234 }
1235 yyarg[yycount++] = yytname[yyx];
1236 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1237 if (! (yysize <= yysize1
1238 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1239 return 2;
1240 yysize = yysize1;
1241 }
1242 }
1243 }
1244
1245 switch (yycount)
1246 {
1247 # define YYCASE_(N, S) \
1248 case N: \
1249 yyformat = S; \
1250 break
1251 YYCASE_(0, YY_("syntax error"));
1252 YYCASE_(1, YY_("syntax error, unexpected %s"));
1253 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1254 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1255 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1256 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1257 # undef YYCASE_
1258 }
1259
1260 yysize1 = yysize + yystrlen (yyformat);
1261 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1262 return 2;
1263 yysize = yysize1;
1264
1265 if (*yymsg_alloc < yysize)
1266 {
1267 *yymsg_alloc = 2 * yysize;
1268 if (! (yysize <= *yymsg_alloc
1269 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1270 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1271 return 1;
1272 }
1273
1274 /* Avoid sprintf, as that infringes on the user's name space.
1275 Don't have undefined behavior even if the translation
1276 produced a string with the wrong number of "%s"s. */
1277 {
1278 char *yyp = *yymsg;
1279 int yyi = 0;
1280 while ((*yyp = *yyformat) != '\0')
1281 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1282 {
1283 yyp += yytnamerr (yyp, yyarg[yyi++]);
1284 yyformat += 2;
1285 }
1286 else
1287 {
1288 yyp++;
1289 yyformat++;
1290 }
1291 }
1292 return 0;
1293 }
1294 #endif /* YYERROR_VERBOSE */
1295
1296 /*-----------------------------------------------.
1297 | Release the memory associated to this symbol. |
1298 `-----------------------------------------------*/
1299
1300 /*ARGSUSED*/
1301 #if (defined __STDC__ || defined __C99__FUNC__ \
1302 || defined __cplusplus || defined _MSC_VER)
1303 static void
1304 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, struct parser *ctx)
1305 #else
1306 static void
1307 yydestruct (yymsg, yytype, yyvaluep, ctx)
1308 const char *yymsg;
1309 int yytype;
1310 YYSTYPE *yyvaluep;
1311 struct parser *ctx;
1312 #endif
1313 {
1314 YYUSE (yyvaluep);
1315 YYUSE (ctx);
1316
1317 if (!yymsg)
1318 yymsg = "Deleting";
1319 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1320
1321 switch (yytype)
1322 {
1323
1324 default:
1325 break;
1326 }
1327 }
1328
1329
1330 /* Prevent warnings from -Wmissing-prototypes. */
1331 #ifdef YYPARSE_PARAM
1332 #if defined __STDC__ || defined __cplusplus
1333 int yyparse (void *YYPARSE_PARAM);
1334 #else
1335 int yyparse ();
1336 #endif
1337 #else /* ! YYPARSE_PARAM */
1338 #if defined __STDC__ || defined __cplusplus
1339 int yyparse (struct parser *ctx);
1340 #else
1341 int yyparse ();
1342 #endif
1343 #endif /* ! YYPARSE_PARAM */
1344
1345
1346 /*----------.
1347 | yyparse. |
1348 `----------*/
1349
1350 #ifdef YYPARSE_PARAM
1351 #if (defined __STDC__ || defined __C99__FUNC__ \
1352 || defined __cplusplus || defined _MSC_VER)
1353 int
1354 yyparse (void *YYPARSE_PARAM)
1355 #else
1356 int
1357 yyparse (YYPARSE_PARAM)
1358 void *YYPARSE_PARAM;
1359 #endif
1360 #else /* ! YYPARSE_PARAM */
1361 #if (defined __STDC__ || defined __C99__FUNC__ \
1362 || defined __cplusplus || defined _MSC_VER)
1363 int
1364 yyparse (struct parser *ctx)
1365 #else
1366 int
1367 yyparse (ctx)
1368 struct parser *ctx;
1369 #endif
1370 #endif
1371 {
1372 /* The lookahead symbol. */
1373 int yychar;
1374
1375 /* The semantic value of the lookahead symbol. */
1376 YYSTYPE yylval;
1377
1378 /* Number of syntax errors so far. */
1379 int yynerrs;
1380
1381 int yystate;
1382 /* Number of tokens to shift before error messages enabled. */
1383 int yyerrstatus;
1384
1385 /* The stacks and their tools:
1386 `yyss': related to states.
1387 `yyvs': related to semantic values.
1388
1389 Refer to the stacks thru separate pointers, to allow yyoverflow
1390 to reallocate them elsewhere. */
1391
1392 /* The state stack. */
1393 yytype_int16 yyssa[YYINITDEPTH];
1394 yytype_int16 *yyss;
1395 yytype_int16 *yyssp;
1396
1397 /* The semantic value stack. */
1398 YYSTYPE yyvsa[YYINITDEPTH];
1399 YYSTYPE *yyvs;
1400 YYSTYPE *yyvsp;
1401
1402 YYSIZE_T yystacksize;
1403
1404 int yyn;
1405 int yyresult;
1406 /* Lookahead token as an internal (translated) token number. */
1407 int yytoken;
1408 /* The variables used to return semantic value and location from the
1409 action routines. */
1410 YYSTYPE yyval;
1411
1412 #if YYERROR_VERBOSE
1413 /* Buffer for error messages, and its allocated size. */
1414 char yymsgbuf[128];
1415 char *yymsg = yymsgbuf;
1416 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1417 #endif
1418
1419 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1420
1421 /* The number of symbols on the RHS of the reduced rule.
1422 Keep to zero when no symbol should be popped. */
1423 int yylen = 0;
1424
1425 yytoken = 0;
1426 yyss = yyssa;
1427 yyvs = yyvsa;
1428 yystacksize = YYINITDEPTH;
1429
1430 YYDPRINTF ((stderr, "Starting parse\n"));
1431
1432 yystate = 0;
1433 yyerrstatus = 0;
1434 yynerrs = 0;
1435 yychar = YYEMPTY; /* Cause a token to be read. */
1436
1437 /* Initialize stack pointers.
1438 Waste one element of value and location stack
1439 so that they stay on the same level as the state stack.
1440 The wasted elements are never initialized. */
1441 yyssp = yyss;
1442 yyvsp = yyvs;
1443
1444 goto yysetstate;
1445
1446 /*------------------------------------------------------------.
1447 | yynewstate -- Push a new state, which is found in yystate. |
1448 `------------------------------------------------------------*/
1449 yynewstate:
1450 /* In all cases, when you get here, the value and location stacks
1451 have just been pushed. So pushing a state here evens the stacks. */
1452 yyssp++;
1453
1454 yysetstate:
1455 *yyssp = yystate;
1456
1457 if (yyss + yystacksize - 1 <= yyssp)
1458 {
1459 /* Get the current used size of the three stacks, in elements. */
1460 YYSIZE_T yysize = yyssp - yyss + 1;
1461
1462 #ifdef yyoverflow
1463 {
1464 /* Give user a chance to reallocate the stack. Use copies of
1465 these so that the &'s don't force the real ones into
1466 memory. */
1467 YYSTYPE *yyvs1 = yyvs;
1468 yytype_int16 *yyss1 = yyss;
1469
1470 /* Each stack pointer address is followed by the size of the
1471 data in use in that stack, in bytes. This used to be a
1472 conditional around just the two extra args, but that might
1473 be undefined if yyoverflow is a macro. */
1474 yyoverflow (YY_("memory exhausted"),
1475 &yyss1, yysize * sizeof (*yyssp),
1476 &yyvs1, yysize * sizeof (*yyvsp),
1477 &yystacksize);
1478
1479 yyss = yyss1;
1480 yyvs = yyvs1;
1481 }
1482 #else /* no yyoverflow */
1483 # ifndef YYSTACK_RELOCATE
1484 goto yyexhaustedlab;
1485 # else
1486 /* Extend the stack our own way. */
1487 if (YYMAXDEPTH <= yystacksize)
1488 goto yyexhaustedlab;
1489 yystacksize *= 2;
1490 if (YYMAXDEPTH < yystacksize)
1491 yystacksize = YYMAXDEPTH;
1492
1493 {
1494 yytype_int16 *yyss1 = yyss;
1495 union yyalloc *yyptr =
1496 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1497 if (! yyptr)
1498 goto yyexhaustedlab;
1499 YYSTACK_RELOCATE (yyss_alloc, yyss);
1500 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1501 # undef YYSTACK_RELOCATE
1502 if (yyss1 != yyssa)
1503 YYSTACK_FREE (yyss1);
1504 }
1505 # endif
1506 #endif /* no yyoverflow */
1507
1508 yyssp = yyss + yysize - 1;
1509 yyvsp = yyvs + yysize - 1;
1510
1511 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1512 (unsigned long int) yystacksize));
1513
1514 if (yyss + yystacksize - 1 <= yyssp)
1515 YYABORT;
1516 }
1517
1518 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1519
1520 if (yystate == YYFINAL)
1521 YYACCEPT;
1522
1523 goto yybackup;
1524
1525 /*-----------.
1526 | yybackup. |
1527 `-----------*/
1528 yybackup:
1529
1530 /* Do appropriate processing given the current state. Read a
1531 lookahead token if we need one and don't already have one. */
1532
1533 /* First try to decide what to do without reference to lookahead token. */
1534 yyn = yypact[yystate];
1535 if (yypact_value_is_default (yyn))
1536 goto yydefault;
1537
1538 /* Not known => get a lookahead token if don't already have one. */
1539
1540 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1541 if (yychar == YYEMPTY)
1542 {
1543 YYDPRINTF ((stderr, "Reading a token: "));
1544 yychar = YYLEX;
1545 }
1546
1547 if (yychar <= YYEOF)
1548 {
1549 yychar = yytoken = YYEOF;
1550 YYDPRINTF ((stderr, "Now at end of input.\n"));
1551 }
1552 else
1553 {
1554 yytoken = YYTRANSLATE (yychar);
1555 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1556 }
1557
1558 /* If the proper action on seeing token YYTOKEN is to reduce or to
1559 detect an error, take that action. */
1560 yyn += yytoken;
1561 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1562 goto yydefault;
1563 yyn = yytable[yyn];
1564 if (yyn <= 0)
1565 {
1566 if (yytable_value_is_error (yyn))
1567 goto yyerrlab;
1568 yyn = -yyn;
1569 goto yyreduce;
1570 }
1571
1572 /* Count tokens shifted since error; after three, turn off error
1573 status. */
1574 if (yyerrstatus)
1575 yyerrstatus--;
1576
1577 /* Shift the lookahead token. */
1578 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1579
1580 /* Discard the shifted token. */
1581 yychar = YYEMPTY;
1582
1583 yystate = yyn;
1584 *++yyvsp = yylval;
1585
1586 goto yynewstate;
1587
1588
1589 /*-----------------------------------------------------------.
1590 | yydefault -- do the default action for the current state. |
1591 `-----------------------------------------------------------*/
1592 yydefault:
1593 yyn = yydefact[yystate];
1594 if (yyn == 0)
1595 goto yyerrlab;
1596 goto yyreduce;
1597
1598
1599 /*-----------------------------.
1600 | yyreduce -- Do a reduction. |
1601 `-----------------------------*/
1602 yyreduce:
1603 /* yyn is the number of a rule to reduce with. */
1604 yylen = yyr2[yyn];
1605
1606 /* If YYLEN is nonzero, implement the default value of the action:
1607 `$$ = $1'.
1608
1609 Otherwise, the following line sets YYVAL to garbage.
1610 This behavior is undocumented and Bison
1611 users should not rely upon it. Assigning to YYVAL
1612 unconditionally makes the parser a bit smaller, and it avoids a
1613 GCC warning that YYVAL may be used uninitialized. */
1614 yyval = yyvsp[1-yylen];
1615
1616
1617 YY_REDUCE_PRINT (yyn);
1618 switch (yyn)
1619 {
1620 case 2:
1621
1622 /* Line 1806 of yacc.c */
1623 #line 222 "wql.y"
1624 {
1625 HRESULT hr;
1626 struct parser *parser = ctx;
1627 struct view *view;
1628
1629 hr = create_view( NULL, (yyvsp[(3) - (3)].string), NULL, &view );
1630 if (hr != S_OK)
1631 YYABORT;
1632
1633 PARSER_BUBBLE_UP_VIEW( parser, (yyval.view), view );
1634 }
1635 break;
1636
1637 case 3:
1638
1639 /* Line 1806 of yacc.c */
1640 #line 234 "wql.y"
1641 {
1642 HRESULT hr;
1643 struct parser *parser = ctx;
1644 struct view *view;
1645
1646 hr = create_view( (yyvsp[(2) - (4)].proplist), (yyvsp[(4) - (4)].string), NULL, &view );
1647 if (hr != S_OK)
1648 YYABORT;
1649
1650 PARSER_BUBBLE_UP_VIEW( parser, (yyval.view), view );
1651 }
1652 break;
1653
1654 case 4:
1655
1656 /* Line 1806 of yacc.c */
1657 #line 246 "wql.y"
1658 {
1659 HRESULT hr;
1660 struct parser *parser = ctx;
1661 struct view *view;
1662
1663 hr = create_view( (yyvsp[(2) - (6)].proplist), (yyvsp[(4) - (6)].string), (yyvsp[(6) - (6)].expr), &view );
1664 if (hr != S_OK)
1665 YYABORT;
1666
1667 PARSER_BUBBLE_UP_VIEW( parser, (yyval.view), view );
1668 }
1669 break;
1670
1671 case 6:
1672
1673 /* Line 1806 of yacc.c */
1674 #line 262 "wql.y"
1675 {
1676 (yyvsp[(1) - (3)].proplist)->next = (yyvsp[(3) - (3)].proplist);
1677 }
1678 break;
1679
1680 case 7:
1681
1682 /* Line 1806 of yacc.c */
1683 #line 266 "wql.y"
1684 {
1685 (yyval.proplist) = NULL;
1686 }
1687 break;
1688
1689 case 8:
1690
1691 /* Line 1806 of yacc.c */
1692 #line 273 "wql.y"
1693 {
1694 (yyval.proplist) = alloc_property( ctx, (yyvsp[(1) - (3)].string), (yyvsp[(3) - (3)].string) );
1695 if (!(yyval.proplist))
1696 YYABORT;
1697 }
1698 break;
1699
1700 case 9:
1701
1702 /* Line 1806 of yacc.c */
1703 #line 279 "wql.y"
1704 {
1705 (yyval.proplist) = alloc_property( ctx, NULL, (yyvsp[(1) - (1)].string) );
1706 if (!(yyval.proplist))
1707 YYABORT;
1708 }
1709 break;
1710
1711 case 10:
1712
1713 /* Line 1806 of yacc.c */
1714 #line 288 "wql.y"
1715 {
1716 (yyval.string) = get_string( ctx, &(yyvsp[(1) - (1)].str) );
1717 if (!(yyval.string))
1718 YYABORT;
1719 }
1720 break;
1721
1722 case 11:
1723
1724 /* Line 1806 of yacc.c */
1725 #line 297 "wql.y"
1726 {
1727 (yyval.integer) = get_int( ctx );
1728 }
1729 break;
1730
1731 case 12:
1732
1733 /* Line 1806 of yacc.c */
1734 #line 304 "wql.y"
1735 {
1736 (yyval.expr) = (yyvsp[(2) - (3)].expr);
1737 if (!(yyval.expr))
1738 YYABORT;
1739 }
1740 break;
1741
1742 case 13:
1743
1744 /* Line 1806 of yacc.c */
1745 #line 310 "wql.y"
1746 {
1747 (yyval.expr) = expr_complex( ctx, (yyvsp[(1) - (3)].expr), OP_AND, (yyvsp[(3) - (3)].expr) );
1748 if (!(yyval.expr))
1749 YYABORT;
1750 }
1751 break;
1752
1753 case 14:
1754
1755 /* Line 1806 of yacc.c */
1756 #line 316 "wql.y"
1757 {
1758 (yyval.expr) = expr_complex( ctx, (yyvsp[(1) - (3)].expr), OP_OR, (yyvsp[(3) - (3)].expr) );
1759 if (!(yyval.expr))
1760 YYABORT;
1761 }
1762 break;
1763
1764 case 15:
1765
1766 /* Line 1806 of yacc.c */
1767 #line 322 "wql.y"
1768 {
1769 (yyval.expr) = expr_complex( ctx, (yyvsp[(1) - (3)].expr), OP_EQ, (yyvsp[(3) - (3)].expr) );
1770 if (!(yyval.expr))
1771 YYABORT;
1772 }
1773 break;
1774
1775 case 16:
1776
1777 /* Line 1806 of yacc.c */
1778 #line 328 "wql.y"
1779 {
1780 (yyval.expr) = expr_complex( ctx, (yyvsp[(1) - (3)].expr), OP_GT, (yyvsp[(3) - (3)].expr) );
1781 if (!(yyval.expr))
1782 YYABORT;
1783 }
1784 break;
1785
1786 case 17:
1787
1788 /* Line 1806 of yacc.c */
1789 #line 334 "wql.y"
1790 {
1791 (yyval.expr) = expr_complex( ctx, (yyvsp[(1) - (3)].expr), OP_LT, (yyvsp[(3) - (3)].expr) );
1792 if (!(yyval.expr))
1793 YYABORT;
1794 }
1795 break;
1796
1797 case 18:
1798
1799 /* Line 1806 of yacc.c */
1800 #line 340 "wql.y"
1801 {
1802 (yyval.expr) = expr_complex( ctx, (yyvsp[(1) - (3)].expr), OP_LE, (yyvsp[(3) - (3)].expr) );
1803 if (!(yyval.expr))
1804 YYABORT;
1805 }
1806 break;
1807
1808 case 19:
1809
1810 /* Line 1806 of yacc.c */
1811 #line 346 "wql.y"
1812 {
1813 (yyval.expr) = expr_complex( ctx, (yyvsp[(1) - (3)].expr), OP_GE, (yyvsp[(3) - (3)].expr) );
1814 if (!(yyval.expr))
1815 YYABORT;
1816 }
1817 break;
1818
1819 case 20:
1820
1821 /* Line 1806 of yacc.c */
1822 #line 352 "wql.y"
1823 {
1824 (yyval.expr) = expr_complex( ctx, (yyvsp[(1) - (3)].expr), OP_NE, (yyvsp[(3) - (3)].expr) );
1825 if (!(yyval.expr))
1826 YYABORT;
1827 }
1828 break;
1829
1830 case 21:
1831
1832 /* Line 1806 of yacc.c */
1833 #line 358 "wql.y"
1834 {
1835 (yyval.expr) = expr_complex( ctx, (yyvsp[(1) - (3)].expr), OP_EQ, (yyvsp[(3) - (3)].expr) );
1836 if (!(yyval.expr))
1837 YYABORT;
1838 }
1839 break;
1840
1841 case 22:
1842
1843 /* Line 1806 of yacc.c */
1844 #line 364 "wql.y"
1845 {
1846 (yyval.expr) = expr_complex( ctx, (yyvsp[(1) - (3)].expr), OP_GT, (yyvsp[(3) - (3)].expr) );
1847 if (!(yyval.expr))
1848 YYABORT;
1849 }
1850 break;
1851
1852 case 23:
1853
1854 /* Line 1806 of yacc.c */
1855 #line 370 "wql.y"
1856 {
1857 (yyval.expr) = expr_complex( ctx, (yyvsp[(1) - (3)].expr), OP_LT, (yyvsp[(3) - (3)].expr) );
1858 if (!(yyval.expr))
1859 YYABORT;
1860 }
1861 break;
1862
1863 case 24:
1864
1865 /* Line 1806 of yacc.c */
1866 #line 376 "wql.y"
1867 {
1868 (yyval.expr) = expr_complex( ctx, (yyvsp[(1) - (3)].expr), OP_LE, (yyvsp[(3) - (3)].expr) );
1869 if (!(yyval.expr))
1870 YYABORT;
1871 }
1872 break;
1873
1874 case 25:
1875
1876 /* Line 1806 of yacc.c */
1877 #line 382 "wql.y"
1878 {
1879 (yyval.expr) = expr_complex( ctx, (yyvsp[(1) - (3)].expr), OP_GE, (yyvsp[(3) - (3)].expr) );
1880 if (!(yyval.expr))
1881 YYABORT;
1882 }
1883 break;
1884
1885 case 26:
1886
1887 /* Line 1806 of yacc.c */
1888 #line 388 "wql.y"
1889 {
1890 (yyval.expr) = expr_complex( ctx, (yyvsp[(1) - (3)].expr), OP_NE, (yyvsp[(3) - (3)].expr) );
1891 if (!(yyval.expr))
1892 YYABORT;
1893 }
1894 break;
1895
1896 case 27:
1897
1898 /* Line 1806 of yacc.c */
1899 #line 394 "wql.y"
1900 {
1901 (yyval.expr) = expr_complex( ctx, (yyvsp[(1) - (3)].expr), OP_LIKE, (yyvsp[(3) - (3)].expr) );
1902 if (!(yyval.expr))
1903 YYABORT;
1904 }
1905 break;
1906
1907 case 28:
1908
1909 /* Line 1806 of yacc.c */
1910 #line 400 "wql.y"
1911 {
1912 (yyval.expr) = expr_unary( ctx, (yyvsp[(1) - (3)].expr), OP_ISNULL );
1913 if (!(yyval.expr))
1914 YYABORT;
1915 }
1916 break;
1917
1918 case 29:
1919
1920 /* Line 1806 of yacc.c */
1921 #line 406 "wql.y"
1922 {
1923 (yyval.expr) = expr_unary( ctx, (yyvsp[(1) - (4)].expr), OP_NOTNULL );
1924 if (!(yyval.expr))
1925 YYABORT;
1926 }
1927 break;
1928
1929 case 30:
1930
1931 /* Line 1806 of yacc.c */
1932 #line 415 "wql.y"
1933 {
1934 (yyval.expr) = expr_sval( ctx, &(yyvsp[(1) - (1)].str) );
1935 if (!(yyval.expr))
1936 YYABORT;
1937 }
1938 break;
1939
1940 case 31:
1941
1942 /* Line 1806 of yacc.c */
1943 #line 424 "wql.y"
1944 {
1945 (yyval.expr) = expr_propval( ctx, (yyvsp[(1) - (1)].proplist) );
1946 if (!(yyval.expr))
1947 YYABORT;
1948 }
1949 break;
1950
1951 case 32:
1952
1953 /* Line 1806 of yacc.c */
1954 #line 433 "wql.y"
1955 {
1956 (yyval.expr) = expr_ival( ctx, (yyvsp[(1) - (1)].integer) );
1957 if (!(yyval.expr))
1958 YYABORT;
1959 }
1960 break;
1961
1962 case 33:
1963
1964 /* Line 1806 of yacc.c */
1965 #line 439 "wql.y"
1966 {
1967 (yyval.expr) = expr_sval( ctx, &(yyvsp[(1) - (1)].str) );
1968 if (!(yyval.expr))
1969 YYABORT;
1970 }
1971 break;
1972
1973 case 34:
1974
1975 /* Line 1806 of yacc.c */
1976 #line 445 "wql.y"
1977 {
1978 (yyval.expr) = expr_bval( ctx, -1 );
1979 if (!(yyval.expr))
1980 YYABORT;
1981 }
1982 break;
1983
1984 case 35:
1985
1986 /* Line 1806 of yacc.c */
1987 #line 451 "wql.y"
1988 {
1989 (yyval.expr) = expr_bval( ctx, 0 );
1990 if (!(yyval.expr))
1991 YYABORT;
1992 }
1993 break;
1994
1995
1996
1997 /* Line 1806 of yacc.c */
1998 #line 2011 "wql.tab.c"
1999 default: break;
2000 }
2001 /* User semantic actions sometimes alter yychar, and that requires
2002 that yytoken be updated with the new translation. We take the
2003 approach of translating immediately before every use of yytoken.
2004 One alternative is translating here after every semantic action,
2005 but that translation would be missed if the semantic action invokes
2006 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2007 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2008 incorrect destructor might then be invoked immediately. In the
2009 case of YYERROR or YYBACKUP, subsequent parser actions might lead
2010 to an incorrect destructor call or verbose syntax error message
2011 before the lookahead is translated. */
2012 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2013
2014 YYPOPSTACK (yylen);
2015 yylen = 0;
2016 YY_STACK_PRINT (yyss, yyssp);
2017
2018 *++yyvsp = yyval;
2019
2020 /* Now `shift' the result of the reduction. Determine what state
2021 that goes to, based on the state we popped back to and the rule
2022 number reduced by. */
2023
2024 yyn = yyr1[yyn];
2025
2026 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2027 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2028 yystate = yytable[yystate];
2029 else
2030 yystate = yydefgoto[yyn - YYNTOKENS];
2031
2032 goto yynewstate;
2033
2034
2035 /*------------------------------------.
2036 | yyerrlab -- here on detecting error |
2037 `------------------------------------*/
2038 yyerrlab:
2039 /* Make sure we have latest lookahead translation. See comments at
2040 user semantic actions for why this is necessary. */
2041 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
2042
2043 /* If not already recovering from an error, report this error. */
2044 if (!yyerrstatus)
2045 {
2046 ++yynerrs;
2047 #if ! YYERROR_VERBOSE
2048 yyerror (ctx, YY_("syntax error"));
2049 #else
2050 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2051 yyssp, yytoken)
2052 {
2053 char const *yymsgp = YY_("syntax error");
2054 int yysyntax_error_status;
2055 yysyntax_error_status = YYSYNTAX_ERROR;
2056 if (yysyntax_error_status == 0)
2057 yymsgp = yymsg;
2058 else if (yysyntax_error_status == 1)
2059 {
2060 if (yymsg != yymsgbuf)
2061 YYSTACK_FREE (yymsg);
2062 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
2063 if (!yymsg)
2064 {
2065 yymsg = yymsgbuf;
2066 yymsg_alloc = sizeof yymsgbuf;
2067 yysyntax_error_status = 2;
2068 }
2069 else
2070 {
2071 yysyntax_error_status = YYSYNTAX_ERROR;
2072 yymsgp = yymsg;
2073 }
2074 }
2075 yyerror (ctx, yymsgp);
2076 if (yysyntax_error_status == 2)
2077 goto yyexhaustedlab;
2078 }
2079 # undef YYSYNTAX_ERROR
2080 #endif
2081 }
2082
2083
2084
2085 if (yyerrstatus == 3)
2086 {
2087 /* If just tried and failed to reuse lookahead token after an
2088 error, discard it. */
2089
2090 if (yychar <= YYEOF)
2091 {
2092 /* Return failure if at end of input. */
2093 if (yychar == YYEOF)
2094 YYABORT;
2095 }
2096 else
2097 {
2098 yydestruct ("Error: discarding",
2099 yytoken, &yylval, ctx);
2100 yychar = YYEMPTY;
2101 }
2102 }
2103
2104 /* Else will try to reuse lookahead token after shifting the error
2105 token. */
2106 goto yyerrlab1;
2107
2108
2109 /*---------------------------------------------------.
2110 | yyerrorlab -- error raised explicitly by YYERROR. |
2111 `---------------------------------------------------*/
2112 yyerrorlab:
2113
2114 /* Pacify compilers like GCC when the user code never invokes
2115 YYERROR and the label yyerrorlab therefore never appears in user
2116 code. */
2117 if (/*CONSTCOND*/ 0)
2118 goto yyerrorlab;
2119
2120 /* Do not reclaim the symbols of the rule which action triggered
2121 this YYERROR. */
2122 YYPOPSTACK (yylen);
2123 yylen = 0;
2124 YY_STACK_PRINT (yyss, yyssp);
2125 yystate = *yyssp;
2126 goto yyerrlab1;
2127
2128
2129 /*-------------------------------------------------------------.
2130 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2131 `-------------------------------------------------------------*/
2132 yyerrlab1:
2133 yyerrstatus = 3; /* Each real token shifted decrements this. */
2134
2135 for (;;)
2136 {
2137 yyn = yypact[yystate];
2138 if (!yypact_value_is_default (yyn))
2139 {
2140 yyn += YYTERROR;
2141 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2142 {
2143 yyn = yytable[yyn];
2144 if (0 < yyn)
2145 break;
2146 }
2147 }
2148
2149 /* Pop the current state because it cannot handle the error token. */
2150 if (yyssp == yyss)
2151 YYABORT;
2152
2153
2154 yydestruct ("Error: popping",
2155 yystos[yystate], yyvsp, ctx);
2156 YYPOPSTACK (1);
2157 yystate = *yyssp;
2158 YY_STACK_PRINT (yyss, yyssp);
2159 }
2160
2161 *++yyvsp = yylval;
2162
2163
2164 /* Shift the error token. */
2165 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2166
2167 yystate = yyn;
2168 goto yynewstate;
2169
2170
2171 /*-------------------------------------.
2172 | yyacceptlab -- YYACCEPT comes here. |
2173 `-------------------------------------*/
2174 yyacceptlab:
2175 yyresult = 0;
2176 goto yyreturn;
2177
2178 /*-----------------------------------.
2179 | yyabortlab -- YYABORT comes here. |
2180 `-----------------------------------*/
2181 yyabortlab:
2182 yyresult = 1;
2183 goto yyreturn;
2184
2185 #if !defined(yyoverflow) || YYERROR_VERBOSE
2186 /*-------------------------------------------------.
2187 | yyexhaustedlab -- memory exhaustion comes here. |
2188 `-------------------------------------------------*/
2189 yyexhaustedlab:
2190 yyerror (ctx, YY_("memory exhausted"));
2191 yyresult = 2;
2192 /* Fall through. */
2193 #endif
2194
2195 yyreturn:
2196 if (yychar != YYEMPTY)
2197 {
2198 /* Make sure we have latest lookahead translation. See comments at
2199 user semantic actions for why this is necessary. */
2200 yytoken = YYTRANSLATE (yychar);
2201 yydestruct ("Cleanup: discarding lookahead",
2202 yytoken, &yylval, ctx);
2203 }
2204 /* Do not reclaim the symbols of the rule which action triggered
2205 this YYABORT or YYACCEPT. */
2206 YYPOPSTACK (yylen);
2207 YY_STACK_PRINT (yyss, yyssp);
2208 while (yyssp != yyss)
2209 {
2210 yydestruct ("Cleanup: popping",
2211 yystos[*yyssp], yyvsp, ctx);
2212 YYPOPSTACK (1);
2213 }
2214 #ifndef yyoverflow
2215 if (yyss != yyssa)
2216 YYSTACK_FREE (yyss);
2217 #endif
2218 #if YYERROR_VERBOSE
2219 if (yymsg != yymsgbuf)
2220 YYSTACK_FREE (yymsg);
2221 #endif
2222 /* Make sure YYID is used. */
2223 return YYID (yyresult);
2224 }
2225
2226
2227
2228 /* Line 2067 of yacc.c */
2229 #line 458 "wql.y"
2230
2231
2232 HRESULT parse_query( const WCHAR *str, struct view **view, struct list *mem )
2233 {
2234 struct parser parser;
2235 int ret;
2236
2237 *view = NULL;
2238
2239 parser.cmd = str;
2240 parser.idx = 0;
2241 parser.len = 0;
2242 parser.error = WBEM_E_INVALID_QUERY;
2243 parser.view = view;
2244 parser.mem = mem;
2245
2246 ret = wql_parse( &parser );
2247 TRACE("wql_parse returned %d\n", ret);
2248 if (ret)
2249 {
2250 if (*parser.view)
2251 {
2252 destroy_view( *parser.view );
2253 *parser.view = NULL;
2254 }
2255 return parser.error;
2256 }
2257 return S_OK;
2258 }
2259
2260 static const char id_char[] =
2261 {
2262 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2263 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2264 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
2265 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
2266 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2267 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1,
2268 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2269 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,
2270 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2271 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2272 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2273 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2274 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2275 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2276 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2277 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2278 };
2279
2280 struct keyword
2281 {
2282 const WCHAR *name;
2283 unsigned int len;
2284 int type;
2285 };
2286
2287 #define MAX_TOKEN_LEN 6
2288
2289 static const WCHAR andW[] = {'A','N','D'};
2290 static const WCHAR byW[] = {'B','Y'};
2291 static const WCHAR falseW[] = {'F','A','L','S','E'};
2292 static const WCHAR fromW[] = {'F','R','O','M'};
2293 static const WCHAR isW[] = {'I','S'};
2294 static const WCHAR likeW[] = {'L','I','K','E'};
2295 static const WCHAR notW[] = {'N','O','T'};
2296 static const WCHAR nullW[] = {'N','U','L','L'};
2297 static const WCHAR orW[] = {'O','R'};
2298 static const WCHAR selectW[] = {'S','E','L','E','C','T'};
2299 static const WCHAR trueW[] = {'T','R','U','E'};
2300 static const WCHAR whereW[] = {'W','H','E','R','E'};
2301
2302 static const struct keyword keyword_table[] =
2303 {
2304 { andW, SIZEOF(andW), TK_AND },
2305 { byW, SIZEOF(byW), TK_BY },
2306 { falseW, SIZEOF(falseW), TK_FALSE },
2307 { fromW, SIZEOF(fromW), TK_FROM },
2308 { isW, SIZEOF(isW), TK_IS },
2309 { likeW, SIZEOF(likeW), TK_LIKE },
2310 { notW, SIZEOF(notW), TK_NOT },
2311 { nullW, SIZEOF(nullW), TK_NULL },
2312 { orW, SIZEOF(orW), TK_OR },
2313 { selectW, SIZEOF(selectW), TK_SELECT },
2314 { trueW, SIZEOF(trueW), TK_TRUE },
2315 { whereW, SIZEOF(whereW), TK_WHERE }
2316 };
2317
2318 static int cmp_keyword( const void *arg1, const void *arg2 )
2319 {
2320 const struct keyword *key1 = arg1, *key2 = arg2;
2321 int len = min( key1->len, key2->len );
2322 int ret;
2323
2324 if ((ret = memicmpW( key1->name, key2->name, len ))) return ret;
2325 if (key1->len < key2->len) return -1;
2326 else if (key1->len > key2->len) return 1;
2327 return 0;
2328 }
2329
2330 static int keyword_type( const WCHAR *str, unsigned int len )
2331 {
2332 struct keyword key, *ret;
2333
2334 if (len > MAX_TOKEN_LEN) return TK_ID;
2335
2336 key.name = str;
2337 key.len = len;
2338 key.type = 0;
2339 ret = bsearch( &key, keyword_table, SIZEOF(keyword_table), sizeof(struct keyword), cmp_keyword );
2340 if (ret) return ret->type;
2341 return TK_ID;
2342 }
2343
2344 static int get_token( const WCHAR *s, int *token )
2345 {
2346 int i;
2347
2348 switch (*s)
2349 {
2350 case ' ':
2351 case '\t':
2352 case '\n':
2353 for (i = 1; isspaceW( s[i] ); i++) {}
2354 *token = TK_SPACE;
2355 return i;
2356 case '-':
2357 if (!s[1]) return -1;
2358 *token = TK_MINUS;
2359 return 1;
2360 case '(':
2361 *token = TK_LP;
2362 return 1;
2363 case ')':
2364 *token = TK_RP;
2365 return 1;
2366 case '*':
2367 *token = TK_STAR;
2368 return 1;
2369 case '=':
2370 *token = TK_EQ;
2371 return 1;
2372 case '<':
2373 if (s[1] == '=' )
2374 {
2375 *token = TK_LE;
2376 return 2;
2377 }
2378 else if (s[1] == '>')
2379 {
2380 *token = TK_NE;
2381 return 2;
2382 }
2383 else
2384 {
2385 *token = TK_LT;
2386 return 1;
2387 }
2388 case '>':
2389 if (s[1] == '=')
2390 {
2391 *token = TK_GE;
2392 return 2;
2393 }
2394 else
2395 {
2396 *token = TK_GT;
2397 return 1;
2398 }
2399 case '!':
2400 if (s[1] != '=')
2401 {
2402 *token = TK_ILLEGAL;
2403 return 2;
2404 }
2405 else
2406 {
2407 *token = TK_NE;
2408 return 2;
2409 }
2410 case ',':
2411 *token = TK_COMMA;
2412 return 1;
2413 case '\"':
2414 case '\'':
2415 {
2416 for (i = 1; s[i]; i++)
2417 {
2418 if (s[i] == s[0]) break;
2419 }
2420 if (s[i]) i++;
2421 *token = TK_STRING;
2422 return i;
2423 }
2424 case '.':
2425 if (!isdigitW( s[1] ))
2426 {
2427 *token = TK_DOT;
2428 return 1;
2429 }
2430 /* fall through */
2431 case '0': case '1': case '2': case '3': case '4':
2432 case '5': case '6': case '7': case '8': case '9':
2433 *token = TK_INTEGER;
2434 for (i = 1; isdigitW( s[i] ); i++) {}
2435 return i;
2436 default:
2437 if (!id_char[*s]) break;
2438
2439 for (i = 1; id_char[s[i]]; i++) {}
2440 *token = keyword_type( s, i );
2441 return i;
2442 }
2443 *token = TK_ILLEGAL;
2444 return 1;
2445 }
2446
2447 static int wql_lex( void *p, struct parser *parser )
2448 {
2449 struct string *str = p;
2450 int token = -1;
2451 do
2452 {
2453 parser->idx += parser->len;
2454 if (!parser->cmd[parser->idx]) return 0;
2455 parser->len = get_token( &parser->cmd[parser->idx], &token );
2456 if (!parser->len) break;
2457
2458 str->data = &parser->cmd[parser->idx];
2459 str->len = parser->len;
2460 } while (token == TK_SPACE);
2461 return token;
2462 }
2463
2464 static int wql_error( struct parser *parser, const char *str )
2465 {
2466 ERR("%s\n", str);
2467 return 0;
2468 }
2469