isomorfeus-ferret 0.12.2 → 0.12.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +612 -612
  3. data/README.md +80 -44
  4. data/ext/isomorfeus_ferret_ext/bm_hash.c +9 -6
  5. data/ext/isomorfeus_ferret_ext/bm_micro_string.c +4 -2
  6. data/ext/isomorfeus_ferret_ext/frb_search.c +14 -2
  7. data/ext/isomorfeus_ferret_ext/frb_store.c +34 -5
  8. data/ext/isomorfeus_ferret_ext/frt_posh.h +11 -19
  9. data/ext/isomorfeus_ferret_ext/frt_q_parser.c +1844 -1911
  10. data/ext/isomorfeus_ferret_ext/frt_q_phrase.c +12 -15
  11. data/ext/isomorfeus_ferret_ext/frt_scanner.c +1 -0
  12. data/ext/isomorfeus_ferret_ext/frt_scanner_mb.c +1 -0
  13. data/ext/isomorfeus_ferret_ext/frt_scanner_utf8.c +1 -0
  14. data/ext/isomorfeus_ferret_ext/frt_search.h +1 -1
  15. data/ext/isomorfeus_ferret_ext/libstemmer.c +14 -11
  16. data/ext/isomorfeus_ferret_ext/libstemmer.h +4 -9
  17. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_basque.c +1167 -0
  18. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_basque.h +6 -0
  19. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_catalan.c +1433 -0
  20. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_catalan.h +6 -0
  21. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_danish.c +120 -143
  22. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_danish.h +1 -2
  23. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_dutch.c +217 -237
  24. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_dutch.h +1 -1
  25. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_english.c +377 -432
  26. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_english.h +1 -1
  27. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_finnish.c +298 -342
  28. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_finnish.h +1 -2
  29. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_french.c +530 -524
  30. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_french.h +1 -1
  31. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_german.c +201 -214
  32. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_german.h +1 -1
  33. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_hungarian.c +1 -1
  34. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_indonesian.c +394 -0
  35. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_indonesian.h +6 -0
  36. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_irish.c +457 -0
  37. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_irish.h +6 -0
  38. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_italian.c +396 -439
  39. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_italian.h +1 -1
  40. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_norwegian.c +104 -128
  41. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_norwegian.h +1 -1
  42. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_porter.c +242 -273
  43. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_porter.h +1 -1
  44. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_portuguese.c +406 -461
  45. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_portuguese.h +1 -2
  46. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_spanish.c +405 -456
  47. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_spanish.h +1 -1
  48. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_swedish.c +108 -126
  49. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_swedish.h +1 -1
  50. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_2_hungarian.c +849 -0
  51. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_2_hungarian.h +6 -0
  52. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_2_romanian.c +373 -405
  53. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_2_romanian.h +1 -1
  54. data/ext/isomorfeus_ferret_ext/stem_KOI8_R_russian.c +288 -305
  55. data/ext/isomorfeus_ferret_ext/stem_KOI8_R_russian.h +1 -1
  56. data/ext/isomorfeus_ferret_ext/stem_UTF_8_arabic.c +1651 -0
  57. data/ext/isomorfeus_ferret_ext/stem_UTF_8_arabic.h +6 -0
  58. data/ext/isomorfeus_ferret_ext/stem_UTF_8_armenian.c +546 -0
  59. data/ext/isomorfeus_ferret_ext/stem_UTF_8_armenian.h +6 -0
  60. data/ext/isomorfeus_ferret_ext/stem_UTF_8_basque.c +1171 -0
  61. data/ext/isomorfeus_ferret_ext/stem_UTF_8_basque.h +6 -0
  62. data/ext/isomorfeus_ferret_ext/stem_UTF_8_catalan.c +1436 -0
  63. data/ext/isomorfeus_ferret_ext/stem_UTF_8_catalan.h +6 -0
  64. data/ext/isomorfeus_ferret_ext/stem_UTF_8_danish.c +121 -141
  65. data/ext/isomorfeus_ferret_ext/stem_UTF_8_danish.h +1 -1
  66. data/ext/isomorfeus_ferret_ext/stem_UTF_8_dutch.c +221 -241
  67. data/ext/isomorfeus_ferret_ext/stem_UTF_8_dutch.h +1 -1
  68. data/ext/isomorfeus_ferret_ext/stem_UTF_8_english.c +381 -431
  69. data/ext/isomorfeus_ferret_ext/stem_UTF_8_english.h +1 -1
  70. data/ext/isomorfeus_ferret_ext/stem_UTF_8_finnish.c +300 -345
  71. data/ext/isomorfeus_ferret_ext/stem_UTF_8_finnish.h +1 -1
  72. data/ext/isomorfeus_ferret_ext/stem_UTF_8_french.c +518 -511
  73. data/ext/isomorfeus_ferret_ext/stem_UTF_8_french.h +1 -1
  74. data/ext/isomorfeus_ferret_ext/stem_UTF_8_german.c +201 -209
  75. data/ext/isomorfeus_ferret_ext/stem_UTF_8_german.h +1 -1
  76. data/ext/isomorfeus_ferret_ext/stem_UTF_8_greek.c +3660 -0
  77. data/ext/isomorfeus_ferret_ext/stem_UTF_8_greek.h +6 -0
  78. data/ext/isomorfeus_ferret_ext/stem_UTF_8_hindi.c +309 -0
  79. data/ext/isomorfeus_ferret_ext/stem_UTF_8_hindi.h +6 -0
  80. data/ext/isomorfeus_ferret_ext/stem_UTF_8_hungarian.c +306 -671
  81. data/ext/isomorfeus_ferret_ext/stem_UTF_8_hungarian.h +1 -1
  82. data/ext/isomorfeus_ferret_ext/stem_UTF_8_indonesian.c +394 -0
  83. data/ext/isomorfeus_ferret_ext/stem_UTF_8_indonesian.h +6 -0
  84. data/ext/isomorfeus_ferret_ext/stem_UTF_8_irish.c +457 -0
  85. data/ext/isomorfeus_ferret_ext/stem_UTF_8_irish.h +6 -0
  86. data/ext/isomorfeus_ferret_ext/stem_UTF_8_italian.c +400 -442
  87. data/ext/isomorfeus_ferret_ext/stem_UTF_8_italian.h +1 -1
  88. data/ext/isomorfeus_ferret_ext/stem_UTF_8_lithuanian.c +824 -0
  89. data/ext/isomorfeus_ferret_ext/stem_UTF_8_lithuanian.h +6 -0
  90. data/ext/isomorfeus_ferret_ext/stem_UTF_8_nepali.c +408 -0
  91. data/ext/isomorfeus_ferret_ext/stem_UTF_8_nepali.h +6 -0
  92. data/ext/isomorfeus_ferret_ext/stem_UTF_8_norwegian.c +105 -127
  93. data/ext/isomorfeus_ferret_ext/stem_UTF_8_norwegian.h +1 -1
  94. data/ext/isomorfeus_ferret_ext/stem_UTF_8_porter.c +245 -276
  95. data/ext/isomorfeus_ferret_ext/stem_UTF_8_porter.h +1 -1
  96. data/ext/isomorfeus_ferret_ext/stem_UTF_8_portuguese.c +409 -464
  97. data/ext/isomorfeus_ferret_ext/stem_UTF_8_portuguese.h +1 -1
  98. data/ext/isomorfeus_ferret_ext/stem_UTF_8_romanian.c +376 -408
  99. data/ext/isomorfeus_ferret_ext/stem_UTF_8_romanian.h +1 -1
  100. data/ext/isomorfeus_ferret_ext/stem_UTF_8_russian.c +272 -287
  101. data/ext/isomorfeus_ferret_ext/stem_UTF_8_russian.h +1 -1
  102. data/ext/isomorfeus_ferret_ext/stem_UTF_8_serbian.c +6530 -0
  103. data/ext/isomorfeus_ferret_ext/stem_UTF_8_serbian.h +6 -0
  104. data/ext/isomorfeus_ferret_ext/stem_UTF_8_spanish.c +407 -458
  105. data/ext/isomorfeus_ferret_ext/stem_UTF_8_spanish.h +1 -1
  106. data/ext/isomorfeus_ferret_ext/stem_UTF_8_swedish.c +110 -125
  107. data/ext/isomorfeus_ferret_ext/stem_UTF_8_swedish.h +1 -1
  108. data/ext/isomorfeus_ferret_ext/stem_UTF_8_tamil.c +1865 -0
  109. data/ext/isomorfeus_ferret_ext/stem_UTF_8_tamil.h +6 -0
  110. data/ext/isomorfeus_ferret_ext/stem_UTF_8_turkish.c +698 -806
  111. data/ext/isomorfeus_ferret_ext/stem_UTF_8_turkish.h +1 -1
  112. data/ext/isomorfeus_ferret_ext/stem_UTF_8_yiddish.c +1220 -0
  113. data/ext/isomorfeus_ferret_ext/stem_UTF_8_yiddish.h +6 -0
  114. data/ext/isomorfeus_ferret_ext/stem_api.c +1 -9
  115. data/ext/isomorfeus_ferret_ext/stem_api.h +1 -3
  116. data/ext/isomorfeus_ferret_ext/stem_header.h +30 -26
  117. data/ext/isomorfeus_ferret_ext/stem_modules.h +113 -26
  118. data/ext/isomorfeus_ferret_ext/stem_modules.txt +18 -5
  119. data/ext/isomorfeus_ferret_ext/stem_utilities.c +167 -132
  120. data/ext/isomorfeus_ferret_ext/test.c +7 -1
  121. data/ext/isomorfeus_ferret_ext/test_search.c +0 -1
  122. data/lib/isomorfeus/ferret/index/index.rb +1 -1
  123. data/lib/isomorfeus/ferret/version.rb +1 -1
  124. metadata +43 -7
  125. data/ext/isomorfeus_ferret_ext/q_parser.y +0 -1366
@@ -1,91 +1,157 @@
1
- /* A Bison parser, made by GNU Bison 2.3. */
2
-
3
- /* Skeleton implementation for Bison's Yacc-like parsers in C
4
-
5
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6
- Free Software Foundation, 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 2, or (at your option)
11
- 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, write to the Free Software
20
- Foundation, Inc., 51 Franklin Street, Fifth Floor,
21
- Boston, MA 02110-1301, USA. */
22
-
23
- /* As a special exception, you may create a larger work that contains
24
- part or all of the Bison parser skeleton and distribute that work
25
- under terms of your choice, so long as that work isn't itself a
26
- parser generator using the skeleton or a modified version thereof
27
- as a parser skeleton. Alternatively, if you modify or redistribute
28
- the parser skeleton itself, you may (at your option) remove this
29
- special exception, which will cause the skeleton and the resulting
30
- Bison output files to be licensed under the GNU General Public
31
- License without this special exception.
32
-
33
- This special exception was added by the Free Software Foundation in
34
- version 2.2 of Bison. */
35
-
36
- /* C LALR(1) parser skeleton written by Richard Stallman, by
37
- simplifying the original so-called "semantic" parser. */
38
-
39
- /* All symbols defined below should begin with yy or YY, to avoid
40
- infringing on user name space. This should be done even for local
41
- variables, as they might otherwise be expanded by user macros.
42
- There are some unavoidable exceptions within include files to
43
- define necessary library symbols; they are noted "INFRINGES ON
44
- USER NAME SPACE" below. */
45
-
46
- /* Identify Bison output. */
47
- #define YYBISON 1
48
-
49
- /* Bison version. */
50
- #define YYBISON_VERSION "2.3"
51
-
52
- /* Skeleton name. */
53
- #define YYSKELETON_NAME "yacc.c"
54
-
55
- /* Pure parsers. */
56
- #define YYPURE 1
57
-
58
- /* Using locations. */
59
- #define YYLSP_NEEDED 0
60
-
61
- /* Tokens. */
62
- #ifndef YYTOKENTYPE
63
- # define YYTOKENTYPE
64
- /* Put the tokens into the symbol table, so that GDB and other debuggers
65
- know about them. */
66
- enum yytokentype {
67
- QWRD = 258,
68
- WILD_STR = 259,
69
- LOW = 260,
70
- OR = 261,
71
- AND = 262,
72
- NOT = 263,
73
- REQ = 264,
74
- HIGH = 265
75
- };
76
- #endif
77
- /* Tokens. */
78
- #define QWRD 258
79
- #define WILD_STR 259
80
- #define LOW 260
81
- #define OR 261
82
- #define AND 262
83
- #define NOT 263
84
- #define REQ 264
85
- #define HIGH 265
86
-
87
- /* Copy the first part of user declarations. */
88
- #line 84 "src/q_parser.y"
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 2
59
+
60
+ /* Push parsers. */
61
+ #define YYPUSH 0
62
+
63
+ /* Pull parsers. */
64
+ #define YYPULL 1
65
+
66
+
67
+
68
+
69
+ /* First part of user prologue. */
70
+ #line 1 "frt_q_parser.y"
71
+
72
+ /*****************************************************************************
73
+ * QueryParser
74
+ * ===========
75
+ *
76
+ * Brief Overview
77
+ * --------------
78
+ *
79
+ * === Creating a QueryParser
80
+ *
81
+ * +qp_new+ allocates a new QueryParser and assigns three very important
82
+ * HashSets; +qp->def_fields+, +qp->tkz_fields+ and +qp->all_fields+. The
83
+ * query language allows you to assign a field or a set of fields to each
84
+ * part of the query.
85
+ *
86
+ * - +qp->def_fields+ is the set of fields that a query is applied to by
87
+ * default when no fields are specified.
88
+ * - +qp->all_fields+ is the set of fields that gets searched when the user
89
+ * requests a search of all fields.
90
+ * - +qp->tkz_fields+ is the set of fields that gets tokenized before being
91
+ * added to the query parser.
92
+ *
93
+ * === qp_parse
94
+ *
95
+ * The main QueryParser method is +qp_parse+. It gets called with a the query
96
+ * string and returns a Query object which can then be passed to the
97
+ * IndexSearcher. The first thing it does is to clean the query string if
98
+ * +qp->clean_str+ is set to true. The cleaning is done with the
99
+ * +qp_clean_str+.
100
+ *
101
+ * It then calls the yacc parser which will set +qp->result+ to the parsed
102
+ * query. If parsing fails in any way, +qp->result+ should be set to NULL, in
103
+ * which case qp_parse does one of two things depending on the value of
104
+ * +qp->handle_parse_errors+;
105
+ *
106
+ * - If it is set to true, qp_parse attempts to do a very basic parsing of
107
+ * the query by ignoring all special characters and parsing the query as
108
+ * a plain boolean query.
109
+ * - If it is set to false, qp_parse will raise a PARSE_ERROR and hopefully
110
+ * free all allocated memory.
111
+ *
112
+ * === The Lexer
113
+ *
114
+ * +yylex+ is the lexing method called by the QueryParser. It breaks the
115
+ * query up into special characters;
116
+ *
117
+ * ( "&:()[]{}!\"~^|<>=*?+-" )
118
+ *
119
+ * and tokens;
120
+ *
121
+ * - QWRD
122
+ * - WILD_STR
123
+ * - AND['AND', '&&']
124
+ * - OR['OR', '||']
125
+ * - REQ['REQ', '+']
126
+ * - NOT['NOT', '-', '~']
127
+ *
128
+ * QWRD tokens are query word tokens which are made up of characters other
129
+ * than the special characters. They can also contain special characters when
130
+ * escaped with a backslash '\'. WILD_STR is the same as QWRD except that it
131
+ * may also contain '?' and '*' characters.
132
+ *
133
+ * === The Parser
134
+ *
135
+ * For a better understanding of the how the query parser works, it is a good
136
+ * idea to study the Ferret Query Language (FQL) described below. Once you
137
+ * understand FQL the one tricky part that needs to be mentioned is how
138
+ * fields are handled. This is where +qp->def_fields+ and +qp->all_fields
139
+ * come into play. When no fields are specified then the default fields are
140
+ * used. The '*:' field specifier will search all fields contained in the
141
+ * all_fields set. Otherwise all fields specified in the field descripter
142
+ * separated by '|' will be searched. For example 'title|content:' will
143
+ * search the title and content fields. When fields are specified like this,
144
+ * the parser will push the fields onto a stack and all queries modified by
145
+ * the field specifier will be applied to the fields on top of the stack.
146
+ * The parser uses the FLDS macro to handle the current fields. It takes the
147
+ * current query building function in the parser and calls it for all the
148
+ * current search fields (on top of the stack).
149
+ *
150
+ * Ferret Query Language (FQL)
151
+ * ---------------------------
152
+ *
153
+ * FIXME to be continued...
154
+ *****************************************************************************/
89
155
 
90
156
  #include <string.h>
91
157
  #include <ctype.h>
@@ -104,71 +170,162 @@ typedef struct Phrase {
104
170
  } Phrase;
105
171
 
106
172
  #define BCA_INIT_CAPA 4
107
- typedef struct BCArray {
173
+ typedef struct FrtBCArray {
108
174
  int size;
109
175
  int capa;
110
176
  FrtBooleanClause **clauses;
111
- } BCArray;
177
+ } FrtBCArray;
112
178
 
113
179
  float frt_qp_default_fuzzy_min_sim = 0.5;
114
180
  int frt_qp_default_fuzzy_pre_len = 0;
115
181
 
