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