1
2 /* A Bison parser, made by GNU Bison 2.4.1. */
3
4 /* Skeleton implementation for Bison's Yacc-like parsers in C
5
6 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
7 Free Software Foundation, Inc.
8
9 This program is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2, or (at your option)
12 any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 Boston, MA 02110-1301, USA. */
23
24 /* As a special exception, you may create a larger work that contains
25 part or all of the Bison parser skeleton and distribute that work
26 under terms of your choice, so long as that work isn't itself a
27 parser generator using the skeleton or a modified version thereof
28 as a parser skeleton. Alternatively, if you modify or redistribute
29 the parser skeleton itself, you may (at your option) remove this
30 special exception, which will cause the skeleton and the resulting
31 Bison output files to be licensed under the GNU General Public
32 License without this special exception.
33
34 This special exception was added by the Free Software Foundation in
35 version 2.2 of Bison. */
36
37 /* C LALR(1) parser skeleton written by Richard Stallman, by
38 simplifying the original so-called "semantic" parser. */
39
40 /* All symbols defined below should begin with yy or YY, to avoid
41 infringing on user name space. This should be done even for local
42 variables, as they might otherwise be expanded by user macros.
43 There are some unavoidable exceptions within include files to
44 define necessary library symbols; they are noted "INFRINGES ON
45 USER NAME SPACE" below. */
46
47 /* Identify Bison output. */
48 #define YYBISON 1
49
50 /* Bison version. */
51 #define YYBISON_VERSION "2.4.1"
52
53 /* Skeleton name. */
54 #define YYSKELETON_NAME "yacc.c"
55
56 /* Pure parsers. */
57 #define YYPURE 1
58
59 /* Push parsers. */
60 #define YYPUSH 0
61
62 /* Pull parsers. */
63 #define YYPULL 1
64
65 /* Using locations. */
66 #define YYLSP_NEEDED 0
67
68 /* Substitute the variable and function names. */
69 #define yyparse Solidparse
70 #define yylex Solidlex
71 #define yyerror Soliderror
72 #define yylval Solidlval
73 #define yychar Solidchar
74 #define yydebug Soliddebug
75 #define yynerrs Solidnerrs
76
77
78 /* Copy the first part of user declarations. */
79
80 /* Line 189 of yacc.c */
81 #line 1 "predicate_parser.y"
82
83 #include <stdlib.h>
84 #include <stdio.h>
85 #include "predicate_parser.h"
86 #include "predicateparse.h"
87
88 #define YYLTYPE_IS_TRIVIAL 0
89 #define YYENABLE_NLS 0
90 #define YYLEX_PARAM scanner
91 #define YYPARSE_PARAM scanner
92 typedef void* yyscan_t;
93 void Soliderror(const char *s);
94 int Solidlex( YYSTYPE *yylval, yyscan_t scanner );
95 int Solidlex_init( yyscan_t *scanner );
96 int Solidlex_destroy( yyscan_t *scanner );
97 void PredicateParse_initLexer( const char *s, yyscan_t scanner );
98 void PredicateParse_mainParse( const char *_code );
99
100
101
102 /* Line 189 of yacc.c */
103 #line 102 "predicate_parser.tab.c"
104
105 /* Enabling traces. */
106 #ifndef YYDEBUG
107 # define YYDEBUG 0
108 #endif
109
110 /* Enabling verbose error messages. */
111 #ifdef YYERROR_VERBOSE
112 # undef YYERROR_VERBOSE
113 # define YYERROR_VERBOSE 1
114 #else
115 # define YYERROR_VERBOSE 0
116 #endif
117
118 /* Enabling the token table. */
119 #ifndef YYTOKEN_TABLE
120 # define YYTOKEN_TABLE 0
121 #endif
122
123
124 /* Tokens. */
125 #ifndef YYTOKENTYPE
126 # define YYTOKENTYPE
127 /* Put the tokens into the symbol table, so that GDB and other debuggers
128 know about them. */
129 enum yytokentype {
130 EQ = 258,
131 MASK = 259,
132 AND = 260,
133 OR = 261,
134 IS = 262,
135 VAL_BOOL = 263,
136 VAL_STRING = 264,
137 VAL_ID = 265,
138 VAL_NUM = 266,
139 VAL_FLOAT = 267
140 };
141 #endif
142
143
144
145 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
146 typedef union YYSTYPE
147 {
148
149 /* Line 214 of yacc.c */
150 #line 22 "predicate_parser.y"
151
152 char valb;
153 int vali;
154 double vald;
155 char *name;
156 void *ptr;
157
158
159
160 /* Line 214 of yacc.c */
161 #line 160 "predicate_parser.tab.c"
162 } YYSTYPE;
163 # define YYSTYPE_IS_TRIVIAL 1
164 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
165 # define YYSTYPE_IS_DECLARED 1
166 #endif
167
168
169 /* Copy the second part of user declarations. */
170
171
172 /* Line 264 of yacc.c */
173 #line 172 "predicate_parser.tab.c"
174
175 #ifdef short
176 # undef short
177 #endif
178
179 #ifdef YYTYPE_UINT8
180 typedef YYTYPE_UINT8 yytype_uint8;
181 #else
182 typedef unsigned char yytype_uint8;
183 #endif
184
185 #ifdef YYTYPE_INT8
186 typedef YYTYPE_INT8 yytype_int8;
187 #elif (defined __STDC__ || defined __C99__FUNC__ \
188 || defined __cplusplus || defined _MSC_VER)
189 typedef signed char yytype_int8;
190 #else
191 typedef short int yytype_int8;
192 #endif
193
194 #ifdef YYTYPE_UINT16
195 typedef YYTYPE_UINT16 yytype_uint16;
196 #else
197 typedef unsigned short int yytype_uint16;
198 #endif
199
200 #ifdef YYTYPE_INT16
201 typedef YYTYPE_INT16 yytype_int16;
202 #else
203 typedef short int yytype_int16;
204 #endif
205
206 #ifndef YYSIZE_T
207 # ifdef __SIZE_TYPE__
208 # define YYSIZE_T __SIZE_TYPE__
209 # elif defined size_t
210 # define YYSIZE_T size_t
211 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
212 || defined __cplusplus || defined _MSC_VER)
213 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
214 # define YYSIZE_T size_t
215 # else
216 # define YYSIZE_T unsigned int
217 # endif
218 #endif
219
220 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
221
222 #ifndef YY_
223 # if YYENABLE_NLS
224 # if ENABLE_NLS
225 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
226 # define YY_(msgid) dgettext ("bison-runtime", msgid)
227 # endif
228 # endif
229 # ifndef YY_
230 # define YY_(msgid) msgid
231 # endif
232 #endif
233
234 /* Suppress unused-variable warnings by "using" E. */
235 #if ! defined lint || defined __GNUC__
236 # define YYUSE(e) ((void) (e))
237 #else
238 # define YYUSE(e) /* empty */
239 #endif
240
241 /* Identity function, used to suppress warnings about constant conditions. */
242 #ifndef lint
243 # define YYID(n) (n)
244 #else
245 #if (defined __STDC__ || defined __C99__FUNC__ \
246 || defined __cplusplus || defined _MSC_VER)
247 static int
YYID(int yyi)248 YYID (int yyi)
249 #else
250 static int
251 YYID (yyi)
252 int yyi;
253 #endif
254 {
255 return yyi;
256 }
257 #endif
258
259 #if ! defined yyoverflow || YYERROR_VERBOSE
260
261 /* The parser invokes alloca or malloc; define the necessary symbols. */
262
263 # ifdef YYSTACK_USE_ALLOCA
264 # if YYSTACK_USE_ALLOCA
265 # ifdef __GNUC__
266 # define YYSTACK_ALLOC __builtin_alloca
267 # elif defined __BUILTIN_VA_ARG_INCR
268 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
269 # elif defined _AIX
270 # define YYSTACK_ALLOC __alloca
271 # elif defined _MSC_VER
272 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
273 # define alloca _alloca
274 # else
275 # define YYSTACK_ALLOC alloca
276 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
277 || defined __cplusplus || defined _MSC_VER)
278 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
279 # ifndef _STDLIB_H
280 # define _STDLIB_H 1
281 # endif
282 # endif
283 # endif
284 # endif
285 # endif
286
287 # ifdef YYSTACK_ALLOC
288 /* Pacify GCC's `empty if-body' warning. */
289 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
290 # ifndef YYSTACK_ALLOC_MAXIMUM
291 /* The OS might guarantee only one guard page at the bottom of the stack,
292 and a page size can be as small as 4096 bytes. So we cannot safely
293 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
294 to allow for a few compiler-allocated temporary stack slots. */
295 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
296 # endif
297 # else
298 # define YYSTACK_ALLOC YYMALLOC
299 # define YYSTACK_FREE YYFREE
300 # ifndef YYSTACK_ALLOC_MAXIMUM
301 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
302 # endif
303 # if (defined __cplusplus && ! defined _STDLIB_H \
304 && ! ((defined YYMALLOC || defined malloc) \
305 && (defined YYFREE || defined free)))
306 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
307 # ifndef _STDLIB_H
308 # define _STDLIB_H 1
309 # endif
310 # endif
311 # ifndef YYMALLOC
312 # define YYMALLOC malloc
313 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
314 || defined __cplusplus || defined _MSC_VER)
315 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
316 # endif
317 # endif
318 # ifndef YYFREE
319 # define YYFREE free
320 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
321 || defined __cplusplus || defined _MSC_VER)
322 void free (void *); /* INFRINGES ON USER NAME SPACE */
323 # endif
324 # endif
325 # endif
326 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
327
328
329 #if (! defined yyoverflow \
330 && (! defined __cplusplus \
331 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
332
333 /* A type that is properly aligned for any stack member. */
334 union yyalloc
335 {
336 yytype_int16 yyss_alloc;
337 YYSTYPE yyvs_alloc;
338 };
339
340 /* The size of the maximum gap between one aligned stack and the next. */
341 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
342
343 /* The size of an array large to enough to hold all stacks, each with
344 N elements. */
345 # define YYSTACK_BYTES(N) \
346 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
347 + YYSTACK_GAP_MAXIMUM)
348
349 /* Copy COUNT objects from FROM to TO. The source and destination do
350 not overlap. */
351 # ifndef YYCOPY
352 # if defined __GNUC__ && 1 < __GNUC__
353 # define YYCOPY(To, From, Count) \
354 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
355 # else
356 # define YYCOPY(To, From, Count) \
357 do \
358 { \
359 YYSIZE_T yyi; \
360 for (yyi = 0; yyi < (Count); yyi++) \
361 (To)[yyi] = (From)[yyi]; \
362 } \
363 while (YYID (0))
364 # endif
365 # endif
366
367 /* Relocate STACK from its old location to the new one. The
368 local variables YYSIZE and YYSTACKSIZE give the old and new number of
369 elements in the stack, and YYPTR gives the new location of the
370 stack. Advance YYPTR to a properly aligned location for the next
371 stack. */
372 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
373 do \
374 { \
375 YYSIZE_T yynewbytes; \
376 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
377 Stack = &yyptr->Stack_alloc; \
378 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
379 yyptr += yynewbytes / sizeof (*yyptr); \
380 } \
381 while (YYID (0))
382
383 #endif
384
385 /* YYFINAL -- State number of the termination state. */
386 #define YYFINAL 11
387 /* YYLAST -- Last index in YYTABLE. */
388 #define YYLAST 29
389
390 /* YYNTOKENS -- Number of terminals. */
391 #define YYNTOKENS 19
392 /* YYNNTS -- Number of nonterminals. */
393 #define YYNNTS 8
394 /* YYNRULES -- Number of rules. */
395 #define YYNRULES 18
396 /* YYNRULES -- Number of states. */
397 #define YYNSTATES 34
398
399 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
400 #define YYUNDEFTOK 2
401 #define YYMAXUTOK 267
402
403 #define YYTRANSLATE(YYX) \
404 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
405
406 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
407 static const yytype_uint8 yytranslate[] =
408 {
409 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
410 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
411 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
412 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
413 2, 2, 2, 2, 18, 2, 15, 2, 2, 2,
414 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
415 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
416 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
417 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
418 2, 13, 2, 14, 2, 2, 2, 2, 2, 2,
419 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
420 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
421 2, 2, 2, 16, 2, 17, 2, 2, 2, 2,
422 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
423 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
424 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
425 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
426 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
427 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
428 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
429 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
430 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
431 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
432 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
433 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
434 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
435 5, 6, 7, 8, 9, 10, 11, 12
436 };
437
438 #if YYDEBUG
439 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
440 YYRHS. */
441 static const yytype_uint8 yyprhs[] =
442 {
443 0, 0, 3, 5, 9, 13, 19, 25, 28, 32,
444 36, 38, 40, 42, 44, 46, 50, 51, 53
445 };
446
447 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
448 static const yytype_int8 yyrhs[] =
449 {
450 20, 0, -1, 21, -1, 13, 22, 14, -1, 13,
451 23, 14, -1, 10, 15, 10, 3, 24, -1, 10,
452 15, 10, 4, 24, -1, 7, 10, -1, 20, 6,
453 20, -1, 20, 5, 20, -1, 9, -1, 8, -1,
454 11, -1, 12, -1, 25, -1, 16, 26, 17, -1,
455 -1, 9, -1, 9, 18, 26, -1
456 };
457
458 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
459 static const yytype_uint8 yyrline[] =
460 {
461 0, 60, 60, 61, 62, 64, 65, 66, 68, 70,
462 72, 73, 74, 75, 76, 78, 80, 81, 82
463 };
464 #endif
465
466 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
467 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
468 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
469 static const char *const yytname[] =
470 {
471 "$end", "error", "$undefined", "EQ", "MASK", "AND", "OR", "IS",
472 "VAL_BOOL", "VAL_STRING", "VAL_ID", "VAL_NUM", "VAL_FLOAT", "'['", "']'",
473 "'.'", "'{'", "'}'", "','", "$accept", "predicate", "predicate_atom",
474 "predicate_or", "predicate_and", "value", "string_list",
475 "string_list_rec", 0
476 };
477 #endif
478
479 # ifdef YYPRINT
480 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
481 token YYLEX-NUM. */
482 static const yytype_uint16 yytoknum[] =
483 {
484 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
485 265, 266, 267, 91, 93, 46, 123, 125, 44
486 };
487 # endif
488
489 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
490 static const yytype_uint8 yyr1[] =
491 {
492 0, 19, 20, 20, 20, 21, 21, 21, 22, 23,
493 24, 24, 24, 24, 24, 25, 26, 26, 26
494 };
495
496 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
497 static const yytype_uint8 yyr2[] =
498 {
499 0, 2, 1, 3, 3, 5, 5, 2, 3, 3,
500 1, 1, 1, 1, 1, 3, 0, 1, 3
501 };
502
503 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
504 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
505 means the default is an error. */
506 static const yytype_uint8 yydefact[] =
507 {
508 0, 0, 0, 0, 0, 2, 7, 0, 0, 0,
509 0, 1, 0, 0, 0, 3, 4, 0, 0, 9,
510 8, 11, 10, 12, 13, 16, 5, 14, 6, 17,
511 0, 16, 15, 18
512 };
513
514 /* YYDEFGOTO[NTERM-NUM]. */
515 static const yytype_int8 yydefgoto[] =
516 {
517 -1, 4, 5, 9, 10, 26, 27, 30
518 };
519
520 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
521 STATE-NUM. */
522 #define YYPACT_NINF -13
523 static const yytype_int8 yypact[] =
524 {
525 5, -2, -12, 5, 16, -13, -13, 7, 1, 6,
526 8, -13, 10, 5, 5, -13, -13, -7, -7, -13,
527 -13, -13, -13, -13, -13, 12, -13, -13, -13, 9,
528 2, 12, -13, -13
529 };
530
531 /* YYPGOTO[NTERM-NUM]. */
532 static const yytype_int8 yypgoto[] =
533 {
534 -13, -3, -13, -13, -13, 11, -13, -8
535 };
536
537 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
538 positive, shift that token. If negative, reduce the rule which
539 number is the opposite. If zero, do what YYDEFACT says.
540 If YYTABLE_NINF, syntax error. */
541 #define YYTABLE_NINF -1
542 static const yytype_uint8 yytable[] =
543 {
544 8, 21, 22, 7, 23, 24, 13, 14, 6, 25,
545 19, 20, 1, 17, 18, 2, 11, 12, 3, 32,
546 15, 29, 16, 33, 0, 0, 0, 31, 0, 28
547 };
548
549 static const yytype_int8 yycheck[] =
550 {
551 3, 8, 9, 15, 11, 12, 5, 6, 10, 16,
552 13, 14, 7, 3, 4, 10, 0, 10, 13, 17,
553 14, 9, 14, 31, -1, -1, -1, 18, -1, 18
554 };
555
556 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
557 symbol of state STATE-NUM. */
558 static const yytype_uint8 yystos[] =
559 {
560 0, 7, 10, 13, 20, 21, 10, 15, 20, 22,
561 23, 0, 10, 5, 6, 14, 14, 3, 4, 20,
562 20, 8, 9, 11, 12, 16, 24, 25, 24, 9,
563 26, 18, 17, 26
564 };
565
566 #define yyerrok (yyerrstatus = 0)
567 #define yyclearin (yychar = YYEMPTY)
568 #define YYEMPTY (-2)
569 #define YYEOF 0
570
571 #define YYACCEPT goto yyacceptlab
572 #define YYABORT goto yyabortlab
573 #define YYERROR goto yyerrorlab
574
575
576 /* Like YYERROR except do call yyerror. This remains here temporarily
577 to ease the transition to the new meaning of YYERROR, for GCC.
578 Once GCC version 2 has supplanted version 1, this can go. */
579
580 #define YYFAIL goto yyerrlab
581
582 #define YYRECOVERING() (!!yyerrstatus)
583
584 #define YYBACKUP(Token, Value) \
585 do \
586 if (yychar == YYEMPTY && yylen == 1) \
587 { \
588 yychar = (Token); \
589 yylval = (Value); \
590 yytoken = YYTRANSLATE (yychar); \
591 YYPOPSTACK (1); \
592 goto yybackup; \
593 } \
594 else \
595 { \
596 yyerror (YY_("syntax error: cannot back up")); \
597 YYERROR; \
598 } \
599 while (YYID (0))
600
601
602 #define YYTERROR 1
603 #define YYERRCODE 256
604
605
606 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
607 If N is 0, then set CURRENT to the empty location which ends
608 the previous symbol: RHS[0] (always defined). */
609
610 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
611 #ifndef YYLLOC_DEFAULT
612 # define YYLLOC_DEFAULT(Current, Rhs, N) \
613 do \
614 if (YYID (N)) \
615 { \
616 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
617 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
618 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
619 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
620 } \
621 else \
622 { \
623 (Current).first_line = (Current).last_line = \
624 YYRHSLOC (Rhs, 0).last_line; \
625 (Current).first_column = (Current).last_column = \
626 YYRHSLOC (Rhs, 0).last_column; \
627 } \
628 while (YYID (0))
629 #endif
630
631
632 /* YY_LOCATION_PRINT -- Print the location on the stream.
633 This macro was not mandated originally: define only if we know
634 we won't break user code: when these are the locations we know. */
635
636 #ifndef YY_LOCATION_PRINT
637 # if YYLTYPE_IS_TRIVIAL
638 # define YY_LOCATION_PRINT(File, Loc) \
639 fprintf (File, "%d.%d-%d.%d", \
640 (Loc).first_line, (Loc).first_column, \
641 (Loc).last_line, (Loc).last_column)
642 # else
643 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
644 # endif
645 #endif
646
647
648 /* YYLEX -- calling `yylex' with the right arguments. */
649
650 #ifdef YYLEX_PARAM
651 # define YYLEX yylex (&yylval, YYLEX_PARAM)
652 #else
653 # define YYLEX yylex (&yylval)
654 #endif
655
656 /* Enable debugging if requested. */
657 #if YYDEBUG
658
659 # ifndef YYFPRINTF
660 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
661 # define YYFPRINTF fprintf
662 # endif
663
664 # define YYDPRINTF(Args) \
665 do { \
666 if (yydebug) \
667 YYFPRINTF Args; \
668 } while (YYID (0))
669
670 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
671 do { \
672 if (yydebug) \
673 { \
674 YYFPRINTF (stderr, "%s ", Title); \
675 yy_symbol_print (stderr, \
676 Type, Value); \
677 YYFPRINTF (stderr, "\n"); \
678 } \
679 } while (YYID (0))
680
681
682 /*--------------------------------.
683 | Print this symbol on YYOUTPUT. |
684 `--------------------------------*/
685
686 /*ARGSUSED*/
687 #if (defined __STDC__ || defined __C99__FUNC__ \
688 || defined __cplusplus || defined _MSC_VER)
689 static void
yy_symbol_value_print(FILE * yyoutput,int yytype,YYSTYPE const * const yyvaluep)690 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
691 #else
692 static void
693 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
694 FILE *yyoutput;
695 int yytype;
696 YYSTYPE const * const yyvaluep;
697 #endif
698 {
699 if (!yyvaluep)
700 return;
701 # ifdef YYPRINT
702 if (yytype < YYNTOKENS)
703 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
704 # else
705 YYUSE (yyoutput);
706 # endif
707 switch (yytype)
708 {
709 default:
710 break;
711 }
712 }
713
714
715 /*--------------------------------.
716 | Print this symbol on YYOUTPUT. |
717 `--------------------------------*/
718
719 #if (defined __STDC__ || defined __C99__FUNC__ \
720 || defined __cplusplus || defined _MSC_VER)
721 static void
yy_symbol_print(FILE * yyoutput,int yytype,YYSTYPE const * const yyvaluep)722 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
723 #else
724 static void
725 yy_symbol_print (yyoutput, yytype, yyvaluep)
726 FILE *yyoutput;
727 int yytype;
728 YYSTYPE const * const yyvaluep;
729 #endif
730 {
731 if (yytype < YYNTOKENS)
732 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
733 else
734 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
735
736 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
737 YYFPRINTF (yyoutput, ")");
738 }
739
740 /*------------------------------------------------------------------.
741 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
742 | TOP (included). |
743 `------------------------------------------------------------------*/
744
745 #if (defined __STDC__ || defined __C99__FUNC__ \
746 || defined __cplusplus || defined _MSC_VER)
747 static void
yy_stack_print(yytype_int16 * yybottom,yytype_int16 * yytop)748 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
749 #else
750 static void
751 yy_stack_print (yybottom, yytop)
752 yytype_int16 *yybottom;
753 yytype_int16 *yytop;
754 #endif
755 {
756 YYFPRINTF (stderr, "Stack now");
757 for (; yybottom <= yytop; yybottom++)
758 {
759 int yybot = *yybottom;
760 YYFPRINTF (stderr, " %d", yybot);
761 }
762 YYFPRINTF (stderr, "\n");
763 }
764
765 # define YY_STACK_PRINT(Bottom, Top) \
766 do { \
767 if (yydebug) \
768 yy_stack_print ((Bottom), (Top)); \
769 } while (YYID (0))
770
771
772 /*------------------------------------------------.
773 | Report that the YYRULE is going to be reduced. |
774 `------------------------------------------------*/
775
776 #if (defined __STDC__ || defined __C99__FUNC__ \
777 || defined __cplusplus || defined _MSC_VER)
778 static void
yy_reduce_print(YYSTYPE * yyvsp,int yyrule)779 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
780 #else
781 static void
782 yy_reduce_print (yyvsp, yyrule)
783 YYSTYPE *yyvsp;
784 int yyrule;
785 #endif
786 {
787 int yynrhs = yyr2[yyrule];
788 int yyi;
789 unsigned long int yylno = yyrline[yyrule];
790 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
791 yyrule - 1, yylno);
792 /* The symbols being reduced. */
793 for (yyi = 0; yyi < yynrhs; yyi++)
794 {
795 YYFPRINTF (stderr, " $%d = ", yyi + 1);
796 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
797 &(yyvsp[(yyi + 1) - (yynrhs)])
798 );
799 YYFPRINTF (stderr, "\n");
800 }
801 }
802
803 # define YY_REDUCE_PRINT(Rule) \
804 do { \
805 if (yydebug) \
806 yy_reduce_print (yyvsp, Rule); \
807 } while (YYID (0))
808
809 /* Nonzero means print parse trace. It is left uninitialized so that
810 multiple parsers can coexist. */
811 int yydebug;
812 #else /* !YYDEBUG */
813 # define YYDPRINTF(Args)
814 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
815 # define YY_STACK_PRINT(Bottom, Top)
816 # define YY_REDUCE_PRINT(Rule)
817 #endif /* !YYDEBUG */
818
819
820 /* YYINITDEPTH -- initial size of the parser's stacks. */
821 #ifndef YYINITDEPTH
822 # define YYINITDEPTH 200
823 #endif
824
825 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
826 if the built-in stack extension method is used).
827
828 Do not make this value too large; the results are undefined if
829 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
830 evaluated with infinite-precision integer arithmetic. */
831
832 #ifndef YYMAXDEPTH
833 # define YYMAXDEPTH 10000
834 #endif
835
836
837
838 #if YYERROR_VERBOSE
839
840 # ifndef yystrlen
841 # if defined __GLIBC__ && defined _STRING_H
842 # define yystrlen strlen
843 # else
844 /* Return the length of YYSTR. */
845 #if (defined __STDC__ || defined __C99__FUNC__ \
846 || defined __cplusplus || defined _MSC_VER)
847 static YYSIZE_T
yystrlen(const char * yystr)848 yystrlen (const char *yystr)
849 #else
850 static YYSIZE_T
851 yystrlen (yystr)
852 const char *yystr;
853 #endif
854 {
855 YYSIZE_T yylen;
856 for (yylen = 0; yystr[yylen]; yylen++)
857 continue;
858 return yylen;
859 }
860 # endif
861 # endif
862
863 # ifndef yystpcpy
864 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
865 # define yystpcpy stpcpy
866 # else
867 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
868 YYDEST. */
869 #if (defined __STDC__ || defined __C99__FUNC__ \
870 || defined __cplusplus || defined _MSC_VER)
871 static char *
yystpcpy(char * yydest,const char * yysrc)872 yystpcpy (char *yydest, const char *yysrc)
873 #else
874 static char *
875 yystpcpy (yydest, yysrc)
876 char *yydest;
877 const char *yysrc;
878 #endif
879 {
880 char *yyd = yydest;
881 const char *yys = yysrc;
882
883 while ((*yyd++ = *yys++) != '\0')
884 continue;
885
886 return yyd - 1;
887 }
888 # endif
889 # endif
890
891 # ifndef yytnamerr
892 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
893 quotes and backslashes, so that it's suitable for yyerror. The
894 heuristic is that double-quoting is unnecessary unless the string
895 contains an apostrophe, a comma, or backslash (other than
896 backslash-backslash). YYSTR is taken from yytname. If YYRES is
897 null, do not copy; instead, return the length of what the result
898 would have been. */
899 static YYSIZE_T
yytnamerr(char * yyres,const char * yystr)900 yytnamerr (char *yyres, const char *yystr)
901 {
902 if (*yystr == '"')
903 {
904 YYSIZE_T yyn = 0;
905 char const *yyp = yystr;
906
907 for (;;)
908 switch (*++yyp)
909 {
910 case '\'':
911 case ',':
912 goto do_not_strip_quotes;
913
914 case '\\':
915 if (*++yyp != '\\')
916 goto do_not_strip_quotes;
917 /* Fall through. */
918 default:
919 if (yyres)
920 yyres[yyn] = *yyp;
921 yyn++;
922 break;
923
924 case '"':
925 if (yyres)
926 yyres[yyn] = '\0';
927 return yyn;
928 }
929 do_not_strip_quotes: ;
930 }
931
932 if (! yyres)
933 return yystrlen (yystr);
934
935 return yystpcpy (yyres, yystr) - yyres;
936 }
937 # endif
938
939 /* Copy into YYRESULT an error message about the unexpected token
940 YYCHAR while in state YYSTATE. Return the number of bytes copied,
941 including the terminating null byte. If YYRESULT is null, do not
942 copy anything; just return the number of bytes that would be
943 copied. As a special case, return 0 if an ordinary "syntax error"
944 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
945 size calculation. */
946 static YYSIZE_T
yysyntax_error(char * yyresult,int yystate,int yychar)947 yysyntax_error (char *yyresult, int yystate, int yychar)
948 {
949 int yyn = yypact[yystate];
950
951 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
952 return 0;
953 else
954 {
955 int yytype = YYTRANSLATE (yychar);
956 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
957 YYSIZE_T yysize = yysize0;
958 YYSIZE_T yysize1;
959 int yysize_overflow = 0;
960 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
961 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
962 int yyx;
963
964 # if 0
965 /* This is so xgettext sees the translatable formats that are
966 constructed on the fly. */
967 YY_("syntax error, unexpected %s");
968 YY_("syntax error, unexpected %s, expecting %s");
969 YY_("syntax error, unexpected %s, expecting %s or %s");
970 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
971 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
972 # endif
973 char *yyfmt;
974 char const *yyf;
975 static char const yyunexpected[] = "syntax error, unexpected %s";
976 static char const yyexpecting[] = ", expecting %s";
977 static char const yyor[] = " or %s";
978 char yyformat[sizeof yyunexpected
979 + sizeof yyexpecting - 1
980 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
981 * (sizeof yyor - 1))];
982 char const *yyprefix = yyexpecting;
983
984 /* Start YYX at -YYN if negative to avoid negative indexes in
985 YYCHECK. */
986 int yyxbegin = yyn < 0 ? -yyn : 0;
987
988 /* Stay within bounds of both yycheck and yytname. */
989 int yychecklim = YYLAST - yyn + 1;
990 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
991 int yycount = 1;
992
993 yyarg[0] = yytname[yytype];
994 yyfmt = yystpcpy (yyformat, yyunexpected);
995
996 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
997 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
998 {
999 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1000 {
1001 yycount = 1;
1002 yysize = yysize0;
1003 yyformat[sizeof yyunexpected - 1] = '\0';
1004 break;
1005 }
1006 yyarg[yycount++] = yytname[yyx];
1007 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1008 yysize_overflow |= (yysize1 < yysize);
1009 yysize = yysize1;
1010 yyfmt = yystpcpy (yyfmt, yyprefix);
1011 yyprefix = yyor;
1012 }
1013
1014 yyf = YY_(yyformat);
1015 yysize1 = yysize + yystrlen (yyf);
1016 yysize_overflow |= (yysize1 < yysize);
1017 yysize = yysize1;
1018
1019 if (yysize_overflow)
1020 return YYSIZE_MAXIMUM;
1021
1022 if (yyresult)
1023 {
1024 /* Avoid sprintf, as that infringes on the user's name space.
1025 Don't have undefined behavior even if the translation
1026 produced a string with the wrong number of "%s"s. */
1027 char *yyp = yyresult;
1028 int yyi = 0;
1029 while ((*yyp = *yyf) != '\0')
1030 {
1031 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1032 {
1033 yyp += yytnamerr (yyp, yyarg[yyi++]);
1034 yyf += 2;
1035 }
1036 else
1037 {
1038 yyp++;
1039 yyf++;
1040 }
1041 }
1042 }
1043 return yysize;
1044 }
1045 }
1046 #endif /* YYERROR_VERBOSE */
1047
1048
1049 /*-----------------------------------------------.
1050 | Release the memory associated to this symbol. |
1051 `-----------------------------------------------*/
1052
1053 /*ARGSUSED*/
1054 #if (defined __STDC__ || defined __C99__FUNC__ \
1055 || defined __cplusplus || defined _MSC_VER)
1056 static void
yydestruct(const char * yymsg,int yytype,YYSTYPE * yyvaluep)1057 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1058 #else
1059 static void
1060 yydestruct (yymsg, yytype, yyvaluep)
1061 const char *yymsg;
1062 int yytype;
1063 YYSTYPE *yyvaluep;
1064 #endif
1065 {
1066 YYUSE (yyvaluep);
1067
1068 if (!yymsg)
1069 yymsg = "Deleting";
1070 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1071
1072 switch (yytype)
1073 {
1074 case 20: /* "predicate" */
1075
1076 /* Line 1000 of yacc.c */
1077 #line 51 "predicate_parser.y"
1078 { PredicateParse_destroy( (yyvaluep->ptr) ); };
1079
1080 /* Line 1000 of yacc.c */
1081 #line 1080 "predicate_parser.tab.c"
1082 break;
1083 case 21: /* "predicate_atom" */
1084
1085 /* Line 1000 of yacc.c */
1086 #line 52 "predicate_parser.y"
1087 { PredicateParse_destroy( (yyvaluep->ptr) ); };
1088
1089 /* Line 1000 of yacc.c */
1090 #line 1089 "predicate_parser.tab.c"
1091 break;
1092 case 22: /* "predicate_or" */
1093
1094 /* Line 1000 of yacc.c */
1095 #line 53 "predicate_parser.y"
1096 { PredicateParse_destroy( (yyvaluep->ptr) ); };
1097
1098 /* Line 1000 of yacc.c */
1099 #line 1098 "predicate_parser.tab.c"
1100 break;
1101 case 23: /* "predicate_and" */
1102
1103 /* Line 1000 of yacc.c */
1104 #line 54 "predicate_parser.y"
1105 { PredicateParse_destroy( (yyvaluep->ptr) ); };
1106
1107 /* Line 1000 of yacc.c */
1108 #line 1107 "predicate_parser.tab.c"
1109 break;
1110
1111 default:
1112 break;
1113 }
1114 }
1115
1116 /* Prevent warnings from -Wmissing-prototypes. */
1117 #ifdef YYPARSE_PARAM
1118 #if defined __STDC__ || defined __cplusplus
1119 int yyparse (void *YYPARSE_PARAM);
1120 #else
1121 int yyparse ();
1122 #endif
1123 #else /* ! YYPARSE_PARAM */
1124 #if defined __STDC__ || defined __cplusplus
1125 int yyparse (void);
1126 #else
1127 int yyparse ();
1128 #endif
1129 #endif /* ! YYPARSE_PARAM */
1130
1131
1132
1133
1134
1135 /*-------------------------.
1136 | yyparse or yypush_parse. |
1137 `-------------------------*/
1138
1139 #ifdef YYPARSE_PARAM
1140 #if (defined __STDC__ || defined __C99__FUNC__ \
1141 || defined __cplusplus || defined _MSC_VER)
1142 int
yyparse(void * YYPARSE_PARAM)1143 yyparse (void *YYPARSE_PARAM)
1144 #else
1145 int
1146 yyparse (YYPARSE_PARAM)
1147 void *YYPARSE_PARAM;
1148 #endif
1149 #else /* ! YYPARSE_PARAM */
1150 #if (defined __STDC__ || defined __C99__FUNC__ \
1151 || defined __cplusplus || defined _MSC_VER)
1152 int
1153 yyparse (void)
1154 #else
1155 int
1156 yyparse ()
1157
1158 #endif
1159 #endif
1160 {
1161 /* The lookahead symbol. */
1162 int yychar;
1163
1164 /* The semantic value of the lookahead symbol. */
1165 YYSTYPE yylval;
1166
1167 /* Number of syntax errors so far. */
1168 int yynerrs;
1169
1170 int yystate;
1171 /* Number of tokens to shift before error messages enabled. */
1172 int yyerrstatus;
1173
1174 /* The stacks and their tools:
1175 `yyss': related to states.
1176 `yyvs': related to semantic values.
1177
1178 Refer to the stacks thru separate pointers, to allow yyoverflow
1179 to reallocate them elsewhere. */
1180
1181 /* The state stack. */
1182 yytype_int16 yyssa[YYINITDEPTH];
1183 yytype_int16 *yyss;
1184 yytype_int16 *yyssp;
1185
1186 /* The semantic value stack. */
1187 YYSTYPE yyvsa[YYINITDEPTH];
1188 YYSTYPE *yyvs;
1189 YYSTYPE *yyvsp;
1190
1191 YYSIZE_T yystacksize;
1192
1193 int yyn;
1194 int yyresult;
1195 /* Lookahead token as an internal (translated) token number. */
1196 int yytoken;
1197 /* The variables used to return semantic value and location from the
1198 action routines. */
1199 YYSTYPE yyval;
1200
1201 #if YYERROR_VERBOSE
1202 /* Buffer for error messages, and its allocated size. */
1203 char yymsgbuf[128];
1204 char *yymsg = yymsgbuf;
1205 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1206 #endif
1207
1208 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1209
1210 /* The number of symbols on the RHS of the reduced rule.
1211 Keep to zero when no symbol should be popped. */
1212 int yylen = 0;
1213
1214 yytoken = 0;
1215 yyss = yyssa;
1216 yyvs = yyvsa;
1217 yystacksize = YYINITDEPTH;
1218
1219 YYDPRINTF ((stderr, "Starting parse\n"));
1220
1221 yystate = 0;
1222 yyerrstatus = 0;
1223 yynerrs = 0;
1224 yychar = YYEMPTY; /* Cause a token to be read. */
1225
1226 /* Initialize stack pointers.
1227 Waste one element of value and location stack
1228 so that they stay on the same level as the state stack.
1229 The wasted elements are never initialized. */
1230 yyssp = yyss;
1231 yyvsp = yyvs;
1232
1233 goto yysetstate;
1234
1235 /*------------------------------------------------------------.
1236 | yynewstate -- Push a new state, which is found in yystate. |
1237 `------------------------------------------------------------*/
1238 yynewstate:
1239 /* In all cases, when you get here, the value and location stacks
1240 have just been pushed. So pushing a state here evens the stacks. */
1241 yyssp++;
1242
1243 yysetstate:
1244 *yyssp = yystate;
1245
1246 if (yyss + yystacksize - 1 <= yyssp)
1247 {
1248 /* Get the current used size of the three stacks, in elements. */
1249 YYSIZE_T yysize = yyssp - yyss + 1;
1250
1251 #ifdef yyoverflow
1252 {
1253 /* Give user a chance to reallocate the stack. Use copies of
1254 these so that the &'s don't force the real ones into
1255 memory. */
1256 YYSTYPE *yyvs1 = yyvs;
1257 yytype_int16 *yyss1 = yyss;
1258
1259 /* Each stack pointer address is followed by the size of the
1260 data in use in that stack, in bytes. This used to be a
1261 conditional around just the two extra args, but that might
1262 be undefined if yyoverflow is a macro. */
1263 yyoverflow (YY_("memory exhausted"),
1264 &yyss1, yysize * sizeof (*yyssp),
1265 &yyvs1, yysize * sizeof (*yyvsp),
1266 &yystacksize);
1267
1268 yyss = yyss1;
1269 yyvs = yyvs1;
1270 }
1271 #else /* no yyoverflow */
1272 # ifndef YYSTACK_RELOCATE
1273 goto yyexhaustedlab;
1274 # else
1275 /* Extend the stack our own way. */
1276 if (YYMAXDEPTH <= yystacksize)
1277 goto yyexhaustedlab;
1278 yystacksize *= 2;
1279 if (YYMAXDEPTH < yystacksize)
1280 yystacksize = YYMAXDEPTH;
1281
1282 {
1283 yytype_int16 *yyss1 = yyss;
1284 union yyalloc *yyptr =
1285 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1286 if (! yyptr)
1287 goto yyexhaustedlab;
1288 YYSTACK_RELOCATE (yyss_alloc, yyss);
1289 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1290 # undef YYSTACK_RELOCATE
1291 if (yyss1 != yyssa)
1292 YYSTACK_FREE (yyss1);
1293 }
1294 # endif
1295 #endif /* no yyoverflow */
1296
1297 yyssp = yyss + yysize - 1;
1298 yyvsp = yyvs + yysize - 1;
1299
1300 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1301 (unsigned long int) yystacksize));
1302
1303 if (yyss + yystacksize - 1 <= yyssp)
1304 YYABORT;
1305 }
1306
1307 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1308
1309 if (yystate == YYFINAL)
1310 YYACCEPT;
1311
1312 goto yybackup;
1313
1314 /*-----------.
1315 | yybackup. |
1316 `-----------*/
1317 yybackup:
1318
1319 /* Do appropriate processing given the current state. Read a
1320 lookahead token if we need one and don't already have one. */
1321
1322 /* First try to decide what to do without reference to lookahead token. */
1323 yyn = yypact[yystate];
1324 if (yyn == YYPACT_NINF)
1325 goto yydefault;
1326
1327 /* Not known => get a lookahead token if don't already have one. */
1328
1329 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1330 if (yychar == YYEMPTY)
1331 {
1332 YYDPRINTF ((stderr, "Reading a token: "));
1333 yychar = YYLEX;
1334 }
1335
1336 if (yychar <= YYEOF)
1337 {
1338 yychar = yytoken = YYEOF;
1339 YYDPRINTF ((stderr, "Now at end of input.\n"));
1340 }
1341 else
1342 {
1343 yytoken = YYTRANSLATE (yychar);
1344 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1345 }
1346
1347 /* If the proper action on seeing token YYTOKEN is to reduce or to
1348 detect an error, take that action. */
1349 yyn += yytoken;
1350 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1351 goto yydefault;
1352 yyn = yytable[yyn];
1353 if (yyn <= 0)
1354 {
1355 if (yyn == 0 || yyn == YYTABLE_NINF)
1356 goto yyerrlab;
1357 yyn = -yyn;
1358 goto yyreduce;
1359 }
1360
1361 /* Count tokens shifted since error; after three, turn off error
1362 status. */
1363 if (yyerrstatus)
1364 yyerrstatus--;
1365
1366 /* Shift the lookahead token. */
1367 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1368
1369 /* Discard the shifted token. */
1370 yychar = YYEMPTY;
1371
1372 yystate = yyn;
1373 *++yyvsp = yylval;
1374
1375 goto yynewstate;
1376
1377
1378 /*-----------------------------------------------------------.
1379 | yydefault -- do the default action for the current state. |
1380 `-----------------------------------------------------------*/
1381 yydefault:
1382 yyn = yydefact[yystate];
1383 if (yyn == 0)
1384 goto yyerrlab;
1385 goto yyreduce;
1386
1387
1388 /*-----------------------------.
1389 | yyreduce -- Do a reduction. |
1390 `-----------------------------*/
1391 yyreduce:
1392 /* yyn is the number of a rule to reduce with. */
1393 yylen = yyr2[yyn];
1394
1395 /* If YYLEN is nonzero, implement the default value of the action:
1396 `$$ = $1'.
1397
1398 Otherwise, the following line sets YYVAL to garbage.
1399 This behavior is undocumented and Bison
1400 users should not rely upon it. Assigning to YYVAL
1401 unconditionally makes the parser a bit smaller, and it avoids a
1402 GCC warning that YYVAL may be used uninitialized. */
1403 yyval = yyvsp[1-yylen];
1404
1405
1406 YY_REDUCE_PRINT (yyn);
1407 switch (yyn)
1408 {
1409 case 2:
1410
1411 /* Line 1455 of yacc.c */
1412 #line 60 "predicate_parser.y"
1413 { PredicateParse_setResult( (yyvsp[(1) - (1)].ptr) ); (yyval.ptr) = (yyvsp[(1) - (1)].ptr); ;}
1414 break;
1415
1416 case 3:
1417
1418 /* Line 1455 of yacc.c */
1419 #line 61 "predicate_parser.y"
1420 { PredicateParse_setResult( (yyvsp[(2) - (3)].ptr) ); (yyval.ptr) = (yyvsp[(2) - (3)].ptr); ;}
1421 break;
1422
1423 case 4:
1424
1425 /* Line 1455 of yacc.c */
1426 #line 62 "predicate_parser.y"
1427 { PredicateParse_setResult( (yyvsp[(2) - (3)].ptr) ); (yyval.ptr) = (yyvsp[(2) - (3)].ptr); ;}
1428 break;
1429
1430 case 5:
1431
1432 /* Line 1455 of yacc.c */
1433 #line 64 "predicate_parser.y"
1434 { (yyval.ptr) = PredicateParse_newAtom( (yyvsp[(1) - (5)].name), (yyvsp[(3) - (5)].name), (yyvsp[(5) - (5)].ptr) ); ;}
1435 break;
1436
1437 case 6:
1438
1439 /* Line 1455 of yacc.c */
1440 #line 65 "predicate_parser.y"
1441 { (yyval.ptr) = PredicateParse_newMaskAtom( (yyvsp[(1) - (5)].name), (yyvsp[(3) - (5)].name), (yyvsp[(5) - (5)].ptr) ); ;}
1442 break;
1443
1444 case 7:
1445
1446 /* Line 1455 of yacc.c */
1447 #line 66 "predicate_parser.y"
1448 { (yyval.ptr) = PredicateParse_newIsAtom( (yyvsp[(2) - (2)].name) ); ;}
1449 break;
1450
1451 case 8:
1452
1453 /* Line 1455 of yacc.c */
1454 #line 68 "predicate_parser.y"
1455 { (yyval.ptr) = PredicateParse_newOr( (yyvsp[(1) - (3)].ptr), (yyvsp[(3) - (3)].ptr) ); ;}
1456 break;
1457
1458 case 9:
1459
1460 /* Line 1455 of yacc.c */
1461 #line 70 "predicate_parser.y"
1462 { (yyval.ptr) = PredicateParse_newAnd( (yyvsp[(1) - (3)].ptr), (yyvsp[(3) - (3)].ptr) ); ;}
1463 break;
1464
1465 case 10:
1466
1467 /* Line 1455 of yacc.c */
1468 #line 72 "predicate_parser.y"
1469 { (yyval.ptr) = PredicateParse_newStringValue( (yyvsp[(1) - (1)].name) ); ;}
1470 break;
1471
1472 case 11:
1473
1474 /* Line 1455 of yacc.c */
1475 #line 73 "predicate_parser.y"
1476 { (yyval.ptr) = PredicateParse_newBoolValue( (yyvsp[(1) - (1)].valb) ); ;}
1477 break;
1478
1479 case 12:
1480
1481 /* Line 1455 of yacc.c */
1482 #line 74 "predicate_parser.y"
1483 { (yyval.ptr) = PredicateParse_newNumValue( (yyvsp[(1) - (1)].vali) ); ;}
1484 break;
1485
1486 case 13:
1487
1488 /* Line 1455 of yacc.c */
1489 #line 75 "predicate_parser.y"
1490 { (yyval.ptr) = PredicateParse_newDoubleValue( (yyvsp[(1) - (1)].vald) ); ;}
1491 break;
1492
1493 case 14:
1494
1495 /* Line 1455 of yacc.c */
1496 #line 76 "predicate_parser.y"
1497 { (yyval.ptr) = (yyvsp[(1) - (1)].ptr); ;}
1498 break;
1499
1500 case 15:
1501
1502 /* Line 1455 of yacc.c */
1503 #line 78 "predicate_parser.y"
1504 { (yyval.ptr) = (yyvsp[(1) - (3)].ptr); ;}
1505 break;
1506
1507 case 16:
1508
1509 /* Line 1455 of yacc.c */
1510 #line 80 "predicate_parser.y"
1511 { (yyval.ptr) = PredicateParse_newEmptyStringListValue(); ;}
1512 break;
1513
1514 case 17:
1515
1516 /* Line 1455 of yacc.c */
1517 #line 81 "predicate_parser.y"
1518 { (yyval.ptr) = PredicateParse_newStringListValue( (yyvsp[(1) - (1)].ptr) ); ;}
1519 break;
1520
1521 case 18:
1522
1523 /* Line 1455 of yacc.c */
1524 #line 82 "predicate_parser.y"
1525 { (yyval.ptr) = PredicateParse_appendStringListValue( (yyvsp[(1) - (3)].name), (yyvsp[(3) - (3)].ptr) ); ;}
1526 break;
1527
1528
1529
1530 /* Line 1455 of yacc.c */
1531 #line 1530 "predicate_parser.tab.c"
1532 default: break;
1533 }
1534 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1535
1536 YYPOPSTACK (yylen);
1537 yylen = 0;
1538 YY_STACK_PRINT (yyss, yyssp);
1539
1540 *++yyvsp = yyval;
1541
1542 /* Now `shift' the result of the reduction. Determine what state
1543 that goes to, based on the state we popped back to and the rule
1544 number reduced by. */
1545
1546 yyn = yyr1[yyn];
1547
1548 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1549 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1550 yystate = yytable[yystate];
1551 else
1552 yystate = yydefgoto[yyn - YYNTOKENS];
1553
1554 goto yynewstate;
1555
1556
1557 /*------------------------------------.
1558 | yyerrlab -- here on detecting error |
1559 `------------------------------------*/
1560 yyerrlab:
1561 /* If not already recovering from an error, report this error. */
1562 if (!yyerrstatus)
1563 {
1564 ++yynerrs;
1565 #if ! YYERROR_VERBOSE
1566 yyerror (YY_("syntax error"));
1567 #else
1568 {
1569 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1570 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1571 {
1572 YYSIZE_T yyalloc = 2 * yysize;
1573 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
1574 yyalloc = YYSTACK_ALLOC_MAXIMUM;
1575 if (yymsg != yymsgbuf)
1576 YYSTACK_FREE (yymsg);
1577 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
1578 if (yymsg)
1579 yymsg_alloc = yyalloc;
1580 else
1581 {
1582 yymsg = yymsgbuf;
1583 yymsg_alloc = sizeof yymsgbuf;
1584 }
1585 }
1586
1587 if (0 < yysize && yysize <= yymsg_alloc)
1588 {
1589 (void) yysyntax_error (yymsg, yystate, yychar);
1590 yyerror (yymsg);
1591 }
1592 else
1593 {
1594 yyerror (YY_("syntax error"));
1595 if (yysize != 0)
1596 goto yyexhaustedlab;
1597 }
1598 }
1599 #endif
1600 }
1601
1602
1603
1604 if (yyerrstatus == 3)
1605 {
1606 /* If just tried and failed to reuse lookahead token after an
1607 error, discard it. */
1608
1609 if (yychar <= YYEOF)
1610 {
1611 /* Return failure if at end of input. */
1612 if (yychar == YYEOF)
1613 YYABORT;
1614 }
1615 else
1616 {
1617 yydestruct ("Error: discarding",
1618 yytoken, &yylval);
1619 yychar = YYEMPTY;
1620 }
1621 }
1622
1623 /* Else will try to reuse lookahead token after shifting the error
1624 token. */
1625 goto yyerrlab1;
1626
1627
1628 /*---------------------------------------------------.
1629 | yyerrorlab -- error raised explicitly by YYERROR. |
1630 `---------------------------------------------------*/
1631 yyerrorlab:
1632
1633 /* Pacify compilers like GCC when the user code never invokes
1634 YYERROR and the label yyerrorlab therefore never appears in user
1635 code. */
1636 if (/*CONSTCOND*/ 0)
1637 goto yyerrorlab;
1638
1639 /* Do not reclaim the symbols of the rule which action triggered
1640 this YYERROR. */
1641 YYPOPSTACK (yylen);
1642 yylen = 0;
1643 YY_STACK_PRINT (yyss, yyssp);
1644 yystate = *yyssp;
1645 goto yyerrlab1;
1646
1647
1648 /*-------------------------------------------------------------.
1649 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1650 `-------------------------------------------------------------*/
1651 yyerrlab1:
1652 yyerrstatus = 3; /* Each real token shifted decrements this. */
1653
1654 for (;;)
1655 {
1656 yyn = yypact[yystate];
1657 if (yyn != YYPACT_NINF)
1658 {
1659 yyn += YYTERROR;
1660 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1661 {
1662 yyn = yytable[yyn];
1663 if (0 < yyn)
1664 break;
1665 }
1666 }
1667
1668 /* Pop the current state because it cannot handle the error token. */
1669 if (yyssp == yyss)
1670 YYABORT;
1671
1672
1673 yydestruct ("Error: popping",
1674 yystos[yystate], yyvsp);
1675 YYPOPSTACK (1);
1676 yystate = *yyssp;
1677 YY_STACK_PRINT (yyss, yyssp);
1678 }
1679
1680 *++yyvsp = yylval;
1681
1682
1683 /* Shift the error token. */
1684 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1685
1686 yystate = yyn;
1687 goto yynewstate;
1688
1689
1690 /*-------------------------------------.
1691 | yyacceptlab -- YYACCEPT comes here. |
1692 `-------------------------------------*/
1693 yyacceptlab:
1694 yyresult = 0;
1695 goto yyreturn;
1696
1697 /*-----------------------------------.
1698 | yyabortlab -- YYABORT comes here. |
1699 `-----------------------------------*/
1700 yyabortlab:
1701 yyresult = 1;
1702 goto yyreturn;
1703
1704 #if !defined(yyoverflow) || YYERROR_VERBOSE
1705 /*-------------------------------------------------.
1706 | yyexhaustedlab -- memory exhaustion comes here. |
1707 `-------------------------------------------------*/
1708 yyexhaustedlab:
1709 yyerror (YY_("memory exhausted"));
1710 yyresult = 2;
1711 /* Fall through. */
1712 #endif
1713
1714 yyreturn:
1715 if (yychar != YYEMPTY)
1716 yydestruct ("Cleanup: discarding lookahead",
1717 yytoken, &yylval);
1718 /* Do not reclaim the symbols of the rule which action triggered
1719 this YYABORT or YYACCEPT. */
1720 YYPOPSTACK (yylen);
1721 YY_STACK_PRINT (yyss, yyssp);
1722 while (yyssp != yyss)
1723 {
1724 yydestruct ("Cleanup: popping",
1725 yystos[*yyssp], yyvsp);
1726 YYPOPSTACK (1);
1727 }
1728 #ifndef yyoverflow
1729 if (yyss != yyssa)
1730 YYSTACK_FREE (yyss);
1731 #endif
1732 #if YYERROR_VERBOSE
1733 if (yymsg != yymsgbuf)
1734 YYSTACK_FREE (yymsg);
1735 #endif
1736 /* Make sure YYID is used. */
1737 return YYID (yyresult);
1738 }
1739
1740
1741
1742 /* Line 1675 of yacc.c */
1743 #line 84 "predicate_parser.y"
1744
1745
Soliderror(const char * s)1746 void Soliderror ( const char *s ) /* Called by Solidparse on error */
1747 {
1748 PredicateParse_errorDetected(s);
1749 }
1750
PredicateParse_mainParse(const char * _code)1751 void PredicateParse_mainParse( const char *_code )
1752 {
1753 yyscan_t scanner;
1754 Solidlex_init( &scanner );
1755 PredicateParse_initLexer( _code, scanner );
1756 Solidparse( scanner );
1757 Solidlex_destroy( scanner );
1758 }
1759
1760
1761