182
+
183
+ #line 184 "frt_q_parser.c"
184
+
185
+ # ifndef YY_CAST
186
+ # ifdef __cplusplus
187
+ # define YY_CAST(Type, Val) static_cast<Type> (Val)
188
+ # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
189
+ # else
190
+ # define YY_CAST(Type, Val) ((Type) (Val))
191
+ # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
192
+ # endif
193
+ # endif
194
+ # ifndef YY_NULLPTR
195
+ # if defined __cplusplus
196
+ # if 201103L <= __cplusplus
197
+ # define YY_NULLPTR nullptr
198
+ # else
199
+ # define YY_NULLPTR 0
200
+ # endif
201
+ # else
202
+ # define YY_NULLPTR ((void*)0)
203
+ # endif
204
+ # endif
205
+
206
+
207
+ /* Debug traces. */
208
+ #ifndef YYDEBUG
209
+ # define YYDEBUG 0
210
+ #endif
211
+ #if YYDEBUG
212
+ extern int yydebug;
213
+ #endif
214
+
215
+ /* Token kinds. */
216
+ #ifndef YYTOKENTYPE
217
+ # define YYTOKENTYPE
218
+ enum yytokentype
219
+ {
220
+ YYEMPTY = -2,
221
+ YYEOF = 0, /* "end of file" */
222
+ YYerror = 256, /* error */
223
+ YYUNDEF = 257, /* "invalid token" */
224
+ QWRD = 258, /* QWRD */
225
+ WILD_STR = 259, /* WILD_STR */
226
+ LOW = 260, /* LOW */
227
+ AND = 261, /* AND */
228
+ OR = 262, /* OR */
229
+ REQ = 263, /* REQ */
230
+ NOT = 264, /* NOT */
231
+ HIGH = 265 /* HIGH */
232
+ };
233
+ typedef enum yytokentype yytoken_kind_t;
234
+ #endif
235
+
236
+ /* Value type. */
237
+ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
238
+ union YYSTYPE
239
+ {
240
+ #line 113 "frt_q_parser.y"
116
241
 
117
-
118
- /* Enabling traces. */
119
- #ifndef YYDEBUG
120
- # define YYDEBUG 0
121
- #endif
122
-
123
- /* Enabling verbose error messages. */
124
- #ifdef YYERROR_VERBOSE
125
- # undef YYERROR_VERBOSE
126
- # define YYERROR_VERBOSE 1
127
- #else
128
- # define YYERROR_VERBOSE 0
129
- #endif
130
-
131
- /* Enabling the token table. */
132
- #ifndef YYTOKEN_TABLE
133
- # define YYTOKEN_TABLE 0
134
- #endif
135
-
136
- #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
137
- typedef union YYSTYPE
138
- #line 113 "src/q_parser.y"
139
- {
140
242
  FrtQuery *query;
141
243
  FrtBooleanClause *bcls;
142
- BCArray *bclss;
244
+ FrtBCArray *bclss;
143
245
  FrtHashSet *hashset;
144
246
  Phrase *phrase;
145
247
  char *str;
146
- }
147
- /* Line 187 of yacc.c. */
148
- #line 163 "src/q_parser.c"
149
- YYSTYPE;
150
- # define yystype YYSTYPE /* obsolescent; will be withdrawn */
151
- # define YYSTYPE_IS_DECLARED 1
152
- # define YYSTYPE_IS_TRIVIAL 1
153
- #endif
154
-
155
-
156
-
157
- /* Copy the second part of user declarations. */
158
- #line 121 "src/q_parser.y"
248
+
249
+ #line 250 "frt_q_parser.c"
250
+
251
+ };
252
+ typedef union YYSTYPE YYSTYPE;
253
+ # define YYSTYPE_IS_TRIVIAL 1
254
+ # define YYSTYPE_IS_DECLARED 1
255
+ #endif
256
+
257
+
258
+
259
+
260
+ int yyparse (FrtQParser *qp);
261
+
262
+
263
+
264
+ /* Symbol kind. */
265
+ enum yysymbol_kind_t
266
+ {
267
+ YYSYMBOL_YYEMPTY = -2,
268
+ YYSYMBOL_YYEOF = 0, /* "end of file" */
269
+ YYSYMBOL_YYerror = 1, /* error */
270
+ YYSYMBOL_YYUNDEF = 2, /* "invalid token" */
271
+ YYSYMBOL_QWRD = 3, /* QWRD */
272
+ YYSYMBOL_WILD_STR = 4, /* WILD_STR */
273
+ YYSYMBOL_LOW = 5, /* LOW */
274
+ YYSYMBOL_AND = 6, /* AND */
275
+ YYSYMBOL_OR = 7, /* OR */
276
+ YYSYMBOL_REQ = 8, /* REQ */
277
+ YYSYMBOL_NOT = 9, /* NOT */
278
+ YYSYMBOL_10_ = 10, /* ':' */
279
+ YYSYMBOL_HIGH = 11, /* HIGH */
280
+ YYSYMBOL_12_ = 12, /* '^' */
281
+ YYSYMBOL_13_ = 13, /* '(' */
282
+ YYSYMBOL_14_ = 14, /* ')' */
283
+ YYSYMBOL_15_ = 15, /* '~' */
284
+ YYSYMBOL_16_ = 16, /* '*' */
285
+ YYSYMBOL_17_ = 17, /* '|' */
286
+ YYSYMBOL_18_ = 18, /* '"' */
287
+ YYSYMBOL_19_ = 19, /* '<' */
288
+ YYSYMBOL_20_ = 20, /* '>' */
289
+ YYSYMBOL_21_ = 21, /* '[' */
290
+ YYSYMBOL_22_ = 22, /* ']' */
291
+ YYSYMBOL_23_ = 23, /* '}' */
292
+ YYSYMBOL_24_ = 24, /* '{' */
293
+ YYSYMBOL_25_ = 25, /* '=' */
294
+ YYSYMBOL_YYACCEPT = 26, /* $accept */
295
+ YYSYMBOL_bool_q = 27, /* bool_q */
296
+ YYSYMBOL_bool_clss = 28, /* bool_clss */
297
+ YYSYMBOL_bool_cls = 29, /* bool_cls */
298
+ YYSYMBOL_boosted_q = 30, /* boosted_q */
299
+ YYSYMBOL_q = 31, /* q */
300
+ YYSYMBOL_term_q = 32, /* term_q */
301
+ YYSYMBOL_wild_q = 33, /* wild_q */
302
+ YYSYMBOL_field_q = 34, /* field_q */
303
+ YYSYMBOL_35_1 = 35, /* $@1 */
304
+ YYSYMBOL_36_2 = 36, /* $@2 */
305
+ YYSYMBOL_37_3 = 37, /* $@3 */
306
+ YYSYMBOL_field = 38, /* field */
307
+ YYSYMBOL_phrase_q = 39, /* phrase_q */
308
+ YYSYMBOL_ph_words = 40, /* ph_words */
309
+ YYSYMBOL_range_q = 41 /* range_q */
310
+ };
311
+ typedef enum yysymbol_kind_t yysymbol_kind_t;
312
+
313
+
314
+ /* Second part of user prologue. */
315
+ #line 121 "frt_q_parser.y"
159
316
 
160
317
  static int yylex(YYSTYPE *lvalp, FrtQParser *qp);
161
318
  static int yyerror(FrtQParser *qp, char const *msg);
162
319
 
163
320
  #define PHRASE_INIT_CAPA 4
164
- static FrtQuery *get_bool_q(BCArray *bca);
321
+ static FrtQuery *get_bool_q(FrtBCArray *bca);
165
322
 
