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