1 /* A Bison parser, made by GNU Bison 2.5. */
3 /* Bison implementation for Yacc-like parsers in C
5 Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
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.
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.
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/>. */
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.
30 This special exception was added by the Free Software Foundation in
31 version 2.2 of Bison. */
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34 simplifying the original so-called "semantic" parser. */
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. */
43 /* Identify Bison output. */
47 #define YYBISON_VERSION "2.5"
50 #define YYSKELETON_NAME "yacc.c"
61 /* Using locations. */
62 #define YYLSP_NEEDED 0
64 /* Substitute the variable and function names. */
65 #define yyparse wql_parse
67 #define yyerror wql_error
68 #define yylval wql_lval
69 #define yychar wql_char
70 #define yydebug wql_debug
71 #define yynerrs wql_nerrs
74 /* Copy the first part of user declarations. */
76 /* Line 268 of yacc.c */
81 * Copyright 2012 Hans Leidekker for CodeWeavers
83 * This library is free software; you can redistribute it and/or
84 * modify it under the terms of the GNU Lesser General Public
85 * License as published by the Free Software Foundation; either
86 * version 2.1 of the License, or (at your option) any later version.
88 * This library is distributed in the hope that it will be useful,
89 * but WITHOUT ANY WARRANTY; without even the implied warranty of
90 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
91 * Lesser General Public License for more details.
93 * You should have received a copy of the GNU Lesser General Public
94 * License along with this library; if not, write to the Free Software
95 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
98 #include "wbemprox_private.h"
116 static void *alloc_mem( struct parser
*parser
, UINT size
)
118 struct list
*mem
= heap_alloc( sizeof(struct list
) + size
);
119 list_add_tail( parser
->mem
, mem
);
123 static struct property
*alloc_property( struct parser
*parser
, const WCHAR
*class, const WCHAR
*name
)
125 struct property
*prop
= alloc_mem( parser
, sizeof(*prop
) );
135 static WCHAR
*get_string( struct parser
*parser
, const struct string
*str
)
137 const WCHAR
*p
= str
->data
;
141 if ((p
[0] == '\"' && p
[len
- 1] != '\"') ||
142 (p
[0] == '\'' && p
[len
- 1] != '\'')) return NULL
;
143 if ((p
[0] == '\"' && p
[len
- 1] == '\"') ||
144 (p
[0] == '\'' && p
[len
- 1] == '\''))
149 if (!(ret
= alloc_mem( parser
, (len
+ 1) * sizeof(WCHAR
) ))) return NULL
;
150 memcpy( ret
, p
, len
* sizeof(WCHAR
) );
155 static int get_int( struct parser
*parser
)
157 const WCHAR
*p
= &parser
->cmd
[parser
->idx
];
160 for (i
= 0; i
< parser
->len
; i
++)
162 if (p
[i
] < '0' || p
[i
] > '9')
164 ERR("should only be numbers here!\n");
167 ret
= (p
[i
] - '0') + ret
* 10;
172 static struct expr
*expr_complex( struct parser
*parser
, struct expr
*l
, UINT op
, struct expr
*r
)
174 struct expr
*e
= alloc_mem( parser
, sizeof(*e
) );
177 e
->type
= EXPR_COMPLEX
;
185 static struct expr
*expr_unary( struct parser
*parser
, struct expr
*l
, UINT op
)
187 struct expr
*e
= alloc_mem( parser
, sizeof(*e
) );
190 e
->type
= EXPR_UNARY
;
193 e
->u
.expr
.right
= NULL
;
198 static struct expr
*expr_ival( struct parser
*parser
, int val
)
200 struct expr
*e
= alloc_mem( parser
, sizeof *e
);
209 static struct expr
*expr_sval( struct parser
*parser
, const struct string
*str
)
211 struct expr
*e
= alloc_mem( parser
, sizeof *e
);
215 e
->u
.sval
= get_string( parser
, str
);
217 return NULL
; /* e will be freed by query destructor */
222 static struct expr
*expr_bval( struct parser
*parser
, int val
)
224 struct expr
*e
= alloc_mem( parser
, sizeof *e
);
233 static struct expr
*expr_propval( struct parser
*parser
, const struct property
*prop
)
235 struct expr
*e
= alloc_mem( parser
, sizeof *e
);
238 e
->type
= EXPR_PROPVAL
;
244 static int wql_error( struct parser
*parser
, const char *str
);
245 static int wql_lex( void *val
, struct parser
*parser
);
247 #define PARSER_BUBBLE_UP_VIEW( parser, result, current_view ) \
248 *parser->view = current_view; \
249 result = current_view
253 /* Line 268 of yacc.c */
254 #line 267 "wql.tab.c"
256 /* Enabling traces. */
261 /* Enabling verbose error messages. */
262 #ifdef YYERROR_VERBOSE
263 # undef YYERROR_VERBOSE
264 # define YYERROR_VERBOSE 1
266 # define YYERROR_VERBOSE 1
269 /* Enabling the token table. */
270 #ifndef YYTOKEN_TABLE
271 # define YYTOKEN_TABLE 0
278 /* Put the tokens into the symbol table, so that GDB and other debuggers
315 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
316 typedef union YYSTYPE
319 /* Line 293 of yacc.c */
324 struct property
*proplist
;
331 /* Line 293 of yacc.c */
332 #line 345 "wql.tab.c"
334 # define YYSTYPE_IS_TRIVIAL 1
335 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
336 # define YYSTYPE_IS_DECLARED 1
340 /* Copy the second part of user declarations. */
343 /* Line 343 of yacc.c */
344 #line 357 "wql.tab.c"
351 typedef YYTYPE_UINT8 yytype_uint8
;
353 typedef unsigned char yytype_uint8
;
357 typedef YYTYPE_INT8 yytype_int8
;
358 #elif (defined __STDC__ || defined __C99__FUNC__ \
359 || defined __cplusplus || defined _MSC_VER)
360 typedef signed char yytype_int8
;
362 typedef short int yytype_int8
;
366 typedef YYTYPE_UINT16 yytype_uint16
;
368 typedef unsigned short int yytype_uint16
;
372 typedef YYTYPE_INT16 yytype_int16
;
374 typedef short int yytype_int16
;
378 # ifdef __SIZE_TYPE__
379 # define YYSIZE_T __SIZE_TYPE__
380 # elif defined size_t
381 # define YYSIZE_T size_t
382 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
383 || defined __cplusplus || defined _MSC_VER)
384 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
385 # define YYSIZE_T size_t
387 # define YYSIZE_T unsigned int
391 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
394 # if defined YYENABLE_NLS && YYENABLE_NLS
396 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
397 # define YY_(msgid) dgettext ("bison-runtime", msgid)
401 # define YY_(msgid) msgid
405 /* Suppress unused-variable warnings by "using" E. */
406 #if ! defined lint || defined __GNUC__
407 # define YYUSE(e) ((void) (e))
409 # define YYUSE(e) /* empty */
412 /* Identity function, used to suppress warnings about constant conditions. */
416 #if (defined __STDC__ || defined __C99__FUNC__ \
417 || defined __cplusplus || defined _MSC_VER)
430 #if ! defined yyoverflow || YYERROR_VERBOSE
432 /* The parser invokes alloca or malloc; define the necessary symbols. */
434 # ifdef YYSTACK_USE_ALLOCA
435 # if YYSTACK_USE_ALLOCA
437 # define YYSTACK_ALLOC __builtin_alloca
438 # elif defined __BUILTIN_VA_ARG_INCR
439 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
441 # define YYSTACK_ALLOC __alloca
442 # elif defined _MSC_VER
443 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
444 # define alloca _alloca
446 # define YYSTACK_ALLOC alloca
447 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
448 || defined __cplusplus || defined _MSC_VER)
449 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
450 # ifndef EXIT_SUCCESS
451 # define EXIT_SUCCESS 0
458 # ifdef YYSTACK_ALLOC
459 /* Pacify GCC's `empty if-body' warning. */
460 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
461 # ifndef YYSTACK_ALLOC_MAXIMUM
462 /* The OS might guarantee only one guard page at the bottom of the stack,
463 and a page size can be as small as 4096 bytes. So we cannot safely
464 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
465 to allow for a few compiler-allocated temporary stack slots. */
466 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
469 # define YYSTACK_ALLOC YYMALLOC
470 # define YYSTACK_FREE YYFREE
471 # ifndef YYSTACK_ALLOC_MAXIMUM
472 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
474 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
475 && ! ((defined YYMALLOC || defined malloc) \
476 && (defined YYFREE || defined free)))
477 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
478 # ifndef EXIT_SUCCESS
479 # define EXIT_SUCCESS 0
483 # define YYMALLOC malloc
484 # if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
485 || defined __cplusplus || defined _MSC_VER)
486 void *malloc (YYSIZE_T
); /* INFRINGES ON USER NAME SPACE */
491 # if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
492 || defined __cplusplus || defined _MSC_VER)
493 void free (void *); /* INFRINGES ON USER NAME SPACE */
497 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
500 #if (! defined yyoverflow \
501 && (! defined __cplusplus \
502 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
504 /* A type that is properly aligned for any stack member. */
507 yytype_int16 yyss_alloc
;
511 /* The size of the maximum gap between one aligned stack and the next. */
512 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
514 /* The size of an array large to enough to hold all stacks, each with
516 # define YYSTACK_BYTES(N) \
517 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
518 + YYSTACK_GAP_MAXIMUM)
520 # define YYCOPY_NEEDED 1
522 /* Relocate STACK from its old location to the new one. The
523 local variables YYSIZE and YYSTACKSIZE give the old and new number of
524 elements in the stack, and YYPTR gives the new location of the
525 stack. Advance YYPTR to a properly aligned location for the next
527 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
530 YYSIZE_T yynewbytes; \
531 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
532 Stack = &yyptr->Stack_alloc; \
533 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
534 yyptr += yynewbytes / sizeof (*yyptr); \
540 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
541 /* Copy COUNT objects from FROM to TO. The source and destination do
544 # if defined __GNUC__ && 1 < __GNUC__
545 # define YYCOPY(To, From, Count) \
546 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
548 # define YYCOPY(To, From, Count) \
552 for (yyi = 0; yyi < (Count); yyi++) \
553 (To)[yyi] = (From)[yyi]; \
558 #endif /* !YYCOPY_NEEDED */
560 /* YYFINAL -- State number of the termination state. */
562 /* YYLAST -- Last index in YYTABLE. */
565 /* YYNTOKENS -- Number of terminals. */
567 /* YYNNTS -- Number of nonterminals. */
569 /* YYNRULES -- Number of rules. */
571 /* YYNRULES -- Number of states. */
574 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
576 #define YYMAXUTOK 286
578 #define YYTRANSLATE(YYX) \
579 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
581 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
582 static const yytype_uint8 yytranslate
[] =
584 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
585 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
586 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
587 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
588 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
589 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
590 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
591 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
592 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
593 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
594 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
595 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
596 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
597 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
598 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
599 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
600 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
601 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
602 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
603 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
604 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
605 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
606 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
607 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
608 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
609 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
610 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
611 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
612 25, 26, 27, 28, 29, 30, 31
616 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
618 static const yytype_uint8 yyprhs
[] =
620 0, 0, 3, 7, 12, 19, 21, 25, 27, 31,
621 33, 35, 37, 41, 45, 49, 52, 56, 60, 64,
622 68, 72, 76, 80, 84, 88, 92, 96, 100, 104,
623 108, 113, 115, 117, 119, 121, 123
626 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
627 static const yytype_int8 yyrhs
[] =
629 33, 0, -1, 3, 4, 36, -1, 3, 34, 4,
630 36, -1, 3, 34, 4, 36, 15, 38, -1, 35,
631 -1, 35, 6, 34, -1, 5, -1, 36, 7, 36,
632 -1, 36, -1, 21, -1, 14, -1, 9, 38, 10,
633 -1, 38, 23, 38, -1, 38, 22, 38, -1, 24,
634 38, -1, 40, 31, 41, -1, 40, 28, 41, -1,
635 40, 29, 41, -1, 40, 27, 41, -1, 40, 26,
636 41, -1, 40, 30, 41, -1, 41, 31, 40, -1,
637 41, 28, 40, -1, 41, 29, 40, -1, 41, 27,
638 40, -1, 41, 26, 40, -1, 41, 30, 40, -1,
639 40, 25, 39, -1, 40, 8, 11, -1, 40, 8,
640 24, 11, -1, 20, -1, 35, -1, 37, -1, 20,
644 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
645 static const yytype_uint16 yyrline
[] =
647 0, 221, 221, 233, 245, 260, 261, 265, 272, 278,
648 287, 296, 303, 309, 315, 321, 327, 333, 339, 345,
649 351, 357, 363, 369, 375, 381, 387, 393, 399, 405,
650 411, 420, 429, 438, 444, 450, 456
654 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
655 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
656 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
657 static const char *const yytname
[] =
659 "$end", "error", "$undefined", "TK_SELECT", "TK_FROM", "TK_STAR",
660 "TK_COMMA", "TK_DOT", "TK_IS", "TK_LP", "TK_RP", "TK_NULL", "TK_FALSE",
661 "TK_TRUE", "TK_INTEGER", "TK_WHERE", "TK_SPACE", "TK_MINUS",
662 "TK_ILLEGAL", "TK_BY", "TK_STRING", "TK_ID", "TK_OR", "TK_AND", "TK_NOT",
663 "TK_LIKE", "TK_GE", "TK_LE", "TK_GT", "TK_LT", "TK_NE", "TK_EQ",
664 "$accept", "select", "proplist", "prop", "id", "number", "expr",
665 "string_val", "prop_val", "const_val", 0
670 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
672 static const yytype_uint16 yytoknum
[] =
674 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
675 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
676 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
681 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
682 static const yytype_uint8 yyr1
[] =
684 0, 32, 33, 33, 33, 34, 34, 34, 35, 35,
685 36, 37, 38, 38, 38, 38, 38, 38, 38, 38,
686 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
687 38, 39, 40, 41, 41, 41, 41
690 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
691 static const yytype_uint8 yyr2
[] =
693 0, 2, 3, 4, 6, 1, 3, 1, 3, 1,
694 1, 1, 3, 3, 3, 2, 3, 3, 3, 3,
695 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
699 /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
700 Performed when YYTABLE doesn't specify something else to do. Zero
701 means the default is an error. */
702 static const yytype_uint8 yydefact
[] =
704 0, 0, 0, 0, 7, 10, 0, 5, 9, 1,
705 2, 0, 0, 0, 3, 6, 8, 0, 0, 36,
706 35, 11, 34, 0, 32, 33, 4, 0, 0, 0,
707 15, 0, 0, 0, 0, 0, 0, 0, 0, 0,
708 0, 0, 0, 0, 0, 0, 0, 12, 14, 13,
709 29, 0, 31, 28, 20, 19, 17, 18, 21, 16,
710 26, 25, 23, 24, 27, 22, 30
713 /* YYDEFGOTO[NTERM-NUM]. */
714 static const yytype_int8 yydefgoto
[] =
716 -1, 2, 6, 24, 8, 25, 26, 53, 27, 28
719 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
721 #define YYPACT_NINF -18
722 static const yytype_int8 yypact
[] =
724 7, 3, 12, -5, -18, -18, 31, 30, 21, -18,
725 -18, -5, 4, -5, 28, -18, -18, 17, 17, -18,
726 -18, -18, -18, 17, -18, -18, 11, -8, 24, 22,
727 -18, 17, 17, 16, 26, -9, -9, -9, -9, -9,
728 -9, -5, -5, -5, -5, -5, -5, -18, 19, -18,
729 -18, 37, -18, -18, -18, -18, -18, -18, -18, -18,
730 -18, -18, -18, -18, -18, -18, -18
733 /* YYPGOTO[NTERM-NUM]. */
734 static const yytype_int8 yypgoto
[] =
736 -18, -18, 56, 1, 36, -18, -17, -18, 15, 27
739 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
740 positive, shift that token. If negative, reduce the rule which
741 number is the opposite. If YYTABLE_NINF, syntax error. */
742 #define YYTABLE_NINF -1
743 static const yytype_uint8 yytable
[] =
745 33, 29, 7, 19, 20, 21, 30, 3, 4, 4,
746 1, 22, 9, 7, 48, 49, 5, 34, 35, 36,
747 37, 38, 39, 40, 5, 5, 18, 50, 13, 19,
748 20, 21, 47, 31, 32, 11, 12, 22, 5, 10,
749 51, 23, 32, 17, 31, 32, 52, 14, 66, 16,
750 41, 42, 43, 44, 45, 46, 60, 61, 62, 63,
751 64, 65, 54, 55, 56, 57, 58, 59, 15
754 #define yypact_value_is_default(yystate) \
757 #define yytable_value_is_error(yytable_value) \
760 static const yytype_uint8 yycheck
[] =
762 8, 18, 1, 12, 13, 14, 23, 4, 5, 5,
763 3, 20, 0, 12, 31, 32, 21, 25, 26, 27,
764 28, 29, 30, 31, 21, 21, 9, 11, 7, 12,
765 13, 14, 10, 22, 23, 4, 6, 20, 21, 3,
766 24, 24, 23, 15, 22, 23, 20, 11, 11, 13,
767 26, 27, 28, 29, 30, 31, 41, 42, 43, 44,
768 45, 46, 35, 36, 37, 38, 39, 40, 12
771 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
772 symbol of state STATE-NUM. */
773 static const yytype_uint8 yystos
[] =
775 0, 3, 33, 4, 5, 21, 34, 35, 36, 0,
776 36, 4, 6, 7, 36, 34, 36, 15, 9, 12,
777 13, 14, 20, 24, 35, 37, 38, 40, 41, 38,
778 38, 22, 23, 8, 25, 26, 27, 28, 29, 30,
779 31, 26, 27, 28, 29, 30, 31, 10, 38, 38,
780 11, 24, 20, 39, 41, 41, 41, 41, 41, 41,
781 40, 40, 40, 40, 40, 40, 11
784 #define yyerrok (yyerrstatus = 0)
785 #define yyclearin (yychar = YYEMPTY)
789 #define YYACCEPT goto yyacceptlab
790 #define YYABORT goto yyabortlab
791 #define YYERROR goto yyerrorlab
794 /* Like YYERROR except do call yyerror. This remains here temporarily
795 to ease the transition to the new meaning of YYERROR, for GCC.
796 Once GCC version 2 has supplanted version 1, this can go. However,
797 YYFAIL appears to be in use. Nevertheless, it is formally deprecated
798 in Bison 2.4.2's NEWS entry, where a plan to phase it out is
801 #define YYFAIL goto yyerrlab
803 /* This is here to suppress warnings from the GCC cpp's
804 -Wunused-macros. Normally we don't worry about that warning, but
805 some users do, and we want to make it easy for users to remove
806 YYFAIL uses, which will produce warnings from Bison 2.5. */
809 #define YYRECOVERING() (!!yyerrstatus)
811 #define YYBACKUP(Token, Value) \
813 if (yychar == YYEMPTY && yylen == 1) \
822 yyerror (ctx, YY_("syntax error: cannot back up")); \
829 #define YYERRCODE 256
832 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
833 If N is 0, then set CURRENT to the empty location which ends
834 the previous symbol: RHS[0] (always defined). */
836 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
837 #ifndef YYLLOC_DEFAULT
838 # define YYLLOC_DEFAULT(Current, Rhs, N) \
842 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
843 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
844 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
845 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
849 (Current).first_line = (Current).last_line = \
850 YYRHSLOC (Rhs, 0).last_line; \
851 (Current).first_column = (Current).last_column = \
852 YYRHSLOC (Rhs, 0).last_column; \
858 /* This macro is provided for backward compatibility. */
860 #ifndef YY_LOCATION_PRINT
861 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
865 /* YYLEX -- calling `yylex' with the right arguments. */
868 # define YYLEX yylex (&yylval, YYLEX_PARAM)
870 # define YYLEX yylex (&yylval, ctx)
873 /* Enable debugging if requested. */
877 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
878 # define YYFPRINTF fprintf
881 # define YYDPRINTF(Args) \
887 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
891 YYFPRINTF (stderr, "%s ", Title); \
892 yy_symbol_print (stderr, \
894 YYFPRINTF (stderr, "\n"); \
899 /*--------------------------------.
900 | Print this symbol on YYOUTPUT. |
901 `--------------------------------*/
904 #if (defined __STDC__ || defined __C99__FUNC__ \
905 || defined __cplusplus || defined _MSC_VER)
907 yy_symbol_value_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
, struct parser
*ctx
)
910 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
, ctx
)
913 YYSTYPE
const * const yyvaluep
;
921 if (yytype
< YYNTOKENS
)
922 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
934 /*--------------------------------.
935 | Print this symbol on YYOUTPUT. |
936 `--------------------------------*/
938 #if (defined __STDC__ || defined __C99__FUNC__ \
939 || defined __cplusplus || defined _MSC_VER)
941 yy_symbol_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
, struct parser
*ctx
)
944 yy_symbol_print (yyoutput
, yytype
, yyvaluep
, ctx
)
947 YYSTYPE
const * const yyvaluep
;
951 if (yytype
< YYNTOKENS
)
952 YYFPRINTF (yyoutput
, "token %s (", yytname
[yytype
]);
954 YYFPRINTF (yyoutput
, "nterm %s (", yytname
[yytype
]);
956 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
, ctx
);
957 YYFPRINTF (yyoutput
, ")");
960 /*------------------------------------------------------------------.
961 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
963 `------------------------------------------------------------------*/
965 #if (defined __STDC__ || defined __C99__FUNC__ \
966 || defined __cplusplus || defined _MSC_VER)
968 yy_stack_print (yytype_int16
*yybottom
, yytype_int16
*yytop
)
971 yy_stack_print (yybottom
, yytop
)
972 yytype_int16
*yybottom
;
976 YYFPRINTF (stderr
, "Stack now");
977 for (; yybottom
<= yytop
; yybottom
++)
979 int yybot
= *yybottom
;
980 YYFPRINTF (stderr
, " %d", yybot
);
982 YYFPRINTF (stderr
, "\n");
985 # define YY_STACK_PRINT(Bottom, Top) \
988 yy_stack_print ((Bottom), (Top)); \
992 /*------------------------------------------------.
993 | Report that the YYRULE is going to be reduced. |
994 `------------------------------------------------*/
996 #if (defined __STDC__ || defined __C99__FUNC__ \
997 || defined __cplusplus || defined _MSC_VER)
999 yy_reduce_print (YYSTYPE
*yyvsp
, int yyrule
, struct parser
*ctx
)
1002 yy_reduce_print (yyvsp
, yyrule
, ctx
)
1008 int yynrhs
= yyr2
[yyrule
];
1010 unsigned long int yylno
= yyrline
[yyrule
];
1011 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %lu):\n",
1013 /* The symbols being reduced. */
1014 for (yyi
= 0; yyi
< yynrhs
; yyi
++)
1016 YYFPRINTF (stderr
, " $%d = ", yyi
+ 1);
1017 yy_symbol_print (stderr
, yyrhs
[yyprhs
[yyrule
] + yyi
],
1018 &(yyvsp
[(yyi
+ 1) - (yynrhs
)])
1020 YYFPRINTF (stderr
, "\n");
1024 # define YY_REDUCE_PRINT(Rule) \
1027 yy_reduce_print (yyvsp, Rule, ctx); \
1030 /* Nonzero means print parse trace. It is left uninitialized so that
1031 multiple parsers can coexist. */
1033 #else /* !YYDEBUG */
1034 # define YYDPRINTF(Args)
1035 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1036 # define YY_STACK_PRINT(Bottom, Top)
1037 # define YY_REDUCE_PRINT(Rule)
1038 #endif /* !YYDEBUG */
1041 /* YYINITDEPTH -- initial size of the parser's stacks. */
1043 # define YYINITDEPTH 200
1046 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1047 if the built-in stack extension method is used).
1049 Do not make this value too large; the results are undefined if
1050 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1051 evaluated with infinite-precision integer arithmetic. */
1054 # define YYMAXDEPTH 10000
1061 # if defined __GLIBC__ && defined _STRING_H
1062 # define yystrlen strlen
1064 /* Return the length of YYSTR. */
1065 #if (defined __STDC__ || defined __C99__FUNC__ \
1066 || defined __cplusplus || defined _MSC_VER)
1068 yystrlen (const char *yystr
)
1076 for (yylen
= 0; yystr
[yylen
]; yylen
++)
1084 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1085 # define yystpcpy stpcpy
1087 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1089 #if (defined __STDC__ || defined __C99__FUNC__ \
1090 || defined __cplusplus || defined _MSC_VER)
1092 yystpcpy (char *yydest
, const char *yysrc
)
1095 yystpcpy (yydest
, yysrc
)
1101 const char *yys
= yysrc
;
1103 while ((*yyd
++ = *yys
++) != '\0')
1112 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1113 quotes and backslashes, so that it's suitable for yyerror. The
1114 heuristic is that double-quoting is unnecessary unless the string
1115 contains an apostrophe, a comma, or backslash (other than
1116 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1117 null, do not copy; instead, return the length of what the result
1120 yytnamerr (char *yyres
, const char *yystr
)
1125 char const *yyp
= yystr
;
1132 goto do_not_strip_quotes
;
1136 goto do_not_strip_quotes
;
1149 do_not_strip_quotes
: ;
1153 return yystrlen (yystr
);
1155 return yystpcpy (yyres
, yystr
) - yyres
;
1159 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1160 about the unexpected token YYTOKEN for the state stack whose top is
1163 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1164 not large enough to hold the message. In that case, also set
1165 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1166 required number of bytes is too large to store. */
1168 yysyntax_error (YYSIZE_T
*yymsg_alloc
, char **yymsg
,
1169 yytype_int16
*yyssp
, int yytoken
)
1171 YYSIZE_T yysize0
= yytnamerr (0, yytname
[yytoken
]);
1172 YYSIZE_T yysize
= yysize0
;
1174 enum { YYERROR_VERBOSE_ARGS_MAXIMUM
= 5 };
1175 /* Internationalized format string. */
1176 const char *yyformat
= 0;
1177 /* Arguments of yyformat. */
1178 char const *yyarg
[YYERROR_VERBOSE_ARGS_MAXIMUM
];
1179 /* Number of reported tokens (one for the "unexpected", one per
1183 /* There are many possibilities here to consider:
1184 - Assume YYFAIL is not used. It's too flawed to consider. See
1185 <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
1186 for details. YYERROR is fine as it does not invoke this
1188 - If this state is a consistent state with a default action, then
1189 the only way this function was invoked is if the default action
1190 is an error action. In that case, don't check for expected
1191 tokens because there are none.
1192 - The only way there can be no lookahead present (in yychar) is if
1193 this state is a consistent state with a default action. Thus,
1194 detecting the absence of a lookahead is sufficient to determine
1195 that there is no unexpected or expected token to report. In that
1196 case, just report a simple "syntax error".
1197 - Don't assume there isn't a lookahead just because this state is a
1198 consistent state with a default action. There might have been a
1199 previous inconsistent state, consistent state with a non-default
1200 action, or user semantic action that manipulated yychar.
1201 - Of course, the expected token list depends on states to have
1202 correct lookahead information, and it depends on the parser not
1203 to perform extra reductions after fetching a lookahead from the
1204 scanner and before detecting a syntax error. Thus, state merging
1205 (from LALR or IELR) and default reductions corrupt the expected
1206 token list. However, the list is correct for canonical LR with
1207 one exception: it will still contain any token that will not be
1208 accepted due to an error action in a later state.
1210 if (yytoken
!= YYEMPTY
)
1212 int yyn
= yypact
[*yyssp
];
1213 yyarg
[yycount
++] = yytname
[yytoken
];
1214 if (!yypact_value_is_default (yyn
))
1216 /* Start YYX at -YYN if negative to avoid negative indexes in
1217 YYCHECK. In other words, skip the first -YYN actions for
1218 this state because they are default actions. */
1219 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
1220 /* Stay within bounds of both yycheck and yytname. */
1221 int yychecklim
= YYLAST
- yyn
+ 1;
1222 int yyxend
= yychecklim
< YYNTOKENS
? yychecklim
: YYNTOKENS
;
1225 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
1226 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
1227 && !yytable_value_is_error (yytable
[yyx
+ yyn
]))
1229 if (yycount
== YYERROR_VERBOSE_ARGS_MAXIMUM
)
1235 yyarg
[yycount
++] = yytname
[yyx
];
1236 yysize1
= yysize
+ yytnamerr (0, yytname
[yyx
]);
1237 if (! (yysize
<= yysize1
1238 && yysize1
<= YYSTACK_ALLOC_MAXIMUM
))
1247 # define YYCASE_(N, S) \
1251 YYCASE_(0, YY_("syntax error"));
1252 YYCASE_(1, YY_("syntax error, unexpected %s"));
1253 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1254 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1255 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1256 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1260 yysize1
= yysize
+ yystrlen (yyformat
);
1261 if (! (yysize
<= yysize1
&& yysize1
<= YYSTACK_ALLOC_MAXIMUM
))
1265 if (*yymsg_alloc
< yysize
)
1267 *yymsg_alloc
= 2 * yysize
;
1268 if (! (yysize
<= *yymsg_alloc
1269 && *yymsg_alloc
<= YYSTACK_ALLOC_MAXIMUM
))
1270 *yymsg_alloc
= YYSTACK_ALLOC_MAXIMUM
;
1274 /* Avoid sprintf, as that infringes on the user's name space.
1275 Don't have undefined behavior even if the translation
1276 produced a string with the wrong number of "%s"s. */
1280 while ((*yyp
= *yyformat
) != '\0')
1281 if (*yyp
== '%' && yyformat
[1] == 's' && yyi
< yycount
)
1283 yyp
+= yytnamerr (yyp
, yyarg
[yyi
++]);
1294 #endif /* YYERROR_VERBOSE */
1296 /*-----------------------------------------------.
1297 | Release the memory associated to this symbol. |
1298 `-----------------------------------------------*/
1301 #if (defined __STDC__ || defined __C99__FUNC__ \
1302 || defined __cplusplus || defined _MSC_VER)
1304 yydestruct (const char *yymsg
, int yytype
, YYSTYPE
*yyvaluep
, struct parser
*ctx
)
1307 yydestruct (yymsg
, yytype
, yyvaluep
, ctx
)
1319 YY_SYMBOL_PRINT (yymsg
, yytype
, yyvaluep
, yylocationp
);
1330 /* Prevent warnings from -Wmissing-prototypes. */
1331 #ifdef YYPARSE_PARAM
1332 #if defined __STDC__ || defined __cplusplus
1333 int yyparse (void *YYPARSE_PARAM
);
1337 #else /* ! YYPARSE_PARAM */
1338 #if defined __STDC__ || defined __cplusplus
1339 int yyparse (struct parser
*ctx
);
1343 #endif /* ! YYPARSE_PARAM */
1350 #ifdef YYPARSE_PARAM
1351 #if (defined __STDC__ || defined __C99__FUNC__ \
1352 || defined __cplusplus || defined _MSC_VER)
1354 yyparse (void *YYPARSE_PARAM
)
1357 yyparse (YYPARSE_PARAM
)
1358 void *YYPARSE_PARAM
;
1360 #else /* ! YYPARSE_PARAM */
1361 #if (defined __STDC__ || defined __C99__FUNC__ \
1362 || defined __cplusplus || defined _MSC_VER)
1364 yyparse (struct parser
*ctx
)
1372 /* The lookahead symbol. */
1375 /* The semantic value of the lookahead symbol. */
1378 /* Number of syntax errors so far. */
1382 /* Number of tokens to shift before error messages enabled. */
1385 /* The stacks and their tools:
1386 `yyss': related to states.
1387 `yyvs': related to semantic values.
1389 Refer to the stacks thru separate pointers, to allow yyoverflow
1390 to reallocate them elsewhere. */
1392 /* The state stack. */
1393 yytype_int16 yyssa
[YYINITDEPTH
];
1395 yytype_int16
*yyssp
;
1397 /* The semantic value stack. */
1398 YYSTYPE yyvsa
[YYINITDEPTH
];
1402 YYSIZE_T yystacksize
;
1406 /* Lookahead token as an internal (translated) token number. */
1408 /* The variables used to return semantic value and location from the
1413 /* Buffer for error messages, and its allocated size. */
1415 char *yymsg
= yymsgbuf
;
1416 YYSIZE_T yymsg_alloc
= sizeof yymsgbuf
;
1419 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1421 /* The number of symbols on the RHS of the reduced rule.
1422 Keep to zero when no symbol should be popped. */
1428 yystacksize
= YYINITDEPTH
;
1430 YYDPRINTF ((stderr
, "Starting parse\n"));
1435 yychar
= YYEMPTY
; /* Cause a token to be read. */
1437 /* Initialize stack pointers.
1438 Waste one element of value and location stack
1439 so that they stay on the same level as the state stack.
1440 The wasted elements are never initialized. */
1446 /*------------------------------------------------------------.
1447 | yynewstate -- Push a new state, which is found in yystate. |
1448 `------------------------------------------------------------*/
1450 /* In all cases, when you get here, the value and location stacks
1451 have just been pushed. So pushing a state here evens the stacks. */
1457 if (yyss
+ yystacksize
- 1 <= yyssp
)
1459 /* Get the current used size of the three stacks, in elements. */
1460 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1464 /* Give user a chance to reallocate the stack. Use copies of
1465 these so that the &'s don't force the real ones into
1467 YYSTYPE
*yyvs1
= yyvs
;
1468 yytype_int16
*yyss1
= yyss
;
1470 /* Each stack pointer address is followed by the size of the
1471 data in use in that stack, in bytes. This used to be a
1472 conditional around just the two extra args, but that might
1473 be undefined if yyoverflow is a macro. */
1474 yyoverflow (YY_("memory exhausted"),
1475 &yyss1
, yysize
* sizeof (*yyssp
),
1476 &yyvs1
, yysize
* sizeof (*yyvsp
),
1482 #else /* no yyoverflow */
1483 # ifndef YYSTACK_RELOCATE
1484 goto yyexhaustedlab
;
1486 /* Extend the stack our own way. */
1487 if (YYMAXDEPTH
<= yystacksize
)
1488 goto yyexhaustedlab
;
1490 if (YYMAXDEPTH
< yystacksize
)
1491 yystacksize
= YYMAXDEPTH
;
1494 yytype_int16
*yyss1
= yyss
;
1495 union yyalloc
*yyptr
=
1496 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1498 goto yyexhaustedlab
;
1499 YYSTACK_RELOCATE (yyss_alloc
, yyss
);
1500 YYSTACK_RELOCATE (yyvs_alloc
, yyvs
);
1501 # undef YYSTACK_RELOCATE
1503 YYSTACK_FREE (yyss1
);
1506 #endif /* no yyoverflow */
1508 yyssp
= yyss
+ yysize
- 1;
1509 yyvsp
= yyvs
+ yysize
- 1;
1511 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1512 (unsigned long int) yystacksize
));
1514 if (yyss
+ yystacksize
- 1 <= yyssp
)
1518 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1520 if (yystate
== YYFINAL
)
1530 /* Do appropriate processing given the current state. Read a
1531 lookahead token if we need one and don't already have one. */
1533 /* First try to decide what to do without reference to lookahead token. */
1534 yyn
= yypact
[yystate
];
1535 if (yypact_value_is_default (yyn
))
1538 /* Not known => get a lookahead token if don't already have one. */
1540 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1541 if (yychar
== YYEMPTY
)
1543 YYDPRINTF ((stderr
, "Reading a token: "));
1547 if (yychar
<= YYEOF
)
1549 yychar
= yytoken
= YYEOF
;
1550 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1554 yytoken
= YYTRANSLATE (yychar
);
1555 YY_SYMBOL_PRINT ("Next token is", yytoken
, &yylval
, &yylloc
);
1558 /* If the proper action on seeing token YYTOKEN is to reduce or to
1559 detect an error, take that action. */
1561 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1566 if (yytable_value_is_error (yyn
))
1572 /* Count tokens shifted since error; after three, turn off error
1577 /* Shift the lookahead token. */
1578 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
1580 /* Discard the shifted token. */
1589 /*-----------------------------------------------------------.
1590 | yydefault -- do the default action for the current state. |
1591 `-----------------------------------------------------------*/
1593 yyn
= yydefact
[yystate
];
1599 /*-----------------------------.
1600 | yyreduce -- Do a reduction. |
1601 `-----------------------------*/
1603 /* yyn is the number of a rule to reduce with. */
1606 /* If YYLEN is nonzero, implement the default value of the action:
1609 Otherwise, the following line sets YYVAL to garbage.
1610 This behavior is undocumented and Bison
1611 users should not rely upon it. Assigning to YYVAL
1612 unconditionally makes the parser a bit smaller, and it avoids a
1613 GCC warning that YYVAL may be used uninitialized. */
1614 yyval
= yyvsp
[1-yylen
];
1617 YY_REDUCE_PRINT (yyn
);
1622 /* Line 1806 of yacc.c */
1626 struct parser
*parser
= ctx
;
1629 hr
= create_view( NULL
, (yyvsp
[(3) - (3)].string
), NULL
, &view
);
1633 PARSER_BUBBLE_UP_VIEW( parser
, (yyval
.view
), view
);
1639 /* Line 1806 of yacc.c */
1643 struct parser
*parser
= ctx
;
1646 hr
= create_view( (yyvsp
[(2) - (4)].proplist
), (yyvsp
[(4) - (4)].string
), NULL
, &view
);
1650 PARSER_BUBBLE_UP_VIEW( parser
, (yyval
.view
), view
);
1656 /* Line 1806 of yacc.c */
1660 struct parser
*parser
= ctx
;
1663 hr
= create_view( (yyvsp
[(2) - (6)].proplist
), (yyvsp
[(4) - (6)].string
), (yyvsp
[(6) - (6)].expr
), &view
);
1667 PARSER_BUBBLE_UP_VIEW( parser
, (yyval
.view
), view
);
1673 /* Line 1806 of yacc.c */
1676 (yyvsp
[(1) - (3)].proplist
)->next
= (yyvsp
[(3) - (3)].proplist
);
1682 /* Line 1806 of yacc.c */
1685 (yyval
.proplist
) = NULL
;
1691 /* Line 1806 of yacc.c */
1694 (yyval
.proplist
) = alloc_property( ctx
, (yyvsp
[(1) - (3)].string
), (yyvsp
[(3) - (3)].string
) );
1695 if (!(yyval
.proplist
))
1702 /* Line 1806 of yacc.c */
1705 (yyval
.proplist
) = alloc_property( ctx
, NULL
, (yyvsp
[(1) - (1)].string
) );
1706 if (!(yyval
.proplist
))
1713 /* Line 1806 of yacc.c */
1716 (yyval
.string
) = get_string( ctx
, &(yyvsp
[(1) - (1)].str
) );
1717 if (!(yyval
.string
))
1724 /* Line 1806 of yacc.c */
1727 (yyval
.integer
) = get_int( ctx
);
1733 /* Line 1806 of yacc.c */
1736 (yyval
.expr
) = (yyvsp
[(2) - (3)].expr
);
1744 /* Line 1806 of yacc.c */
1747 (yyval
.expr
) = expr_complex( ctx
, (yyvsp
[(1) - (3)].expr
), OP_AND
, (yyvsp
[(3) - (3)].expr
) );
1755 /* Line 1806 of yacc.c */
1758 (yyval
.expr
) = expr_complex( ctx
, (yyvsp
[(1) - (3)].expr
), OP_OR
, (yyvsp
[(3) - (3)].expr
) );
1766 /* Line 1806 of yacc.c */
1769 (yyval
.expr
) = expr_unary( ctx
, (yyvsp
[(2) - (2)].expr
), OP_NOT
);
1777 /* Line 1806 of yacc.c */
1780 (yyval
.expr
) = expr_complex( ctx
, (yyvsp
[(1) - (3)].expr
), OP_EQ
, (yyvsp
[(3) - (3)].expr
) );
1788 /* Line 1806 of yacc.c */
1791 (yyval
.expr
) = expr_complex( ctx
, (yyvsp
[(1) - (3)].expr
), OP_GT
, (yyvsp
[(3) - (3)].expr
) );
1799 /* Line 1806 of yacc.c */
1802 (yyval
.expr
) = expr_complex( ctx
, (yyvsp
[(1) - (3)].expr
), OP_LT
, (yyvsp
[(3) - (3)].expr
) );
1810 /* Line 1806 of yacc.c */
1813 (yyval
.expr
) = expr_complex( ctx
, (yyvsp
[(1) - (3)].expr
), OP_LE
, (yyvsp
[(3) - (3)].expr
) );
1821 /* Line 1806 of yacc.c */
1824 (yyval
.expr
) = expr_complex( ctx
, (yyvsp
[(1) - (3)].expr
), OP_GE
, (yyvsp
[(3) - (3)].expr
) );
1832 /* Line 1806 of yacc.c */
1835 (yyval
.expr
) = expr_complex( ctx
, (yyvsp
[(1) - (3)].expr
), OP_NE
, (yyvsp
[(3) - (3)].expr
) );
1843 /* Line 1806 of yacc.c */
1846 (yyval
.expr
) = expr_complex( ctx
, (yyvsp
[(1) - (3)].expr
), OP_EQ
, (yyvsp
[(3) - (3)].expr
) );
1854 /* Line 1806 of yacc.c */
1857 (yyval
.expr
) = expr_complex( ctx
, (yyvsp
[(1) - (3)].expr
), OP_GT
, (yyvsp
[(3) - (3)].expr
) );
1865 /* Line 1806 of yacc.c */
1868 (yyval
.expr
) = expr_complex( ctx
, (yyvsp
[(1) - (3)].expr
), OP_LT
, (yyvsp
[(3) - (3)].expr
) );
1876 /* Line 1806 of yacc.c */
1879 (yyval
.expr
) = expr_complex( ctx
, (yyvsp
[(1) - (3)].expr
), OP_LE
, (yyvsp
[(3) - (3)].expr
) );
1887 /* Line 1806 of yacc.c */
1890 (yyval
.expr
) = expr_complex( ctx
, (yyvsp
[(1) - (3)].expr
), OP_GE
, (yyvsp
[(3) - (3)].expr
) );
1898 /* Line 1806 of yacc.c */
1901 (yyval
.expr
) = expr_complex( ctx
, (yyvsp
[(1) - (3)].expr
), OP_NE
, (yyvsp
[(3) - (3)].expr
) );
1909 /* Line 1806 of yacc.c */
1912 (yyval
.expr
) = expr_complex( ctx
, (yyvsp
[(1) - (3)].expr
), OP_LIKE
, (yyvsp
[(3) - (3)].expr
) );
1920 /* Line 1806 of yacc.c */
1923 (yyval
.expr
) = expr_unary( ctx
, (yyvsp
[(1) - (3)].expr
), OP_ISNULL
);
1931 /* Line 1806 of yacc.c */
1934 (yyval
.expr
) = expr_unary( ctx
, (yyvsp
[(1) - (4)].expr
), OP_NOTNULL
);
1942 /* Line 1806 of yacc.c */
1945 (yyval
.expr
) = expr_sval( ctx
, &(yyvsp
[(1) - (1)].str
) );
1953 /* Line 1806 of yacc.c */
1956 (yyval
.expr
) = expr_propval( ctx
, (yyvsp
[(1) - (1)].proplist
) );
1964 /* Line 1806 of yacc.c */
1967 (yyval
.expr
) = expr_ival( ctx
, (yyvsp
[(1) - (1)].integer
) );
1975 /* Line 1806 of yacc.c */
1978 (yyval
.expr
) = expr_sval( ctx
, &(yyvsp
[(1) - (1)].str
) );
1986 /* Line 1806 of yacc.c */
1989 (yyval
.expr
) = expr_bval( ctx
, -1 );
1997 /* Line 1806 of yacc.c */
2000 (yyval
.expr
) = expr_bval( ctx
, 0 );
2008 /* Line 1806 of yacc.c */
2009 #line 2022 "wql.tab.c"
2012 /* User semantic actions sometimes alter yychar, and that requires
2013 that yytoken be updated with the new translation. We take the
2014 approach of translating immediately before every use of yytoken.
2015 One alternative is translating here after every semantic action,
2016 but that translation would be missed if the semantic action invokes
2017 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2018 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2019 incorrect destructor might then be invoked immediately. In the
2020 case of YYERROR or YYBACKUP, subsequent parser actions might lead
2021 to an incorrect destructor call or verbose syntax error message
2022 before the lookahead is translated. */
2023 YY_SYMBOL_PRINT ("-> $$ =", yyr1
[yyn
], &yyval
, &yyloc
);
2027 YY_STACK_PRINT (yyss
, yyssp
);
2031 /* Now `shift' the result of the reduction. Determine what state
2032 that goes to, based on the state we popped back to and the rule
2033 number reduced by. */
2037 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
2038 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
2039 yystate
= yytable
[yystate
];
2041 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
2046 /*------------------------------------.
2047 | yyerrlab -- here on detecting error |
2048 `------------------------------------*/
2050 /* Make sure we have latest lookahead translation. See comments at
2051 user semantic actions for why this is necessary. */
2052 yytoken
= yychar
== YYEMPTY
? YYEMPTY
: YYTRANSLATE (yychar
);
2054 /* If not already recovering from an error, report this error. */
2058 #if ! YYERROR_VERBOSE
2059 yyerror (ctx
, YY_("syntax error"));
2061 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2064 char const *yymsgp
= YY_("syntax error");
2065 int yysyntax_error_status
;
2066 yysyntax_error_status
= YYSYNTAX_ERROR
;
2067 if (yysyntax_error_status
== 0)
2069 else if (yysyntax_error_status
== 1)
2071 if (yymsg
!= yymsgbuf
)
2072 YYSTACK_FREE (yymsg
);
2073 yymsg
= (char *) YYSTACK_ALLOC (yymsg_alloc
);
2077 yymsg_alloc
= sizeof yymsgbuf
;
2078 yysyntax_error_status
= 2;
2082 yysyntax_error_status
= YYSYNTAX_ERROR
;
2086 yyerror (ctx
, yymsgp
);
2087 if (yysyntax_error_status
== 2)
2088 goto yyexhaustedlab
;
2090 # undef YYSYNTAX_ERROR
2096 if (yyerrstatus
== 3)
2098 /* If just tried and failed to reuse lookahead token after an
2099 error, discard it. */
2101 if (yychar
<= YYEOF
)
2103 /* Return failure if at end of input. */
2104 if (yychar
== YYEOF
)
2109 yydestruct ("Error: discarding",
2110 yytoken
, &yylval
, ctx
);
2115 /* Else will try to reuse lookahead token after shifting the error
2120 /*---------------------------------------------------.
2121 | yyerrorlab -- error raised explicitly by YYERROR. |
2122 `---------------------------------------------------*/
2125 /* Pacify compilers like GCC when the user code never invokes
2126 YYERROR and the label yyerrorlab therefore never appears in user
2128 if (/*CONSTCOND*/ 0)
2131 /* Do not reclaim the symbols of the rule which action triggered
2135 YY_STACK_PRINT (yyss
, yyssp
);
2140 /*-------------------------------------------------------------.
2141 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2142 `-------------------------------------------------------------*/
2144 yyerrstatus
= 3; /* Each real token shifted decrements this. */
2148 yyn
= yypact
[yystate
];
2149 if (!yypact_value_is_default (yyn
))
2152 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
2160 /* Pop the current state because it cannot handle the error token. */
2165 yydestruct ("Error: popping",
2166 yystos
[yystate
], yyvsp
, ctx
);
2169 YY_STACK_PRINT (yyss
, yyssp
);
2175 /* Shift the error token. */
2176 YY_SYMBOL_PRINT ("Shifting", yystos
[yyn
], yyvsp
, yylsp
);
2182 /*-------------------------------------.
2183 | yyacceptlab -- YYACCEPT comes here. |
2184 `-------------------------------------*/
2189 /*-----------------------------------.
2190 | yyabortlab -- YYABORT comes here. |
2191 `-----------------------------------*/
2196 #if !defined(yyoverflow) || YYERROR_VERBOSE
2197 /*-------------------------------------------------.
2198 | yyexhaustedlab -- memory exhaustion comes here. |
2199 `-------------------------------------------------*/
2201 yyerror (ctx
, YY_("memory exhausted"));
2207 if (yychar
!= YYEMPTY
)
2209 /* Make sure we have latest lookahead translation. See comments at
2210 user semantic actions for why this is necessary. */
2211 yytoken
= YYTRANSLATE (yychar
);
2212 yydestruct ("Cleanup: discarding lookahead",
2213 yytoken
, &yylval
, ctx
);
2215 /* Do not reclaim the symbols of the rule which action triggered
2216 this YYABORT or YYACCEPT. */
2218 YY_STACK_PRINT (yyss
, yyssp
);
2219 while (yyssp
!= yyss
)
2221 yydestruct ("Cleanup: popping",
2222 yystos
[*yyssp
], yyvsp
, ctx
);
2227 YYSTACK_FREE (yyss
);
2230 if (yymsg
!= yymsgbuf
)
2231 YYSTACK_FREE (yymsg
);
2233 /* Make sure YYID is used. */
2234 return YYID (yyresult
);
2239 /* Line 2067 of yacc.c */
2243 HRESULT
parse_query( const WCHAR
*str
, struct view
**view
, struct list
*mem
)
2245 struct parser parser
;
2253 parser
.error
= WBEM_E_INVALID_QUERY
;
2257 ret
= wql_parse( &parser
);
2258 TRACE("wql_parse returned %d\n", ret
);
2263 destroy_view( *parser
.view
);
2264 *parser
.view
= NULL
;
2266 return parser
.error
;
2271 static const char id_char
[] =
2273 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2274 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2275 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
2276 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
2277 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2278 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1,
2279 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2280 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,
2281 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2282 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2283 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2284 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2285 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2286 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2287 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2288 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2298 #define MAX_TOKEN_LEN 6
2300 static const WCHAR andW
[] = {'A','N','D'};
2301 static const WCHAR byW
[] = {'B','Y'};
2302 static const WCHAR falseW
[] = {'F','A','L','S','E'};
2303 static const WCHAR fromW
[] = {'F','R','O','M'};
2304 static const WCHAR isW
[] = {'I','S'};
2305 static const WCHAR likeW
[] = {'L','I','K','E'};
2306 static const WCHAR notW
[] = {'N','O','T'};
2307 static const WCHAR nullW
[] = {'N','U','L','L'};
2308 static const WCHAR orW
[] = {'O','R'};
2309 static const WCHAR selectW
[] = {'S','E','L','E','C','T'};
2310 static const WCHAR trueW
[] = {'T','R','U','E'};
2311 static const WCHAR whereW
[] = {'W','H','E','R','E'};
2313 static const struct keyword keyword_table
[] =
2315 { andW
, SIZEOF(andW
), TK_AND
},
2316 { byW
, SIZEOF(byW
), TK_BY
},
2317 { falseW
, SIZEOF(falseW
), TK_FALSE
},
2318 { fromW
, SIZEOF(fromW
), TK_FROM
},
2319 { isW
, SIZEOF(isW
), TK_IS
},
2320 { likeW
, SIZEOF(likeW
), TK_LIKE
},
2321 { notW
, SIZEOF(notW
), TK_NOT
},
2322 { nullW
, SIZEOF(nullW
), TK_NULL
},
2323 { orW
, SIZEOF(orW
), TK_OR
},
2324 { selectW
, SIZEOF(selectW
), TK_SELECT
},
2325 { trueW
, SIZEOF(trueW
), TK_TRUE
},
2326 { whereW
, SIZEOF(whereW
), TK_WHERE
}
2329 static int cmp_keyword( const void *arg1
, const void *arg2
)
2331 const struct keyword
*key1
= arg1
, *key2
= arg2
;
2332 int len
= min( key1
->len
, key2
->len
);
2335 if ((ret
= memicmpW( key1
->name
, key2
->name
, len
))) return ret
;
2336 if (key1
->len
< key2
->len
) return -1;
2337 else if (key1
->len
> key2
->len
) return 1;
2341 static int keyword_type( const WCHAR
*str
, unsigned int len
)
2343 struct keyword key
, *ret
;
2345 if (len
> MAX_TOKEN_LEN
) return TK_ID
;
2350 ret
= bsearch( &key
, keyword_table
, SIZEOF(keyword_table
), sizeof(struct keyword
), cmp_keyword
);
2351 if (ret
) return ret
->type
;
2355 static int get_token( const WCHAR
*s
, int *token
)
2364 for (i
= 1; isspaceW( s
[i
] ); i
++) {}
2368 if (!s
[1]) return -1;
2389 else if (s
[1] == '>')
2413 *token
= TK_ILLEGAL
;
2427 for (i
= 1; s
[i
]; i
++)
2429 if (s
[i
] == s
[0]) break;
2436 if (!isdigitW( s
[1] ))
2442 case '0': case '1': case '2': case '3': case '4':
2443 case '5': case '6': case '7': case '8': case '9':
2444 *token
= TK_INTEGER
;
2445 for (i
= 1; isdigitW( s
[i
] ); i
++) {}
2448 if (!id_char
[*s
]) break;
2450 for (i
= 1; id_char
[s
[i
]]; i
++) {}
2451 *token
= keyword_type( s
, i
);
2454 *token
= TK_ILLEGAL
;
2458 static int wql_lex( void *p
, struct parser
*parser
)
2460 struct string
*str
= p
;
2464 parser
->idx
+= parser
->len
;
2465 if (!parser
->cmd
[parser
->idx
]) return 0;
2466 parser
->len
= get_token( &parser
->cmd
[parser
->idx
], &token
);
2467 if (!parser
->len
) break;
2469 str
->data
= &parser
->cmd
[parser
->idx
];
2470 str
->len
= parser
->len
;
2471 } while (token
== TK_SPACE
);
2475 static int wql_error( struct parser
*parser
, const char *str
)