166
- static BCArray *first_cls(FrtBooleanClause *boolean_clause);
167
- static BCArray *add_and_cls(BCArray *bca, FrtBooleanClause *clause);
168
- static BCArray *add_or_cls(BCArray *bca, FrtBooleanClause *clause);
169
- static BCArray *add_default_cls(FrtQParser *qp, BCArray *bca,
323
+ static FrtBCArray *first_cls(FrtBooleanClause *boolean_clause);
324
+ static FrtBCArray *add_and_cls(FrtBCArray *bca, FrtBooleanClause *clause);
325
+ static FrtBCArray *add_or_cls(FrtBCArray *bca, FrtBooleanClause *clause);
326
+ static FrtBCArray *add_default_cls(FrtQParser *qp, FrtBCArray *bca,
170
327
  FrtBooleanClause *clause);
171
- static void bca_destroy(BCArray *bca);
328
+ static void bca_destroy(FrtBCArray *bca);
172
329
 
173
330
  static FrtBooleanClause *get_bool_cls(FrtQuery *q, FrtBCType occur);
174
331
 
@@ -240,1773 +397,1549 @@ static void qp_pop_fields(FrtQParser *self);
240
397
  FRT_HANDLED();\
241
398
  FRT_XENDTRY\
242
399
  if (qp->destruct) Y;
243
-
244
-
245
- /* Line 216 of yacc.c. */
246
- #line 261 "src/q_parser.c"
247
-
248
- #ifdef short
249
- # undef short
250
- #endif
251
-
252
- #ifdef YYTYPE_UINT8
253
- typedef YYTYPE_UINT8 yytype_uint8;
254
- #else
255
- typedef unsigned char yytype_uint8;
256
- #endif
257
-
258
- #ifdef YYTYPE_INT8
259
- typedef YYTYPE_INT8 yytype_int8;
260
- #elif (defined __STDC__ || defined __C99__FUNC__ \
261
- || defined __cplusplus || defined _MSC_VER)
262
- typedef signed char yytype_int8;
263
- #else
264
- typedef short int yytype_int8;
265
- #endif
266
-
267
- #ifdef YYTYPE_UINT16
268
- typedef YYTYPE_UINT16 yytype_uint16;
269
- #else
270
- typedef unsigned short int yytype_uint16;
271
- #endif
272
-
273
- #ifdef YYTYPE_INT16
274
- typedef YYTYPE_INT16 yytype_int16;
275
- #else
276
- typedef short int yytype_int16;
277
- #endif
278
-
279
- #ifndef YYSIZE_T
280
- # ifdef __SIZE_TYPE__
281
- # define YYSIZE_T __SIZE_TYPE__
282
- # elif defined size_t
283
- # define YYSIZE_T size_t
284
- # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
285
- || defined __cplusplus || defined _MSC_VER)
286
- # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
287
- # define YYSIZE_T size_t
288
- # else
289
- # define YYSIZE_T unsigned int
290
- # endif
291
- #endif
292
-
293
- #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
294
-
295
- #ifndef YY_
296
- # if YYENABLE_NLS
297
- # if ENABLE_NLS
298
- # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
299
- # define YY_(msgid) dgettext ("bison-runtime", msgid)
300
- # endif
301
- # endif
302
- # ifndef YY_
303
- # define YY_(msgid) msgid
304
- # endif
305
- #endif
306
-
307
- /* Suppress unused-variable warnings by "using" E. */
308
- #if ! defined lint || defined __GNUC__
309
- # define YYUSE(e) ((void) (e))
310
- #else
311
- # define YYUSE(e) /* empty */
312
- #endif
313
-
314
- /* Identity function, used to suppress warnings about constant conditions. */
315
- #ifndef lint
316
- # define YYID(n) (n)
317
- #else
318
- #if (defined __STDC__ || defined __C99__FUNC__ \
319
- || defined __cplusplus || defined _MSC_VER)
320
- static int
321
- YYID (int i)
322
- #else
323
- static int
324
- YYID (i)
325
- int i;
326
- #endif
327
- {
328
- return i;
329
- }
330
- #endif
331
-
332
- #if ! defined yyoverflow || YYERROR_VERBOSE
333
-
334
- /* The parser invokes alloca or malloc; define the necessary symbols. */
335
-
336
- # ifdef YYSTACK_USE_ALLOCA
337
- # if YYSTACK_USE_ALLOCA
338
- # ifdef __GNUC__
339
- # define YYSTACK_ALLOC __builtin_alloca
340
- # elif defined __BUILTIN_VA_ARG_INCR
341
- # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
342
- # elif defined _AIX
343
- # define YYSTACK_ALLOC __alloca
344
- # elif defined _MSC_VER
345
- # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
346
- # define alloca _alloca
347
- # else
348
- # define YYSTACK_ALLOC alloca
349
- # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
350
- || defined __cplusplus || defined _MSC_VER)
351
- # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
352
- # ifndef _STDLIB_H
353
- # define _STDLIB_H 1
354
- # endif
355
- # endif
356
- # endif
357
- # endif
358
- # endif
359
-
360
- # ifdef YYSTACK_ALLOC
361
- /* Pacify GCC's `empty if-body' warning. */
362
- # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
363
- # ifndef YYSTACK_ALLOC_MAXIMUM
364
- /* The OS might guarantee only one guard page at the bottom of the stack,
365
- and a page size can be as small as 4096 bytes. So we cannot safely
366
- invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
367
- to allow for a few compiler-allocated temporary stack slots. */
368
- # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
369
- # endif
370
- # else
371
- # define YYSTACK_ALLOC YYMALLOC
372
- # define YYSTACK_FREE YYFREE
373
- # ifndef YYSTACK_ALLOC_MAXIMUM
374
- # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
375
- # endif
376
- # if (defined __cplusplus && ! defined _STDLIB_H \
377
- && ! ((defined YYMALLOC || defined malloc) \
378
- && (defined YYFREE || defined free)))
379
- # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
380
- # ifndef _STDLIB_H
381
- # define _STDLIB_H 1
382
- # endif
383
- # endif
384
- # ifndef YYMALLOC
385
- # define YYMALLOC malloc
386
- # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
387
- || defined __cplusplus || defined _MSC_VER)
388
- void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
389
- # endif
390
- # endif
391
- # ifndef YYFREE
392
- # define YYFREE free
393
- # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
394
- || defined __cplusplus || defined _MSC_VER)
395
- void free (void *); /* INFRINGES ON USER NAME SPACE */
396
- # endif
397
- # endif
398
- # endif
399
- #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
400
-
401
-
402
- #if (! defined yyoverflow \
403
- && (! defined __cplusplus \
404
- || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
405
-
406
- /* A type that is properly aligned for any stack member. */
407
- union yyalloc
408
- {
409
- yytype_int16 yyss;
410
- YYSTYPE yyvs;
411
- };
412
-
413
- /* The size of the maximum gap between one aligned stack and the next. */
414
- # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
415
-
416
- /* The size of an array large to enough to hold all stacks, each with
417
- N elements. */
418
- # define YYSTACK_BYTES(N) \
419
- ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
420
- + YYSTACK_GAP_MAXIMUM)
421
-
422
- /* Copy COUNT objects from FROM to TO. The source and destination do
423
- not overlap. */
424
- # ifndef YYCOPY
425
- # if defined __GNUC__ && 1 < __GNUC__
426
- # define YYCOPY(To, From, Count) \
427
- __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
428
- # else
429
- # define YYCOPY(To, From, Count) \
430
- do \
431
- { \
432
- YYSIZE_T yyi; \
433
- for (yyi = 0; yyi < (Count); yyi++) \
434
- (To)[yyi] = (From)[yyi]; \
435
- } \
436
- while (YYID (0))
437
- # endif
438
- # endif
439
-
440
- /* Relocate STACK from its old location to the new one. The
441
- local variables YYSIZE and YYSTACKSIZE give the old and new number of
442
- elements in the stack, and YYPTR gives the new location of the
443
- stack. Advance YYPTR to a properly aligned location for the next
444
- stack. */
445
- # define YYSTACK_RELOCATE(Stack) \
446
- do \
447
- { \
448
- YYSIZE_T yynewbytes; \
449
- YYCOPY (&yyptr->Stack, Stack, yysize); \
450
- Stack = &yyptr->Stack; \
451
- yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
452
- yyptr += yynewbytes / sizeof (*yyptr); \
453
- } \
454
- while (YYID (0))
455
-
456
- #endif
457
-
458
- /* YYFINAL -- State number of the termination state. */
459
- #define YYFINAL 39
460
- /* YYLAST -- Last index in YYTABLE. */
461
- #define YYLAST 126
462
-
463
- /* YYNTOKENS -- Number of terminals. */
464
- #define YYNTOKENS 26
465
- /* YYNNTS -- Number of nonterminals. */
466
- #define YYNNTS 16
467
- /* YYNRULES -- Number of rules. */
468
- #define YYNRULES 51
469
- /* YYNRULES -- Number of states. */
470
- #define YYNSTATES 80
471
-
472
- /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
473
- #define YYUNDEFTOK 2
474
- #define YYMAXUTOK 265
475
-
476
- #define YYTRANSLATE(YYX) \
477
- ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
478
-
479
- /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
480
- static const yytype_uint8 yytranslate[] =
481
- {
482
- 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
483
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
484
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
485
- 2, 2, 2, 2, 18, 2, 2, 2, 2, 2,
486
- 13, 14, 16, 2, 2, 2, 2, 2, 2, 2,
487
- 2, 2, 2, 2, 2, 2, 2, 2, 10, 2,
488
- 19, 25, 20, 2, 2, 2, 2, 2, 2, 2,
489
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
490
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
491
- 2, 21, 2, 22, 12, 2, 2, 2, 2, 2,
492
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
493
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
494
- 2, 2, 2, 24, 17, 23, 15, 2, 2, 2,
495
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
496
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
497
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
498
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
499
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
500
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
501
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
502
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
503
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
504
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
505
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
506
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
507
- 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
508
- 5, 6, 7, 8, 9, 11
509
- };
510
-
511
- #if YYDEBUG
512
- /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
513
- YYRHS. */
514
- static const yytype_uint8 yyprhs[] =
515
- {
516
- 0, 0, 3, 4, 6, 8, 12, 16, 19, 22,
517
- 25, 27, 29, 33, 35, 38, 42, 44, 46, 48,
518
- 50, 52, 56, 59, 61, 62, 67, 68, 69, 75,
519
- 77, 81, 85, 91, 94, 99, 101, 104, 107, 111,
520
- 115, 120, 125, 130, 135, 139, 143, 147, 151, 154,
521
- 158, 162
522
- };
523
-
524
- /* YYRHS -- A `-1'-separated list of the rules' RHS. */
525
- static const yytype_int8 yyrhs[] =
526
- {
527
- 27, 0, -1, -1, 28, -1, 29, -1, 28, 7,
528
- 29, -1, 28, 6, 29, -1, 28, 29, -1, 9,
529
- 30, -1, 8, 30, -1, 30, -1, 31, -1, 31,
530
- 12, 3, -1, 32, -1, 13, 14, -1, 13, 28,
531
- 14, -1, 34, -1, 39, -1, 41, -1, 33, -1,
532
- 3, -1, 3, 15, 3, -1, 3, 15, -1, 4,
533
- -1, -1, 38, 10, 31, 35, -1, -1, -1, 16,
534
- 36, 10, 31, 37, -1, 3, -1, 38, 17, 3,
535
- -1, 18, 40, 18, -1, 18, 40, 18, 15, 3,
536
- -1, 18, 18, -1, 18, 18, 15, 3, -1, 3,
537
- -1, 19, 20, -1, 40, 3, -1, 40, 19, 20,
538
- -1, 40, 17, 3, -1, 21, 3, 3, 22, -1,
539
- 21, 3, 3, 23, -1, 24, 3, 3, 22, -1,
540
- 24, 3, 3, 23, -1, 19, 3, 23, -1, 19,
541
- 3, 22, -1, 21, 3, 20, -1, 24, 3, 20,
542
- -1, 19, 3, -1, 19, 25, 3, -1, 20, 25,
543
- 3, -1, 20, 3, -1
544
- };
545
-
546
- /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
547
- static const yytype_uint16 yyrline[] =
548
- {
549
- 0, 226, 226, 227, 229, 230, 231, 232, 234, 235,
550
- 236, 238, 239, 241, 242, 243, 244, 245, 246, 247,
551
- 249, 250, 251, 253, 255, 255, 257, 257, 257, 260,
552
- 261, 263, 264, 265, 266, 268, 269, 270, 271, 272,
553
- 274, 275, 276, 277, 278, 279, 280, 281, 282, 283,
554
- 284, 285
555
- };
556
- #endif
557
-
558
- #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
559
- /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
560
- First, the terminals, then, starting at YYNTOKENS, nonterminals. */
561
- static const char *const yytname[] =
562
- {
563
- "$end", "error", "$undefined", "QWRD", "WILD_STR", "LOW", "OR", "AND",
564
- "NOT", "REQ", "':'", "HIGH", "'^'", "'('", "')'", "'~'", "'*'", "'|'",
565
- "'\"'", "'<'", "'>'", "'['", "']'", "'}'", "'{'", "'='", "$accept",
566
- "bool_q", "bool_clss", "bool_cls", "boosted_q", "q", "term_q", "wild_q",
567
- "field_q", "@1", "@2", "@3", "field", "phrase_q", "ph_words", "range_q", 0
568
- };
569
- #endif
570
-
571
- # ifdef YYPRINT
572
- /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
573
- token YYLEX-NUM. */
574
- static const yytype_uint16 yytoknum[] =
575
- {
576
- 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
577
- 58, 265, 94, 40, 41, 126, 42, 124, 34, 60,
578
- 62, 91, 93, 125, 123, 61
579
- };
580
- # endif
581
-
582
- /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
583
- static const yytype_uint8 yyr1[] =
584
- {
585
- 0, 26, 27, 27, 28, 28, 28, 28, 29, 29,
586
- 29, 30, 30, 31, 31, 31, 31, 31, 31, 31,
587
- 32, 32, 32, 33, 35, 34, 36, 37, 34, 38,
588
- 38, 39, 39, 39, 39, 40, 40, 40, 40, 40,
589
- 41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
590
- 41, 41
591
- };
592
-
593
- /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
594
- static const yytype_uint8 yyr2[] =
595
- {
596
- 0, 2, 0, 1, 1, 3, 3, 2, 2, 2,
597
- 1, 1, 3, 1, 2, 3, 1, 1, 1, 1,
598
- 1, 3, 2, 1, 0, 4, 0, 0, 5, 1,
599
- 3, 3, 5, 2, 4, 1, 2, 2, 3, 3,
600
- 4, 4, 4, 4, 3, 3, 3, 3, 2, 3,
601
- 3, 2
602
- };
603
-
604
- /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
605
- STATE-NUM when YYTABLE doesn't specify something else to do. Zero
606
- means the default is an error. */
607
- static const yytype_uint8 yydefact[] =
608
- {
609
- 2, 20, 23, 0, 0, 0, 26, 0, 0, 0,
610
- 0, 0, 0, 3, 4, 10, 11, 13, 19, 16,
611
- 0, 17, 18, 22, 9, 8, 14, 0, 0, 35,
612
- 33, 0, 0, 48, 0, 51, 0, 0, 0, 1,
613
- 0, 0, 7, 0, 0, 0, 21, 15, 0, 0,
614
- 36, 37, 0, 31, 0, 45, 44, 49, 50, 0,
615
- 46, 0, 47, 6, 5, 12, 24, 30, 27, 34,
616
- 39, 0, 38, 40, 41, 42, 43, 25, 28, 32
617
- };
618
-
619
- /* YYDEFGOTO[NTERM-NUM]. */
620
- static const yytype_int8 yydefgoto[] =
621
- {
622
- -1, 12, 13, 14, 15, 16, 17, 18, 19, 77,
623
- 28, 78, 20, 21, 32, 22
624
- };
625
-
626
- /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
627
- STATE-NUM. */
628
- #define YYPACT_NINF -30
629
- static const yytype_int8 yypact[] =
630
- {
631
- 83, -4, -30, 102, 102, 64, -30, 7, -2, -1,
632
- 6, 15, 31, 45, -30, -30, 29, -30, -30, -30,
633
- -5, -30, -30, 40, -30, -30, -30, 26, 47, -30,
634
- 55, 42, 19, -15, 68, -30, 71, 0, 1, -30,
635
- 83, 83, -30, 72, 102, 73, -30, -30, 102, 76,
636
- -30, -30, 78, 74, 70, -30, -30, -30, -30, -6,
637
- -30, 33, -30, -30, -30, -30, -30, -30, -30, -30,
638
- -30, 90, -30, -30, -30, -30, -30, -30, -30, -30
639
- };
640
-
641
- /* YYPGOTO[NTERM-NUM]. */
642
- static const yytype_int8 yypgoto[] =
643
- {
644
- -30, -30, 89, -13, 56, -29, -30, -30, -30, -30,
645
- -30, -30, -30, -30, -30, -30
646
- };
647
-
648
- /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
649
- positive, shift that token. If negative, reduce the rule which
650
- number is the opposite. If zero, do what YYDEFACT says.
651
- If YYTABLE_NINF, syntax error. */
652
- #define YYTABLE_NINF -30
653
- static const yytype_int8 yytable[] =
654
- {
655
- 42, 33, 35, 59, 61, 44, -29, 55, 56, 37,
656
- 29, 23, 45, -29, 42, 66, 73, 74, 38, 68,
657
- 60, 62, 51, 34, 36, 30, 31, 63, 64, 1,
658
- 2, 39, 40, 41, 3, 4, 52, 53, 54, 5,
659
- 47, 43, 6, 46, 7, 8, 9, 10, 1, 2,
660
- 11, 40, 41, 3, 4, 75, 76, 48, 5, 24,
661
- 25, 6, 50, 7, 8, 9, 10, 1, 2, 11,
662
- 49, 57, 3, 4, 58, 65, 67, 5, 26, 69,
663
- 6, 70, 7, 8, 9, 10, 1, 2, 11, 71,
664
- 72, 3, 4, 79, 27, 0, 5, 0, 0, 6,
665
- 0, 7, 8, 9, 10, 1, 2, 11, 0, 0,
666
- 0, 0, 0, 0, 0, 5, 0, 0, 6, 0,
667
- 7, 8, 9, 10, 0, 0, 11
668
- };
669
-
670
- static const yytype_int8 yycheck[] =
671
- {
672
- 13, 3, 3, 3, 3, 10, 10, 22, 23, 3,
673
- 3, 15, 17, 17, 27, 44, 22, 23, 3, 48,
674
- 20, 20, 3, 25, 25, 18, 19, 40, 41, 3,
675
- 4, 0, 6, 7, 8, 9, 17, 18, 19, 13,
676
- 14, 12, 16, 3, 18, 19, 20, 21, 3, 4,
677
- 24, 6, 7, 8, 9, 22, 23, 10, 13, 3,
678
- 4, 16, 20, 18, 19, 20, 21, 3, 4, 24,
679
- 15, 3, 8, 9, 3, 3, 3, 13, 14, 3,
680
- 16, 3, 18, 19, 20, 21, 3, 4, 24, 15,
681
- 20, 8, 9, 3, 5, -1, 13, -1, -1, 16,
682
- -1, 18, 19, 20, 21, 3, 4, 24, -1, -1,
683
- -1, -1, -1, -1, -1, 13, -1, -1, 16, -1,
684
- 18, 19, 20, 21, -1, -1, 24
685
- };
686
-
687
- /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
688
- symbol of state STATE-NUM. */
689
- static const yytype_uint8 yystos[] =
690
- {
691
- 0, 3, 4, 8, 9, 13, 16, 18, 19, 20,
692
- 21, 24, 27, 28, 29, 30, 31, 32, 33, 34,
693
- 38, 39, 41, 15, 30, 30, 14, 28, 36, 3,
694
- 18, 19, 40, 3, 25, 3, 25, 3, 3, 0,
695
- 6, 7, 29, 12, 10, 17, 3, 14, 10, 15,
696
- 20, 3, 17, 18, 19, 22, 23, 3, 3, 3,
697
- 20, 3, 20, 29, 29, 3, 31, 3, 31, 3,
698
- 3, 15, 20, 22, 23, 22, 23, 35, 37, 3
699
- };
700
-
701
- #define yyerrok (yyerrstatus = 0)
702
- #define yyclearin (yychar = YYEMPTY)
703
- #define YYEMPTY (-2)
704
- #define YYEOF 0
705
-
706
- #define YYACCEPT goto yyacceptlab
707
- #define YYABORT goto yyabortlab
708
- #define YYERROR goto yyerrorlab
709
-
710
-
711
- /* Like YYERROR except do call yyerror. This remains here temporarily
712
- to ease the transition to the new meaning of YYERROR, for GCC.
713
- Once GCC version 2 has supplanted version 1, this can go. */
714
-
715
- #define YYFAIL goto yyerrlab
716
-
717
- #define YYRECOVERING() (!!yyerrstatus)
718
-
719
- #define YYBACKUP(FrtToken, Value) \
720
- do \
721
- if (yychar == YYEMPTY && yylen == 1) \
722
- { \
723
- yychar = (FrtToken); \
724
- yylval = (Value); \
725
- yytoken = YYTRANSLATE (yychar); \
726
- YYPOPSTACK (1); \
727
- goto yybackup; \
728
- } \
729
- else \
730
- { \
731
- yyerror (qp, YY_("syntax error: cannot back up")); \
732
- YYERROR; \
733
- } \
734
- while (YYID (0))
735
-
736
-
737
- #define YYTERROR 1
738
- #define YYERRCODE 256
739
-
740
-
741
- /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
742
- If N is 0, then set CURRENT to the empty location which ends
743
- the previous symbol: RHS[0] (always defined). */
744
-
745
- #define YYRHSLOC(Rhs, K) ((Rhs)[K])
746
- #ifndef YYLLOC_DEFAULT
747
- # define YYLLOC_DEFAULT(Current, Rhs, N) \
748
- do \
749
- if (YYID (N)) \
750
- { \
751
- (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
752
- (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
753
- (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
754
- (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
755
- } \
756
- else \
757
- { \
758
- (Current).first_line = (Current).last_line = \
759
- YYRHSLOC (Rhs, 0).last_line; \
760
- (Current).first_column = (Current).last_column = \
761
- YYRHSLOC (Rhs, 0).last_column; \
762
- } \
763
- while (YYID (0))
764
- #endif
765
-
766
-
767
- /* YY_LOCATION_PRINT -- Print the location on the stream.
768
- This macro was not mandated originally: define only if we know
769
- we won't break user code: when these are the locations we know. */
770
-
771
- #ifndef YY_LOCATION_PRINT
772
- # if YYLTYPE_IS_TRIVIAL
773
- # define YY_LOCATION_PRINT(File, Loc) \
774
- fprintf (File, "%d.%d-%d.%d", \
775
- (Loc).first_line, (Loc).first_column, \
776
- (Loc).last_line, (Loc).last_column)
777
- # else
778
- # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
779
- # endif
780
- #endif
781
-
782
-
783
- /* YYLEX -- calling `yylex' with the right arguments. */
784
-
785
- #ifdef YYLEX_PARAM
786
- # define YYLEX yylex (&yylval, YYLEX_PARAM)
787
- #else
788
- # define YYLEX yylex (&yylval, qp)
789
- #endif
790
-
791
- /* Enable debugging if requested. */
792
- #if YYDEBUG
793
-
794
- # ifndef YYFPRINTF
795
- # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
796
- # define YYFPRINTF fprintf
797
- # endif
798
-
799
- # define YYDPRINTF(Args) \
800
- do { \
801
- if (yydebug) \
802
- YYFPRINTF Args; \
803
- } while (YYID (0))
804
-
805
- # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
806
- do { \
807
- if (yydebug) \
808
- { \
809
- YYFPRINTF (stderr, "%s ", Title); \
810
- yy_symbol_print (stderr, \
811
- Type, Value, qp); \
812
- YYFPRINTF (stderr, "\n"); \
813
- } \
814
- } while (YYID (0))
815
-
816
-
817
- /*--------------------------------.
818
- | Print this symbol on YYOUTPUT. |
819
- `--------------------------------*/
820
-
821
- /*ARGSUSED*/
822
- #if (defined __STDC__ || defined __C99__FUNC__ \
823
- || defined __cplusplus || defined _MSC_VER)
824
- static void
825
- yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, FrtQParser *qp)
826
- #else
827
- static void
828
- yy_symbol_value_print (yyoutput, yytype, yyvaluep, qp)
829
- FILE *yyoutput;
830
- int yytype;
831
- YYSTYPE const * const yyvaluep;
832
- FrtQParser *qp;
833
- #endif
834
- {
835
- if (!yyvaluep)
836
- return;
837
- YYUSE (qp);
838
- # ifdef YYPRINT
839
- if (yytype < YYNTOKENS)
840
- YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
841
- # else
842
- YYUSE (yyoutput);
843
- # endif
844
- switch (yytype)
845
- {
846
- default:
847
- break;
848
- }
849
- }
850
-
851
-
852
- /*--------------------------------.
853
- | Print this symbol on YYOUTPUT. |
854
- `--------------------------------*/
855
-
856
- #if (defined __STDC__ || defined __C99__FUNC__ \
857
- || defined __cplusplus || defined _MSC_VER)
858
- static void
859
- yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, FrtQParser *qp)
860
- #else
861
- static void
862
- yy_symbol_print (yyoutput, yytype, yyvaluep, qp)
863
- FILE *yyoutput;
864
- int yytype;
865
- YYSTYPE const * const yyvaluep;
866
- FrtQParser *qp;
867
- #endif
868
- {
869
- if (yytype < YYNTOKENS)
870
- YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
871
- else
872
- YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
873
-
874
- yy_symbol_value_print (yyoutput, yytype, yyvaluep, qp);
875
- YYFPRINTF (yyoutput, ")");
876
- }
877
-
878
- /*------------------------------------------------------------------.
879
- | yy_stack_print -- Print the state stack from its BOTTOM up to its |
880
- | TOP (included). |
881
- `------------------------------------------------------------------*/
882
-
883
- #if (defined __STDC__ || defined __C99__FUNC__ \
884
- || defined __cplusplus || defined _MSC_VER)
885
- static void
886
- yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
887
- #else
888
- static void
889
- yy_stack_print (bottom, top)
890
- yytype_int16 *bottom;
891
- yytype_int16 *top;
892
- #endif
893
- {
894
- YYFPRINTF (stderr, "Stack now");
895
- for (; bottom <= top; ++bottom)
896
- YYFPRINTF (stderr, " %d", *bottom);
897
- YYFPRINTF (stderr, "\n");
898
- }
899
-
900
- # define YY_STACK_PRINT(Bottom, Top) \
901
- do { \
902
- if (yydebug) \
903
- yy_stack_print ((Bottom), (Top)); \
904
- } while (YYID (0))
905
-
906
-
907
- /*------------------------------------------------.
908
- | Report that the YYRULE is going to be reduced. |
909
- `------------------------------------------------*/
910
-
911
- #if (defined __STDC__ || defined __C99__FUNC__ \
912
- || defined __cplusplus || defined _MSC_VER)
913
- static void
914
- yy_reduce_print (YYSTYPE *yyvsp, int yyrule, FrtQParser *qp)
915
- #else
916
- static void
917
- yy_reduce_print (yyvsp, yyrule, qp)
918
- YYSTYPE *yyvsp;
919
- int yyrule;
920
- FrtQParser *qp;
921
- #endif
922
- {
923
- int yynrhs = yyr2[yyrule];
924
- int yyi;
925
- unsigned long int yylno = yyrline[yyrule];
926
- YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
927
- yyrule - 1, yylno);
928
- /* The symbols being reduced. */
929
- for (yyi = 0; yyi < yynrhs; yyi++)
930
- {
931
- fprintf (stderr, " $%d = ", yyi + 1);
932
- yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
933
- &(yyvsp[(yyi + 1) - (yynrhs)])
934
- , qp);
935
- fprintf (stderr, "\n");
936
- }
937
- }
938
-
939
- # define YY_REDUCE_PRINT(Rule) \
940
- do { \
941
- if (yydebug) \
942
- yy_reduce_print (yyvsp, Rule, qp); \
943
- } while (YYID (0))
944
-
945
- /* Nonzero means print parse trace. It is left uninitialized so that
946
- multiple parsers can coexist. */
947
- int yydebug;
948
- #else /* !YYDEBUG */
949
- # define YYDPRINTF(Args)
950
- # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
951
- # define YY_STACK_PRINT(Bottom, Top)
952
- # define YY_REDUCE_PRINT(Rule)
953
- #endif /* !YYDEBUG */
954
-
955
-
956
- /* YYINITDEPTH -- initial size of the parser's stacks. */
957
- #ifndef YYINITDEPTH
958
- # define YYINITDEPTH 200
959
- #endif
960
-
961
- /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
962
- if the built-in stack extension method is used).
963
-
964
- Do not make this value too large; the results are undefined if
965
- YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
966
- evaluated with infinite-precision integer arithmetic. */
967
-
968
- #ifndef YYMAXDEPTH
969
- # define YYMAXDEPTH 10000
970
- #endif
971
-
972
-
973
-
974
- #if YYERROR_VERBOSE
975
-
976
- # ifndef yystrlen
977
- # if defined __GLIBC__ && defined _STRING_H
978
- # define yystrlen strlen
979
- # else
980
- /* Return the length of YYSTR. */
981
- #if (defined __STDC__ || defined __C99__FUNC__ \
982
- || defined __cplusplus || defined _MSC_VER)
983
- static YYSIZE_T
984
- yystrlen (const char *yystr)
985
- #else
986
- static YYSIZE_T
987
- yystrlen (yystr)
988
- const char *yystr;
989
- #endif
990
- {
991
- YYSIZE_T yylen;
992
- for (yylen = 0; yystr[yylen]; yylen++)
993
- continue;
994
- return yylen;
995
- }
996
- # endif
997
- # endif
998
-
999
- # ifndef yystpcpy
1000
- # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1001
- # define yystpcpy stpcpy
1002
- # else
1003
- /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1004
- YYDEST. */
1005
- #if (defined __STDC__ || defined __C99__FUNC__ \
1006
- || defined __cplusplus || defined _MSC_VER)
1007
- static char *
1008
- yystpcpy (char *yydest, const char *yysrc)
1009
- #else
1010
- static char *
1011
- yystpcpy (yydest, yysrc)
1012
- char *yydest;
1013
- const char *yysrc;
1014
- #endif
1015
- {
1016
- char *yyd = yydest;
1017
- const char *yys = yysrc;
1018
-
1019
- while ((*yyd++ = *yys++) != '\0')
1020
- continue;
1021
-
1022
- return yyd - 1;
1023
- }
1024
- # endif
1025
- # endif
1026
-
1027
- # ifndef yytnamerr
1028
- /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1029
- quotes and backslashes, so that it's suitable for yyerror. The
1030
- heuristic is that double-quoting is unnecessary unless the string
1031
- contains an apostrophe, a comma, or backslash (other than
1032
- backslash-backslash). YYSTR is taken from yytname. If YYRES is
1033
- null, do not copy; instead, return the length of what the result
1034
- would have been. */
1035
- static YYSIZE_T
1036
- yytnamerr (char *yyres, const char *yystr)
1037
- {
1038
- if (*yystr == '"')
1039
- {
1040
- YYSIZE_T yyn = 0;
1041
- char const *yyp = yystr;
1042
-
1043
- for (;;)
1044
- switch (*++yyp)
1045
- {
1046
- case '\'':
1047
- case ',':
1048
- goto do_not_strip_quotes;
1049
-
1050
- case '\\':
1051
- if (*++yyp != '\\')
1052
- goto do_not_strip_quotes;
1053
- /* Fall through. */
1054
- default:
1055
- if (yyres)
1056
- yyres[yyn] = *yyp;
1057
- yyn++;
1058
- break;
1059
-
1060
- case '"':
1061
- if (yyres)
1062
- yyres[yyn] = '\0';
1063
- return yyn;
1064
- }
1065
- do_not_strip_quotes: ;
1066
- }
1067
-
1068
- if (! yyres)
1069
- return yystrlen (yystr);
1070
-
1071
- return yystpcpy (yyres, yystr) - yyres;
1072
- }
1073
- # endif
1074
-
1075
- /* Copy into YYRESULT an error message about the unexpected token
1076
- YYCHAR while in state YYSTATE. Return the number of bytes copied,
1077
- including the terminating null byte. If YYRESULT is null, do not
1078
- copy anything; just return the number of bytes that would be
1079
- copied. As a special case, return 0 if an ordinary "syntax error"
1080
- message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1081
- size calculation. */
1082
- static YYSIZE_T
1083
- yysyntax_error (char *yyresult, int yystate, int yychar)
1084
- {
1085
- int yyn = yypact[yystate];
1086
-
1087
- if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1088
- return 0;
1089
- else
1090
- {
1091
- int yytype = YYTRANSLATE (yychar);
1092
- YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1093
- YYSIZE_T yysize = yysize0;
1094
- YYSIZE_T yysize1;
1095
- int yysize_overflow = 0;
1096
- enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1097
- char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1098
- int yyx;
1099
-
1100
- # if 0
1101
- /* This is so xgettext sees the translatable formats that are
1102
- constructed on the fly. */
1103
- YY_("syntax error, unexpected %s");
1104
- YY_("syntax error, unexpected %s, expecting %s");
1105
- YY_("syntax error, unexpected %s, expecting %s or %s");
1106
- YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1107
- YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1108
- # endif
1109
- char *yyfmt;
1110
- char const *yyf;
1111
- static char const yyunexpected[] = "syntax error, unexpected %s";
1112
- static char const yyexpecting[] = ", expecting %s";
1113
- static char const yyor[] = " or %s";
1114
- char yyformat[sizeof yyunexpected
1115
- + sizeof yyexpecting - 1
1116
- + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1117
- * (sizeof yyor - 1))];
1118
- char const *yyprefix = yyexpecting;
1119
-
1120
- /* Start YYX at -YYN if negative to avoid negative indexes in
1121
- YYCHECK. */
1122
- int yyxbegin = yyn < 0 ? -yyn : 0;
1123
-
1124
- /* Stay within bounds of both yycheck and yytname. */
1125
- int yychecklim = YYLAST - yyn + 1;
1126
- int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1127
- int yycount = 1;
1128
-
1129
- yyarg[0] = yytname[yytype];
1130
- yyfmt = yystpcpy (yyformat, yyunexpected);
1131
-
1132
- for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1133
- if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1134
- {
1135
- if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1136
- {
1137
- yycount = 1;
1138
- yysize = yysize0;
1139
- yyformat[sizeof yyunexpected - 1] = '\0';
1140
- break;
1141
- }
1142
- yyarg[yycount++] = yytname[yyx];
1143
- yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1144
- yysize_overflow |= (yysize1 < yysize);
1145
- yysize = yysize1;
1146
- yyfmt = yystpcpy (yyfmt, yyprefix);
1147
- yyprefix = yyor;
1148
- }
1149
-
1150
- yyf = YY_(yyformat);
1151
- yysize1 = yysize + yystrlen (yyf);
1152
- yysize_overflow |= (yysize1 < yysize);
1153
- yysize = yysize1;
1154
-
1155
- if (yysize_overflow)
1156
- return YYSIZE_MAXIMUM;
1157
-
1158
- if (yyresult)
1159
- {
1160
- /* Avoid sprintf, as that infringes on the user's name space.
1161
- Don't have undefined behavior even if the translation
1162
- produced a string with the wrong number of "%s"s. */
1163
- char *yyp = yyresult;
1164
- int yyi = 0;
1165
- while ((*yyp = *yyf) != '\0')
1166
- {
1167
- if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1168
- {
1169
- yyp += yytnamerr (yyp, yyarg[yyi++]);
1170
- yyf += 2;
1171
- }
1172
- else
1173
- {
1174
- yyp++;
1175
- yyf++;
1176
- }
1177
- }
1178
- }
1179
- return yysize;
1180
- }
1181
- }
1182
- #endif /* YYERROR_VERBOSE */
1183
-
1184
-
1185
- /*-----------------------------------------------.
1186
- | Release the memory associated to this symbol. |
1187
- `-----------------------------------------------*/
1188
-
1189
- /*ARGSUSED*/
1190
- #if (defined __STDC__ || defined __C99__FUNC__ \
1191
- || defined __cplusplus || defined _MSC_VER)
1192
- static void
1193
- yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, FrtQParser *qp)
1194
- #else
1195
- static void
1196
- yydestruct (yymsg, yytype, yyvaluep, qp)
1197
- const char *yymsg;
1198
- int yytype;
1199
- YYSTYPE *yyvaluep;
1200
- FrtQParser *qp;
1201
- #endif
1202
- {
1203
- YYUSE (yyvaluep);
1204
- YYUSE (qp);
1205
-
1206
- if (!yymsg)
1207
- yymsg = "Deleting";
1208
- YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1209
-
1210
- switch (yytype)
1211
- {
1212
- case 27: /* "bool_q" */
1213
- #line 221 "src/q_parser.y"
1214
- { if ((yyvaluep->query) && qp->destruct) frt_q_deref((yyvaluep->query)); };
1215
- #line 1230 "src/q_parser.c"
1216
- break;
1217
- case 28: /* "bool_clss" */
1218
- #line 223 "src/q_parser.y"
1219
- { if ((yyvaluep->bclss) && qp->destruct) bca_destroy((yyvaluep->bclss)); };
1220
- #line 1235 "src/q_parser.c"
1221
- break;
1222
- case 29: /* "bool_cls" */
1223
- #line 222 "src/q_parser.y"
1224
- { if ((yyvaluep->bcls) && qp->destruct) frt_bc_deref((yyvaluep->bcls)); };
1225
- #line 1240 "src/q_parser.c"
1226
- break;
1227
- case 30: /* "boosted_q" */
1228
- #line 221 "src/q_parser.y"
1229
- { if ((yyvaluep->query) && qp->destruct) frt_q_deref((yyvaluep->query)); };
1230
- #line 1245 "src/q_parser.c"
1231
- break;
1232
- case 31: /* "q" */
1233
- #line 221 "src/q_parser.y"
1234
- { if ((yyvaluep->query) && qp->destruct) frt_q_deref((yyvaluep->query)); };
1235
- #line 1250 "src/q_parser.c"
1236
- break;
1237
- case 32: /* "term_q" */
1238
- #line 221 "src/q_parser.y"
1239
- { if ((yyvaluep->query) && qp->destruct) frt_q_deref((yyvaluep->query)); };
1240
- #line 1255 "src/q_parser.c"
1241
- break;
1242
- case 33: /* "wild_q" */
1243
- #line 221 "src/q_parser.y"
1244
- { if ((yyvaluep->query) && qp->destruct) frt_q_deref((yyvaluep->query)); };
1245
- #line 1260 "src/q_parser.c"
1246
- break;
1247
- case 34: /* "field_q" */
1248
- #line 221 "src/q_parser.y"
1249
- { if ((yyvaluep->query) && qp->destruct) frt_q_deref((yyvaluep->query)); };
1250
- #line 1265 "src/q_parser.c"
1251
- break;
1252
- case 39: /* "phrase_q" */
1253
- #line 221 "src/q_parser.y"
1254
- { if ((yyvaluep->query) && qp->destruct) frt_q_deref((yyvaluep->query)); };
1255
- #line 1270 "src/q_parser.c"
1256
- break;
1257
- case 40: /* "ph_words" */
1258
- #line 224 "src/q_parser.y"
1259
- { if ((yyvaluep->phrase) && qp->destruct) ph_destroy((yyvaluep->phrase)); };
1260
- #line 1275 "src/q_parser.c"
1261
- break;
1262
- case 41: /* "range_q" */
1263
- #line 221 "src/q_parser.y"
1264
- { if ((yyvaluep->query) && qp->destruct) frt_q_deref((yyvaluep->query)); };
1265
- #line 1280 "src/q_parser.c"
1266
- break;
1267
-
1268
- default:
1269
- break;
1270
- }
1271
- }
1272
-
1273
-
1274
- /* Prevent warnings from -Wmissing-prototypes. */
1275
-
1276
- #ifdef YYPARSE_PARAM
1277
- #if defined __STDC__ || defined __cplusplus
1278
- int yyparse (void *YYPARSE_PARAM);
1279
- #else
1280
- int yyparse ();
1281
- #endif
1282
- #else /* ! YYPARSE_PARAM */
1283
- #if defined __STDC__ || defined __cplusplus
1284
- int yyparse (FrtQParser *qp);
1285
- #else
1286
- int yyparse ();
1287
- #endif
1288
- #endif /* ! YYPARSE_PARAM */
1289
-
1290
-
1291
-
1292
-
1293
-
1294
-
1295
- /*----------.
1296
- | yyparse. |
1297
- `----------*/
1298
-
1299
- #ifdef YYPARSE_PARAM
1300
- #if (defined __STDC__ || defined __C99__FUNC__ \
1301
- || defined __cplusplus || defined _MSC_VER)
1302
- int
1303
- yyparse (void *YYPARSE_PARAM)
1304
- #else
1305
- int
1306
- yyparse (YYPARSE_PARAM)
1307
- void *YYPARSE_PARAM;
1308
- #endif
1309
- #else /* ! YYPARSE_PARAM */
1310
- #if (defined __STDC__ || defined __C99__FUNC__ \
1311
- || defined __cplusplus || defined _MSC_VER)
1312
- int
1313
- yyparse (FrtQParser *qp)
1314
- #else
1315
- int
1316
- yyparse (qp)
1317
- FrtQParser *qp;
1318
- #endif
1319
- #endif
1320
- {
1321
- /* The look-ahead symbol. */
1322
- int yychar;
1323
-
1324
- /* The semantic value of the look-ahead symbol. */
1325
- YYSTYPE yylval;
1326
-
1327
- /* Number of syntax errors so far. */
1328
- int yynerrs;
1329
-
1330
- int yystate;
1331
- int yyn;
1332
- int yyresult;
1333
- /* Number of tokens to shift before error messages enabled. */
1334
- int yyerrstatus;
1335
- /* Look-ahead token as an internal (translated) token number. */
1336
- int yytoken = 0;
1337
- #if YYERROR_VERBOSE
1338
- /* Buffer for error messages, and its allocated size. */
1339
- char yymsgbuf[128];
1340
- char *yymsg = yymsgbuf;
1341
- YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1342
- #endif
1343
-
1344
- /* Three stacks and their tools:
1345
- `yyss': related to states,
1346
- `yyvs': related to semantic values,
1347
- `yyls': related to locations.
1348
-
1349
- Refer to the stacks thru separate pointers, to allow yyoverflow
1350
- to reallocate them elsewhere. */
1351
-
1352
- /* The state stack. */
1353
- yytype_int16 yyssa[YYINITDEPTH];
1354
- yytype_int16 *yyss = yyssa;
1355
- yytype_int16 *yyssp;
1356
-
1357
- /* The semantic value stack. */
1358
- YYSTYPE yyvsa[YYINITDEPTH];
1359
- YYSTYPE *yyvs = yyvsa;
1360
- YYSTYPE *yyvsp;
1361
-
1362
-
1363
-
1364
- #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1365
-
1366
- YYSIZE_T yystacksize = YYINITDEPTH;
1367
-
1368
- /* The variables used to return semantic value and location from the
1369
- action routines. */
1370
- YYSTYPE yyval;
1371
-
1372
-
1373
- /* The number of symbols on the RHS of the reduced rule.
1374
- Keep to zero when no symbol should be popped. */
1375
- int yylen = 0;
1376
-
1377
- YYDPRINTF ((stderr, "Starting parse\n"));
1378
-
1379
- yystate = 0;
1380
- yyerrstatus = 0;
1381
- yynerrs = 0;
1382
- yychar = YYEMPTY; /* Cause a token to be read. */
1383
-
1384
- /* Initialize stack pointers.
1385
- Waste one element of value and location stack
1386
- so that they stay on the same level as the state stack.
1387
- The wasted elements are never initialized. */
1388
-
1389
- yyssp = yyss;
1390
- yyvsp = yyvs;
1391
-
1392
- goto yysetstate;
1393
-
1394
- /*------------------------------------------------------------.
1395
- | yynewstate -- Push a new state, which is found in yystate. |
1396
- `------------------------------------------------------------*/
1397
- yynewstate:
1398
- /* In all cases, when you get here, the value and location stacks
1399
- have just been pushed. So pushing a state here evens the stacks. */
1400
- yyssp++;
1401
-
1402
- yysetstate:
1403
- *yyssp = yystate;
1404
-
1405
- if (yyss + yystacksize - 1 <= yyssp)
1406
- {
1407
- /* Get the current used size of the three stacks, in elements. */
1408
- YYSIZE_T yysize = yyssp - yyss + 1;
1409
-
1410
- #ifdef yyoverflow
1411
- {
1412
- /* Give user a chance to reallocate the stack. Use copies of
1413
- these so that the &'s don't force the real ones into
1414
- memory. */
1415
- YYSTYPE *yyvs1 = yyvs;
1416
- yytype_int16 *yyss1 = yyss;
1417
-
1418
-
1419
- /* Each stack pointer address is followed by the size of the
1420
- data in use in that stack, in bytes. This used to be a
1421
- conditional around just the two extra args, but that might
1422
- be undefined if yyoverflow is a macro. */
1423
- yyoverflow (YY_("memory exhausted"),
1424
- &yyss1, yysize * sizeof (*yyssp),
1425
- &yyvs1, yysize * sizeof (*yyvsp),
1426
-
1427
- &yystacksize);
1428
-
1429
- yyss = yyss1;
1430
- yyvs = yyvs1;
1431
- }
1432
- #else /* no yyoverflow */
1433
- # ifndef YYSTACK_RELOCATE
1434
- goto yyexhaustedlab;
1435
- # else
1436
- /* Extend the stack our own way. */
1437
- if (YYMAXDEPTH <= yystacksize)
1438
- goto yyexhaustedlab;
1439
- yystacksize *= 2;
1440
- if (YYMAXDEPTH < yystacksize)
1441
- yystacksize = YYMAXDEPTH;
1442
-
1443
- {
1444
- yytype_int16 *yyss1 = yyss;
1445
- union yyalloc *yyptr =
1446
- (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1447
- if (! yyptr)
1448
- goto yyexhaustedlab;
1449
- YYSTACK_RELOCATE (yyss);
1450
- YYSTACK_RELOCATE (yyvs);
1451
-
1452
- # undef YYSTACK_RELOCATE
1453
- if (yyss1 != yyssa)
1454
- YYSTACK_FREE (yyss1);
1455
- }
1456
- # endif
1457
- #endif /* no yyoverflow */
1458
-
1459
- yyssp = yyss + yysize - 1;
1460
- yyvsp = yyvs + yysize - 1;
1461
-
1462
-
1463
- YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1464
- (unsigned long int) yystacksize));
1465
-
1466
- if (yyss + yystacksize - 1 <= yyssp)
1467
- YYABORT;
1468
- }
1469
-
1470
- YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1471
-
1472
- goto yybackup;
1473
-
1474
- /*-----------.
1475
- | yybackup. |
1476
- `-----------*/
1477
- yybackup:
1478
-
1479
- /* Do appropriate processing given the current state. Read a
1480
- look-ahead token if we need one and don't already have one. */
1481
-
1482
- /* First try to decide what to do without reference to look-ahead token. */
1483
- yyn = yypact[yystate];
1484
- if (yyn == YYPACT_NINF)
1485
- goto yydefault;
1486
-
1487
- /* Not known => get a look-ahead token if don't already have one. */
1488
-
1489
- /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1490
- if (yychar == YYEMPTY)
1491
- {
1492
- YYDPRINTF ((stderr, "Reading a token: "));
1493
- yychar = YYLEX;
1494
- }
1495
-
1496
- if (yychar <= YYEOF)
1497
- {
1498
- yychar = yytoken = YYEOF;
1499
- YYDPRINTF ((stderr, "Now at end of input.\n"));
1500
- }
1501
- else
1502
- {
1503
- yytoken = YYTRANSLATE (yychar);
1504
- YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1505
- }
1506
-
1507
- /* If the proper action on seeing token YYTOKEN is to reduce or to
1508
- detect an error, take that action. */
1509
- yyn += yytoken;
1510
- if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1511
- goto yydefault;
1512
- yyn = yytable[yyn];
1513
- if (yyn <= 0)
1514
- {
1515
- if (yyn == 0 || yyn == YYTABLE_NINF)
1516
- goto yyerrlab;
1517
- yyn = -yyn;
1518
- goto yyreduce;
1519
- }
1520
-
1521
- if (yyn == YYFINAL)
1522
- YYACCEPT;
1523
-
1524
- /* Count tokens shifted since error; after three, turn off error
1525
- status. */
1526
- if (yyerrstatus)
1527
- yyerrstatus--;
1528
-
1529
- /* Shift the look-ahead token. */
1530
- YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1531
-
1532
- /* Discard the shifted token unless it is eof. */
1533
- if (yychar != YYEOF)
1534
- yychar = YYEMPTY;
1535
-
1536
- yystate = yyn;
1537
- *++yyvsp = yylval;
1538
-
1539
- goto yynewstate;
1540
-
1541
-
1542
- /*-----------------------------------------------------------.
1543
- | yydefault -- do the default action for the current state. |
1544
- `-----------------------------------------------------------*/
1545
- yydefault:
1546
- yyn = yydefact[yystate];
1547
- if (yyn == 0)
1548
- goto yyerrlab;
1549
- goto yyreduce;
1550
-
1551
-
1552
- /*-----------------------------.
1553
- | yyreduce -- Do a reduction. |
1554
- `-----------------------------*/
1555
- yyreduce:
1556
- /* yyn is the number of a rule to reduce with. */
1557
- yylen = yyr2[yyn];
1558
-
1559
- /* If YYLEN is nonzero, implement the default value of the action:
1560
- `$$ = $1'.
1561
-
1562
- Otherwise, the following line sets YYVAL to garbage.
1563
- This behavior is undocumented and Bison
1564
- users should not rely upon it. Assigning to YYVAL
1565
- unconditionally makes the parser a bit smaller, and it avoids a
1566
- GCC warning that YYVAL may be used uninitialized. */
1567
- yyval = yyvsp[1-yylen];
1568
-
1569
-
1570
- YY_REDUCE_PRINT (yyn);
1571
- switch (yyn)
1572
- {
1573
- case 2:
1574
- #line 226 "src/q_parser.y"
1575
- { qp->result = (yyval.query) = NULL; }
1576
- break;
1577
-
1578
- case 3:
1579
- #line 227 "src/q_parser.y"
1580
- { T qp->result = (yyval.query) = get_bool_q((yyvsp[(1) - (1)].bclss)); E }
1581
- break;
1582
-
1583
- case 4:
1584
- #line 229 "src/q_parser.y"
1585
- { T (yyval.bclss) = first_cls((yyvsp[(1) - (1)].bcls)); E }
1586
- break;
1587
-
1588
- case 5:
1589
- #line 230 "src/q_parser.y"
1590
- { T (yyval.bclss) = add_and_cls((yyvsp[(1) - (3)].bclss), (yyvsp[(3) - (3)].bcls)); E }
1591
- break;
1592
-
1593
- case 6:
1594
- #line 231 "src/q_parser.y"
1595
- { T (yyval.bclss) = add_or_cls((yyvsp[(1) - (3)].bclss), (yyvsp[(3) - (3)].bcls)); E }
1596
- break;
1597
-
1598
- case 7:
1599
- #line 232 "src/q_parser.y"
1600
- { T (yyval.bclss) = add_default_cls(qp, (yyvsp[(1) - (2)].bclss), (yyvsp[(2) - (2)].bcls)); E }
1601
- break;
1602
-
1603
- case 8:
1604
- #line 234 "src/q_parser.y"
1605
- { T (yyval.bcls) = get_bool_cls((yyvsp[(2) - (2)].query), FRT_BC_MUST); E }
1606
- break;
1607
-
1608
- case 9:
1609
- #line 235 "src/q_parser.y"
1610
- { T (yyval.bcls) = get_bool_cls((yyvsp[(2) - (2)].query), FRT_BC_MUST_NOT); E }
1611
- break;
1612
-
1613
- case 10:
1614
- #line 236 "src/q_parser.y"
1615
- { T (yyval.bcls) = get_bool_cls((yyvsp[(1) - (1)].query), FRT_BC_SHOULD); E }
1616
- break;
1617
-
1618
- case 12:
1619
- #line 239 "src/q_parser.y"
1620
- { T if ((yyvsp[(1) - (3)].query)) sscanf((yyvsp[(3) - (3)].str),"%f",&((yyvsp[(1) - (3)].query)->boost)); (yyval.query)=(yyvsp[(1) - (3)].query); E }
1621
- break;
1622
-
1623
- case 14:
1624
- #line 242 "src/q_parser.y"
1625
- { T (yyval.query) = frt_bq_new_max(true, qp->max_clauses); E }
1626
- break;
1627
-
1628
- case 15:
1629
- #line 243 "src/q_parser.y"
1630
- { T (yyval.query) = get_bool_q((yyvsp[(2) - (3)].bclss)); E }
1631
- break;
1632
-
1633
- case 20:
1634
- #line 249 "src/q_parser.y"
1635
- { FLDS((yyval.query), get_term_q(qp, field, (yyvsp[(1) - (1)].str))); Y }
1636
- break;
1637
-
1638
- case 21:
1639
- #line 250 "src/q_parser.y"
1640
- { FLDS((yyval.query), get_fuzzy_q(qp, field, (yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].str))); Y }
1641
- break;
1642
-
1643
- case 22:
1644
- #line 251 "src/q_parser.y"
1645
- { FLDS((yyval.query), get_fuzzy_q(qp, field, (yyvsp[(1) - (2)].str), NULL)); Y }
1646
- break;
1647
-
1648
- case 23:
1649
- #line 253 "src/q_parser.y"
1650
- { FLDS((yyval.query), get_wild_q(qp, field, (yyvsp[(1) - (1)].str))); Y }
1651
- break;
1652
-
1653
- case 24:
1654
- #line 255 "src/q_parser.y"
1655
- { qp_pop_fields(qp); }
1656
- break;
1657
-
1658
- case 25:
1659
- #line 256 "src/q_parser.y"
1660
- { (yyval.query) = (yyvsp[(3) - (4)].query); }
1661
- break;
1662
-
1663
- case 26:
1664
- #line 257 "src/q_parser.y"
1665
- { qp_push_fields(qp, qp->all_fields, false); }
1666
- break;
1667
-
1668
- case 27:
1669
- #line 257 "src/q_parser.y"
1670
- { qp_pop_fields(qp); }
1671
- break;
1672
-
1673
- case 28:
1674
- #line 258 "src/q_parser.y"
1675
- { (yyval.query) = (yyvsp[(4) - (5)].query); }
1676
- break;
1677
-
1678
- case 29:
1679
- #line 260 "src/q_parser.y"
1680
- { (yyval.hashset) = first_field(qp, (yyvsp[(1) - (1)].str)); }
1681
- break;
1682
-
1683
- case 30:
1684
- #line 261 "src/q_parser.y"
1685
- { (yyval.hashset) = add_field(qp, (yyvsp[(3) - (3)].str));}
1686
- break;
1687
-
1688
- case 31:
1689
- #line 263 "src/q_parser.y"
1690
- { (yyval.query) = get_phrase_q(qp, (yyvsp[(2) - (3)].phrase), NULL); }
1691
- break;
1692
-
1693
- case 32:
1694
- #line 264 "src/q_parser.y"
1695
- { (yyval.query) = get_phrase_q(qp, (yyvsp[(2) - (5)].phrase), (yyvsp[(5) - (5)].str)); }
1696
- break;
1697
-
1698
- case 33:
1699
- #line 265 "src/q_parser.y"
1700
- { (yyval.query) = NULL; }
1701
- break;
1702
-
1703
- case 34:
1704
- #line 266 "src/q_parser.y"
1705
- { (yyval.query) = NULL; (void)(yyvsp[(4) - (4)].str);}
1706
- break;
1707
-
1708
- case 35:
1709
- #line 268 "src/q_parser.y"
1710
- { (yyval.phrase) = ph_first_word((yyvsp[(1) - (1)].str)); }
1711
- break;
1712
-
1713
- case 36:
1714
- #line 269 "src/q_parer.y"
1715
- { (yyval.phrase) = ph_first_word(NULL); }
1716
- break;
1717
-
1718
- case 37:
1719
- #line 270 "src/q_parser.y"
1720
- { (yyval.phrase) = ph_add_word((yyvsp[(1) - (2)].phrase), (yyvsp[(2) - (2)].str)); }
1721
- break;
1722
-
1723
- case 38:
1724
- #line 271 "src/q_parser.y"
1725
- { (yyval.phrase) = ph_add_word((yyvsp[(1) - (3)].phrase), NULL); }
1726
- break;
1727
-
1728
- case 39:
1729
- #line 272 "src/q_parser.y"
1730
- { (yyval.phrase) = ph_add_multi_word((yyvsp[(1) - (3)].phrase), (yyvsp[(3) - (3)].str)); }
1731
- break;
1732
-
1733
- case 40:
1734
- #line 274 "src/q_parser.y"
1735
- { FLDS((yyval.query), get_r_q(qp, field, (yyvsp[(2) - (4)].str), (yyvsp[(3) - (4)].str), true, true)); Y }
1736
- break;
1737
-
1738
- case 41:
1739
- #line 275 "src/q_parser.y"
1740
- { FLDS((yyval.query), get_r_q(qp, field, (yyvsp[(2) - (4)].str), (yyvsp[(3) - (4)].str), true, false)); Y }
1741
- break;
1742
-
1743
- case 42:
1744
- #line 276 "src/q_parser.y"
1745
- { FLDS((yyval.query), get_r_q(qp, field, (yyvsp[(2) - (4)].str), (yyvsp[(3) - (4)].str), false, true)); Y }
1746
- break;
1747
-
1748
- case 43:
1749
- #line 277 "src/q_parser.y"
1750
- { FLDS((yyval.query), get_r_q(qp, field, (yyvsp[(2) - (4)].str), (yyvsp[(3) - (4)].str), false, false)); Y }
1751
- break;
1752
-
1753
- case 44:
1754
- #line 278 "src/q_parser.y"
1755
- { FLDS((yyval.query), get_r_q(qp, field, NULL,(yyvsp[(2) - (3)].str), false, false)); Y }
1756
- break;
1757
-
1758
- case 45:
1759
- #line 279 "src/q_parser.y"
1760
- { FLDS((yyval.query), get_r_q(qp, field, NULL,(yyvsp[(2) - (3)].str), false, true)); Y }
1761
- break;
1762
-
1763
- case 46:
1764
- #line 280 "src/q_parser.y"
1765
- { FLDS((yyval.query), get_r_q(qp, field, (yyvsp[(2) - (3)].str), NULL, true, false)); Y }
1766
- break;
1767
-
1768
- case 47:
1769
- #line 281 "src/q_parser.y"
1770
- { FLDS((yyval.query), get_r_q(qp, field, (yyvsp[(2) - (3)].str), NULL, false, false)); Y }
1771
- break;
1772
-
1773
- case 48:
1774
- #line 282 "src/q_parser.y"
1775
- { FLDS((yyval.query), get_r_q(qp, field, NULL,(yyvsp[(2) - (2)].str), false, false)); Y }
1776
- break;
1777
-
1778
- case 49:
1779
- #line 283 "src/q_parser.y"
1780
- { FLDS((yyval.query), get_r_q(qp, field, NULL,(yyvsp[(3) - (3)].str), false, true)); Y }
1781
- break;
1782
-
1783
- case 50:
1784
- #line 284 "src/q_parser.y"
1785
- { FLDS((yyval.query), get_r_q(qp, field, (yyvsp[(3) - (3)].str), NULL, true, false)); Y }
1786
- break;
1787
-
1788
- case 51:
1789
- #line 285 "src/q_parser.y"
1790
- { FLDS((yyval.query), get_r_q(qp, field, (yyvsp[(2) - (2)].str), NULL, false, false)); Y }
1791
- break;
1792
-
1793
-
1794
- /* Line 1267 of yacc.c. */
1795
- #line 1810 "src/q_parser.c"
1796
- default: break;
1797
- }
1798
- YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1799
-
1800
- YYPOPSTACK (yylen);
1801
- yylen = 0;
1802
- YY_STACK_PRINT (yyss, yyssp);
1803
-
1804
- *++yyvsp = yyval;
1805
-
1806
-
1807
- /* Now `shift' the result of the reduction. Determine what state
1808
- that goes to, based on the state we popped back to and the rule
1809
- number reduced by. */
1810
-
1811
- yyn = yyr1[yyn];
1812
-
1813
- yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1814
- if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1815
- yystate = yytable[yystate];
1816
- else
1817
- yystate = yydefgoto[yyn - YYNTOKENS];
1818
-
1819
- goto yynewstate;
1820
-
1821
-
1822
- /*------------------------------------.
1823
- | yyerrlab -- here on detecting error |
1824
- `------------------------------------*/
1825
- yyerrlab:
1826
- /* If not already recovering from an error, report this error. */
1827
- if (!yyerrstatus)
1828
- {
1829
- ++yynerrs;
1830
- #if ! YYERROR_VERBOSE
1831
- yyerror (qp, YY_("syntax error"));
1832
- #else
1833
- {
1834
- YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1835
- if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1836
- {
1837
- YYSIZE_T yyalloc = 2 * yysize;
1838
- if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
1839
- yyalloc = YYSTACK_ALLOC_MAXIMUM;
1840
- if (yymsg != yymsgbuf)
1841
- YYSTACK_FREE (yymsg);
1842
- yymsg = (char *) YYSTACK_ALLOC (yyalloc);
1843
- if (yymsg)
1844
- yymsg_alloc = yyalloc;
1845
- else
1846
- {
1847
- yymsg = yymsgbuf;
1848
- yymsg_alloc = sizeof yymsgbuf;
1849
- }
1850
- }
1851
-
1852
- if (0 < yysize && yysize <= yymsg_alloc)
1853
- {
1854
- (void) yysyntax_error (yymsg, yystate, yychar);
1855
- yyerror (qp, yymsg);
1856
- }
1857
- else
1858
- {
1859
- yyerror (qp, YY_("syntax error"));
1860
- if (yysize != 0)
1861
- goto yyexhaustedlab;
1862
- }
1863
- }
1864
- #endif
1865
- }
1866
-
1867
-
1868
-
1869
- if (yyerrstatus == 3)
1870
- {
1871
- /* If just tried and failed to reuse look-ahead token after an
1872
- error, discard it. */
1873
-
1874
- if (yychar <= YYEOF)
1875
- {
1876
- /* Return failure if at end of input. */
1877
- if (yychar == YYEOF)
1878
- YYABORT;
1879
- }
1880
- else
1881
- {
1882
- yydestruct ("Error: discarding",
1883
- yytoken, &yylval, qp);
1884
- yychar = YYEMPTY;
1885
- }
1886
- }
1887
-
1888
- /* Else will try to reuse look-ahead token after shifting the error
1889
- token. */
1890
- goto yyerrlab1;
1891
-
1892
-
1893
- /*---------------------------------------------------.
1894
- | yyerrorlab -- error raised explicitly by YYERROR. |
1895
- `---------------------------------------------------*/
1896
- yyerrorlab:
1897
-
1898
- /* Pacify compilers like GCC when the user code never invokes
1899
- YYERROR and the label yyerrorlab therefore never appears in user
1900
- code. */
1901
- if (/*CONSTCOND*/ 0)
1902
- goto yyerrorlab;
1903
-
1904
- /* Do not reclaim the symbols of the rule which action triggered
1905
- this YYERROR. */
1906
- YYPOPSTACK (yylen);
1907
- yylen = 0;
1908
- YY_STACK_PRINT (yyss, yyssp);
1909
- yystate = *yyssp;
1910
- goto yyerrlab1;
1911
-
1912
-
1913
- /*-------------------------------------------------------------.
1914
- | yyerrlab1 -- common code for both syntax error and YYERROR. |
1915
- `-------------------------------------------------------------*/
1916
- yyerrlab1:
1917
- yyerrstatus = 3; /* Each real token shifted decrements this. */
1918
-
1919
- for (;;)
1920
- {
1921
- yyn = yypact[yystate];
1922
- if (yyn != YYPACT_NINF)
1923
- {
1924
- yyn += YYTERROR;
1925
- if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1926
- {
1927
- yyn = yytable[yyn];
1928
- if (0 < yyn)
1929
- break;
1930
- }
1931
- }
1932
-
1933
- /* Pop the current state because it cannot handle the error token. */
1934
- if (yyssp == yyss)
1935
- YYABORT;
1936
-
1937
-
1938
- yydestruct ("Error: popping",
1939
- yystos[yystate], yyvsp, qp);
1940
- YYPOPSTACK (1);
1941
- yystate = *yyssp;
1942
- YY_STACK_PRINT (yyss, yyssp);
1943
- }
1944
-
1945
- if (yyn == YYFINAL)
1946
- YYACCEPT;
1947
-
1948
- *++yyvsp = yylval;
1949
-
1950
-
1951
- /* Shift the error token. */
1952
- YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1953
-
1954
- yystate = yyn;
1955
- goto yynewstate;
1956
-
1957
-
1958
- /*-------------------------------------.
1959
- | yyacceptlab -- YYACCEPT comes here. |
1960
- `-------------------------------------*/
1961
- yyacceptlab:
1962
- yyresult = 0;
1963
- goto yyreturn;
1964
-
1965
- /*-----------------------------------.
1966
- | yyabortlab -- YYABORT comes here. |
1967
- `-----------------------------------*/
1968
- yyabortlab:
1969
- yyresult = 1;
1970
- goto yyreturn;
1971
-
1972
- #ifndef yyoverflow
1973
- /*-------------------------------------------------.
1974
- | yyexhaustedlab -- memory exhaustion comes here. |
1975
- `-------------------------------------------------*/
1976
- yyexhaustedlab:
1977
- yyerror (qp, YY_("memory exhausted"));
1978
- yyresult = 2;
1979
- /* Fall through. */
1980
- #endif
1981
-
1982
- yyreturn:
1983
- if (yychar != YYEOF && yychar != YYEMPTY)
1984
- yydestruct ("Cleanup: discarding lookahead",
1985
- yytoken, &yylval, qp);
1986
- /* Do not reclaim the symbols of the rule which action triggered
1987
- this YYABORT or YYACCEPT. */
1988
- YYPOPSTACK (yylen);
1989
- YY_STACK_PRINT (yyss, yyssp);
1990
- while (yyssp != yyss)
1991
- {
1992
- yydestruct ("Cleanup: popping",
1993
- yystos[*yyssp], yyvsp, qp);
1994
- YYPOPSTACK (1);
1995
- }
1996
- #ifndef yyoverflow
1997
- if (yyss != yyssa)
1998
- YYSTACK_FREE (yyss);
1999
- #endif
2000
- #if YYERROR_VERBOSE
2001
- if (yymsg != yymsgbuf)
2002
- YYSTACK_FREE (yymsg);
2003
- #endif
2004
- /* Make sure YYID is used. */
2005
- return YYID (yyresult);
2006
- }
2007
-
2008
-
2009
- #line 287 "src/q_parser.y"
400
+
401
+ #line 402 "frt_q_parser.c"
402
+
403
+
404
+ #ifdef short
405
+ # undef short
406
+ #endif
407
+
408
+ /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
409
+ <limits.h> and (if available) <stdint.h> are included
410
+ so that the code can choose integer types of a good width. */
411
+
412
+ #ifndef __PTRDIFF_MAX__
413
+ # include <limits.h> /* INFRINGES ON USER NAME SPACE */
414
+ # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
415
+ # include <stdint.h> /* INFRINGES ON USER NAME SPACE */
416
+ # define YY_STDINT_H
417
+ # endif
418
+ #endif
419
+
420
+ /* Narrow types that promote to a signed type and that can represent a
421
+ signed or unsigned integer of at least N bits. In tables they can
422
+ save space and decrease cache pressure. Promoting to a signed type
423
+ helps avoid bugs in integer arithmetic. */
424
+
425
+ #ifdef __INT_LEAST8_MAX__
426
+ typedef __INT_LEAST8_TYPE__ yytype_int8;
427
+ #elif defined YY_STDINT_H
428
+ typedef int_least8_t yytype_int8;
429
+ #else
430
+ typedef signed char yytype_int8;
431
+ #endif
432
+
433
+ #ifdef __INT_LEAST16_MAX__
434
+ typedef __INT_LEAST16_TYPE__ yytype_int16;
435
+ #elif defined YY_STDINT_H
436
+ typedef int_least16_t yytype_int16;
437
+ #else
438
+ typedef short yytype_int16;
439
+ #endif
440
+
441
+ /* Work around bug in HP-UX 11.23, which defines these macros
442
+ incorrectly for preprocessor constants. This workaround can likely
443
+ be removed in 2023, as HPE has promised support for HP-UX 11.23
444
+ (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
445
+ <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>. */
446
+ #ifdef __hpux
447
+ # undef UINT_LEAST8_MAX
448
+ # undef UINT_LEAST16_MAX
449
+ # define UINT_LEAST8_MAX 255
450
+ # define UINT_LEAST16_MAX 65535
451
+ #endif
452
+
453
+ #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
454
+ typedef __UINT_LEAST8_TYPE__ yytype_uint8;
455
+ #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
456
+ && UINT_LEAST8_MAX <= INT_MAX)
457
+ typedef uint_least8_t yytype_uint8;
458
+ #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
459
+ typedef unsigned char yytype_uint8;
460
+ #else
461
+ typedef short yytype_uint8;
462
+ #endif
463
+
464
+ #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
465
+ typedef __UINT_LEAST16_TYPE__ yytype_uint16;
466
+ #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
467
+ && UINT_LEAST16_MAX <= INT_MAX)
468
+ typedef uint_least16_t yytype_uint16;
469
+ #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
470
+ typedef unsigned short yytype_uint16;
471
+ #else
472
+ typedef int yytype_uint16;
473
+ #endif
474
+
475
+ #ifndef YYPTRDIFF_T
476
+ # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
477
+ # define YYPTRDIFF_T __PTRDIFF_TYPE__
478
+ # define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
479
+ # elif defined PTRDIFF_MAX
480
+ # ifndef ptrdiff_t
481
+ # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
482
+ # endif
483
+ # define YYPTRDIFF_T ptrdiff_t
484
+ # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
485
+ # else
486
+ # define YYPTRDIFF_T long
487
+ # define YYPTRDIFF_MAXIMUM LONG_MAX
488
+ # endif
489
+ #endif
490
+
491
+ #ifndef YYSIZE_T
492
+ # ifdef __SIZE_TYPE__
493
+ # define YYSIZE_T __SIZE_TYPE__
494
+ # elif defined size_t
495
+ # define YYSIZE_T size_t
496
+ # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
497
+ # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
498
+ # define YYSIZE_T size_t
499
+ # else
500
+ # define YYSIZE_T unsigned
501
+ # endif
502
+ #endif
503
+
504
+ #define YYSIZE_MAXIMUM \
505
+ YY_CAST (YYPTRDIFF_T, \
506
+ (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
507
+ ? YYPTRDIFF_MAXIMUM \
508
+ : YY_CAST (YYSIZE_T, -1)))
509
+
510
+ #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
511
+
512
+
513
+ /* Stored state numbers (used for stacks). */
514
+ typedef yytype_int8 yy_state_t;
515
+
516
+ /* State numbers in computations. */
517
+ typedef int yy_state_fast_t;
518
+
519
+ #ifndef YY_
520
+ # if defined YYENABLE_NLS && YYENABLE_NLS
521
+ # if ENABLE_NLS
522
+ # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
523
+ # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
524
+ # endif
525
+ # endif
526
+ # ifndef YY_
527
+ # define YY_(Msgid) Msgid
528
+ # endif
529
+ #endif
530
+
531
+
532
+ #ifndef YY_ATTRIBUTE_PURE
533
+ # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
534
+ # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
535
+ # else
536
+ # define YY_ATTRIBUTE_PURE
537
+ # endif
538
+ #endif
539
+
540
+ #ifndef YY_ATTRIBUTE_UNUSED
541
+ # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
542
+ # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
543
+ # else
544
+ # define YY_ATTRIBUTE_UNUSED
545
+ # endif
546
+ #endif
547
+
548
+ /* Suppress unused-variable warnings by "using" E. */
549
+ #if ! defined lint || defined __GNUC__
550
+ # define YY_USE(E) ((void) (E))
551
+ #else
552
+ # define YY_USE(E) /* empty */
553
+ #endif
554
+
555
+ /* Suppress an incorrect diagnostic about yylval being uninitialized. */
556
+ #if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
557
+ # if __GNUC__ * 100 + __GNUC_MINOR__ < 407
558
+ # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
559
+ _Pragma ("GCC diagnostic push") \
560
+ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")
561
+ # else
562
+ # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
563
+ _Pragma ("GCC diagnostic push") \
564
+ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
565
+ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
566
+ # endif
567
+ # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
568
+ _Pragma ("GCC diagnostic pop")
569
+ #else
570
+ # define YY_INITIAL_VALUE(Value) Value
571
+ #endif
572
+ #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
573
+ # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
574
+ # define YY_IGNORE_MAYBE_UNINITIALIZED_END
575
+ #endif
576
+ #ifndef YY_INITIAL_VALUE
577
+ # define YY_INITIAL_VALUE(Value) /* Nothing. */
578
+ #endif
579
+
580
+ #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
581
+ # define YY_IGNORE_USELESS_CAST_BEGIN \
582
+ _Pragma ("GCC diagnostic push") \
583
+ _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
584
+ # define YY_IGNORE_USELESS_CAST_END \
585
+ _Pragma ("GCC diagnostic pop")
586
+ #endif
587
+ #ifndef YY_IGNORE_USELESS_CAST_BEGIN
588
+ # define YY_IGNORE_USELESS_CAST_BEGIN
589
+ # define YY_IGNORE_USELESS_CAST_END
590
+ #endif
591
+
592
+
593
+ #define YY_ASSERT(E) ((void) (0 && (E)))
594
+
595
+ #if !defined yyoverflow
596
+
597
+ /* The parser invokes alloca or malloc; define the necessary symbols. */
598
+
599
+ # ifdef YYSTACK_USE_ALLOCA
600
+ # if YYSTACK_USE_ALLOCA
601
+ # ifdef __GNUC__
602
+ # define YYSTACK_ALLOC __builtin_alloca
603
+ # elif defined __BUILTIN_VA_ARG_INCR
604
+ # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
605
+ # elif defined _AIX
606
+ # define YYSTACK_ALLOC __alloca
607
+ # elif defined _MSC_VER
608
+ # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
609
+ # define alloca _alloca
610
+ # else
611
+ # define YYSTACK_ALLOC alloca
612
+ # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
613
+ # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
614
+ /* Use EXIT_SUCCESS as a witness for stdlib.h. */
615
+ # ifndef EXIT_SUCCESS
616
+ # define EXIT_SUCCESS 0
617
+ # endif
618
+ # endif
619
+ # endif
620
+ # endif
621
+ # endif
622
+
623
+ # ifdef YYSTACK_ALLOC
624
+ /* Pacify GCC's 'empty if-body' warning. */
625
+ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
626
+ # ifndef YYSTACK_ALLOC_MAXIMUM
627
+ /* The OS might guarantee only one guard page at the bottom of the stack,
628
+ and a page size can be as small as 4096 bytes. So we cannot safely
629
+ invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
630
+ to allow for a few compiler-allocated temporary stack slots. */
631
+ # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
632
+ # endif
633
+ # else
634
+ # define YYSTACK_ALLOC YYMALLOC
635
+ # define YYSTACK_FREE YYFREE
636
+ # ifndef YYSTACK_ALLOC_MAXIMUM
637
+ # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
638
+ # endif
639
+ # if (defined __cplusplus && ! defined EXIT_SUCCESS \
640
+ && ! ((defined YYMALLOC || defined malloc) \
641
+ && (defined YYFREE || defined free)))
642
+ # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
643
+ # ifndef EXIT_SUCCESS
644
+ # define EXIT_SUCCESS 0
645
+ # endif
646
+ # endif
647
+ # ifndef YYMALLOC
648
+ # define YYMALLOC malloc
649
+ # if ! defined malloc && ! defined EXIT_SUCCESS
650
+ void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
651
+ # endif
652
+ # endif
653
+ # ifndef YYFREE
654
+ # define YYFREE free
655
+ # if ! defined free && ! defined EXIT_SUCCESS
656
+ void free (void *); /* INFRINGES ON USER NAME SPACE */
657
+ # endif
658
+ # endif
659
+ # endif
660
+ #endif /* !defined yyoverflow */
661
+
662
+ #if (! defined yyoverflow \
663
+ && (! defined __cplusplus \
664
+ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
665
+
666
+ /* A type that is properly aligned for any stack member. */
667
+ union yyalloc
668
+ {
669
+ yy_state_t yyss_alloc;
670
+ YYSTYPE yyvs_alloc;
671
+ };
672
+
673
+ /* The size of the maximum gap between one aligned stack and the next. */
674
+ # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
675
+
676
+ /* The size of an array large to enough to hold all stacks, each with
677
+ N elements. */
678
+ # define YYSTACK_BYTES(N) \
679
+ ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
680
+ + YYSTACK_GAP_MAXIMUM)
681
+
682
+ # define YYCOPY_NEEDED 1
683
+
684
+ /* Relocate STACK from its old location to the new one. The
685
+ local variables YYSIZE and YYSTACKSIZE give the old and new number of
686
+ elements in the stack, and YYPTR gives the new location of the
687
+ stack. Advance YYPTR to a properly aligned location for the next
688
+ stack. */
689
+ # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
690
+ do \
691
+ { \
692
+ YYPTRDIFF_T yynewbytes; \
693
+ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
694
+ Stack = &yyptr->Stack_alloc; \
695
+ yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
696
+ yyptr += yynewbytes / YYSIZEOF (*yyptr); \
697
+ } \
698
+ while (0)
699
+
700
+ #endif
701
+
702
+ #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
703
+ /* Copy COUNT objects from SRC to DST. The source and destination do
704
+ not overlap. */
705
+ # ifndef YYCOPY
706
+ # if defined __GNUC__ && 1 < __GNUC__
707
+ # define YYCOPY(Dst, Src, Count) \
708
+ __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
709
+ # else
710
+ # define YYCOPY(Dst, Src, Count) \
711
+ do \
712
+ { \
713
+ YYPTRDIFF_T yyi; \
714
+ for (yyi = 0; yyi < (Count); yyi++) \
715
+ (Dst)[yyi] = (Src)[yyi]; \
716
+ } \
717
+ while (0)
718
+ # endif
719
+ # endif
720
+ #endif /* !YYCOPY_NEEDED */
721
+
722
+ /* YYFINAL -- State number of the termination state. */
723
+ #define YYFINAL 39
724
+ /* YYLAST -- Last index in YYTABLE. */
725
+ #define YYLAST 126
726
+
727
+ /* YYNTOKENS -- Number of terminals. */
728
+ #define YYNTOKENS 26
729
+ /* YYNNTS -- Number of nonterminals. */
730
+ #define YYNNTS 16
731
+ /* YYNRULES -- Number of rules. */
732
+ #define YYNRULES 51
733
+ /* YYNSTATES -- Number of states. */
734
+ #define YYNSTATES 80
735
+
736
+ /* YYMAXUTOK -- Last valid token kind. */
737
+ #define YYMAXUTOK 265
738
+
739
+
740
+ /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
741
+ as returned by yylex, with out-of-bounds checking. */
742
+ #define YYTRANSLATE(YYX) \
743
+ (0 <= (YYX) && (YYX) <= YYMAXUTOK \
744
+ ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \
745
+ : YYSYMBOL_YYUNDEF)
746
+
747
+ /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
748
+ as returned by yylex. */
749
+ static const yytype_int8 yytranslate[] =
750
+ {
751
+ 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
752
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
753
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
754
+ 2, 2, 2, 2, 18, 2, 2, 2, 2, 2,
755
+ 13, 14, 16, 2, 2, 2, 2, 2, 2, 2,
756
+ 2, 2, 2, 2, 2, 2, 2, 2, 10, 2,
757
+ 19, 25, 20, 2, 2, 2, 2, 2, 2, 2,
758
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
759
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
760
+ 2, 21, 2, 22, 12, 2, 2, 2, 2, 2,
761
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
762
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
763
+ 2, 2, 2, 24, 17, 23, 15, 2, 2, 2,
764
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
765
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
766
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
767
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
768
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
769
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
770
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
771
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
772
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
773
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
774
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
775
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
776
+ 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
777
+ 5, 6, 7, 8, 9, 11
778
+ };
779
+
780
+ #if YYDEBUG
781
+ /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
782
+ static const yytype_int16 yyrline[] =
783
+ {
784
+ 0, 226, 226, 227, 229, 230, 231, 232, 234, 235,
785
+ 236, 238, 239, 241, 242, 243, 244, 245, 246, 247,
786
+ 249, 250, 251, 253, 255, 255, 257, 257, 257, 260,
787
+ 261, 263, 264, 265, 266, 268, 269, 270, 271, 272,
788
+ 274, 275, 276, 277, 278, 279, 280, 281, 282, 283,
789
+ 284, 285
790
+ };
791
+ #endif
792
+
793
+ /** Accessing symbol of state STATE. */
794
+ #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
795
+
796
+ #if YYDEBUG || 0
797
+ /* The user-facing name of the symbol whose (internal) number is
798
+ YYSYMBOL. No bounds checking. */
799
+ static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
800
+
801
+ /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
802
+ First, the terminals, then, starting at YYNTOKENS, nonterminals. */
803
+ static const char *const yytname[] =
804
+ {
805
+ "\"end of file\"", "error", "\"invalid token\"", "QWRD", "WILD_STR",
806
+ "LOW", "AND", "OR", "REQ", "NOT", "':'", "HIGH", "'^'", "'('", "')'",
807
+ "'~'", "'*'", "'|'", "'\"'", "'<'", "'>'", "'['", "']'", "'}'", "'{'",
808
+ "'='", "$accept", "bool_q", "bool_clss", "bool_cls", "boosted_q", "q",
809
+ "term_q", "wild_q", "field_q", "$@1", "$@2", "$@3", "field", "phrase_q",
810
+ "ph_words", "range_q", YY_NULLPTR
811
+ };
812
+
813
+ static const char *
814
+ yysymbol_name (yysymbol_kind_t yysymbol)
815
+ {
816
+ return yytname[yysymbol];
817
+ }
818
+ #endif
819
+
820
+ #define YYPACT_NINF (-30)
821
+
822
+ #define yypact_value_is_default(Yyn) \
823
+ ((Yyn) == YYPACT_NINF)
824
+
825
+ #define YYTABLE_NINF (-30)
826
+
827
+ #define yytable_value_is_error(Yyn) \
828
+ 0
829
+
830
+ /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
831
+ STATE-NUM. */
832
+ static const yytype_int8 yypact[] =
833
+ {
834
+ 83, -4, -30, 102, 102, 64, -30, 7, -2, -1,
835
+ 6, 15, 31, 45, -30, -30, 29, -30, -30, -30,
836
+ -5, -30, -30, 40, -30, -30, -30, 26, 47, -30,
837
+ 55, 42, 19, -15, 68, -30, 71, 0, 1, -30,
838
+ 83, 83, -30, 72, 102, 73, -30, -30, 102, 76,
839
+ -30, -30, 78, 74, 70, -30, -30, -30, -30, -6,
840
+ -30, 33, -30, -30, -30, -30, -30, -30, -30, -30,
841
+ -30, 90, -30, -30, -30, -30, -30, -30, -30, -30
842
+ };
843
+
844
+ /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
845
+ Performed when YYTABLE does not specify something else to do. Zero
846
+ means the default is an error. */
847
+ static const yytype_int8 yydefact[] =
848
+ {
849
+ 2, 20, 23, 0, 0, 0, 26, 0, 0, 0,
850
+ 0, 0, 0, 3, 4, 10, 11, 13, 19, 16,
851
+ 0, 17, 18, 22, 8, 9, 14, 0, 0, 35,
852
+ 33, 0, 0, 48, 0, 51, 0, 0, 0, 1,
853
+ 0, 0, 7, 0, 0, 0, 21, 15, 0, 0,
854
+ 36, 37, 0, 31, 0, 45, 44, 49, 50, 0,
855
+ 46, 0, 47, 5, 6, 12, 24, 30, 27, 34,
856
+ 39, 0, 38, 40, 41, 42, 43, 25, 28, 32
857
+ };
858
+
859
+ /* YYPGOTO[NTERM-NUM]. */
860
+ static const yytype_int8 yypgoto[] =
861
+ {
862
+ -30, -30, 89, -13, 56, -29, -30, -30, -30, -30,
863
+ -30, -30, -30, -30, -30, -30
864
+ };
865
+
866
+ /* YYDEFGOTO[NTERM-NUM]. */
867
+ static const yytype_int8 yydefgoto[] =
868
+ {
869
+ 0, 12, 13, 14, 15, 16, 17, 18, 19, 77,
870
+ 28, 78, 20, 21, 32, 22
871
+ };
872
+
873
+ /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
874
+ positive, shift that token. If negative, reduce the rule whose
875
+ number is the opposite. If YYTABLE_NINF, syntax error. */
876
+ static const yytype_int8 yytable[] =
877
+ {
878
+ 42, 33, 35, 59, 61, 44, -29, 55, 56, 37,
879
+ 29, 23, 45, -29, 42, 66, 73, 74, 38, 68,
880
+ 60, 62, 51, 34, 36, 30, 31, 63, 64, 1,
881
+ 2, 39, 40, 41, 3, 4, 52, 53, 54, 5,
882
+ 47, 43, 6, 46, 7, 8, 9, 10, 1, 2,
883
+ 11, 40, 41, 3, 4, 75, 76, 48, 5, 24,
884
+ 25, 6, 50, 7, 8, 9, 10, 1, 2, 11,
885
+ 49, 57, 3, 4, 58, 65, 67, 5, 26, 69,
886
+ 6, 70, 7, 8, 9, 10, 1, 2, 11, 71,
887
+ 72, 3, 4, 79, 27, 0, 5, 0, 0, 6,
888
+ 0, 7, 8, 9, 10, 1, 2, 11, 0, 0,
889
+ 0, 0, 0, 0, 0, 5, 0, 0, 6, 0,
890
+ 7, 8, 9, 10, 0, 0, 11
891
+ };
892
+
893
+ static const yytype_int8 yycheck[] =
894
+ {
895
+ 13, 3, 3, 3, 3, 10, 10, 22, 23, 3,
896
+ 3, 15, 17, 17, 27, 44, 22, 23, 3, 48,
897
+ 20, 20, 3, 25, 25, 18, 19, 40, 41, 3,
898
+ 4, 0, 6, 7, 8, 9, 17, 18, 19, 13,
899
+ 14, 12, 16, 3, 18, 19, 20, 21, 3, 4,
900
+ 24, 6, 7, 8, 9, 22, 23, 10, 13, 3,
901
+ 4, 16, 20, 18, 19, 20, 21, 3, 4, 24,
902
+ 15, 3, 8, 9, 3, 3, 3, 13, 14, 3,
903
+ 16, 3, 18, 19, 20, 21, 3, 4, 24, 15,
904
+ 20, 8, 9, 3, 5, -1, 13, -1, -1, 16,
905
+ -1, 18, 19, 20, 21, 3, 4, 24, -1, -1,
906
+ -1, -1, -1, -1, -1, 13, -1, -1, 16, -1,
907
+ 18, 19, 20, 21, -1, -1, 24
908
+ };
909
+
910
+ /* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
911
+ state STATE-NUM. */
912
+ static const yytype_int8 yystos[] =
913
+ {
914
+ 0, 3, 4, 8, 9, 13, 16, 18, 19, 20,
915
+ 21, 24, 27, 28, 29, 30, 31, 32, 33, 34,
916
+ 38, 39, 41, 15, 30, 30, 14, 28, 36, 3,
917
+ 18, 19, 40, 3, 25, 3, 25, 3, 3, 0,
918
+ 6, 7, 29, 12, 10, 17, 3, 14, 10, 15,
919
+ 20, 3, 17, 18, 19, 22, 23, 3, 3, 3,
920
+ 20, 3, 20, 29, 29, 3, 31, 3, 31, 3,
921
+ 3, 15, 20, 22, 23, 22, 23, 35, 37, 3
922
+ };
923
+
924
+ /* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */
925
+ static const yytype_int8 yyr1[] =
926
+ {
927
+ 0, 26, 27, 27, 28, 28, 28, 28, 29, 29,
928
+ 29, 30, 30, 31, 31, 31, 31, 31, 31, 31,
929
+ 32, 32, 32, 33, 35, 34, 36, 37, 34, 38,
930
+ 38, 39, 39, 39, 39, 40, 40, 40, 40, 40,
931
+ 41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
932
+ 41, 41
933
+ };
934
+
935
+ /* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */
936
+ static const yytype_int8 yyr2[] =
937
+ {
938
+ 0, 2, 0, 1, 1, 3, 3, 2, 2, 2,
939
+ 1, 1, 3, 1, 2, 3, 1, 1, 1, 1,
940
+ 1, 3, 2, 1, 0, 4, 0, 0, 5, 1,
941
+ 3, 3, 5, 2, 4, 1, 2, 2, 3, 3,
942
+ 4, 4, 4, 4, 3, 3, 3, 3, 2, 3,
943
+ 3, 2
944
+ };
945
+
946
+
947
+ enum { YYENOMEM = -2 };
948
+
949
+ #define yyerrok (yyerrstatus = 0)
950
+ #define yyclearin (yychar = YYEMPTY)
951
+
952
+ #define YYACCEPT goto yyacceptlab
953
+ #define YYABORT goto yyabortlab
954
+ #define YYERROR goto yyerrorlab
955
+ #define YYNOMEM goto yyexhaustedlab
956
+
957
+
958
+ #define YYRECOVERING() (!!yyerrstatus)
959
+
960
+ #define YYBACKUP(Token, Value) \
961
+ do \
962
+ if (yychar == YYEMPTY) \
963
+ { \
964
+ yychar = (Token); \
965
+ yylval = (Value); \
966
+ YYPOPSTACK (yylen); \
967
+ yystate = *yyssp; \
968
+ goto yybackup; \
969
+ } \
970
+ else \
971
+ { \
972
+ yyerror (qp, YY_("syntax error: cannot back up")); \
973
+ YYERROR; \
974
+ } \
975
+ while (0)
976
+
977
+ /* Backward compatibility with an undocumented macro.
978
+ Use YYerror or YYUNDEF. */
979
+ #define YYERRCODE YYUNDEF
980
+
981
+
982
+ /* Enable debugging if requested. */
983
+ #if YYDEBUG
984
+
985
+ # ifndef YYFPRINTF
986
+ # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
987
+ # define YYFPRINTF fprintf
988
+ # endif
989
+
990
+ # define YYDPRINTF(Args) \
991
+ do { \
992
+ if (yydebug) \
993
+ YYFPRINTF Args; \
994
+ } while (0)
995
+
996
+
997
+
998
+
999
+ # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
1000
+ do { \
1001
+ if (yydebug) \
1002
+ { \
1003
+ YYFPRINTF (stderr, "%s ", Title); \
1004
+ yy_symbol_print (stderr, \
1005
+ Kind, Value, qp); \
1006
+ YYFPRINTF (stderr, "\n"); \
1007
+ } \
1008
+ } while (0)
1009
+
1010
+
1011
+ /*-----------------------------------.
1012
+ | Print this symbol's value on YYO. |
1013
+ `-----------------------------------*/
1014
+
1015
+ static void
1016
+ yy_symbol_value_print (FILE *yyo,
1017
+ yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, FrtQParser *qp)
1018
+ {
1019
+ FILE *yyoutput = yyo;
1020
+ YY_USE (yyoutput);
1021
+ YY_USE (qp);
1022
+ if (!yyvaluep)
1023
+ return;
1024
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1025
+ YY_USE (yykind);
1026
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
1027
+ }
1028
+
1029
+
1030
+ /*---------------------------.
1031
+ | Print this symbol on YYO. |
1032
+ `---------------------------*/
1033
+
1034
+ static void
1035
+ yy_symbol_print (FILE *yyo,
1036
+ yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, FrtQParser *qp)
1037
+ {
1038
+ YYFPRINTF (yyo, "%s %s (",
1039
+ yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
1040
+
1041
+ yy_symbol_value_print (yyo, yykind, yyvaluep, qp);
1042
+ YYFPRINTF (yyo, ")");
1043
+ }
1044
+
1045
+ /*------------------------------------------------------------------.
1046
+ | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1047
+ | TOP (included). |
1048
+ `------------------------------------------------------------------*/
1049
+
1050
+ static void
1051
+ yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
1052
+ {
1053
+ YYFPRINTF (stderr, "Stack now");
1054
+ for (; yybottom <= yytop; yybottom++)
1055
+ {
1056
+ int yybot = *yybottom;
1057
+ YYFPRINTF (stderr, " %d", yybot);
1058
+ }
1059
+ YYFPRINTF (stderr, "\n");
1060
+ }
1061
+
1062
+ # define YY_STACK_PRINT(Bottom, Top) \
1063
+ do { \
1064
+ if (yydebug) \
1065
+ yy_stack_print ((Bottom), (Top)); \
1066
+ } while (0)
1067
+
1068
+
1069
+ /*------------------------------------------------.
1070
+ | Report that the YYRULE is going to be reduced. |
1071
+ `------------------------------------------------*/
1072
+
1073
+ static void
1074
+ yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
1075
+ int yyrule, FrtQParser *qp)
1076
+ {
1077
+ int yylno = yyrline[yyrule];
1078
+ int yynrhs = yyr2[yyrule];
1079
+ int yyi;
1080
+ YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
1081
+ yyrule - 1, yylno);
1082
+ /* The symbols being reduced. */
1083
+ for (yyi = 0; yyi < yynrhs; yyi++)
1084
+ {
1085
+ YYFPRINTF (stderr, " $%d = ", yyi + 1);
1086
+ yy_symbol_print (stderr,
1087
+ YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
1088
+ &yyvsp[(yyi + 1) - (yynrhs)], qp);
1089
+ YYFPRINTF (stderr, "\n");
1090
+ }
1091
+ }
1092
+
1093
+ # define YY_REDUCE_PRINT(Rule) \
1094
+ do { \
1095
+ if (yydebug) \
1096
+ yy_reduce_print (yyssp, yyvsp, Rule, qp); \
1097
+ } while (0)
1098
+
1099
+ /* Nonzero means print parse trace. It is left uninitialized so that
1100
+ multiple parsers can coexist. */
1101
+ int yydebug;
1102
+ #else /* !YYDEBUG */
1103
+ # define YYDPRINTF(Args) ((void) 0)
1104
+ # define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
1105
+ # define YY_STACK_PRINT(Bottom, Top)
1106
+ # define YY_REDUCE_PRINT(Rule)
1107
+ #endif /* !YYDEBUG */
1108
+
1109
+
1110
+ /* YYINITDEPTH -- initial size of the parser's stacks. */
1111
+ #ifndef YYINITDEPTH
1112
+ # define YYINITDEPTH 200
1113
+ #endif
1114
+
1115
+ /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1116
+ if the built-in stack extension method is used).
1117
+
1118
+ Do not make this value too large; the results are undefined if
1119
+ YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1120
+ evaluated with infinite-precision integer arithmetic. */
1121
+
1122
+ #ifndef YYMAXDEPTH
1123
+ # define YYMAXDEPTH 10000
1124
+ #endif
1125
+
1126
+
1127
+
1128
+
1129
+
1130
+
1131
+ /*-----------------------------------------------.
1132
+ | Release the memory associated to this symbol. |
1133
+ `-----------------------------------------------*/
1134
+
1135
+ static void
1136
+ yydestruct (const char *yymsg,
1137
+ yysymbol_kind_t yykind, YYSTYPE *yyvaluep, FrtQParser *qp)
1138
+ {
1139
+ YY_USE (yyvaluep);
1140
+ YY_USE (qp);
1141
+ if (!yymsg)
1142
+ yymsg = "Deleting";
1143
+ YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
1144
+
1145
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1146
+ switch (yykind)
1147
+ {
1148
+ case YYSYMBOL_bool_q: /* bool_q */
1149
+ #line 221 "frt_q_parser.y"
1150
+ { if (((*yyvaluep).query) && qp->destruct) frt_q_deref(((*yyvaluep).query)); }
1151
+ #line 1152 "frt_q_parser.c"
1152
+ break;
1153
+
1154
+ case YYSYMBOL_bool_clss: /* bool_clss */
1155
+ #line 223 "frt_q_parser.y"
1156
+ { if (((*yyvaluep).bclss) && qp->destruct) bca_destroy(((*yyvaluep).bclss)); }
1157
+ #line 1158 "frt_q_parser.c"
1158
+ break;
1159
+
1160
+ case YYSYMBOL_bool_cls: /* bool_cls */
1161
+ #line 222 "frt_q_parser.y"
1162
+ { if (((*yyvaluep).bcls) && qp->destruct) frt_bc_deref(((*yyvaluep).bcls)); }
1163
+ #line 1164 "frt_q_parser.c"
1164
+ break;
1165
+
1166
+ case YYSYMBOL_boosted_q: /* boosted_q */
1167
+ #line 221 "frt_q_parser.y"
1168
+ { if (((*yyvaluep).query) && qp->destruct) frt_q_deref(((*yyvaluep).query)); }
1169
+ #line 1170 "frt_q_parser.c"
1170
+ break;
1171
+
1172
+ case YYSYMBOL_q: /* q */
1173
+ #line 221 "frt_q_parser.y"
1174
+ { if (((*yyvaluep).query) && qp->destruct) frt_q_deref(((*yyvaluep).query)); }
1175
+ #line 1176 "frt_q_parser.c"
1176
+ break;
1177
+
1178
+ case YYSYMBOL_term_q: /* term_q */
1179
+ #line 221 "frt_q_parser.y"
1180
+ { if (((*yyvaluep).query) && qp->destruct) frt_q_deref(((*yyvaluep).query)); }
1181
+ #line 1182 "frt_q_parser.c"
1182
+ break;
1183
+
1184
+ case YYSYMBOL_wild_q: /* wild_q */
1185
+ #line 221 "frt_q_parser.y"
1186
+ { if (((*yyvaluep).query) && qp->destruct) frt_q_deref(((*yyvaluep).query)); }
1187
+ #line 1188 "frt_q_parser.c"
1188
+ break;
1189
+
1190
+ case YYSYMBOL_field_q: /* field_q */
1191
+ #line 221 "frt_q_parser.y"
1192
+ { if (((*yyvaluep).query) && qp->destruct) frt_q_deref(((*yyvaluep).query)); }
1193
+ #line 1194 "frt_q_parser.c"
1194
+ break;
1195
+
1196
+ case YYSYMBOL_phrase_q: /* phrase_q */
1197
+ #line 221 "frt_q_parser.y"
1198
+ { if (((*yyvaluep).query) && qp->destruct) frt_q_deref(((*yyvaluep).query)); }
1199
+ #line 1200 "frt_q_parser.c"
1200
+ break;
1201
+
1202
+ case YYSYMBOL_ph_words: /* ph_words */
1203
+ #line 224 "frt_q_parser.y"
1204
+ { if (((*yyvaluep).phrase) && qp->destruct) ph_destroy(((*yyvaluep).phrase)); }
1205
+ #line 1206 "frt_q_parser.c"
1206
+ break;
1207
+
1208
+ case YYSYMBOL_range_q: /* range_q */
1209
+ #line 221 "frt_q_parser.y"
1210
+ { if (((*yyvaluep).query) && qp->destruct) frt_q_deref(((*yyvaluep).query)); }
1211
+ #line 1212 "frt_q_parser.c"
1212
+ break;
1213
+
1214
+ default:
1215
+ break;
1216
+ }
1217
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
1218
+ }
1219
+
1220
+
1221
+
1222
+
1223
+
1224
+
1225
+ /*----------.
1226
+ | yyparse. |
1227
+ `----------*/
1228
+
1229
+ int
1230
+ yyparse (FrtQParser *qp)
1231
+ {
1232
+ /* Lookahead token kind. */
1233
+ int yychar;
1234
+
1235
+
1236
+ /* The semantic value of the lookahead symbol. */
1237
+ /* Default value used for initialization, for pacifying older GCCs
1238
+ or non-GCC compilers. */
1239
+ YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
1240
+ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
1241
+
1242
+ /* Number of syntax errors so far. */
1243
+ int yynerrs = 0;
1244
+
1245
+ yy_state_fast_t yystate = 0;
1246
+ /* Number of tokens to shift before error messages enabled. */
1247
+ int yyerrstatus = 0;
1248
+
1249
+ /* Refer to the stacks through separate pointers, to allow yyoverflow
1250
+ to reallocate them elsewhere. */
1251
+
1252
+ /* Their size. */
1253
+ YYPTRDIFF_T yystacksize = YYINITDEPTH;
1254
+
1255
+ /* The state stack: array, bottom, top. */
1256
+ yy_state_t yyssa[YYINITDEPTH];
1257
+ yy_state_t *yyss = yyssa;
1258
+ yy_state_t *yyssp = yyss;
1259
+
1260
+ /* The semantic value stack: array, bottom, top. */
1261
+ YYSTYPE yyvsa[YYINITDEPTH];
1262
+ YYSTYPE *yyvs = yyvsa;
1263
+ YYSTYPE *yyvsp = yyvs;
1264
+
1265
+ int yyn;
1266
+ /* The return value of yyparse. */
1267
+ int yyresult;
1268
+ /* Lookahead symbol kind. */
1269
+ yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
1270
+ /* The variables used to return semantic value and location from the
1271
+ action routines. */
1272
+ YYSTYPE yyval;
1273
+
1274
+
1275
+
1276
+ #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1277
+
1278
+ /* The number of symbols on the RHS of the reduced rule.
1279
+ Keep to zero when no symbol should be popped. */
1280
+ int yylen = 0;
1281
+
1282
+ YYDPRINTF ((stderr, "Starting parse\n"));
1283
+
1284
+ yychar = YYEMPTY; /* Cause a token to be read. */
1285
+
1286
+ goto yysetstate;
1287
+
1288
+
1289
+ /*------------------------------------------------------------.
1290
+ | yynewstate -- push a new state, which is found in yystate. |
1291
+ `------------------------------------------------------------*/
1292
+ yynewstate:
1293
+ /* In all cases, when you get here, the value and location stacks
1294
+ have just been pushed. So pushing a state here evens the stacks. */
1295
+ yyssp++;
1296
+
1297
+
1298
+ /*--------------------------------------------------------------------.
1299
+ | yysetstate -- set current state (the top of the stack) to yystate. |
1300
+ `--------------------------------------------------------------------*/
1301
+ yysetstate:
1302
+ YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1303
+ YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
1304
+ YY_IGNORE_USELESS_CAST_BEGIN
1305
+ *yyssp = YY_CAST (yy_state_t, yystate);
1306
+ YY_IGNORE_USELESS_CAST_END
1307
+ YY_STACK_PRINT (yyss, yyssp);
1308
+
1309
+ if (yyss + yystacksize - 1 <= yyssp)
1310
+ #if !defined yyoverflow && !defined YYSTACK_RELOCATE
1311
+ YYNOMEM;
1312
+ #else
1313
+ {
1314
+ /* Get the current used size of the three stacks, in elements. */
1315
+ YYPTRDIFF_T yysize = yyssp - yyss + 1;
1316
+
1317
+ # if defined yyoverflow
1318
+ {
1319
+ /* Give user a chance to reallocate the stack. Use copies of
1320
+ these so that the &'s don't force the real ones into
1321
+ memory. */
1322
+ yy_state_t *yyss1 = yyss;
1323
+ YYSTYPE *yyvs1 = yyvs;
1324
+
1325
+ /* Each stack pointer address is followed by the size of the
1326
+ data in use in that stack, in bytes. This used to be a
1327
+ conditional around just the two extra args, but that might
1328
+ be undefined if yyoverflow is a macro. */
1329
+ yyoverflow (YY_("memory exhausted"),
1330
+ &yyss1, yysize * YYSIZEOF (*yyssp),
1331
+ &yyvs1, yysize * YYSIZEOF (*yyvsp),
1332
+ &yystacksize);
1333
+ yyss = yyss1;
1334
+ yyvs = yyvs1;
1335
+ }
1336
+ # else /* defined YYSTACK_RELOCATE */
1337
+ /* Extend the stack our own way. */
1338
+ if (YYMAXDEPTH <= yystacksize)
1339
+ YYNOMEM;
1340
+ yystacksize *= 2;
1341
+ if (YYMAXDEPTH < yystacksize)
1342
+ yystacksize = YYMAXDEPTH;
1343
+
1344
+ {
1345
+ yy_state_t *yyss1 = yyss;
1346
+ union yyalloc *yyptr =
1347
+ YY_CAST (union yyalloc *,
1348
+ YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
1349
+ if (! yyptr)
1350
+ YYNOMEM;
1351
+ YYSTACK_RELOCATE (yyss_alloc, yyss);
1352
+ YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1353
+ # undef YYSTACK_RELOCATE
1354
+ if (yyss1 != yyssa)
1355
+ YYSTACK_FREE (yyss1);
1356
+ }
1357
+ # endif
1358
+
1359
+ yyssp = yyss + yysize - 1;
1360
+ yyvsp = yyvs + yysize - 1;
1361
+
1362
+ YY_IGNORE_USELESS_CAST_BEGIN
1363
+ YYDPRINTF ((stderr, "Stack size increased to %ld\n",
1364
+ YY_CAST (long, yystacksize)));
1365
+ YY_IGNORE_USELESS_CAST_END
1366
+
1367
+ if (yyss + yystacksize - 1 <= yyssp)
1368
+ YYABORT;
1369
+ }
1370
+ #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1371
+
1372
+
1373
+ if (yystate == YYFINAL)
1374
+ YYACCEPT;
1375
+
1376
+ goto yybackup;
1377
+
1378
+
1379
+ /*-----------.
1380
+ | yybackup. |
1381
+ `-----------*/
1382
+ yybackup:
1383
+ /* Do appropriate processing given the current state. Read a
1384
+ lookahead token if we need one and don't already have one. */
1385
+
1386
+ /* First try to decide what to do without reference to lookahead token. */
1387
+ yyn = yypact[yystate];
1388
+ if (yypact_value_is_default (yyn))
1389
+ goto yydefault;
1390
+
1391
+ /* Not known => get a lookahead token if don't already have one. */
1392
+
1393
+ /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */
1394
+ if (yychar == YYEMPTY)
1395
+ {
1396
+ YYDPRINTF ((stderr, "Reading a token\n"));
1397
+ yychar = yylex (&yylval, qp);
1398
+ }
1399
+
1400
+ if (yychar <= YYEOF)
1401
+ {
1402
+ yychar = YYEOF;
1403
+ yytoken = YYSYMBOL_YYEOF;
1404
+ YYDPRINTF ((stderr, "Now at end of input.\n"));
1405
+ }
1406
+ else if (yychar == YYerror)
1407
+ {
1408
+ /* The scanner already issued an error message, process directly
1409
+ to error recovery. But do not keep the error token as
1410
+ lookahead, it is too special and may lead us to an endless
1411
+ loop in error recovery. */
1412
+ yychar = YYUNDEF;
1413
+ yytoken = YYSYMBOL_YYerror;
1414
+ goto yyerrlab1;
1415
+ }
1416
+ else
1417
+ {
1418
+ yytoken = YYTRANSLATE (yychar);
1419
+ YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1420
+ }
1421
+
1422
+ /* If the proper action on seeing token YYTOKEN is to reduce or to
1423
+ detect an error, take that action. */
1424
+ yyn += yytoken;
1425
+ if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1426
+ goto yydefault;
1427
+ yyn = yytable[yyn];
1428
+ if (yyn <= 0)
1429
+ {
1430
+ if (yytable_value_is_error (yyn))
1431
+ goto yyerrlab;
1432
+ yyn = -yyn;
1433
+ goto yyreduce;
1434
+ }
1435
+
1436
+ /* Count tokens shifted since error; after three, turn off error
1437
+ status. */
1438
+ if (yyerrstatus)
1439
+ yyerrstatus--;
1440
+
1441
+ /* Shift the lookahead token. */
1442
+ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1443
+ yystate = yyn;
1444
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1445
+ *++yyvsp = yylval;
1446
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
1447
+
1448
+ /* Discard the shifted token. */
1449
+ yychar = YYEMPTY;
1450
+ goto yynewstate;
1451
+
1452
+
1453
+ /*-----------------------------------------------------------.
1454
+ | yydefault -- do the default action for the current state. |
1455
+ `-----------------------------------------------------------*/
1456
+ yydefault:
1457
+ yyn = yydefact[yystate];
1458
+ if (yyn == 0)
1459
+ goto yyerrlab;
1460
+ goto yyreduce;
1461
+
1462
+
1463
+ /*-----------------------------.
1464
+ | yyreduce -- do a reduction. |
1465
+ `-----------------------------*/
1466
+ yyreduce:
1467
+ /* yyn is the number of a rule to reduce with. */
1468
+ yylen = yyr2[yyn];
1469
+
1470
+ /* If YYLEN is nonzero, implement the default value of the action:
1471
+ '$$ = $1'.
1472
+
1473
+ Otherwise, the following line sets YYVAL to garbage.
1474
+ This behavior is undocumented and Bison
1475
+ users should not rely upon it. Assigning to YYVAL
1476
+ unconditionally makes the parser a bit smaller, and it avoids a
1477
+ GCC warning that YYVAL may be used uninitialized. */
1478
+ yyval = yyvsp[1-yylen];
1479
+
1480
+
1481
+ YY_REDUCE_PRINT (yyn);
1482
+ switch (yyn)
1483
+ {
1484
+ case 2: /* bool_q: %empty */
1485
+ #line 226 "frt_q_parser.y"
1486
+ { qp->result = (yyval.query) = NULL; }
1487
+ #line 1488 "frt_q_parser.c"
1488
+ break;
1489
+
1490
+ case 3: /* bool_q: bool_clss */
1491
+ #line 227 "frt_q_parser.y"
1492
+ { T qp->result = (yyval.query) = get_bool_q((yyvsp[0].bclss)); E }
1493
+ #line 1494 "frt_q_parser.c"
1494
+ break;
1495
+
1496
+ case 4: /* bool_clss: bool_cls */
1497
+ #line 229 "frt_q_parser.y"
1498
+ { T (yyval.bclss) = first_cls((yyvsp[0].bcls)); E }
1499
+ #line 1500 "frt_q_parser.c"
1500
+ break;
1501
+
1502
+ case 5: /* bool_clss: bool_clss AND bool_cls */
1503
+ #line 230 "frt_q_parser.y"
1504
+ { T (yyval.bclss) = add_and_cls((yyvsp[-2].bclss), (yyvsp[0].bcls)); E }
1505
+ #line 1506 "frt_q_parser.c"
1506
+ break;
1507
+
1508
+ case 6: /* bool_clss: bool_clss OR bool_cls */
1509
+ #line 231 "frt_q_parser.y"
1510
+ { T (yyval.bclss) = add_or_cls((yyvsp[-2].bclss), (yyvsp[0].bcls)); E }
1511
+ #line 1512 "frt_q_parser.c"
1512
+ break;
1513
+
1514
+ case 7: /* bool_clss: bool_clss bool_cls */
1515
+ #line 232 "frt_q_parser.y"
1516
+ { T (yyval.bclss) = add_default_cls(qp, (yyvsp[-1].bclss), (yyvsp[0].bcls)); E }
1517
+ #line 1518 "frt_q_parser.c"
1518
+ break;
1519
+
1520
+ case 8: /* bool_cls: REQ boosted_q */
1521
+ #line 234 "frt_q_parser.y"
1522
+ { T (yyval.bcls) = get_bool_cls((yyvsp[0].query), FRT_BC_MUST); E }
1523
+ #line 1524 "frt_q_parser.c"
1524
+ break;
1525
+
1526
+ case 9: /* bool_cls: NOT boosted_q */
1527
+ #line 235 "frt_q_parser.y"
1528
+ { T (yyval.bcls) = get_bool_cls((yyvsp[0].query), FRT_BC_MUST_NOT); E }
1529
+ #line 1530 "frt_q_parser.c"
1530
+ break;
1531
+
1532
+ case 10: /* bool_cls: boosted_q */
1533
+ #line 236 "frt_q_parser.y"
1534
+ { T (yyval.bcls) = get_bool_cls((yyvsp[0].query), FRT_BC_SHOULD); E }
1535
+ #line 1536 "frt_q_parser.c"
1536
+ break;
1537
+
1538
+ case 12: /* boosted_q: q '^' QWRD */
1539
+ #line 239 "frt_q_parser.y"
1540
+ { T if ((yyvsp[-2].query)) sscanf((yyvsp[0].str),"%f",&((yyvsp[-2].query)->boost)); (yyval.query)=(yyvsp[-2].query); E }
1541
+ #line 1542 "frt_q_parser.c"
1542
+ break;
1543
+
1544
+ case 14: /* q: '(' ')' */
1545
+ #line 242 "frt_q_parser.y"
1546
+ { T (yyval.query) = frt_bq_new_max(true, qp->max_clauses); E }
1547
+ #line 1548 "frt_q_parser.c"
1548
+ break;
1549
+
1550
+ case 15: /* q: '(' bool_clss ')' */
1551
+ #line 243 "frt_q_parser.y"
1552
+ { T (yyval.query) = get_bool_q((yyvsp[-1].bclss)); E }
1553
+ #line 1554 "frt_q_parser.c"
1554
+ break;
1555
+
1556
+ case 20: /* term_q: QWRD */
1557
+ #line 249 "frt_q_parser.y"
1558
+ { FLDS((yyval.query), get_term_q(qp, field, (yyvsp[0].str))); Y}
1559
+ #line 1560 "frt_q_parser.c"
1560
+ break;
1561
+
1562
+ case 21: /* term_q: QWRD '~' QWRD */
1563
+ #line 250 "frt_q_parser.y"
1564
+ { FLDS((yyval.query), get_fuzzy_q(qp, field, (yyvsp[-2].str), (yyvsp[0].str))); Y}
1565
+ #line 1566 "frt_q_parser.c"
1566
+ break;
1567
+
1568
+ case 22: /* term_q: QWRD '~' */
1569
+ #line 251 "frt_q_parser.y"
1570
+ { FLDS((yyval.query), get_fuzzy_q(qp, field, (yyvsp[-1].str), NULL)); Y}
1571
+ #line 1572 "frt_q_parser.c"
1572
+ break;
1573
+
1574
+ case 23: /* wild_q: WILD_STR */
1575
+ #line 253 "frt_q_parser.y"
1576
+ { FLDS((yyval.query), get_wild_q(qp, field, (yyvsp[0].str))); Y}
1577
+ #line 1578 "frt_q_parser.c"
1578
+ break;
1579
+
1580
+ case 24: /* $@1: %empty */
1581
+ #line 255 "frt_q_parser.y"
1582
+ { qp_pop_fields(qp); }
1583
+ #line 1584 "frt_q_parser.c"
1584
+ break;
1585
+
1586
+ case 25: /* field_q: field ':' q $@1 */
1587
+ #line 256 "frt_q_parser.y"
1588
+ { (yyval.query) = (yyvsp[-1].query); }
1589
+ #line 1590 "frt_q_parser.c"
1590
+ break;
1591
+
1592
+ case 26: /* $@2: %empty */
1593
+ #line 257 "frt_q_parser.y"
1594
+ { qp_push_fields(qp, qp->all_fields, false); }
1595
+ #line 1596 "frt_q_parser.c"
1596
+ break;
1597
+
1598
+ case 27: /* $@3: %empty */
1599
+ #line 257 "frt_q_parser.y"
1600
+ { qp_pop_fields(qp); }
1601
+ #line 1602 "frt_q_parser.c"
1602
+ break;
1603
+
1604
+ case 28: /* field_q: '*' $@2 ':' q $@3 */
1605
+ #line 258 "frt_q_parser.y"
1606
+ { (yyval.query) = (yyvsp[-1].query); }
1607
+ #line 1608 "frt_q_parser.c"
1608
+ break;
1609
+
1610
+ case 29: /* field: QWRD */
1611
+ #line 260 "frt_q_parser.y"
1612
+ { (yyval.hashset) = first_field(qp, (yyvsp[0].str)); }
1613
+ #line 1614 "frt_q_parser.c"
1614
+ break;
1615
+
1616
+ case 30: /* field: field '|' QWRD */
1617
+ #line 261 "frt_q_parser.y"
1618
+ { (yyval.hashset) = add_field(qp, (yyvsp[0].str));}
1619
+ #line 1620 "frt_q_parser.c"
1620
+ break;
1621
+
1622
+ case 31: /* phrase_q: '"' ph_words '"' */
1623
+ #line 263 "frt_q_parser.y"
1624
+ { (yyval.query) = get_phrase_q(qp, (yyvsp[-1].phrase), NULL); }
1625
+ #line 1626 "frt_q_parser.c"
1626
+ break;
1627
+
1628
+ case 32: /* phrase_q: '"' ph_words '"' '~' QWRD */
1629
+ #line 264 "frt_q_parser.y"
1630
+ { (yyval.query) = get_phrase_q(qp, (yyvsp[-3].phrase), (yyvsp[0].str)); }
1631
+ #line 1632 "frt_q_parser.c"
1632
+ break;
1633
+
1634
+ case 33: /* phrase_q: '"' '"' */
1635
+ #line 265 "frt_q_parser.y"
1636
+ { (yyval.query) = NULL; }
1637
+ #line 1638 "frt_q_parser.c"
1638
+ break;
1639
+
1640
+ case 34: /* phrase_q: '"' '"' '~' QWRD */
1641
+ #line 266 "frt_q_parser.y"
1642
+ { (yyval.query) = NULL; (void)(yyvsp[0].str);}
1643
+ #line 1644 "frt_q_parser.c"
1644
+ break;
1645
+
1646
+ case 35: /* ph_words: QWRD */
1647
+ #line 268 "frt_q_parser.y"
1648
+ { (yyval.phrase) = ph_first_word((yyvsp[0].str)); }
1649
+ #line 1650 "frt_q_parser.c"
1650
+ break;
1651
+
1652
+ case 36: /* ph_words: '<' '>' */
1653
+ #line 269 "frt_q_parser.y"
1654
+ { (yyval.phrase) = ph_first_word(NULL); }
1655
+ #line 1656 "frt_q_parser.c"
1656
+ break;
1657
+
1658
+ case 37: /* ph_words: ph_words QWRD */
1659
+ #line 270 "frt_q_parser.y"
1660
+ { (yyval.phrase) = ph_add_word((yyvsp[-1].phrase), (yyvsp[0].str)); }
1661
+ #line 1662 "frt_q_parser.c"
1662
+ break;
1663
+
1664
+ case 38: /* ph_words: ph_words '<' '>' */
1665
+ #line 271 "frt_q_parser.y"
1666
+ { (yyval.phrase) = ph_add_word((yyvsp[-2].phrase), NULL); }
1667
+ #line 1668 "frt_q_parser.c"
1668
+ break;
1669
+
1670
+ case 39: /* ph_words: ph_words '|' QWRD */
1671
+ #line 272 "frt_q_parser.y"
1672
+ { (yyval.phrase) = ph_add_multi_word((yyvsp[-2].phrase), (yyvsp[0].str)); }
1673
+ #line 1674 "frt_q_parser.c"
1674
+ break;
1675
+
1676
+ case 40: /* range_q: '[' QWRD QWRD ']' */
1677
+ #line 274 "frt_q_parser.y"
1678
+ { FLDS((yyval.query), get_r_q(qp, field, (yyvsp[-2].str), (yyvsp[-1].str), true, true)); Y}
1679
+ #line 1680 "frt_q_parser.c"
1680
+ break;
1681
+
1682
+ case 41: /* range_q: '[' QWRD QWRD '}' */
1683
+ #line 275 "frt_q_parser.y"
1684
+ { FLDS((yyval.query), get_r_q(qp, field, (yyvsp[-2].str), (yyvsp[-1].str), true, false)); Y}
1685
+ #line 1686 "frt_q_parser.c"
1686
+ break;
1687
+
1688
+ case 42: /* range_q: '{' QWRD QWRD ']' */
1689
+ #line 276 "frt_q_parser.y"
1690
+ { FLDS((yyval.query), get_r_q(qp, field, (yyvsp[-2].str), (yyvsp[-1].str), false, true)); Y}
1691
+ #line 1692 "frt_q_parser.c"
1692
+ break;
1693
+
1694
+ case 43: /* range_q: '{' QWRD QWRD '}' */
1695
+ #line 277 "frt_q_parser.y"
1696
+ { FLDS((yyval.query), get_r_q(qp, field, (yyvsp[-2].str), (yyvsp[-1].str), false, false)); Y}
1697
+ #line 1698 "frt_q_parser.c"
1698
+ break;
1699
+
1700
+ case 44: /* range_q: '<' QWRD '}' */
1701
+ #line 278 "frt_q_parser.y"
1702
+ { FLDS((yyval.query), get_r_q(qp, field, NULL,(yyvsp[-1].str), false, false)); Y}
1703
+ #line 1704 "frt_q_parser.c"
1704
+ break;
1705
+
1706
+ case 45: /* range_q: '<' QWRD ']' */
1707
+ #line 279 "frt_q_parser.y"
1708
+ { FLDS((yyval.query), get_r_q(qp, field, NULL,(yyvsp[-1].str), false, true)); Y}
1709
+ #line 1710 "frt_q_parser.c"
1710
+ break;
1711
+
1712
+ case 46: /* range_q: '[' QWRD '>' */
1713
+ #line 280 "frt_q_parser.y"
1714
+ { FLDS((yyval.query), get_r_q(qp, field, (yyvsp[-1].str), NULL,true, false)); Y}
1715
+ #line 1716 "frt_q_parser.c"
1716
+ break;
1717
+
1718
+ case 47: /* range_q: '{' QWRD '>' */
1719
+ #line 281 "frt_q_parser.y"
1720
+ { FLDS((yyval.query), get_r_q(qp, field, (yyvsp[-1].str), NULL,false, false)); Y}
1721
+ #line 1722 "frt_q_parser.c"
1722
+ break;
1723
+
1724
+ case 48: /* range_q: '<' QWRD */
1725
+ #line 282 "frt_q_parser.y"
1726
+ { FLDS((yyval.query), get_r_q(qp, field, NULL,(yyvsp[0].str), false, false)); Y}
1727
+ #line 1728 "frt_q_parser.c"
1728
+ break;
1729
+
1730
+ case 49: /* range_q: '<' '=' QWRD */
1731
+ #line 283 "frt_q_parser.y"
1732
+ { FLDS((yyval.query), get_r_q(qp, field, NULL,(yyvsp[0].str), false, true)); Y}
1733
+ #line 1734 "frt_q_parser.c"
1734
+ break;
1735
+
1736
+ case 50: /* range_q: '>' '=' QWRD */
1737
+ #line 284 "frt_q_parser.y"
1738
+ { FLDS((yyval.query), get_r_q(qp, field, (yyvsp[0].str), NULL,true, false)); Y}
1739
+ #line 1740 "frt_q_parser.c"
1740
+ break;
1741
+
1742
+ case 51: /* range_q: '>' QWRD */
1743
+ #line 285 "frt_q_parser.y"
1744
+ { FLDS((yyval.query), get_r_q(qp, field, (yyvsp[0].str), NULL,false, false)); Y}
1745
+ #line 1746 "frt_q_parser.c"
1746
+ break;
1747
+
1748
+
1749
+ #line 1750 "frt_q_parser.c"
1750
+
1751
+ default: break;
1752
+ }
1753
+ /* User semantic actions sometimes alter yychar, and that requires
1754
+ that yytoken be updated with the new translation. We take the
1755
+ approach of translating immediately before every use of yytoken.
1756
+ One alternative is translating here after every semantic action,
1757
+ but that translation would be missed if the semantic action invokes
1758
+ YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1759
+ if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1760
+ incorrect destructor might then be invoked immediately. In the
1761
+ case of YYERROR or YYBACKUP, subsequent parser actions might lead
1762
+ to an incorrect destructor call or verbose syntax error message
1763
+ before the lookahead is translated. */
1764
+ YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
1765
+
1766
+ YYPOPSTACK (yylen);
1767
+ yylen = 0;
1768
+
1769
+ *++yyvsp = yyval;
1770
+
1771
+ /* Now 'shift' the result of the reduction. Determine what state
1772
+ that goes to, based on the state we popped back to and the rule
1773
+ number reduced by. */
1774
+ {
1775
+ const int yylhs = yyr1[yyn] - YYNTOKENS;
1776
+ const int yyi = yypgoto[yylhs] + *yyssp;
1777
+ yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
1778
+ ? yytable[yyi]
1779
+ : yydefgoto[yylhs]);
1780
+ }
1781
+
1782
+ goto yynewstate;
1783
+
1784
+
1785
+ /*--------------------------------------.
1786
+ | yyerrlab -- here on detecting error. |
1787
+ `--------------------------------------*/
1788
+ yyerrlab:
1789
+ /* Make sure we have latest lookahead translation. See comments at
1790
+ user semantic actions for why this is necessary. */
1791
+ yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
1792
+ /* If not already recovering from an error, report this error. */
1793
+ if (!yyerrstatus)
1794
+ {
1795
+ ++yynerrs;
1796
+ yyerror (qp, YY_("syntax error"));
1797
+ }
1798
+
1799
+ if (yyerrstatus == 3)
1800
+ {
1801
+ /* If just tried and failed to reuse lookahead token after an
1802
+ error, discard it. */
1803
+
1804
+ if (yychar <= YYEOF)
1805
+ {
1806
+ /* Return failure if at end of input. */
1807
+ if (yychar == YYEOF)
1808
+ YYABORT;
1809
+ }
1810
+ else
1811
+ {
1812
+ yydestruct ("Error: discarding",
1813
+ yytoken, &yylval, qp);
1814
+ yychar = YYEMPTY;
1815
+ }
1816
+ }
1817
+
1818
+ /* Else will try to reuse lookahead token after shifting the error
1819
+ token. */
1820
+ goto yyerrlab1;
1821
+
1822
+
1823
+ /*---------------------------------------------------.
1824
+ | yyerrorlab -- error raised explicitly by YYERROR. |
1825
+ `---------------------------------------------------*/
1826
+ yyerrorlab:
1827
+ /* Pacify compilers when the user code never invokes YYERROR and the
1828
+ label yyerrorlab therefore never appears in user code. */
1829
+ if (0)
1830
+ YYERROR;
1831
+ ++yynerrs;
1832
+
1833
+ /* Do not reclaim the symbols of the rule whose action triggered
1834
+ this YYERROR. */
1835
+ YYPOPSTACK (yylen);
1836
+ yylen = 0;
1837
+ YY_STACK_PRINT (yyss, yyssp);
1838
+ yystate = *yyssp;
1839
+ goto yyerrlab1;
1840
+
1841
+
1842
+ /*-------------------------------------------------------------.
1843
+ | yyerrlab1 -- common code for both syntax error and YYERROR. |
1844
+ `-------------------------------------------------------------*/
1845
+ yyerrlab1:
1846
+ yyerrstatus = 3; /* Each real token shifted decrements this. */
1847
+
1848
+ /* Pop stack until we find a state that shifts the error token. */
1849
+ for (;;)
1850
+ {
1851
+ yyn = yypact[yystate];
1852
+ if (!yypact_value_is_default (yyn))
1853
+ {
1854
+ yyn += YYSYMBOL_YYerror;
1855
+ if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
1856
+ {
1857
+ yyn = yytable[yyn];
1858
+ if (0 < yyn)
1859
+ break;
1860
+ }
1861
+ }
1862
+
1863
+ /* Pop the current state because it cannot handle the error token. */
1864
+ if (yyssp == yyss)
1865
+ YYABORT;
1866
+
1867
+
1868
+ yydestruct ("Error: popping",
1869
+ YY_ACCESSING_SYMBOL (yystate), yyvsp, qp);
1870
+ YYPOPSTACK (1);
1871
+ yystate = *yyssp;
1872
+ YY_STACK_PRINT (yyss, yyssp);
1873
+ }
1874
+
1875
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1876
+ *++yyvsp = yylval;
1877
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
1878
+
1879
+
1880
+ /* Shift the error token. */
1881
+ YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
1882
+
1883
+ yystate = yyn;
1884
+ goto yynewstate;
1885
+
1886
+
1887
+ /*-------------------------------------.
1888
+ | yyacceptlab -- YYACCEPT comes here. |
1889
+ `-------------------------------------*/
1890
+ yyacceptlab:
1891
+ yyresult = 0;
1892
+ goto yyreturnlab;
1893
+
1894
+
1895
+ /*-----------------------------------.
1896
+ | yyabortlab -- YYABORT comes here. |
1897
+ `-----------------------------------*/
1898
+ yyabortlab:
1899
+ yyresult = 1;
1900
+ goto yyreturnlab;
1901
+
1902
+
1903
+ /*-----------------------------------------------------------.
1904
+ | yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. |
1905
+ `-----------------------------------------------------------*/
1906
+ yyexhaustedlab:
1907
+ yyerror (qp, YY_("memory exhausted"));
1908
+ yyresult = 2;
1909
+ goto yyreturnlab;
1910
+
1911
+
1912
+ /*----------------------------------------------------------.
1913
+ | yyreturnlab -- parsing is finished, clean up and return. |
1914
+ `----------------------------------------------------------*/
1915
+ yyreturnlab:
1916
+ if (yychar != YYEMPTY)
1917
+ {
1918
+ /* Make sure we have latest lookahead translation. See comments at
1919
+ user semantic actions for why this is necessary. */
1920
+ yytoken = YYTRANSLATE (yychar);
1921
+ yydestruct ("Cleanup: discarding lookahead",
1922
+ yytoken, &yylval, qp);
1923
+ }
1924
+ /* Do not reclaim the symbols of the rule whose action triggered
1925
+ this YYABORT or YYACCEPT. */
1926
+ YYPOPSTACK (yylen);
1927
+ YY_STACK_PRINT (yyss, yyssp);
1928
+ while (yyssp != yyss)
1929
+ {
1930
+ yydestruct ("Cleanup: popping",
1931
+ YY_ACCESSING_SYMBOL (+*yyssp), yyvsp, qp);
1932
+ YYPOPSTACK (1);
1933
+ }
1934
+ #ifndef yyoverflow
1935
+ if (yyss != yyssa)
1936
+ YYSTACK_FREE (yyss);
1937
+ #endif
1938
+
1939
+ return yyresult;
1940
+ }
1941
+
1942
+ #line 287 "frt_q_parser.y"
2010
1943
 
