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