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