2011
1944
 
2012
1945
  static const char *special_char = "&:()[]{}!\"~^|<>=*?+-";
@@ -2225,7 +2158,7 @@ static FrtTokenStream *get_cached_ts(FrtQParser *qp, FrtSymbol field, char *text
2225
2158
  * if 0 or 1 clauses are present to NULL or the actual query in the clause
2226
2159
  * respectively.
2227
2160
  */
2228
- static FrtQuery *get_bool_q(BCArray *bca)
2161
+ static FrtQuery *get_bool_q(FrtBCArray *bca)
2229
2162
  {
2230
2163
  FrtQuery *q;
2231
2164
  const int clause_count = bca->size;
@@ -2261,10 +2194,10 @@ static FrtQuery *get_bool_q(BCArray *bca)
2261
2194
  }
2262
2195
 
2263
2196
  /**
2264
- * Base method for appending BooleanClauses to a BooleanClause array. This
2197
+ * Base method for appending BooleanClauses to a FrtBooleanClause array. This
2265
2198
  * method doesn't care about the type of clause (MUST, SHOULD, MUST_NOT).
2266
2199
  */
2267
- static void bca_add_clause(BCArray *bca, FrtBooleanClause *clause)
2200
+ static void bca_add_clause(FrtBCArray *bca, FrtBooleanClause *clause)
2268
2201
  {
2269
2202
  if (bca->size >= bca->capa) {
2270
2203
  bca->capa <<= 1;
@@ -2278,9 +2211,9 @@ static void bca_add_clause(BCArray *bca, FrtBooleanClause *clause)
2278
2211
  * Add the first clause to a BooleanClause array. This method is also
2279
2212
  * responsible for allocating a new BooleanClause array.
2280
2213
  */
2281
- static BCArray *first_cls(FrtBooleanClause *clause)
2214
+ static FrtBCArray *first_cls(FrtBooleanClause *clause)
2282
2215
  {
2283
- BCArray *bca = FRT_ALLOC_AND_ZERO(BCArray);
2216
+ FrtBCArray *bca = FRT_ALLOC_AND_ZERO(FrtBCArray);
2284
2217
  bca->capa = BCA_INIT_CAPA;
2285
2218
  bca->clauses = FRT_ALLOC_N(FrtBooleanClause *, BCA_INIT_CAPA);
2286
2219
  if (clause) {
@@ -2295,7 +2228,7 @@ static BCArray *first_cls(FrtBooleanClause *clause)
2295
2228
  * MUST clauses. (If they are currently MUST_NOT clauses they stay as they
2296
2229
  * are.)
2297
2230
  */
2298
- static BCArray *add_and_cls(BCArray *bca, FrtBooleanClause *clause)
2231
+ static FrtBCArray *add_and_cls(FrtBCArray *bca, FrtBooleanClause *clause)
2299
2232
  {
2300
2233
  if (clause) {
2301
2234
  if (bca->size == 1) {
@@ -2314,7 +2247,7 @@ static BCArray *add_and_cls(BCArray *bca, FrtBooleanClause *clause)
2314
2247
  /**
2315
2248
  * Add SHOULD clause to the BooleanClause array.
2316
2249
  */
2317
- static BCArray *add_or_cls(BCArray *bca, FrtBooleanClause *clause)
2250
+ static FrtBCArray *add_or_cls(FrtBCArray *bca, FrtBooleanClause *clause)
2318
2251
  {
2319
2252
  if (clause) {
2320
2253
  bca_add_clause(bca, clause);
@@ -2326,7 +2259,7 @@ static BCArray *add_or_cls(BCArray *bca, FrtBooleanClause *clause)
2326
2259
  * Add AND or OR clause to the BooleanClause array, depending on the default
2327
2260
  * clause type.
2328
2261
  */
2329
- static BCArray *add_default_cls(FrtQParser *qp, BCArray *bca,
2262
+ static FrtBCArray *add_default_cls(FrtQParser *qp, FrtBCArray *bca,
2330
2263
  FrtBooleanClause *clause)
2331
2264
  {
2332
2265
  if (qp->or_default) {
@@ -2341,7 +2274,7 @@ static BCArray *add_default_cls(FrtQParser *qp, BCArray *bca,
2341
2274
  /**
2342
2275
  * destroy array of BooleanClauses
2343
2276
  */
2344
- static void bca_destroy(BCArray *bca)
2277
+ static void bca_destroy(FrtBCArray *bca)
2345
2278
  {
2346
2279
  int i;
2347
2280
  for (i = 0; i < bca->size; i++) {
@@ -2885,6 +2818,7 @@ FrtQParser *frt_qp_new(FrtAnalyzer *analyzer)
2885
2818
  self->tokenized_fields = frt_hs_new_ptr(NULL);
2886
2819
  self->fields_top = NULL;
2887
2820
 
2821
+ /* make sure all_fields contains the default fields */
2888
2822
  qp_push_fields(self, self->def_fields, false);
2889
2823
 
2890
2824
  self->analyzer = analyzer;
@@ -3061,10 +2995,10 @@ FrtQuery *qp_parse(FrtQParser *self, char *qstr)
3061
2995
  }
3062
2996
  self->fields = self->def_fields;
3063
2997
  self->result = NULL;
2998
+
3064
2999
  if (0 == yyparse(self)) {
3065
3000
  result = self->result;
3066
3001
  }
3067
-
3068
3002
  if (!result && self->handle_parse_errors) {
3069
3003
  self->destruct = false;
3070
3004
  result = qp_get_bad_query(self, self->qstr);
@@ -3081,4 +3015,3 @@ FrtQuery *qp_parse(FrtQParser *self, char *qstr)
3081
3015
  frt_mutex_unlock(&self->mutex);
3082
3016
  return result;
3083
3017
  }
3084
-