whistlepig 0.1

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