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