Groonga 3.0.9 Source Code Document
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ecmascript.c
Go to the documentation of this file.
1 /* Driver template for the LEMON parser generator.
2 ** The author disclaims copyright to this source code.
3 */
4 /* First off, code is included that follows the "include" declaration
5 ** in the input grammar file. */
6 #include <stdio.h>
7 #line 3 "ecmascript.y"
8 
9 #define assert GRN_ASSERT
10 #line 11 "ecmascript.c"
11 /* Next is all token values, in a form suitable for use by makeheaders.
12 ** This section will be null unless lemon is run with the -m switch.
13 */
14 /*
15 ** These constants (all generated automatically by the parser generator)
16 ** specify the various kinds of tokens (terminals) that the parser
17 ** understands.
18 **
19 ** Each symbol here is a terminal symbol in the grammar.
20 */
21 /* Make sure the INTERFACE macro is defined.
22 */
23 #ifndef INTERFACE
24 # define INTERFACE 1
25 #endif
26 /* The next thing included is series of defines which control
27 ** various aspects of the generated parser.
28 ** YYCODETYPE is the data type used for storing terminal
29 ** and nonterminal numbers. "unsigned char" is
30 ** used if there are fewer than 250 terminals
31 ** and nonterminals. "int" is used otherwise.
32 ** YYNOCODE is a number of type YYCODETYPE which corresponds
33 ** to no legal terminal or nonterminal number. This
34 ** number is used to fill in empty slots of the hash
35 ** table.
36 ** YYFALLBACK If defined, this indicates that one or more tokens
37 ** have fall-back values which should be used if the
38 ** original value of the token will not parse.
39 ** YYACTIONTYPE is the data type used for storing terminal
40 ** and nonterminal numbers. "unsigned char" is
41 ** used if there are fewer than 250 rules and
42 ** states combined. "int" is used otherwise.
43 ** grn_expr_parserTOKENTYPE is the data type used for minor tokens given
44 ** directly to the parser from the tokenizer.
45 ** YYMINORTYPE is the data type used for all minor tokens.
46 ** This is typically a union of many types, one of
47 ** which is grn_expr_parserTOKENTYPE. The entry in the union
48 ** for base tokens is called "yy0".
49 ** YYSTACKDEPTH is the maximum depth of the parser's stack. If
50 ** zero the stack is dynamically sized using realloc()
51 ** grn_expr_parserARG_SDECL A static variable declaration for the %extra_argument
52 ** grn_expr_parserARG_PDECL A parameter declaration for the %extra_argument
53 ** grn_expr_parserARG_STORE Code to store %extra_argument into yypParser
54 ** grn_expr_parserARG_FETCH Code to extract %extra_argument from yypParser
55 ** YYNSTATE the combined number of states.
56 ** YYNRULE the number of rules in the grammar
57 ** YYERRORSYMBOL is the code number of the error symbol. If not
58 ** defined, then do no error processing.
59 */
60 #define YYCODETYPE unsigned char
61 #define YYNOCODE 108
62 #define YYACTIONTYPE unsigned short int
63 #define grn_expr_parserTOKENTYPE int
64 typedef union {
65  int yyinit;
67 } YYMINORTYPE;
68 #ifndef YYSTACKDEPTH
69 #define YYSTACKDEPTH 100
70 #endif
71 #define grn_expr_parserARG_SDECL efs_info *efsi ;
72 #define grn_expr_parserARG_PDECL , efs_info *efsi
73 #define grn_expr_parserARG_FETCH efs_info *efsi = yypParser->efsi
74 #define grn_expr_parserARG_STORE yypParser->efsi = efsi
75 #define YYNSTATE 212
76 #define YYNRULE 124
77 #define YY_NO_ACTION (YYNSTATE+YYNRULE+2)
78 #define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1)
79 #define YY_ERROR_ACTION (YYNSTATE+YYNRULE)
80 
81 /* The yyzerominor constant is used to initialize instances of
82 ** YYMINORTYPE objects to zero. */
83 static const YYMINORTYPE yyzerominor = { 0 };
84 
85 /* Define the yytestcase() macro to be a no-op if is not already defined
86 ** otherwise.
87 **
88 ** Applications can choose to define yytestcase() in the %include section
89 ** to a macro that can assist in verifying code coverage. For production
90 ** code the yytestcase() macro should be turned off. But it is useful
91 ** for testing.
92 */
93 #ifndef yytestcase
94 # define yytestcase(X)
95 #endif
96 
97 
98 /* Next are the tables used to determine what action to take based on the
99 ** current state and lookahead token. These tables are used to implement
100 ** functions that take a state number and lookahead value and return an
101 ** action integer.
102 **
103 ** Suppose the action integer is N. Then the action is determined as
104 ** follows
105 **
106 ** 0 <= N < YYNSTATE Shift N. That is, push the lookahead
107 ** token onto the stack and goto state N.
108 **
109 ** YYNSTATE <= N < YYNSTATE+YYNRULE Reduce by rule N-YYNSTATE.
110 **
111 ** N == YYNSTATE+YYNRULE A syntax error has occurred.
112 **
113 ** N == YYNSTATE+YYNRULE+1 The parser accepts its input.
114 **
115 ** N == YYNSTATE+YYNRULE+2 No such action. Denotes unused
116 ** slots in the yy_action[] table.
117 **
118 ** The action table is constructed as a single large table named yy_action[].
119 ** Given state S and lookahead X, the action is computed as
120 **
121 ** yy_action[ yy_shift_ofst[S] + X ]
122 **
123 ** If the index value yy_shift_ofst[S]+X is out of range or if the value
124 ** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S]
125 ** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table
126 ** and that yy_default[S] should be used instead.
127 **
128 ** The formula above is for computing the action when the lookahead is
129 ** a terminal symbol. If the lookahead is a non-terminal (as occurs after
130 ** a reduce action) then the yy_reduce_ofst[] array is used in place of
131 ** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of
132 ** YY_SHIFT_USE_DFLT.
133 **
134 ** The following are the tables generated in this section:
135 **
136 ** yy_action[] A single table containing all actions.
137 ** yy_lookahead[] A table containing the lookahead for each entry in
138 ** yy_action. Used to detect hash collisions.
139 ** yy_shift_ofst[] For each state, the offset into yy_action for
140 ** shifting terminals.
141 ** yy_reduce_ofst[] For each state, the offset into yy_action for
142 ** shifting non-terminals after a reduce.
143 ** yy_default[] Default action for each state.
144 */
145 #define YY_ACTTAB_COUNT (1756)
146 static const YYACTIONTYPE yy_action[] = {
147  /* 0 */ 337, 74, 104, 76, 208, 178, 181, 202, 82, 118,
148  /* 10 */ 117, 126, 125, 124, 112, 83, 96, 108, 97, 167,
149  /* 20 */ 198, 184, 72, 2, 25, 177, 173, 209, 1, 32,
150  /* 30 */ 77, 120, 4, 33, 69, 73, 110, 139, 208, 178,
151  /* 40 */ 181, 202, 82, 118, 117, 126, 125, 124, 112, 83,
152  /* 50 */ 96, 108, 97, 167, 198, 184, 72, 177, 173, 177,
153  /* 60 */ 173, 209, 1, 34, 77, 120, 4, 24, 69, 6,
154  /* 70 */ 29, 64, 63, 52, 51, 50, 67, 66, 65, 62,
155  /* 80 */ 61, 60, 59, 58, 57, 172, 171, 170, 169, 168,
156  /* 90 */ 3, 7, 26, 154, 174, 81, 209, 70, 165, 77,
157  /* 100 */ 131, 9, 176, 69, 107, 64, 63, 204, 28, 28,
158  /* 110 */ 67, 66, 65, 62, 61, 60, 59, 58, 57, 172,
159  /* 120 */ 171, 170, 169, 168, 3, 7, 31, 30, 174, 81,
160  /* 130 */ 10, 8, 165, 122, 64, 63, 54, 53, 160, 67,
161  /* 140 */ 66, 65, 62, 61, 60, 59, 58, 57, 172, 171,
162  /* 150 */ 170, 169, 168, 3, 166, 7, 36, 35, 174, 81,
163  /* 160 */ 210, 153, 68, 56, 55, 186, 185, 23, 64, 63,
164  /* 170 */ 163, 207, 71, 67, 66, 65, 62, 61, 60, 59,
165  /* 180 */ 58, 57, 172, 171, 170, 169, 168, 3, 159, 213,
166  /* 190 */ 28, 206, 160, 205, 160, 183, 182, 138, 64, 63,
167  /* 200 */ 135, 338, 28, 67, 66, 65, 62, 61, 60, 59,
168  /* 210 */ 58, 57, 172, 171, 170, 169, 168, 3, 119, 211,
169  /* 220 */ 134, 178, 181, 202, 82, 118, 117, 126, 125, 124,
170  /* 230 */ 112, 83, 96, 108, 97, 167, 198, 184, 72, 156,
171  /* 240 */ 338, 177, 173, 162, 123, 107, 180, 178, 155, 202,
172  /* 250 */ 82, 118, 117, 126, 125, 124, 112, 83, 96, 108,
173  /* 260 */ 97, 167, 198, 184, 72, 338, 338, 177, 173, 11,
174  /* 270 */ 80, 73, 338, 338, 208, 103, 338, 178, 133, 202,
175  /* 280 */ 82, 118, 117, 126, 125, 124, 112, 83, 96, 108,
176  /* 290 */ 97, 167, 198, 184, 72, 157, 338, 177, 173, 338,
177  /* 300 */ 338, 338, 338, 119, 338, 132, 178, 181, 202, 82,
178  /* 310 */ 118, 117, 126, 125, 124, 112, 83, 96, 108, 97,
179  /* 320 */ 167, 198, 184, 72, 338, 113, 177, 173, 178, 181,
180  /* 330 */ 202, 82, 118, 117, 126, 125, 124, 112, 83, 96,
181  /* 340 */ 108, 97, 167, 198, 184, 72, 338, 338, 177, 173,
182  /* 350 */ 338, 110, 338, 338, 178, 181, 202, 82, 118, 117,
183  /* 360 */ 126, 125, 124, 112, 83, 96, 108, 97, 167, 198,
184  /* 370 */ 184, 72, 338, 338, 177, 173, 178, 151, 202, 82,
185  /* 380 */ 118, 117, 126, 125, 124, 112, 83, 96, 108, 97,
186  /* 390 */ 167, 198, 184, 72, 338, 7, 177, 173, 174, 81,
187  /* 400 */ 338, 338, 156, 106, 178, 133, 202, 82, 118, 117,
188  /* 410 */ 126, 125, 124, 112, 83, 96, 108, 97, 167, 198,
189  /* 420 */ 184, 72, 214, 7, 177, 173, 174, 81, 338, 338,
190  /* 430 */ 338, 338, 136, 338, 338, 5, 338, 338, 64, 63,
191  /* 440 */ 338, 338, 338, 67, 66, 65, 62, 61, 60, 59,
192  /* 450 */ 58, 57, 172, 171, 170, 169, 168, 3, 338, 338,
193  /* 460 */ 338, 338, 338, 338, 338, 338, 64, 63, 338, 338,
194  /* 470 */ 338, 67, 66, 65, 62, 61, 60, 59, 58, 57,
195  /* 480 */ 172, 171, 170, 169, 168, 3, 178, 203, 202, 82,
196  /* 490 */ 118, 117, 126, 125, 124, 112, 83, 96, 108, 97,
197  /* 500 */ 167, 198, 184, 72, 338, 338, 177, 173, 338, 338,
198  /* 510 */ 338, 178, 201, 202, 82, 118, 117, 126, 125, 124,
199  /* 520 */ 112, 83, 96, 108, 97, 167, 198, 184, 72, 338,
200  /* 530 */ 338, 177, 173, 178, 130, 202, 82, 118, 117, 126,
201  /* 540 */ 125, 124, 112, 83, 96, 108, 97, 167, 198, 184,
202  /* 550 */ 72, 338, 338, 177, 173, 178, 200, 202, 82, 118,
203  /* 560 */ 117, 126, 125, 124, 112, 83, 96, 108, 97, 167,
204  /* 570 */ 198, 184, 72, 338, 338, 177, 173, 178, 161, 202,
205  /* 580 */ 82, 118, 117, 126, 125, 124, 112, 83, 96, 108,
206  /* 590 */ 97, 167, 198, 184, 72, 338, 338, 177, 173, 178,
207  /* 600 */ 152, 202, 82, 118, 117, 126, 125, 124, 112, 83,
208  /* 610 */ 96, 108, 97, 167, 198, 184, 72, 338, 338, 177,
209  /* 620 */ 173, 178, 150, 202, 82, 118, 117, 126, 125, 124,
210  /* 630 */ 112, 83, 96, 108, 97, 167, 198, 184, 72, 338,
211  /* 640 */ 338, 177, 173, 178, 149, 202, 82, 118, 117, 126,
212  /* 650 */ 125, 124, 112, 83, 96, 108, 97, 167, 198, 184,
213  /* 660 */ 72, 338, 338, 177, 173, 178, 148, 202, 82, 118,
214  /* 670 */ 117, 126, 125, 124, 112, 83, 96, 108, 97, 167,
215  /* 680 */ 198, 184, 72, 338, 338, 177, 173, 178, 147, 202,
216  /* 690 */ 82, 118, 117, 126, 125, 124, 112, 83, 96, 108,
217  /* 700 */ 97, 167, 198, 184, 72, 338, 338, 177, 173, 178,
218  /* 710 */ 146, 202, 82, 118, 117, 126, 125, 124, 112, 83,
219  /* 720 */ 96, 108, 97, 167, 198, 184, 72, 338, 338, 177,
220  /* 730 */ 173, 178, 145, 202, 82, 118, 117, 126, 125, 124,
221  /* 740 */ 112, 83, 96, 108, 97, 167, 198, 184, 72, 338,
222  /* 750 */ 338, 177, 173, 178, 144, 202, 82, 118, 117, 126,
223  /* 760 */ 125, 124, 112, 83, 96, 108, 97, 167, 198, 184,
224  /* 770 */ 72, 338, 338, 177, 173, 178, 143, 202, 82, 118,
225  /* 780 */ 117, 126, 125, 124, 112, 83, 96, 108, 97, 167,
226  /* 790 */ 198, 184, 72, 338, 338, 177, 173, 178, 142, 202,
227  /* 800 */ 82, 118, 117, 126, 125, 124, 112, 83, 96, 108,
228  /* 810 */ 97, 167, 198, 184, 72, 338, 338, 177, 173, 178,
229  /* 820 */ 141, 202, 82, 118, 117, 126, 125, 124, 112, 83,
230  /* 830 */ 96, 108, 97, 167, 198, 184, 72, 338, 338, 177,
231  /* 840 */ 173, 178, 140, 202, 82, 118, 117, 126, 125, 124,
232  /* 850 */ 112, 83, 96, 108, 97, 167, 198, 184, 72, 338,
233  /* 860 */ 338, 177, 173, 178, 164, 202, 82, 118, 117, 126,
234  /* 870 */ 125, 124, 112, 83, 96, 108, 97, 167, 198, 184,
235  /* 880 */ 72, 338, 338, 177, 173, 178, 158, 202, 82, 118,
236  /* 890 */ 117, 126, 125, 124, 112, 83, 96, 108, 97, 167,
237  /* 900 */ 198, 184, 72, 338, 178, 177, 173, 114, 338, 105,
238  /* 910 */ 126, 125, 124, 112, 83, 96, 108, 97, 167, 198,
239  /* 920 */ 184, 72, 338, 178, 177, 173, 114, 338, 338, 129,
240  /* 930 */ 125, 124, 112, 83, 96, 108, 97, 167, 198, 184,
241  /* 940 */ 72, 338, 178, 177, 173, 114, 338, 338, 121, 125,
242  /* 950 */ 124, 112, 83, 96, 108, 97, 167, 198, 184, 72,
243  /* 960 */ 338, 338, 177, 173, 178, 338, 338, 114, 338, 338,
244  /* 970 */ 338, 128, 124, 112, 83, 96, 108, 97, 167, 198,
245  /* 980 */ 184, 72, 338, 338, 177, 173, 27, 22, 21, 20,
246  /* 990 */ 19, 18, 17, 16, 15, 14, 13, 12, 178, 338,
247  /* 1000 */ 338, 114, 338, 338, 338, 338, 127, 112, 83, 96,
248  /* 1010 */ 108, 97, 167, 198, 184, 72, 338, 338, 177, 173,
249  /* 1020 */ 338, 338, 338, 338, 338, 338, 338, 186, 185, 49,
250  /* 1030 */ 48, 47, 46, 45, 44, 43, 42, 41, 40, 39,
251  /* 1040 */ 38, 37, 178, 338, 338, 114, 338, 338, 338, 338,
252  /* 1050 */ 338, 116, 83, 96, 108, 97, 167, 198, 184, 72,
253  /* 1060 */ 338, 338, 177, 173, 178, 338, 338, 114, 338, 338,
254  /* 1070 */ 338, 338, 338, 338, 85, 96, 108, 97, 167, 198,
255  /* 1080 */ 184, 72, 338, 338, 177, 173, 178, 338, 338, 114,
256  /* 1090 */ 338, 338, 338, 338, 338, 338, 84, 96, 108, 97,
257  /* 1100 */ 167, 198, 184, 72, 338, 338, 177, 173, 178, 338,
258  /* 1110 */ 338, 114, 338, 338, 338, 338, 338, 338, 338, 102,
259  /* 1120 */ 108, 97, 167, 198, 184, 72, 338, 338, 177, 173,
260  /* 1130 */ 178, 338, 338, 114, 338, 338, 338, 338, 338, 338,
261  /* 1140 */ 338, 100, 108, 97, 167, 198, 184, 72, 338, 338,
262  /* 1150 */ 177, 173, 338, 178, 338, 338, 114, 338, 338, 338,
263  /* 1160 */ 338, 338, 338, 338, 98, 108, 97, 167, 198, 184,
264  /* 1170 */ 72, 338, 338, 177, 173, 178, 338, 338, 114, 338,
265  /* 1180 */ 338, 338, 338, 338, 338, 338, 95, 108, 97, 167,
266  /* 1190 */ 198, 184, 72, 338, 338, 177, 173, 338, 178, 338,
267  /* 1200 */ 338, 114, 338, 338, 338, 338, 338, 338, 338, 94,
268  /* 1210 */ 108, 97, 167, 198, 184, 72, 338, 338, 177, 173,
269  /* 1220 */ 178, 338, 338, 114, 338, 338, 338, 338, 338, 338,
270  /* 1230 */ 338, 93, 108, 97, 167, 198, 184, 72, 338, 338,
271  /* 1240 */ 177, 173, 338, 178, 338, 338, 114, 338, 338, 338,
272  /* 1250 */ 338, 338, 338, 338, 92, 108, 97, 167, 198, 184,
273  /* 1260 */ 72, 338, 338, 177, 173, 178, 338, 338, 114, 338,
274  /* 1270 */ 338, 338, 338, 338, 338, 338, 91, 108, 97, 167,
275  /* 1280 */ 198, 184, 72, 338, 338, 177, 173, 338, 178, 338,
276  /* 1290 */ 338, 114, 338, 338, 338, 338, 338, 338, 338, 90,
277  /* 1300 */ 108, 97, 167, 198, 184, 72, 338, 338, 177, 173,
278  /* 1310 */ 178, 338, 338, 114, 338, 338, 338, 338, 338, 338,
279  /* 1320 */ 338, 89, 108, 97, 167, 198, 184, 72, 338, 338,
280  /* 1330 */ 177, 173, 338, 178, 338, 338, 114, 338, 338, 338,
281  /* 1340 */ 338, 338, 338, 338, 88, 108, 97, 167, 198, 184,
282  /* 1350 */ 72, 338, 338, 177, 173, 178, 338, 338, 114, 338,
283  /* 1360 */ 338, 338, 338, 338, 338, 338, 87, 108, 97, 167,
284  /* 1370 */ 198, 184, 72, 338, 338, 177, 173, 338, 178, 338,
285  /* 1380 */ 338, 114, 338, 338, 338, 338, 338, 338, 338, 86,
286  /* 1390 */ 108, 97, 167, 198, 184, 72, 338, 338, 177, 173,
287  /* 1400 */ 212, 338, 79, 78, 75, 209, 70, 338, 77, 131,
288  /* 1410 */ 9, 338, 69, 79, 78, 75, 209, 70, 137, 77,
289  /* 1420 */ 131, 9, 338, 69, 178, 338, 338, 114, 338, 338,
290  /* 1430 */ 338, 338, 338, 338, 338, 338, 115, 97, 167, 198,
291  /* 1440 */ 184, 72, 338, 338, 177, 173, 178, 7, 338, 114,
292  /* 1450 */ 174, 81, 338, 338, 338, 338, 338, 338, 111, 97,
293  /* 1460 */ 167, 198, 184, 72, 338, 338, 177, 173, 178, 338,
294  /* 1470 */ 338, 114, 338, 338, 338, 338, 338, 338, 338, 338,
295  /* 1480 */ 109, 97, 167, 198, 184, 72, 338, 338, 177, 173,
296  /* 1490 */ 338, 338, 338, 338, 338, 338, 338, 178, 338, 338,
297  /* 1500 */ 114, 338, 338, 338, 172, 171, 170, 169, 168, 3,
298  /* 1510 */ 101, 167, 198, 184, 72, 338, 178, 177, 173, 114,
299  /* 1520 */ 338, 338, 338, 338, 178, 338, 338, 114, 338, 99,
300  /* 1530 */ 167, 198, 184, 72, 338, 338, 177, 173, 199, 198,
301  /* 1540 */ 184, 72, 338, 338, 177, 173, 178, 338, 338, 114,
302  /* 1550 */ 338, 338, 338, 338, 338, 338, 338, 338, 338, 338,
303  /* 1560 */ 197, 198, 184, 72, 338, 338, 177, 173, 178, 338,
304  /* 1570 */ 338, 114, 338, 338, 338, 338, 178, 338, 338, 114,
305  /* 1580 */ 338, 338, 196, 198, 184, 72, 338, 338, 177, 173,
306  /* 1590 */ 195, 198, 184, 72, 338, 178, 177, 173, 114, 338,
307  /* 1600 */ 338, 338, 338, 178, 338, 338, 114, 338, 338, 194,
308  /* 1610 */ 198, 184, 72, 338, 338, 177, 173, 193, 198, 184,
309  /* 1620 */ 72, 338, 338, 177, 173, 178, 338, 338, 114, 338,
310  /* 1630 */ 338, 338, 338, 338, 338, 338, 338, 338, 338, 192,
311  /* 1640 */ 198, 184, 72, 338, 338, 177, 173, 178, 338, 338,
312  /* 1650 */ 114, 338, 338, 338, 338, 178, 338, 338, 114, 338,
313  /* 1660 */ 338, 191, 198, 184, 72, 338, 338, 177, 173, 190,
314  /* 1670 */ 198, 184, 72, 338, 178, 177, 173, 114, 338, 338,
315  /* 1680 */ 338, 338, 178, 338, 338, 114, 338, 338, 189, 198,
316  /* 1690 */ 184, 72, 338, 338, 177, 173, 188, 198, 184, 72,
317  /* 1700 */ 338, 338, 177, 173, 178, 338, 338, 114, 338, 338,
318  /* 1710 */ 338, 338, 338, 338, 338, 338, 338, 338, 187, 198,
319  /* 1720 */ 184, 72, 338, 338, 177, 173, 178, 338, 338, 114,
320  /* 1730 */ 338, 338, 338, 338, 178, 338, 338, 114, 338, 338,
321  /* 1740 */ 179, 198, 184, 72, 338, 338, 177, 173, 175, 198,
322  /* 1750 */ 184, 72, 338, 338, 177, 173,
323 };
324 static const YYCODETYPE yy_lookahead[] = {
325  /* 0 */ 73, 74, 75, 8, 77, 78, 79, 80, 81, 82,
326  /* 10 */ 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
327  /* 20 */ 93, 94, 95, 1, 27, 98, 99, 5, 6, 28,
328  /* 30 */ 8, 9, 10, 29, 12, 74, 75, 78, 77, 78,
329  /* 40 */ 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
330  /* 50 */ 89, 90, 91, 92, 93, 94, 95, 98, 99, 98,
331  /* 60 */ 99, 5, 6, 30, 8, 9, 10, 27, 12, 6,
332  /* 70 */ 4, 49, 50, 46, 47, 48, 54, 55, 56, 57,
333  /* 80 */ 58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
334  /* 90 */ 68, 6, 26, 9, 9, 10, 5, 6, 13, 8,
335  /* 100 */ 9, 10, 7, 12, 102, 49, 50, 11, 13, 13,
336  /* 110 */ 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
337  /* 120 */ 64, 65, 66, 67, 68, 6, 2, 3, 9, 10,
338  /* 130 */ 100, 68, 13, 70, 49, 50, 49, 50, 9, 54,
339  /* 140 */ 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
340  /* 150 */ 65, 66, 67, 68, 69, 6, 31, 32, 9, 10,
341  /* 160 */ 77, 7, 51, 52, 53, 55, 56, 13, 49, 50,
342  /* 170 */ 11, 77, 13, 54, 55, 56, 57, 58, 59, 60,
343  /* 180 */ 61, 62, 63, 64, 65, 66, 67, 68, 69, 0,
344  /* 190 */ 13, 77, 63, 77, 65, 96, 97, 77, 49, 50,
345  /* 200 */ 51, 107, 13, 54, 55, 56, 57, 58, 59, 60,
346  /* 210 */ 61, 62, 63, 64, 65, 66, 67, 68, 75, 77,
347  /* 220 */ 71, 78, 79, 80, 81, 82, 83, 84, 85, 86,
348  /* 230 */ 87, 88, 89, 90, 91, 92, 93, 94, 95, 13,
349  /* 240 */ 107, 98, 99, 103, 104, 102, 69, 78, 79, 80,
350  /* 250 */ 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
351  /* 260 */ 91, 92, 93, 94, 95, 107, 107, 98, 99, 100,
352  /* 270 */ 101, 74, 107, 107, 77, 76, 107, 78, 79, 80,
353  /* 280 */ 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
354  /* 290 */ 91, 92, 93, 94, 95, 69, 107, 98, 99, 107,
355  /* 300 */ 107, 107, 107, 75, 107, 106, 78, 79, 80, 81,
356  /* 310 */ 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
357  /* 320 */ 92, 93, 94, 95, 107, 75, 98, 99, 78, 79,
358  /* 330 */ 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
359  /* 340 */ 90, 91, 92, 93, 94, 95, 107, 107, 98, 99,
360  /* 350 */ 107, 75, 107, 107, 78, 79, 80, 81, 82, 83,
361  /* 360 */ 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
362  /* 370 */ 94, 95, 107, 107, 98, 99, 78, 79, 80, 81,
363  /* 380 */ 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
364  /* 390 */ 92, 93, 94, 95, 107, 6, 98, 99, 9, 10,
365  /* 400 */ 107, 107, 13, 105, 78, 79, 80, 81, 82, 83,
366  /* 410 */ 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
367  /* 420 */ 94, 95, 0, 6, 98, 99, 9, 10, 107, 107,
368  /* 430 */ 107, 107, 106, 107, 107, 13, 107, 107, 49, 50,
369  /* 440 */ 107, 107, 107, 54, 55, 56, 57, 58, 59, 60,
370  /* 450 */ 61, 62, 63, 64, 65, 66, 67, 68, 107, 107,
371  /* 460 */ 107, 107, 107, 107, 107, 107, 49, 50, 107, 107,
372  /* 470 */ 107, 54, 55, 56, 57, 58, 59, 60, 61, 62,
373  /* 480 */ 63, 64, 65, 66, 67, 68, 78, 79, 80, 81,
374  /* 490 */ 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
375  /* 500 */ 92, 93, 94, 95, 107, 107, 98, 99, 107, 107,
376  /* 510 */ 107, 78, 79, 80, 81, 82, 83, 84, 85, 86,
377  /* 520 */ 87, 88, 89, 90, 91, 92, 93, 94, 95, 107,
378  /* 530 */ 107, 98, 99, 78, 79, 80, 81, 82, 83, 84,
379  /* 540 */ 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
380  /* 550 */ 95, 107, 107, 98, 99, 78, 79, 80, 81, 82,
381  /* 560 */ 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
382  /* 570 */ 93, 94, 95, 107, 107, 98, 99, 78, 79, 80,
383  /* 580 */ 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
384  /* 590 */ 91, 92, 93, 94, 95, 107, 107, 98, 99, 78,
385  /* 600 */ 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
386  /* 610 */ 89, 90, 91, 92, 93, 94, 95, 107, 107, 98,
387  /* 620 */ 99, 78, 79, 80, 81, 82, 83, 84, 85, 86,
388  /* 630 */ 87, 88, 89, 90, 91, 92, 93, 94, 95, 107,
389  /* 640 */ 107, 98, 99, 78, 79, 80, 81, 82, 83, 84,
390  /* 650 */ 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
391  /* 660 */ 95, 107, 107, 98, 99, 78, 79, 80, 81, 82,
392  /* 670 */ 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
393  /* 680 */ 93, 94, 95, 107, 107, 98, 99, 78, 79, 80,
394  /* 690 */ 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
395  /* 700 */ 91, 92, 93, 94, 95, 107, 107, 98, 99, 78,
396  /* 710 */ 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
397  /* 720 */ 89, 90, 91, 92, 93, 94, 95, 107, 107, 98,
398  /* 730 */ 99, 78, 79, 80, 81, 82, 83, 84, 85, 86,
399  /* 740 */ 87, 88, 89, 90, 91, 92, 93, 94, 95, 107,
400  /* 750 */ 107, 98, 99, 78, 79, 80, 81, 82, 83, 84,
401  /* 760 */ 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
402  /* 770 */ 95, 107, 107, 98, 99, 78, 79, 80, 81, 82,
403  /* 780 */ 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
404  /* 790 */ 93, 94, 95, 107, 107, 98, 99, 78, 79, 80,
405  /* 800 */ 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
406  /* 810 */ 91, 92, 93, 94, 95, 107, 107, 98, 99, 78,
407  /* 820 */ 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
408  /* 830 */ 89, 90, 91, 92, 93, 94, 95, 107, 107, 98,
409  /* 840 */ 99, 78, 79, 80, 81, 82, 83, 84, 85, 86,
410  /* 850 */ 87, 88, 89, 90, 91, 92, 93, 94, 95, 107,
411  /* 860 */ 107, 98, 99, 78, 79, 80, 81, 82, 83, 84,
412  /* 870 */ 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
413  /* 880 */ 95, 107, 107, 98, 99, 78, 79, 80, 81, 82,
414  /* 890 */ 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
415  /* 900 */ 93, 94, 95, 107, 78, 98, 99, 81, 107, 83,
416  /* 910 */ 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
417  /* 920 */ 94, 95, 107, 78, 98, 99, 81, 107, 107, 84,
418  /* 930 */ 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
419  /* 940 */ 95, 107, 78, 98, 99, 81, 107, 107, 84, 85,
420  /* 950 */ 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
421  /* 960 */ 107, 107, 98, 99, 78, 107, 107, 81, 107, 107,
422  /* 970 */ 107, 85, 86, 87, 88, 89, 90, 91, 92, 93,
423  /* 980 */ 94, 95, 107, 107, 98, 99, 14, 15, 16, 17,
424  /* 990 */ 18, 19, 20, 21, 22, 23, 24, 25, 78, 107,
425  /* 1000 */ 107, 81, 107, 107, 107, 107, 86, 87, 88, 89,
426  /* 1010 */ 90, 91, 92, 93, 94, 95, 107, 107, 98, 99,
427  /* 1020 */ 107, 107, 107, 107, 107, 107, 107, 55, 56, 33,
428  /* 1030 */ 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
429  /* 1040 */ 44, 45, 78, 107, 107, 81, 107, 107, 107, 107,
430  /* 1050 */ 107, 87, 88, 89, 90, 91, 92, 93, 94, 95,
431  /* 1060 */ 107, 107, 98, 99, 78, 107, 107, 81, 107, 107,
432  /* 1070 */ 107, 107, 107, 107, 88, 89, 90, 91, 92, 93,
433  /* 1080 */ 94, 95, 107, 107, 98, 99, 78, 107, 107, 81,
434  /* 1090 */ 107, 107, 107, 107, 107, 107, 88, 89, 90, 91,
435  /* 1100 */ 92, 93, 94, 95, 107, 107, 98, 99, 78, 107,
436  /* 1110 */ 107, 81, 107, 107, 107, 107, 107, 107, 107, 89,
437  /* 1120 */ 90, 91, 92, 93, 94, 95, 107, 107, 98, 99,
438  /* 1130 */ 78, 107, 107, 81, 107, 107, 107, 107, 107, 107,
439  /* 1140 */ 107, 89, 90, 91, 92, 93, 94, 95, 107, 107,
440  /* 1150 */ 98, 99, 107, 78, 107, 107, 81, 107, 107, 107,
441  /* 1160 */ 107, 107, 107, 107, 89, 90, 91, 92, 93, 94,
442  /* 1170 */ 95, 107, 107, 98, 99, 78, 107, 107, 81, 107,
443  /* 1180 */ 107, 107, 107, 107, 107, 107, 89, 90, 91, 92,
444  /* 1190 */ 93, 94, 95, 107, 107, 98, 99, 107, 78, 107,
445  /* 1200 */ 107, 81, 107, 107, 107, 107, 107, 107, 107, 89,
446  /* 1210 */ 90, 91, 92, 93, 94, 95, 107, 107, 98, 99,
447  /* 1220 */ 78, 107, 107, 81, 107, 107, 107, 107, 107, 107,
448  /* 1230 */ 107, 89, 90, 91, 92, 93, 94, 95, 107, 107,
449  /* 1240 */ 98, 99, 107, 78, 107, 107, 81, 107, 107, 107,
450  /* 1250 */ 107, 107, 107, 107, 89, 90, 91, 92, 93, 94,
451  /* 1260 */ 95, 107, 107, 98, 99, 78, 107, 107, 81, 107,
452  /* 1270 */ 107, 107, 107, 107, 107, 107, 89, 90, 91, 92,
453  /* 1280 */ 93, 94, 95, 107, 107, 98, 99, 107, 78, 107,
454  /* 1290 */ 107, 81, 107, 107, 107, 107, 107, 107, 107, 89,
455  /* 1300 */ 90, 91, 92, 93, 94, 95, 107, 107, 98, 99,
456  /* 1310 */ 78, 107, 107, 81, 107, 107, 107, 107, 107, 107,
457  /* 1320 */ 107, 89, 90, 91, 92, 93, 94, 95, 107, 107,
458  /* 1330 */ 98, 99, 107, 78, 107, 107, 81, 107, 107, 107,
459  /* 1340 */ 107, 107, 107, 107, 89, 90, 91, 92, 93, 94,
460  /* 1350 */ 95, 107, 107, 98, 99, 78, 107, 107, 81, 107,
461  /* 1360 */ 107, 107, 107, 107, 107, 107, 89, 90, 91, 92,
462  /* 1370 */ 93, 94, 95, 107, 107, 98, 99, 107, 78, 107,
463  /* 1380 */ 107, 81, 107, 107, 107, 107, 107, 107, 107, 89,
464  /* 1390 */ 90, 91, 92, 93, 94, 95, 107, 107, 98, 99,
465  /* 1400 */ 0, 107, 2, 3, 4, 5, 6, 107, 8, 9,
466  /* 1410 */ 10, 107, 12, 2, 3, 4, 5, 6, 7, 8,
467  /* 1420 */ 9, 10, 107, 12, 78, 107, 107, 81, 107, 107,
468  /* 1430 */ 107, 107, 107, 107, 107, 107, 90, 91, 92, 93,
469  /* 1440 */ 94, 95, 107, 107, 98, 99, 78, 6, 107, 81,
470  /* 1450 */ 9, 10, 107, 107, 107, 107, 107, 107, 90, 91,
471  /* 1460 */ 92, 93, 94, 95, 107, 107, 98, 99, 78, 107,
472  /* 1470 */ 107, 81, 107, 107, 107, 107, 107, 107, 107, 107,
473  /* 1480 */ 90, 91, 92, 93, 94, 95, 107, 107, 98, 99,
474  /* 1490 */ 107, 107, 107, 107, 107, 107, 107, 78, 107, 107,
475  /* 1500 */ 81, 107, 107, 107, 63, 64, 65, 66, 67, 68,
476  /* 1510 */ 91, 92, 93, 94, 95, 107, 78, 98, 99, 81,
477  /* 1520 */ 107, 107, 107, 107, 78, 107, 107, 81, 107, 91,
478  /* 1530 */ 92, 93, 94, 95, 107, 107, 98, 99, 92, 93,
479  /* 1540 */ 94, 95, 107, 107, 98, 99, 78, 107, 107, 81,
480  /* 1550 */ 107, 107, 107, 107, 107, 107, 107, 107, 107, 107,
481  /* 1560 */ 92, 93, 94, 95, 107, 107, 98, 99, 78, 107,
482  /* 1570 */ 107, 81, 107, 107, 107, 107, 78, 107, 107, 81,
483  /* 1580 */ 107, 107, 92, 93, 94, 95, 107, 107, 98, 99,
484  /* 1590 */ 92, 93, 94, 95, 107, 78, 98, 99, 81, 107,
485  /* 1600 */ 107, 107, 107, 78, 107, 107, 81, 107, 107, 92,
486  /* 1610 */ 93, 94, 95, 107, 107, 98, 99, 92, 93, 94,
487  /* 1620 */ 95, 107, 107, 98, 99, 78, 107, 107, 81, 107,
488  /* 1630 */ 107, 107, 107, 107, 107, 107, 107, 107, 107, 92,
489  /* 1640 */ 93, 94, 95, 107, 107, 98, 99, 78, 107, 107,
490  /* 1650 */ 81, 107, 107, 107, 107, 78, 107, 107, 81, 107,
491  /* 1660 */ 107, 92, 93, 94, 95, 107, 107, 98, 99, 92,
492  /* 1670 */ 93, 94, 95, 107, 78, 98, 99, 81, 107, 107,
493  /* 1680 */ 107, 107, 78, 107, 107, 81, 107, 107, 92, 93,
494  /* 1690 */ 94, 95, 107, 107, 98, 99, 92, 93, 94, 95,
495  /* 1700 */ 107, 107, 98, 99, 78, 107, 107, 81, 107, 107,
496  /* 1710 */ 107, 107, 107, 107, 107, 107, 107, 107, 92, 93,
497  /* 1720 */ 94, 95, 107, 107, 98, 99, 78, 107, 107, 81,
498  /* 1730 */ 107, 107, 107, 107, 78, 107, 107, 81, 107, 107,
499  /* 1740 */ 92, 93, 94, 95, 107, 107, 98, 99, 92, 93,
500  /* 1750 */ 94, 95, 107, 107, 98, 99,
501 };
502 #define YY_SHIFT_USE_DFLT (-6)
503 #define YY_SHIFT_COUNT (131)
504 #define YY_SHIFT_MIN (-5)
505 #define YY_SHIFT_MAX (1441)
506 static const short yy_shift_ofst[] = {
507  /* 0 */ 22, 56, 149, 389, 417, 149, 417, 417, 417, 417,
508  /* 10 */ 119, 85, 417, 417, 417, 417, 417, 417, 417, 417,
509  /* 20 */ 417, 417, 417, 417, 417, 417, 417, 417, 417, 417,
510  /* 30 */ 417, 417, 417, 417, 417, 417, 417, 417, 417, 417,
511  /* 40 */ 417, 417, 417, 417, 417, 417, 417, 417, 417, 417,
512  /* 50 */ 417, 417, 417, 417, 417, 417, 417, 417, 417, 417,
513  /* 60 */ 417, 417, 417, 417, 417, 417, 417, 417, 417, 1441,
514  /* 70 */ 91, 129, 63, 1411, 1400, 91, 91, 91, 91, 91,
515  /* 80 */ 226, -6, 972, 996, 996, 996, 27, 27, 27, 27,
516  /* 90 */ 27, 27, 27, 27, 27, 27, 27, 111, 27, 111,
517  /* 100 */ 27, 111, 27, 422, 189, 124, 154, 159, 87, 87,
518  /* 110 */ 95, 87, 125, 177, 110, 87, 125, 124, 66, 96,
519  /* 120 */ -5, 1, 84, 40, 33, 4, 1, 33, 4, 1,
520  /* 130 */ -3, -5,
521 };
522 #define YY_REDUCE_USE_DFLT (-74)
523 #define YY_REDUCE_COUNT (81)
524 #define YY_REDUCE_MIN (-73)
525 #define YY_REDUCE_MAX (1656)
526 static const short yy_reduce_ofst[] = {
527  /* 0 */ -73, -39, 199, 169, 143, 326, 298, 276, 250, 228,
528  /* 10 */ 807, 785, 763, 741, 719, 697, 675, 653, 631, 609,
529  /* 20 */ 587, 565, 543, 521, 499, 477, 455, 433, 408, 826,
530  /* 30 */ 864, 845, 886, 920, 964, 1008, 986, 1300, 1277, 1255,
531  /* 40 */ 1232, 1210, 1187, 1165, 1142, 1120, 1097, 1075, 1052, 1030,
532  /* 50 */ 1390, 1368, 1346, 1438, 1419, 1656, 1648, 1626, 1604, 1596,
533  /* 60 */ 1577, 1569, 1547, 1525, 1517, 1498, 1490, 1468, 1446, -41,
534  /* 70 */ 197, 140, 99, 142, 142, 120, 116, 114, 94, 83,
535  /* 80 */ 30, 2,
536 };
537 static const YYACTIONTYPE yy_default[] = {
538  /* 0 */ 336, 336, 330, 336, 320, 336, 327, 336, 336, 336,
539  /* 10 */ 336, 336, 336, 336, 336, 336, 336, 336, 336, 336,
540  /* 20 */ 336, 336, 336, 336, 336, 336, 336, 336, 336, 336,
541  /* 30 */ 336, 336, 336, 336, 336, 336, 336, 336, 336, 336,
542  /* 40 */ 336, 336, 336, 336, 336, 336, 336, 336, 336, 336,
543  /* 50 */ 336, 336, 336, 336, 336, 336, 336, 336, 336, 336,
544  /* 60 */ 336, 336, 336, 336, 336, 336, 336, 336, 336, 336,
545  /* 70 */ 336, 336, 298, 336, 336, 336, 336, 336, 336, 336,
546  /* 80 */ 336, 320, 294, 254, 256, 255, 270, 269, 268, 267,
547  /* 90 */ 266, 265, 264, 263, 262, 261, 257, 275, 260, 277,
548  /* 100 */ 259, 276, 258, 336, 336, 244, 336, 336, 271, 274,
549  /* 110 */ 336, 273, 252, 336, 294, 272, 253, 243, 241, 336,
550  /* 120 */ 304, 247, 336, 336, 250, 248, 245, 251, 249, 246,
551  /* 130 */ 336, 336, 331, 335, 334, 333, 332, 221, 219, 225,
552  /* 140 */ 240, 239, 238, 237, 236, 235, 234, 233, 232, 231,
553  /* 150 */ 230, 328, 329, 326, 325, 316, 314, 313, 318, 312,
554  /* 160 */ 323, 322, 321, 319, 317, 315, 311, 278, 310, 309,
555  /* 170 */ 308, 307, 306, 305, 304, 281, 303, 302, 300, 280,
556  /* 180 */ 324, 226, 301, 299, 297, 296, 295, 293, 292, 291,
557  /* 190 */ 290, 289, 288, 287, 286, 285, 284, 283, 282, 279,
558  /* 200 */ 242, 229, 228, 227, 224, 223, 222, 218, 215, 220,
559  /* 210 */ 217, 216,
560 };
561 
562 /* The next table maps tokens into fallback tokens. If a construct
563 ** like the following:
564 **
565 ** %fallback ID X Y Z.
566 **
567 ** appears in the grammar, then ID becomes a fallback token for X, Y,
568 ** and Z. Whenever one of the tokens X, Y, or Z is input to the parser
569 ** but it does not parse, the type of the token is changed to ID and
570 ** the parse is retried before an error is thrown.
571 */
572 #ifdef YYFALLBACK
573 static const YYCODETYPE yyFallback[] = {
574 };
575 #endif /* YYFALLBACK */
576 
577 /* The following structure represents a single element of the
578 ** parser's stack. Information stored includes:
579 **
580 ** + The state number for the parser at this level of the stack.
581 **
582 ** + The value of the token stored at this level of the stack.
583 ** (In other words, the "major" token.)
584 **
585 ** + The semantic value stored at this level of the stack. This is
586 ** the information used by the action routines in the grammar.
587 ** It is sometimes called the "minor" token.
588 */
589 struct yyStackEntry {
590  YYACTIONTYPE stateno; /* The state-number */
591  YYCODETYPE major; /* The major token value. This is the code
592  ** number for the token at this stack level */
593  YYMINORTYPE minor; /* The user-supplied minor token value. This
594  ** is the value of the token */
595 };
596 typedef struct yyStackEntry yyStackEntry;
597 
598 /* The state of the parser is completely contained in an instance of
599 ** the following structure */
600 struct yyParser {
601  int yyidx; /* Index of top element in stack */
602 #ifdef YYTRACKMAXSTACKDEPTH
603  int yyidxMax; /* Maximum value of yyidx */
604 #endif
605  int yyerrcnt; /* Shifts left before out of the error */
606  grn_expr_parserARG_SDECL /* A place to hold %extra_argument */
607 #if YYSTACKDEPTH<=0
608  int yystksz; /* Current side of the stack */
609  yyStackEntry *yystack; /* The parser's stack */
610 #else
611  yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */
612 #endif
613 };
614 typedef struct yyParser yyParser;
615 
616 #ifndef NDEBUG
617 #include <stdio.h>
618 static FILE *yyTraceFILE = 0;
619 static char *yyTracePrompt = 0;
620 #endif /* NDEBUG */
621 
622 #ifndef NDEBUG
623 /*
624 ** Turn parser tracing on by giving a stream to which to write the trace
625 ** and a prompt to preface each trace message. Tracing is turned off
626 ** by making either argument NULL
627 **
628 ** Inputs:
629 ** <ul>
630 ** <li> A FILE* to which trace output should be written.
631 ** If NULL, then tracing is turned off.
632 ** <li> A prefix string written at the beginning of every
633 ** line of trace output. If NULL, then tracing is
634 ** turned off.
635 ** </ul>
636 **
637 ** Outputs:
638 ** None.
639 */
640 void grn_expr_parserTrace(FILE *TraceFILE, char *zTracePrompt){
641  yyTraceFILE = TraceFILE;
642  yyTracePrompt = zTracePrompt;
643  if( yyTraceFILE==0 ) yyTracePrompt = 0;
644  else if( yyTracePrompt==0 ) yyTraceFILE = 0;
645 }
646 #endif /* NDEBUG */
647 
648 #ifndef NDEBUG
649 /* For tracing shifts, the names of all terminals and nonterminals
650 ** are required. The following table supplies these names */
651 static const char *const yyTokenName[] = {
652  "$", "START_OUTPUT_COLUMNS", "LOGICAL_AND", "LOGICAL_AND_NOT",
653  "LOGICAL_OR", "QSTRING", "PARENL", "PARENR",
654  "RELATIVE_OP", "IDENTIFIER", "BRACEL", "BRACER",
655  "EVAL", "COMMA", "ASSIGN", "STAR_ASSIGN",
656  "SLASH_ASSIGN", "MOD_ASSIGN", "PLUS_ASSIGN", "MINUS_ASSIGN",
657  "SHIFTL_ASSIGN", "SHIFTR_ASSIGN", "SHIFTRR_ASSIGN", "AND_ASSIGN",
658  "XOR_ASSIGN", "OR_ASSIGN", "QUESTION", "COLON",
659  "BITWISE_OR", "BITWISE_XOR", "BITWISE_AND", "EQUAL",
660  "NOT_EQUAL", "LESS", "GREATER", "LESS_EQUAL",
661  "GREATER_EQUAL", "IN", "MATCH", "NEAR",
662  "NEAR2", "SIMILAR", "TERM_EXTRACT", "LCP",
663  "PREFIX", "SUFFIX", "SHIFTL", "SHIFTR",
664  "SHIFTRR", "PLUS", "MINUS", "STAR",
665  "SLASH", "MOD", "DELETE", "INCR",
666  "DECR", "NOT", "BITWISE_NOT", "ADJUST",
667  "EXACT", "PARTIAL", "UNSPLIT", "DECIMAL",
668  "HEX_INTEGER", "STRING", "BOOLEAN", "NULL",
669  "BRACKETL", "BRACKETR", "DOT", "NONEXISTENT_COLUMN",
670  "error", "input", "query", "expression",
671  "output_columns", "query_element", "primary_expression", "assignment_expression",
672  "conditional_expression", "lefthand_side_expression", "logical_or_expression", "logical_and_expression",
673  "bitwise_or_expression", "bitwise_xor_expression", "bitwise_and_expression", "equality_expression",
674  "relational_expression", "shift_expression", "additive_expression", "multiplicative_expression",
675  "unary_expression", "postfix_expression", "call_expression", "member_expression",
676  "arguments", "member_expression_part", "object_literal", "array_literal",
677  "elision", "element_list", "property_name_and_value_list", "property_name_and_value",
678  "property_name", "argument_list", "output_column",
679 };
680 #endif /* NDEBUG */
681 
682 #ifndef NDEBUG
683 /* For tracing reduce actions, the names of all rules are required.
684 */
685 static const char *const yyRuleName[] = {
686  /* 0 */ "input ::= query",
687  /* 1 */ "input ::= expression",
688  /* 2 */ "input ::= START_OUTPUT_COLUMNS output_columns",
689  /* 3 */ "query ::= query_element",
690  /* 4 */ "query ::= query query_element",
691  /* 5 */ "query ::= query LOGICAL_AND query_element",
692  /* 6 */ "query ::= query LOGICAL_AND_NOT query_element",
693  /* 7 */ "query ::= query LOGICAL_OR query_element",
694  /* 8 */ "query_element ::= QSTRING",
695  /* 9 */ "query_element ::= PARENL query PARENR",
696  /* 10 */ "query_element ::= RELATIVE_OP query_element",
697  /* 11 */ "query_element ::= IDENTIFIER RELATIVE_OP query_element",
698  /* 12 */ "query_element ::= BRACEL expression BRACER",
699  /* 13 */ "query_element ::= EVAL primary_expression",
700  /* 14 */ "expression ::= assignment_expression",
701  /* 15 */ "expression ::= expression COMMA assignment_expression",
702  /* 16 */ "assignment_expression ::= conditional_expression",
703  /* 17 */ "assignment_expression ::= lefthand_side_expression ASSIGN assignment_expression",
704  /* 18 */ "assignment_expression ::= lefthand_side_expression STAR_ASSIGN assignment_expression",
705  /* 19 */ "assignment_expression ::= lefthand_side_expression SLASH_ASSIGN assignment_expression",
706  /* 20 */ "assignment_expression ::= lefthand_side_expression MOD_ASSIGN assignment_expression",
707  /* 21 */ "assignment_expression ::= lefthand_side_expression PLUS_ASSIGN assignment_expression",
708  /* 22 */ "assignment_expression ::= lefthand_side_expression MINUS_ASSIGN assignment_expression",
709  /* 23 */ "assignment_expression ::= lefthand_side_expression SHIFTL_ASSIGN assignment_expression",
710  /* 24 */ "assignment_expression ::= lefthand_side_expression SHIFTR_ASSIGN assignment_expression",
711  /* 25 */ "assignment_expression ::= lefthand_side_expression SHIFTRR_ASSIGN assignment_expression",
712  /* 26 */ "assignment_expression ::= lefthand_side_expression AND_ASSIGN assignment_expression",
713  /* 27 */ "assignment_expression ::= lefthand_side_expression XOR_ASSIGN assignment_expression",
714  /* 28 */ "assignment_expression ::= lefthand_side_expression OR_ASSIGN assignment_expression",
715  /* 29 */ "conditional_expression ::= logical_or_expression",
716  /* 30 */ "conditional_expression ::= logical_or_expression QUESTION assignment_expression COLON assignment_expression",
717  /* 31 */ "logical_or_expression ::= logical_and_expression",
718  /* 32 */ "logical_or_expression ::= logical_or_expression LOGICAL_OR logical_and_expression",
719  /* 33 */ "logical_and_expression ::= bitwise_or_expression",
720  /* 34 */ "logical_and_expression ::= logical_and_expression LOGICAL_AND bitwise_or_expression",
721  /* 35 */ "logical_and_expression ::= logical_and_expression LOGICAL_AND_NOT bitwise_or_expression",
722  /* 36 */ "bitwise_or_expression ::= bitwise_xor_expression",
723  /* 37 */ "bitwise_or_expression ::= bitwise_or_expression BITWISE_OR bitwise_xor_expression",
724  /* 38 */ "bitwise_xor_expression ::= bitwise_and_expression",
725  /* 39 */ "bitwise_xor_expression ::= bitwise_xor_expression BITWISE_XOR bitwise_and_expression",
726  /* 40 */ "bitwise_and_expression ::= equality_expression",
727  /* 41 */ "bitwise_and_expression ::= bitwise_and_expression BITWISE_AND equality_expression",
728  /* 42 */ "equality_expression ::= relational_expression",
729  /* 43 */ "equality_expression ::= equality_expression EQUAL relational_expression",
730  /* 44 */ "equality_expression ::= equality_expression NOT_EQUAL relational_expression",
731  /* 45 */ "relational_expression ::= shift_expression",
732  /* 46 */ "relational_expression ::= relational_expression LESS shift_expression",
733  /* 47 */ "relational_expression ::= relational_expression GREATER shift_expression",
734  /* 48 */ "relational_expression ::= relational_expression LESS_EQUAL shift_expression",
735  /* 49 */ "relational_expression ::= relational_expression GREATER_EQUAL shift_expression",
736  /* 50 */ "relational_expression ::= relational_expression IN shift_expression",
737  /* 51 */ "relational_expression ::= relational_expression MATCH shift_expression",
738  /* 52 */ "relational_expression ::= relational_expression NEAR shift_expression",
739  /* 53 */ "relational_expression ::= relational_expression NEAR2 shift_expression",
740  /* 54 */ "relational_expression ::= relational_expression SIMILAR shift_expression",
741  /* 55 */ "relational_expression ::= relational_expression TERM_EXTRACT shift_expression",
742  /* 56 */ "relational_expression ::= relational_expression LCP shift_expression",
743  /* 57 */ "relational_expression ::= relational_expression PREFIX shift_expression",
744  /* 58 */ "relational_expression ::= relational_expression SUFFIX shift_expression",
745  /* 59 */ "shift_expression ::= additive_expression",
746  /* 60 */ "shift_expression ::= shift_expression SHIFTL additive_expression",
747  /* 61 */ "shift_expression ::= shift_expression SHIFTR additive_expression",
748  /* 62 */ "shift_expression ::= shift_expression SHIFTRR additive_expression",
749  /* 63 */ "additive_expression ::= multiplicative_expression",
750  /* 64 */ "additive_expression ::= additive_expression PLUS multiplicative_expression",
751  /* 65 */ "additive_expression ::= additive_expression MINUS multiplicative_expression",
752  /* 66 */ "multiplicative_expression ::= unary_expression",
753  /* 67 */ "multiplicative_expression ::= multiplicative_expression STAR unary_expression",
754  /* 68 */ "multiplicative_expression ::= multiplicative_expression SLASH unary_expression",
755  /* 69 */ "multiplicative_expression ::= multiplicative_expression MOD unary_expression",
756  /* 70 */ "unary_expression ::= postfix_expression",
757  /* 71 */ "unary_expression ::= DELETE unary_expression",
758  /* 72 */ "unary_expression ::= INCR unary_expression",
759  /* 73 */ "unary_expression ::= DECR unary_expression",
760  /* 74 */ "unary_expression ::= PLUS unary_expression",
761  /* 75 */ "unary_expression ::= MINUS unary_expression",
762  /* 76 */ "unary_expression ::= NOT unary_expression",
763  /* 77 */ "unary_expression ::= BITWISE_NOT unary_expression",
764  /* 78 */ "unary_expression ::= ADJUST unary_expression",
765  /* 79 */ "unary_expression ::= EXACT unary_expression",
766  /* 80 */ "unary_expression ::= PARTIAL unary_expression",
767  /* 81 */ "unary_expression ::= UNSPLIT unary_expression",
768  /* 82 */ "postfix_expression ::= lefthand_side_expression",
769  /* 83 */ "postfix_expression ::= lefthand_side_expression INCR",
770  /* 84 */ "postfix_expression ::= lefthand_side_expression DECR",
771  /* 85 */ "lefthand_side_expression ::= call_expression",
772  /* 86 */ "lefthand_side_expression ::= member_expression",
773  /* 87 */ "call_expression ::= member_expression arguments",
774  /* 88 */ "member_expression ::= primary_expression",
775  /* 89 */ "member_expression ::= member_expression member_expression_part",
776  /* 90 */ "primary_expression ::= object_literal",
777  /* 91 */ "primary_expression ::= PARENL expression PARENR",
778  /* 92 */ "primary_expression ::= IDENTIFIER",
779  /* 93 */ "primary_expression ::= array_literal",
780  /* 94 */ "primary_expression ::= DECIMAL",
781  /* 95 */ "primary_expression ::= HEX_INTEGER",
782  /* 96 */ "primary_expression ::= STRING",
783  /* 97 */ "primary_expression ::= BOOLEAN",
784  /* 98 */ "primary_expression ::= NULL",
785  /* 99 */ "array_literal ::= BRACKETL elision BRACKETR",
786  /* 100 */ "array_literal ::= BRACKETL element_list elision BRACKETR",
787  /* 101 */ "array_literal ::= BRACKETL element_list BRACKETR",
788  /* 102 */ "elision ::= COMMA",
789  /* 103 */ "elision ::= elision COMMA",
790  /* 104 */ "element_list ::= assignment_expression",
791  /* 105 */ "element_list ::= elision assignment_expression",
792  /* 106 */ "element_list ::= element_list elision assignment_expression",
793  /* 107 */ "object_literal ::= BRACEL property_name_and_value_list BRACER",
794  /* 108 */ "property_name_and_value_list ::=",
795  /* 109 */ "property_name_and_value_list ::= property_name_and_value_list COMMA property_name_and_value",
796  /* 110 */ "property_name_and_value ::= property_name COLON assignment_expression",
797  /* 111 */ "property_name ::= IDENTIFIER|STRING|DECIMAL",
798  /* 112 */ "member_expression_part ::= BRACKETL expression BRACKETR",
799  /* 113 */ "member_expression_part ::= DOT IDENTIFIER",
800  /* 114 */ "arguments ::= PARENL argument_list PARENR",
801  /* 115 */ "argument_list ::=",
802  /* 116 */ "argument_list ::= assignment_expression",
803  /* 117 */ "argument_list ::= argument_list COMMA assignment_expression",
804  /* 118 */ "output_columns ::=",
805  /* 119 */ "output_columns ::= output_column",
806  /* 120 */ "output_columns ::= output_columns COMMA output_column",
807  /* 121 */ "output_column ::= STAR",
808  /* 122 */ "output_column ::= NONEXISTENT_COLUMN",
809  /* 123 */ "output_column ::= assignment_expression",
810 };
811 #endif /* NDEBUG */
812 
813 
814 #if YYSTACKDEPTH<=0
815 /*
816 ** Try to increase the size of the parser stack.
817 */
818 static void yyGrowStack(yyParser *p){
819  int newSize;
820  yyStackEntry *pNew;
821 
822  newSize = p->yystksz*2 + 100;
823  pNew = realloc(p->yystack, newSize*sizeof(pNew[0]));
824  if( pNew ){
825  p->yystack = pNew;
826  p->yystksz = newSize;
827 #ifndef NDEBUG
828  if( yyTraceFILE ){
829  fprintf(yyTraceFILE,"%sStack grows to %d entries!\n",
830  yyTracePrompt, p->yystksz);
831  }
832 #endif
833  }
834 }
835 #endif
836 
837 /*
838 ** This function allocates a new parser.
839 ** The only argument is a pointer to a function which works like
840 ** malloc.
841 **
842 ** Inputs:
843 ** A pointer to the function used to allocate memory.
844 **
845 ** Outputs:
846 ** A pointer to a parser. This pointer is used in subsequent calls
847 ** to grn_expr_parser and grn_expr_parserFree.
848 */
849 void *grn_expr_parserAlloc(void *(*mallocProc)(size_t)){
850  yyParser *pParser;
851  pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) );
852  if( pParser ){
853  pParser->yyidx = -1;
854 #ifdef YYTRACKMAXSTACKDEPTH
855  pParser->yyidxMax = 0;
856 #endif
857 #if YYSTACKDEPTH<=0
858  pParser->yystack = NULL;
859  pParser->yystksz = 0;
860  yyGrowStack(pParser);
861 #endif
862  }
863  return pParser;
864 }
865 
866 /* The following function deletes the value associated with a
867 ** symbol. The symbol can be either a terminal or nonterminal.
868 ** "yymajor" is the symbol code, and "yypminor" is a pointer to
869 ** the value.
870 */
871 static void yy_destructor(
872  yyParser *yypParser, /* The parser */
873  YYCODETYPE yymajor, /* Type code for object to destroy */
874  YYMINORTYPE *yypminor /* The object to be destroyed */
875 ){
877  switch( yymajor ){
878  /* Here is inserted the actions which take place when a
879  ** terminal or non-terminal is destroyed. This can happen
880  ** when the symbol is popped from the stack during a
881  ** reduce or during error processing or when a parser is
882  ** being destroyed before it is finished parsing.
883  **
884  ** Note: during a reduce, the only symbols destroyed are those
885  ** which appear on the RHS of the rule, but which are not used
886  ** inside the C code.
887  */
888  default: break; /* If no destructor action specified: do nothing */
889  }
890 }
891 
892 /*
893 ** Pop the parser's stack once.
894 **
895 ** If there is a destructor routine associated with the token which
896 ** is popped from the stack, then call it.
897 **
898 ** Return the major token number for the symbol popped.
899 */
900 static int yy_pop_parser_stack(yyParser *pParser){
901  YYCODETYPE yymajor;
902  yyStackEntry *yytos = &pParser->yystack[pParser->yyidx];
903 
904  if( pParser->yyidx<0 ) return 0;
905 #ifndef NDEBUG
906  if( yyTraceFILE && pParser->yyidx>=0 ){
907  fprintf(yyTraceFILE,"%sPopping %s\n",
908  yyTracePrompt,
909  yyTokenName[yytos->major]);
910  }
911 #endif
912  yymajor = yytos->major;
913  yy_destructor(pParser, yymajor, &yytos->minor);
914  pParser->yyidx--;
915  return yymajor;
916 }
917 
918 /*
919 ** Deallocate and destroy a parser. Destructors are all called for
920 ** all stack elements before shutting the parser down.
921 **
922 ** Inputs:
923 ** <ul>
924 ** <li> A pointer to the parser. This should be a pointer
925 ** obtained from grn_expr_parserAlloc.
926 ** <li> A pointer to a function used to reclaim memory obtained
927 ** from malloc.
928 ** </ul>
929 */
931  void *p, /* The parser to be deleted */
932  void (*freeProc)(void*) /* Function used to reclaim memory */
933 ){
934  yyParser *pParser = (yyParser*)p;
935  if( pParser==0 ) return;
936  while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser);
937 #if YYSTACKDEPTH<=0
938  free(pParser->yystack);
939 #endif
940  (*freeProc)((void*)pParser);
941 }
942 
943 /*
944 ** Return the peak depth of the stack for a parser.
945 */
946 #ifdef YYTRACKMAXSTACKDEPTH
947 int grn_expr_parserStackPeak(void *p){
948  yyParser *pParser = (yyParser*)p;
949  return pParser->yyidxMax;
950 }
951 #endif
952 
953 /*
954 ** Find the appropriate action for a parser given the terminal
955 ** look-ahead token iLookAhead.
956 **
957 ** If the look-ahead token is YYNOCODE, then check to see if the action is
958 ** independent of the look-ahead. If it is, return the action, otherwise
959 ** return YY_NO_ACTION.
960 */
961 static int yy_find_shift_action(
962  yyParser *pParser, /* The parser */
963  YYCODETYPE iLookAhead /* The look-ahead token */
964 ){
965  int i;
966  int stateno = pParser->yystack[pParser->yyidx].stateno;
967 
968  if( stateno>YY_SHIFT_COUNT
969  || (i = yy_shift_ofst[stateno])==YY_SHIFT_USE_DFLT ){
970  return yy_default[stateno];
971  }
972  assert( iLookAhead!=YYNOCODE );
973  i += iLookAhead;
974  if( i<0 || i>=YY_ACTTAB_COUNT || yy_lookahead[i]!=iLookAhead ){
975  if( iLookAhead>0 ){
976 #ifdef YYFALLBACK
977  YYCODETYPE iFallback; /* Fallback token */
978  if( iLookAhead<sizeof(yyFallback)/sizeof(yyFallback[0])
979  && (iFallback = yyFallback[iLookAhead])!=0 ){
980 #ifndef NDEBUG
981  if( yyTraceFILE ){
982  fprintf(yyTraceFILE, "%sFALLBACK %s => %s\n",
983  yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]);
984  }
985 #endif
986  return yy_find_shift_action(pParser, iFallback);
987  }
988 #endif
989 #ifdef YYWILDCARD
990  {
991  int j = i - iLookAhead + YYWILDCARD;
992  if(
993 #if YY_SHIFT_MIN+YYWILDCARD<0
994  j>=0 &&
995 #endif
996 #if YY_SHIFT_MAX+YYWILDCARD>=YY_ACTTAB_COUNT
997  j<YY_ACTTAB_COUNT &&
998 #endif
999  yy_lookahead[j]==YYWILDCARD
1000  ){
1001 #ifndef NDEBUG
1002  if( yyTraceFILE ){
1003  fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n",
1004  yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[YYWILDCARD]);
1005  }
1006 #endif /* NDEBUG */
1007  return yy_action[j];
1008  }
1009  }
1010 #endif /* YYWILDCARD */
1011  }
1012  return yy_default[stateno];
1013  }else{
1014  return yy_action[i];
1015  }
1016 }
1017 
1018 /*
1019 ** Find the appropriate action for a parser given the non-terminal
1020 ** look-ahead token iLookAhead.
1021 **
1022 ** If the look-ahead token is YYNOCODE, then check to see if the action is
1023 ** independent of the look-ahead. If it is, return the action, otherwise
1024 ** return YY_NO_ACTION.
1025 */
1026 static int yy_find_reduce_action(
1027  int stateno, /* Current state number */
1028  YYCODETYPE iLookAhead /* The look-ahead token */
1029 ){
1030  int i;
1031 #ifdef YYERRORSYMBOL
1032  if( stateno>YY_REDUCE_COUNT ){
1033  return yy_default[stateno];
1034  }
1035 #else
1036  assert( stateno<=YY_REDUCE_COUNT );
1037 #endif
1038  i = yy_reduce_ofst[stateno];
1039  assert( i!=YY_REDUCE_USE_DFLT );
1040  assert( iLookAhead!=YYNOCODE );
1041  i += iLookAhead;
1042 #ifdef YYERRORSYMBOL
1043  if( i<0 || i>=YY_ACTTAB_COUNT || yy_lookahead[i]!=iLookAhead ){
1044  return yy_default[stateno];
1045  }
1046 #else
1047  assert( i>=0 && i<YY_ACTTAB_COUNT );
1048  assert( yy_lookahead[i]==iLookAhead );
1049 #endif
1050  return yy_action[i];
1051 }
1052 
1053 /*
1054 ** The following routine is called if the stack overflows.
1055 */
1056 static void yyStackOverflow(yyParser *yypParser, YYMINORTYPE *yypMinor){
1058  yypParser->yyidx--;
1059 #ifndef NDEBUG
1060  if( yyTraceFILE ){
1061  fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt);
1062  }
1063 #endif
1064  while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
1065  /* Here code is inserted which will execute if the parser
1066  ** stack every overflows */
1067  grn_expr_parserARG_STORE; /* Suppress warning about unused %extra_argument var */
1068 }
1069 
1070 /*
1071 ** Perform a shift action.
1072 */
1073 static void yy_shift(
1074  yyParser *yypParser, /* The parser to be shifted */
1075  int yyNewState, /* The new state to shift in */
1076  int yyMajor, /* The major token to shift in */
1077  YYMINORTYPE *yypMinor /* Pointer to the minor token to shift in */
1078 ){
1079  yyStackEntry *yytos;
1080  yypParser->yyidx++;
1081 #ifdef YYTRACKMAXSTACKDEPTH
1082  if( yypParser->yyidx>yypParser->yyidxMax ){
1083  yypParser->yyidxMax = yypParser->yyidx;
1084  }
1085 #endif
1086 #if YYSTACKDEPTH>0
1087  if( yypParser->yyidx>=YYSTACKDEPTH ){
1088  yyStackOverflow(yypParser, yypMinor);
1089  return;
1090  }
1091 #else
1092  if( yypParser->yyidx>=yypParser->yystksz ){
1093  yyGrowStack(yypParser);
1094  if( yypParser->yyidx>=yypParser->yystksz ){
1095  yyStackOverflow(yypParser, yypMinor);
1096  return;
1097  }
1098  }
1099 #endif
1100  yytos = &yypParser->yystack[yypParser->yyidx];
1101  yytos->stateno = (YYACTIONTYPE)yyNewState;
1102  yytos->major = (YYCODETYPE)yyMajor;
1103  yytos->minor = *yypMinor;
1104 #ifndef NDEBUG
1105  if( yyTraceFILE && yypParser->yyidx>0 ){
1106  int i;
1107  fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState);
1108  fprintf(yyTraceFILE,"%sStack:",yyTracePrompt);
1109  for(i=1; i<=yypParser->yyidx; i++)
1110  fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]);
1111  fprintf(yyTraceFILE,"\n");
1112  }
1113 #endif
1114 }
1115 
1116 /* The following table contains information about every rule that
1117 ** is used during the reduce.
1118 */
1119 static const struct {
1120  YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */
1121  unsigned char nrhs; /* Number of right-hand side symbols in the rule */
1122 } yyRuleInfo[] = {
1123  { 73, 1 },
1124  { 73, 1 },
1125  { 73, 2 },
1126  { 74, 1 },
1127  { 74, 2 },
1128  { 74, 3 },
1129  { 74, 3 },
1130  { 74, 3 },
1131  { 77, 1 },
1132  { 77, 3 },
1133  { 77, 2 },
1134  { 77, 3 },
1135  { 77, 3 },
1136  { 77, 2 },
1137  { 75, 1 },
1138  { 75, 3 },
1139  { 79, 1 },
1140  { 79, 3 },
1141  { 79, 3 },
1142  { 79, 3 },
1143  { 79, 3 },
1144  { 79, 3 },
1145  { 79, 3 },
1146  { 79, 3 },
1147  { 79, 3 },
1148  { 79, 3 },
1149  { 79, 3 },
1150  { 79, 3 },
1151  { 79, 3 },
1152  { 80, 1 },
1153  { 80, 5 },
1154  { 82, 1 },
1155  { 82, 3 },
1156  { 83, 1 },
1157  { 83, 3 },
1158  { 83, 3 },
1159  { 84, 1 },
1160  { 84, 3 },
1161  { 85, 1 },
1162  { 85, 3 },
1163  { 86, 1 },
1164  { 86, 3 },
1165  { 87, 1 },
1166  { 87, 3 },
1167  { 87, 3 },
1168  { 88, 1 },
1169  { 88, 3 },
1170  { 88, 3 },
1171  { 88, 3 },
1172  { 88, 3 },
1173  { 88, 3 },
1174  { 88, 3 },
1175  { 88, 3 },
1176  { 88, 3 },
1177  { 88, 3 },
1178  { 88, 3 },
1179  { 88, 3 },
1180  { 88, 3 },
1181  { 88, 3 },
1182  { 89, 1 },
1183  { 89, 3 },
1184  { 89, 3 },
1185  { 89, 3 },
1186  { 90, 1 },
1187  { 90, 3 },
1188  { 90, 3 },
1189  { 91, 1 },
1190  { 91, 3 },
1191  { 91, 3 },
1192  { 91, 3 },
1193  { 92, 1 },
1194  { 92, 2 },
1195  { 92, 2 },
1196  { 92, 2 },
1197  { 92, 2 },
1198  { 92, 2 },
1199  { 92, 2 },
1200  { 92, 2 },
1201  { 92, 2 },
1202  { 92, 2 },
1203  { 92, 2 },
1204  { 92, 2 },
1205  { 93, 1 },
1206  { 93, 2 },
1207  { 93, 2 },
1208  { 81, 1 },
1209  { 81, 1 },
1210  { 94, 2 },
1211  { 95, 1 },
1212  { 95, 2 },
1213  { 78, 1 },
1214  { 78, 3 },
1215  { 78, 1 },
1216  { 78, 1 },
1217  { 78, 1 },
1218  { 78, 1 },
1219  { 78, 1 },
1220  { 78, 1 },
1221  { 78, 1 },
1222  { 99, 3 },
1223  { 99, 4 },
1224  { 99, 3 },
1225  { 100, 1 },
1226  { 100, 2 },
1227  { 101, 1 },
1228  { 101, 2 },
1229  { 101, 3 },
1230  { 98, 3 },
1231  { 102, 0 },
1232  { 102, 3 },
1233  { 103, 3 },
1234  { 104, 1 },
1235  { 97, 3 },
1236  { 97, 2 },
1237  { 96, 3 },
1238  { 105, 0 },
1239  { 105, 1 },
1240  { 105, 3 },
1241  { 76, 0 },
1242  { 76, 1 },
1243  { 76, 3 },
1244  { 106, 1 },
1245  { 106, 1 },
1246  { 106, 1 },
1247 };
1248 
1249 static void yy_accept(yyParser*); /* Forward Declaration */
1250 
1251 /*
1252 ** Perform a reduce action and the shift that must immediately
1253 ** follow the reduce.
1254 */
1255 static void yy_reduce(
1256  yyParser *yypParser, /* The parser */
1257  int yyruleno /* Number of the rule by which to reduce */
1258 ){
1259  int yygoto; /* The next state */
1260  int yyact; /* The next action */
1261  YYMINORTYPE yygotominor; /* The LHS of the rule reduced */
1262  yyStackEntry *yymsp; /* The top of the parser's stack */
1263  int yysize; /* Amount to pop the stack */
1265  yymsp = &yypParser->yystack[yypParser->yyidx];
1266 #ifndef NDEBUG
1267  if( yyTraceFILE && yyruleno>=0
1268  && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){
1269  fprintf(yyTraceFILE, "%sReduce [%s].\n", yyTracePrompt,
1270  yyRuleName[yyruleno]);
1271  }
1272 #endif /* NDEBUG */
1273 
1274  /* Silence complaints from purify about yygotominor being uninitialized
1275  ** in some cases when it is copied into the stack after the following
1276  ** switch. yygotominor is uninitialized when a rule reduces that does
1277  ** not set the value of its left-hand side nonterminal. Leaving the
1278  ** value of the nonterminal uninitialized is utterly harmless as long
1279  ** as the value is never used. So really the only thing this code
1280  ** accomplishes is to quieten purify.
1281  **
1282  ** 2007-01-16: The wireshark project (www.wireshark.org) reports that
1283  ** without this code, their parser segfaults. I'm not sure what there
1284  ** parser is doing to make this happen. This is the second bug report
1285  ** from wireshark this week. Clearly they are stressing Lemon in ways
1286  ** that it has not been previously stressed... (SQLite ticket #2172)
1287  */
1288  /*memset(&yygotominor, 0, sizeof(yygotominor));*/
1289  yygotominor = yyzerominor;
1290 
1291 
1292  switch( yyruleno ){
1293  /* Beginning here are the reduction cases. A typical example
1294  ** follows:
1295  ** case 0:
1296  ** #line <lineno> <grammarfile>
1297  ** { ... } // User supplied code
1298  ** #line <lineno> <thisfile>
1299  ** break;
1300  */
1301  case 4: /* query ::= query query_element */
1302 #line 30 "ecmascript.y"
1303 {
1304  grn_expr_append_op(efsi->ctx, efsi->e, grn_int32_value_at(&efsi->op_stack, -1), 2);
1305 }
1306 #line 1307 "ecmascript.c"
1307  break;
1308  case 5: /* query ::= query LOGICAL_AND query_element */
1309  case 34: /* logical_and_expression ::= logical_and_expression LOGICAL_AND bitwise_or_expression */ yytestcase(yyruleno==34);
1310 #line 33 "ecmascript.y"
1311 {
1312  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_AND, 2);
1313 }
1314 #line 1315 "ecmascript.c"
1315  break;
1316  case 6: /* query ::= query LOGICAL_AND_NOT query_element */
1317  case 35: /* logical_and_expression ::= logical_and_expression LOGICAL_AND_NOT bitwise_or_expression */ yytestcase(yyruleno==35);
1318 #line 36 "ecmascript.y"
1319 {
1320  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_AND_NOT, 2);
1321 }
1322 #line 1323 "ecmascript.c"
1323  break;
1324  case 7: /* query ::= query LOGICAL_OR query_element */
1325  case 32: /* logical_or_expression ::= logical_or_expression LOGICAL_OR logical_and_expression */ yytestcase(yyruleno==32);
1326 #line 39 "ecmascript.y"
1327 {
1328  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_OR, 2);
1329 }
1330 #line 1331 "ecmascript.c"
1331  break;
1332  case 10: /* query_element ::= RELATIVE_OP query_element */
1333 #line 46 "ecmascript.y"
1334 {
1335  int mode;
1336  GRN_UINT32_POP(&efsi->mode_stack, mode);
1337 }
1338 #line 1339 "ecmascript.c"
1339  break;
1340  case 11: /* query_element ::= IDENTIFIER RELATIVE_OP query_element */
1341 #line 50 "ecmascript.y"
1342 {
1343  int mode;
1344  grn_obj *c;
1345  GRN_PTR_POP(&efsi->column_stack, c);
1346  GRN_UINT32_POP(&efsi->mode_stack, mode);
1347 }
1348 #line 1349 "ecmascript.c"
1349  break;
1350  case 12: /* query_element ::= BRACEL expression BRACER */
1351  case 13: /* query_element ::= EVAL primary_expression */ yytestcase(yyruleno==13);
1352 #line 56 "ecmascript.y"
1353 {
1354  efsi->flags = efsi->default_flags;
1355 }
1356 #line 1357 "ecmascript.c"
1357  break;
1358  case 15: /* expression ::= expression COMMA assignment_expression */
1359 #line 64 "ecmascript.y"
1360 {
1361  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_COMMA, 2);
1362 }
1363 #line 1364 "ecmascript.c"
1364  break;
1365  case 17: /* assignment_expression ::= lefthand_side_expression ASSIGN assignment_expression */
1366 #line 69 "ecmascript.y"
1367 {
1368  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_ASSIGN, 2);
1369 }
1370 #line 1371 "ecmascript.c"
1371  break;
1372  case 18: /* assignment_expression ::= lefthand_side_expression STAR_ASSIGN assignment_expression */
1373 #line 72 "ecmascript.y"
1374 {
1375  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_STAR_ASSIGN, 2);
1376 }
1377 #line 1378 "ecmascript.c"
1378  break;
1379  case 19: /* assignment_expression ::= lefthand_side_expression SLASH_ASSIGN assignment_expression */
1380 #line 75 "ecmascript.y"
1381 {
1382  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_SLASH_ASSIGN, 2);
1383 }
1384 #line 1385 "ecmascript.c"
1385  break;
1386  case 20: /* assignment_expression ::= lefthand_side_expression MOD_ASSIGN assignment_expression */
1387 #line 78 "ecmascript.y"
1388 {
1389  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_MOD_ASSIGN, 2);
1390 }
1391 #line 1392 "ecmascript.c"
1392  break;
1393  case 21: /* assignment_expression ::= lefthand_side_expression PLUS_ASSIGN assignment_expression */
1394 #line 81 "ecmascript.y"
1395 {
1396  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_PLUS_ASSIGN, 2);
1397 }
1398 #line 1399 "ecmascript.c"
1399  break;
1400  case 22: /* assignment_expression ::= lefthand_side_expression MINUS_ASSIGN assignment_expression */
1401 #line 84 "ecmascript.y"
1402 {
1403  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_MINUS_ASSIGN, 2);
1404 }
1405 #line 1406 "ecmascript.c"
1406  break;
1407  case 23: /* assignment_expression ::= lefthand_side_expression SHIFTL_ASSIGN assignment_expression */
1408 #line 87 "ecmascript.y"
1409 {
1410  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_SHIFTL_ASSIGN, 2);
1411 }
1412 #line 1413 "ecmascript.c"
1413  break;
1414  case 24: /* assignment_expression ::= lefthand_side_expression SHIFTR_ASSIGN assignment_expression */
1415 #line 90 "ecmascript.y"
1416 {
1417  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_SHIFTR_ASSIGN, 2);
1418 }
1419 #line 1420 "ecmascript.c"
1420  break;
1421  case 25: /* assignment_expression ::= lefthand_side_expression SHIFTRR_ASSIGN assignment_expression */
1422 #line 93 "ecmascript.y"
1423 {
1424  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_SHIFTRR_ASSIGN, 2);
1425 }
1426 #line 1427 "ecmascript.c"
1427  break;
1428  case 26: /* assignment_expression ::= lefthand_side_expression AND_ASSIGN assignment_expression */
1429 #line 96 "ecmascript.y"
1430 {
1431  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_AND_ASSIGN, 2);
1432 }
1433 #line 1434 "ecmascript.c"
1434  break;
1435  case 27: /* assignment_expression ::= lefthand_side_expression XOR_ASSIGN assignment_expression */
1436 #line 99 "ecmascript.y"
1437 {
1438  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_XOR_ASSIGN, 2);
1439 }
1440 #line 1441 "ecmascript.c"
1441  break;
1442  case 28: /* assignment_expression ::= lefthand_side_expression OR_ASSIGN assignment_expression */
1443 #line 102 "ecmascript.y"
1444 {
1445  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_OR_ASSIGN, 2);
1446 }
1447 #line 1448 "ecmascript.c"
1448  break;
1449  case 30: /* conditional_expression ::= logical_or_expression QUESTION assignment_expression COLON assignment_expression */
1450 #line 107 "ecmascript.y"
1451 {
1452  grn_expr *e = (grn_expr *)efsi->e;
1453  e->codes[yymsp[-3].minor.yy0].nargs = yymsp[-1].minor.yy0 - yymsp[-3].minor.yy0;
1454  e->codes[yymsp[-1].minor.yy0].nargs = e->codes_curr - yymsp[-1].minor.yy0 - 1;
1455 }
1456 #line 1457 "ecmascript.c"
1457  break;
1458  case 37: /* bitwise_or_expression ::= bitwise_or_expression BITWISE_OR bitwise_xor_expression */
1459 #line 127 "ecmascript.y"
1460 {
1461  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_BITWISE_OR, 2);
1462 }
1463 #line 1464 "ecmascript.c"
1464  break;
1465  case 39: /* bitwise_xor_expression ::= bitwise_xor_expression BITWISE_XOR bitwise_and_expression */
1466 #line 132 "ecmascript.y"
1467 {
1468  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_BITWISE_XOR, 2);
1469 }
1470 #line 1471 "ecmascript.c"
1471  break;
1472  case 41: /* bitwise_and_expression ::= bitwise_and_expression BITWISE_AND equality_expression */
1473 #line 137 "ecmascript.y"
1474 {
1475  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_BITWISE_AND, 2);
1476 }
1477 #line 1478 "ecmascript.c"
1478  break;
1479  case 43: /* equality_expression ::= equality_expression EQUAL relational_expression */
1480 #line 142 "ecmascript.y"
1481 {
1482  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_EQUAL, 2);
1483 }
1484 #line 1485 "ecmascript.c"
1485  break;
1486  case 44: /* equality_expression ::= equality_expression NOT_EQUAL relational_expression */
1487 #line 145 "ecmascript.y"
1488 {
1489  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_NOT_EQUAL, 2);
1490 }
1491 #line 1492 "ecmascript.c"
1492  break;
1493  case 46: /* relational_expression ::= relational_expression LESS shift_expression */
1494 #line 150 "ecmascript.y"
1495 {
1496  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_LESS, 2);
1497 }
1498 #line 1499 "ecmascript.c"
1499  break;
1500  case 47: /* relational_expression ::= relational_expression GREATER shift_expression */
1501 #line 153 "ecmascript.y"
1502 {
1503  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_GREATER, 2);
1504 }
1505 #line 1506 "ecmascript.c"
1506  break;
1507  case 48: /* relational_expression ::= relational_expression LESS_EQUAL shift_expression */
1508 #line 156 "ecmascript.y"
1509 {
1510  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_LESS_EQUAL, 2);
1511 }
1512 #line 1513 "ecmascript.c"
1513  break;
1514  case 49: /* relational_expression ::= relational_expression GREATER_EQUAL shift_expression */
1515 #line 159 "ecmascript.y"
1516 {
1517  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_GREATER_EQUAL, 2);
1518 }
1519 #line 1520 "ecmascript.c"
1520  break;
1521  case 50: /* relational_expression ::= relational_expression IN shift_expression */
1522 #line 162 "ecmascript.y"
1523 {
1524  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_IN, 2);
1525 }
1526 #line 1527 "ecmascript.c"
1527  break;
1528  case 51: /* relational_expression ::= relational_expression MATCH shift_expression */
1529 #line 165 "ecmascript.y"
1530 {
1531  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_MATCH, 2);
1532 }
1533 #line 1534 "ecmascript.c"
1534  break;
1535  case 52: /* relational_expression ::= relational_expression NEAR shift_expression */
1536 #line 168 "ecmascript.y"
1537 {
1538  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_NEAR, 2);
1539 }
1540 #line 1541 "ecmascript.c"
1541  break;
1542  case 53: /* relational_expression ::= relational_expression NEAR2 shift_expression */
1543 #line 171 "ecmascript.y"
1544 {
1545  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_NEAR2, 2);
1546 }
1547 #line 1548 "ecmascript.c"
1548  break;
1549  case 54: /* relational_expression ::= relational_expression SIMILAR shift_expression */
1550 #line 174 "ecmascript.y"
1551 {
1552  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_SIMILAR, 2);
1553 }
1554 #line 1555 "ecmascript.c"
1555  break;
1556  case 55: /* relational_expression ::= relational_expression TERM_EXTRACT shift_expression */
1557 #line 177 "ecmascript.y"
1558 {
1559  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_TERM_EXTRACT, 2);
1560 }
1561 #line 1562 "ecmascript.c"
1562  break;
1563  case 56: /* relational_expression ::= relational_expression LCP shift_expression */
1564 #line 180 "ecmascript.y"
1565 {
1566  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_LCP, 2);
1567 }
1568 #line 1569 "ecmascript.c"
1569  break;
1570  case 57: /* relational_expression ::= relational_expression PREFIX shift_expression */
1571 #line 183 "ecmascript.y"
1572 {
1573  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_PREFIX, 2);
1574 }
1575 #line 1576 "ecmascript.c"
1576  break;
1577  case 58: /* relational_expression ::= relational_expression SUFFIX shift_expression */
1578 #line 186 "ecmascript.y"
1579 {
1580  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_SUFFIX, 2);
1581 }
1582 #line 1583 "ecmascript.c"
1583  break;
1584  case 60: /* shift_expression ::= shift_expression SHIFTL additive_expression */
1585 #line 191 "ecmascript.y"
1586 {
1587  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_SHIFTL, 2);
1588 }
1589 #line 1590 "ecmascript.c"
1590  break;
1591  case 61: /* shift_expression ::= shift_expression SHIFTR additive_expression */
1592 #line 194 "ecmascript.y"
1593 {
1594  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_SHIFTR, 2);
1595 }
1596 #line 1597 "ecmascript.c"
1597  break;
1598  case 62: /* shift_expression ::= shift_expression SHIFTRR additive_expression */
1599 #line 197 "ecmascript.y"
1600 {
1601  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_SHIFTRR, 2);
1602 }
1603 #line 1604 "ecmascript.c"
1604  break;
1605  case 64: /* additive_expression ::= additive_expression PLUS multiplicative_expression */
1606 #line 202 "ecmascript.y"
1607 {
1608  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_PLUS, 2);
1609 }
1610 #line 1611 "ecmascript.c"
1611  break;
1612  case 65: /* additive_expression ::= additive_expression MINUS multiplicative_expression */
1613 #line 205 "ecmascript.y"
1614 {
1615  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_MINUS, 2);
1616 }
1617 #line 1618 "ecmascript.c"
1618  break;
1619  case 67: /* multiplicative_expression ::= multiplicative_expression STAR unary_expression */
1620 #line 210 "ecmascript.y"
1621 {
1622  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_STAR, 2);
1623 }
1624 #line 1625 "ecmascript.c"
1625  break;
1626  case 68: /* multiplicative_expression ::= multiplicative_expression SLASH unary_expression */
1627 #line 213 "ecmascript.y"
1628 {
1629  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_SLASH, 2);
1630 }
1631 #line 1632 "ecmascript.c"
1632  break;
1633  case 69: /* multiplicative_expression ::= multiplicative_expression MOD unary_expression */
1634 #line 216 "ecmascript.y"
1635 {
1636  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_MOD, 2);
1637 }
1638 #line 1639 "ecmascript.c"
1639  break;
1640  case 71: /* unary_expression ::= DELETE unary_expression */
1641 #line 221 "ecmascript.y"
1642 {
1643  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_DELETE, 1);
1644 }
1645 #line 1646 "ecmascript.c"
1646  break;
1647  case 72: /* unary_expression ::= INCR unary_expression */
1648 #line 224 "ecmascript.y"
1649 {
1650  grn_ctx *ctx = efsi->ctx;
1651  grn_expr *e = (grn_expr *)(efsi->e);
1652  grn_expr_dfi *dfi_;
1653  unsigned int const_p;
1654 
1655  DFI_POP(e, dfi_);
1656  const_p = CONSTP(dfi_->code->value);
1657  DFI_PUT(e, dfi_->type, dfi_->domain, dfi_->code);
1658  if (const_p) {
1660  "constant can't be incremented (%.*s)",
1661  (int)(efsi->str_end - efsi->str), efsi->str);
1662  } else {
1663  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_INCR, 1);
1664  }
1665 }
1666 #line 1667 "ecmascript.c"
1667  break;
1668  case 73: /* unary_expression ::= DECR unary_expression */
1669 #line 241 "ecmascript.y"
1670 {
1671  grn_ctx *ctx = efsi->ctx;
1672  grn_expr *e = (grn_expr *)(efsi->e);
1673  grn_expr_dfi *dfi_;
1674  unsigned int const_p;
1675 
1676  DFI_POP(e, dfi_);
1677  const_p = CONSTP(dfi_->code->value);
1678  DFI_PUT(e, dfi_->type, dfi_->domain, dfi_->code);
1679  if (const_p) {
1681  "constant can't be decremented (%.*s)",
1682  (int)(efsi->str_end - efsi->str), efsi->str);
1683  } else {
1684  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_DECR, 1);
1685  }
1686 }
1687 #line 1688 "ecmascript.c"
1688  break;
1689  case 74: /* unary_expression ::= PLUS unary_expression */
1690 #line 258 "ecmascript.y"
1691 {
1692  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_PLUS, 1);
1693 }
1694 #line 1695 "ecmascript.c"
1695  break;
1696  case 75: /* unary_expression ::= MINUS unary_expression */
1697 #line 261 "ecmascript.y"
1698 {
1699  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_MINUS, 1);
1700 }
1701 #line 1702 "ecmascript.c"
1702  break;
1703  case 76: /* unary_expression ::= NOT unary_expression */
1704 #line 264 "ecmascript.y"
1705 {
1706  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_NOT, 1);
1707 }
1708 #line 1709 "ecmascript.c"
1709  break;
1710  case 77: /* unary_expression ::= BITWISE_NOT unary_expression */
1711 #line 267 "ecmascript.y"
1712 {
1713  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_BITWISE_NOT, 1);
1714 }
1715 #line 1716 "ecmascript.c"
1716  break;
1717  case 78: /* unary_expression ::= ADJUST unary_expression */
1718 #line 270 "ecmascript.y"
1719 {
1720  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_ADJUST, 1);
1721 }
1722 #line 1723 "ecmascript.c"
1723  break;
1724  case 79: /* unary_expression ::= EXACT unary_expression */
1725 #line 273 "ecmascript.y"
1726 {
1727  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_EXACT, 1);
1728 }
1729 #line 1730 "ecmascript.c"
1730  break;
1731  case 80: /* unary_expression ::= PARTIAL unary_expression */
1732 #line 276 "ecmascript.y"
1733 {
1734  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_PARTIAL, 1);
1735 }
1736 #line 1737 "ecmascript.c"
1737  break;
1738  case 81: /* unary_expression ::= UNSPLIT unary_expression */
1739 #line 279 "ecmascript.y"
1740 {
1741  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_UNSPLIT, 1);
1742 }
1743 #line 1744 "ecmascript.c"
1744  break;
1745  case 83: /* postfix_expression ::= lefthand_side_expression INCR */
1746 #line 284 "ecmascript.y"
1747 {
1748  grn_ctx *ctx = efsi->ctx;
1749  grn_expr *e = (grn_expr *)(efsi->e);
1750  grn_expr_dfi *dfi_;
1751  unsigned int const_p;
1752 
1753  DFI_POP(e, dfi_);
1754  const_p = CONSTP(dfi_->code->value);
1755  DFI_PUT(e, dfi_->type, dfi_->domain, dfi_->code);
1756  if (const_p) {
1758  "constant can't be incremented (%.*s)",
1759  (int)(efsi->str_end - efsi->str), efsi->str);
1760  } else {
1761  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_INCR_POST, 1);
1762  }
1763 }
1764 #line 1765 "ecmascript.c"
1765  break;
1766  case 84: /* postfix_expression ::= lefthand_side_expression DECR */
1767 #line 301 "ecmascript.y"
1768 {
1769  grn_ctx *ctx = efsi->ctx;
1770  grn_expr *e = (grn_expr *)(efsi->e);
1771  grn_expr_dfi *dfi_;
1772  unsigned int const_p;
1773 
1774  DFI_POP(e, dfi_);
1775  const_p = CONSTP(dfi_->code->value);
1776  DFI_PUT(e, dfi_->type, dfi_->domain, dfi_->code);
1777  if (const_p) {
1779  "constant can't be decremented (%.*s)",
1780  (int)(efsi->str_end - efsi->str), efsi->str);
1781  } else {
1782  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_DECR_POST, 1);
1783  }
1784 }
1785 #line 1786 "ecmascript.c"
1786  break;
1787  case 87: /* call_expression ::= member_expression arguments */
1788 #line 322 "ecmascript.y"
1789 {
1790  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_CALL, yymsp[0].minor.yy0);
1791 }
1792 #line 1793 "ecmascript.c"
1793  break;
1794  case 112: /* member_expression_part ::= BRACKETL expression BRACKETR */
1795 #line 358 "ecmascript.y"
1796 {
1797  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_GET_MEMBER, 2);
1798 }
1799 #line 1800 "ecmascript.c"
1800  break;
1801  case 114: /* arguments ::= PARENL argument_list PARENR */
1802 #line 363 "ecmascript.y"
1803 { yygotominor.yy0 = yymsp[-1].minor.yy0; }
1804 #line 1805 "ecmascript.c"
1805  break;
1806  case 115: /* argument_list ::= */
1807 #line 364 "ecmascript.y"
1808 { yygotominor.yy0 = 0; }
1809 #line 1810 "ecmascript.c"
1810  break;
1811  case 116: /* argument_list ::= assignment_expression */
1812 #line 365 "ecmascript.y"
1813 { yygotominor.yy0 = 1; }
1814 #line 1815 "ecmascript.c"
1815  break;
1816  case 117: /* argument_list ::= argument_list COMMA assignment_expression */
1817 #line 366 "ecmascript.y"
1818 { yygotominor.yy0 = yymsp[-2].minor.yy0 + 1; }
1819 #line 1820 "ecmascript.c"
1820  break;
1821  case 118: /* output_columns ::= */
1822 #line 368 "ecmascript.y"
1823 {
1824  yygotominor.yy0 = 0;
1825 }
1826 #line 1827 "ecmascript.c"
1827  break;
1828  case 119: /* output_columns ::= output_column */
1829 #line 371 "ecmascript.y"
1830 {
1831  if (yymsp[0].minor.yy0) {
1832  yygotominor.yy0 = 0;
1833  } else {
1834  yygotominor.yy0 = 1;
1835  }
1836 }
1837 #line 1838 "ecmascript.c"
1838  break;
1839  case 120: /* output_columns ::= output_columns COMMA output_column */
1840 #line 379 "ecmascript.y"
1841 {
1842  if (yymsp[0].minor.yy0) {
1843  yygotominor.yy0 = yymsp[-2].minor.yy0;
1844  } else {
1845  if (yymsp[-2].minor.yy0 == 1) {
1846  grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_COMMA, 2);
1847  }
1848  yygotominor.yy0 = 1;
1849  }
1850 }
1851 #line 1852 "ecmascript.c"
1852  break;
1853  case 121: /* output_column ::= STAR */
1854 #line 390 "ecmascript.y"
1855 {
1856  grn_ctx *ctx = efsi->ctx;
1857  grn_obj *expr = efsi->e;
1858  grn_expr *e = (grn_expr *)expr;
1859  grn_obj *variable = grn_expr_get_var_by_offset(ctx, expr, 0);
1860  if (variable) {
1861  grn_id table_id = GRN_OBJ_GET_DOMAIN(variable);
1862  grn_obj *table = grn_ctx_at(ctx, table_id);
1863  grn_obj columns_buffer;
1864  grn_obj **columns;
1865  int i, n_columns;
1866 
1867  GRN_PTR_INIT(&columns_buffer, GRN_OBJ_VECTOR, GRN_ID_NIL);
1868  grn_obj_columns(ctx, table, "*", strlen("*"), &columns_buffer);
1869  n_columns = GRN_BULK_VSIZE(&columns_buffer) / sizeof(grn_obj *);
1870  columns = (grn_obj **)GRN_BULK_HEAD(&columns_buffer);
1871 
1872  for (i = 0; i < n_columns; i++) {
1873  if (i > 0) {
1874  grn_expr_append_op(ctx, expr, GRN_OP_COMMA, 2);
1875  }
1876  grn_expr_append_const(ctx, expr, columns[i], GRN_OP_GET_VALUE, 1);
1877  GRN_PTR_PUT(ctx, &e->objs, columns[i]);
1878  }
1879 
1880  GRN_OBJ_FIN(ctx, &columns_buffer);
1881 
1882  if (n_columns > 0) {
1883  yygotominor.yy0 = GRN_FALSE;
1884  } else {
1885  yygotominor.yy0 = GRN_TRUE;
1886  }
1887  } else {
1888  /* TODO: report error */
1889  yygotominor.yy0 = GRN_TRUE;
1890  }
1891 }
1892 #line 1893 "ecmascript.c"
1893  break;
1894  case 122: /* output_column ::= NONEXISTENT_COLUMN */
1895 #line 427 "ecmascript.y"
1896 {
1897  yygotominor.yy0 = GRN_TRUE;
1898 }
1899 #line 1900 "ecmascript.c"
1900  break;
1901  case 123: /* output_column ::= assignment_expression */
1902 #line 430 "ecmascript.y"
1903 {
1904  yygotominor.yy0 = GRN_FALSE;
1905 }
1906 #line 1907 "ecmascript.c"
1907  break;
1908  default:
1909  /* (0) input ::= query */ yytestcase(yyruleno==0);
1910  /* (1) input ::= expression */ yytestcase(yyruleno==1);
1911  /* (2) input ::= START_OUTPUT_COLUMNS output_columns */ yytestcase(yyruleno==2);
1912  /* (3) query ::= query_element */ yytestcase(yyruleno==3);
1913  /* (8) query_element ::= QSTRING */ yytestcase(yyruleno==8);
1914  /* (9) query_element ::= PARENL query PARENR */ yytestcase(yyruleno==9);
1915  /* (14) expression ::= assignment_expression */ yytestcase(yyruleno==14);
1916  /* (16) assignment_expression ::= conditional_expression */ yytestcase(yyruleno==16);
1917  /* (29) conditional_expression ::= logical_or_expression */ yytestcase(yyruleno==29);
1918  /* (31) logical_or_expression ::= logical_and_expression */ yytestcase(yyruleno==31);
1919  /* (33) logical_and_expression ::= bitwise_or_expression */ yytestcase(yyruleno==33);
1920  /* (36) bitwise_or_expression ::= bitwise_xor_expression */ yytestcase(yyruleno==36);
1921  /* (38) bitwise_xor_expression ::= bitwise_and_expression */ yytestcase(yyruleno==38);
1922  /* (40) bitwise_and_expression ::= equality_expression */ yytestcase(yyruleno==40);
1923  /* (42) equality_expression ::= relational_expression */ yytestcase(yyruleno==42);
1924  /* (45) relational_expression ::= shift_expression */ yytestcase(yyruleno==45);
1925  /* (59) shift_expression ::= additive_expression */ yytestcase(yyruleno==59);
1926  /* (63) additive_expression ::= multiplicative_expression */ yytestcase(yyruleno==63);
1927  /* (66) multiplicative_expression ::= unary_expression */ yytestcase(yyruleno==66);
1928  /* (70) unary_expression ::= postfix_expression */ yytestcase(yyruleno==70);
1929  /* (82) postfix_expression ::= lefthand_side_expression */ yytestcase(yyruleno==82);
1930  /* (85) lefthand_side_expression ::= call_expression */ yytestcase(yyruleno==85);
1931  /* (86) lefthand_side_expression ::= member_expression */ yytestcase(yyruleno==86);
1932  /* (88) member_expression ::= primary_expression */ yytestcase(yyruleno==88);
1933  /* (89) member_expression ::= member_expression member_expression_part */ yytestcase(yyruleno==89);
1934  /* (90) primary_expression ::= object_literal */ yytestcase(yyruleno==90);
1935  /* (91) primary_expression ::= PARENL expression PARENR */ yytestcase(yyruleno==91);
1936  /* (92) primary_expression ::= IDENTIFIER */ yytestcase(yyruleno==92);
1937  /* (93) primary_expression ::= array_literal */ yytestcase(yyruleno==93);
1938  /* (94) primary_expression ::= DECIMAL */ yytestcase(yyruleno==94);
1939  /* (95) primary_expression ::= HEX_INTEGER */ yytestcase(yyruleno==95);
1940  /* (96) primary_expression ::= STRING */ yytestcase(yyruleno==96);
1941  /* (97) primary_expression ::= BOOLEAN */ yytestcase(yyruleno==97);
1942  /* (98) primary_expression ::= NULL */ yytestcase(yyruleno==98);
1943  /* (99) array_literal ::= BRACKETL elision BRACKETR */ yytestcase(yyruleno==99);
1944  /* (100) array_literal ::= BRACKETL element_list elision BRACKETR */ yytestcase(yyruleno==100);
1945  /* (101) array_literal ::= BRACKETL element_list BRACKETR */ yytestcase(yyruleno==101);
1946  /* (102) elision ::= COMMA */ yytestcase(yyruleno==102);
1947  /* (103) elision ::= elision COMMA */ yytestcase(yyruleno==103);
1948  /* (104) element_list ::= assignment_expression */ yytestcase(yyruleno==104);
1949  /* (105) element_list ::= elision assignment_expression */ yytestcase(yyruleno==105);
1950  /* (106) element_list ::= element_list elision assignment_expression */ yytestcase(yyruleno==106);
1951  /* (107) object_literal ::= BRACEL property_name_and_value_list BRACER */ yytestcase(yyruleno==107);
1952  /* (108) property_name_and_value_list ::= */ yytestcase(yyruleno==108);
1953  /* (109) property_name_and_value_list ::= property_name_and_value_list COMMA property_name_and_value */ yytestcase(yyruleno==109);
1954  /* (110) property_name_and_value ::= property_name COLON assignment_expression */ yytestcase(yyruleno==110);
1955  /* (111) property_name ::= IDENTIFIER|STRING|DECIMAL */ yytestcase(yyruleno==111);
1956  /* (113) member_expression_part ::= DOT IDENTIFIER */ yytestcase(yyruleno==113);
1957  break;
1958  };
1959  yygoto = yyRuleInfo[yyruleno].lhs;
1960  yysize = yyRuleInfo[yyruleno].nrhs;
1961  yypParser->yyidx -= yysize;
1962  yyact = yy_find_reduce_action(yymsp[-yysize].stateno,(YYCODETYPE)yygoto);
1963  if( yyact < YYNSTATE ){
1964 #ifdef NDEBUG
1965  /* If we are not debugging and the reduce action popped at least
1966  ** one element off the stack, then we can push the new element back
1967  ** onto the stack here, and skip the stack overflow test in yy_shift().
1968  ** That gives a significant speed improvement. */
1969  if( yysize ){
1970  yypParser->yyidx++;
1971  yymsp -= yysize-1;
1972  yymsp->stateno = (YYACTIONTYPE)yyact;
1973  yymsp->major = (YYCODETYPE)yygoto;
1974  yymsp->minor = yygotominor;
1975  }else
1976 #endif
1977  {
1978  yy_shift(yypParser,yyact,yygoto,&yygotominor);
1979  }
1980  }else{
1981  assert( yyact == YYNSTATE + YYNRULE + 1 );
1982  yy_accept(yypParser);
1983  }
1984 }
1985 
1986 /*
1987 ** The following code executes when the parse fails
1988 */
1989 #ifndef YYNOERRORRECOVERY
1990 static void yy_parse_failed(
1991  yyParser *yypParser /* The parser */
1992 ){
1994 #ifndef NDEBUG
1995  if( yyTraceFILE ){
1996  fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt);
1997  }
1998 #endif
1999  while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
2000  /* Here code is inserted which will be executed whenever the
2001  ** parser fails */
2002  grn_expr_parserARG_STORE; /* Suppress warning about unused %extra_argument variable */
2003 }
2004 #endif /* YYNOERRORRECOVERY */
2005 
2006 /*
2007 ** The following code executes when a syntax error first occurs.
2008 */
2009 static void yy_syntax_error(
2010  yyParser *yypParser, /* The parser */
2011  int yymajor, /* The major type of the error token */
2012  YYMINORTYPE yyminor /* The minor type of the error token */
2013 ){
2015 #define TOKEN (yyminor.yy0)
2016 #line 11 "ecmascript.y"
2017 
2018  {
2019  grn_ctx *ctx = efsi->ctx;
2020  grn_obj buf;
2021  if (ctx->rc == GRN_SUCCESS) {
2022  GRN_TEXT_INIT(&buf, 0);
2023  GRN_TEXT_PUT(ctx, &buf, efsi->str, efsi->str_end - efsi->str);
2024  GRN_TEXT_PUTC(ctx, &buf, '\0');
2025  ERR(GRN_SYNTAX_ERROR, "Syntax error! (%s)", GRN_TEXT_VALUE(&buf));
2026  GRN_OBJ_FIN(ctx, &buf);
2027  }
2028  }
2029 #line 2030 "ecmascript.c"
2030  grn_expr_parserARG_STORE; /* Suppress warning about unused %extra_argument variable */
2031 }
2032 
2033 /*
2034 ** The following is executed when the parser accepts
2035 */
2036 static void yy_accept(
2037  yyParser *yypParser /* The parser */
2038 ){
2040 #ifndef NDEBUG
2041  if( yyTraceFILE ){
2042  fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt);
2043  }
2044 #endif
2045  while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
2046  /* Here code is inserted which will be executed whenever the
2047  ** parser accepts */
2048  grn_expr_parserARG_STORE; /* Suppress warning about unused %extra_argument variable */
2049 }
2050 
2051 /* The main parser program.
2052 ** The first argument is a pointer to a structure obtained from
2053 ** "grn_expr_parserAlloc" which describes the current state of the parser.
2054 ** The second argument is the major token number. The third is
2055 ** the minor token. The fourth optional argument is whatever the
2056 ** user wants (and specified in the grammar) and is available for
2057 ** use by the action routines.
2058 **
2059 ** Inputs:
2060 ** <ul>
2061 ** <li> A pointer to the parser (an opaque structure.)
2062 ** <li> The major token number.
2063 ** <li> The minor token number.
2064 ** <li> An option argument of a grammar-specified type.
2065 ** </ul>
2066 **
2067 ** Outputs:
2068 ** None.
2069 */
2071  void *yyp, /* The parser */
2072  int yymajor, /* The major token code number */
2073  grn_expr_parserTOKENTYPE yyminor /* The value for the token */
2074  grn_expr_parserARG_PDECL /* Optional %extra_argument parameter */
2075 ){
2076  YYMINORTYPE yyminorunion;
2077  int yyact; /* The parser action. */
2078  int yyendofinput; /* True if we are at the end of input */
2079 #ifdef YYERRORSYMBOL
2080  int yyerrorhit = 0; /* True if yymajor has invoked an error */
2081 #endif
2082  yyParser *yypParser; /* The parser */
2083 
2084  /* (re)initialize the parser, if necessary */
2085  yypParser = (yyParser*)yyp;
2086  if( yypParser->yyidx<0 ){
2087 #if YYSTACKDEPTH<=0
2088  if( yypParser->yystksz <=0 ){
2089  /*memset(&yyminorunion, 0, sizeof(yyminorunion));*/
2090  yyminorunion = yyzerominor;
2091  yyStackOverflow(yypParser, &yyminorunion);
2092  return;
2093  }
2094 #endif
2095  yypParser->yyidx = 0;
2096  yypParser->yyerrcnt = -1;
2097  yypParser->yystack[0].stateno = 0;
2098  yypParser->yystack[0].major = 0;
2099  }
2100  yyminorunion.yy0 = yyminor;
2101  yyendofinput = (yymajor==0);
2103 
2104 #ifndef NDEBUG
2105  if( yyTraceFILE ){
2106  fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]);
2107  }
2108 #endif
2109 
2110  do{
2111  yyact = yy_find_shift_action(yypParser,(YYCODETYPE)yymajor);
2112  if( yyact<YYNSTATE ){
2113  assert( !yyendofinput ); /* Impossible to shift the $ token */
2114  yy_shift(yypParser,yyact,yymajor,&yyminorunion);
2115  yypParser->yyerrcnt--;
2116  yymajor = YYNOCODE;
2117  }else if( yyact < YYNSTATE + YYNRULE ){
2118  yy_reduce(yypParser,yyact-YYNSTATE);
2119  }else{
2120  assert( yyact == YY_ERROR_ACTION );
2121 #ifdef YYERRORSYMBOL
2122  int yymx;
2123 #endif
2124 #ifndef NDEBUG
2125  if( yyTraceFILE ){
2126  fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt);
2127  }
2128 #endif
2129 #ifdef YYERRORSYMBOL
2130  /* A syntax error has occurred.
2131  ** The response to an error depends upon whether or not the
2132  ** grammar defines an error token "ERROR".
2133  **
2134  ** This is what we do if the grammar does define ERROR:
2135  **
2136  ** * Call the %syntax_error function.
2137  **
2138  ** * Begin popping the stack until we enter a state where
2139  ** it is legal to shift the error symbol, then shift
2140  ** the error symbol.
2141  **
2142  ** * Set the error count to three.
2143  **
2144  ** * Begin accepting and shifting new tokens. No new error
2145  ** processing will occur until three tokens have been
2146  ** shifted successfully.
2147  **
2148  */
2149  if( yypParser->yyerrcnt<0 ){
2150  yy_syntax_error(yypParser,yymajor,yyminorunion);
2151  }
2152  yymx = yypParser->yystack[yypParser->yyidx].major;
2153  if( yymx==YYERRORSYMBOL || yyerrorhit ){
2154 #ifndef NDEBUG
2155  if( yyTraceFILE ){
2156  fprintf(yyTraceFILE,"%sDiscard input token %s\n",
2157  yyTracePrompt,yyTokenName[yymajor]);
2158  }
2159 #endif
2160  yy_destructor(yypParser, (YYCODETYPE)yymajor,&yyminorunion);
2161  yymajor = YYNOCODE;
2162  }else{
2163  while(
2164  yypParser->yyidx >= 0 &&
2165  yymx != YYERRORSYMBOL &&
2166  (yyact = yy_find_reduce_action(
2167  yypParser->yystack[yypParser->yyidx].stateno,
2168  YYERRORSYMBOL)) >= YYNSTATE
2169  ){
2170  yy_pop_parser_stack(yypParser);
2171  }
2172  if( yypParser->yyidx < 0 || yymajor==0 ){
2173  yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
2174  yy_parse_failed(yypParser);
2175  yymajor = YYNOCODE;
2176  }else if( yymx!=YYERRORSYMBOL ){
2177  YYMINORTYPE u2;
2178  u2.YYERRSYMDT = 0;
2179  yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2);
2180  }
2181  }
2182  yypParser->yyerrcnt = 3;
2183  yyerrorhit = 1;
2184 #elif defined(YYNOERRORRECOVERY)
2185  /* If the YYNOERRORRECOVERY macro is defined, then do not attempt to
2186  ** do any kind of error recovery. Instead, simply invoke the syntax
2187  ** error routine and continue going as if nothing had happened.
2188  **
2189  ** Applications can set this macro (for example inside %include) if
2190  ** they intend to abandon the parse upon the first syntax error seen.
2191  */
2192  yy_syntax_error(yypParser,yymajor,yyminorunion);
2193  yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
2194  yymajor = YYNOCODE;
2195 
2196 #else /* YYERRORSYMBOL is not defined */
2197  /* This is what we do if the grammar does not define ERROR:
2198  **
2199  ** * Report an error message, and throw away the input token.
2200  **
2201  ** * If the input token is $, then fail the parse.
2202  **
2203  ** As before, subsequent error messages are suppressed until
2204  ** three input tokens have been successfully shifted.
2205  */
2206  if( yypParser->yyerrcnt<=0 ){
2207  yy_syntax_error(yypParser,yymajor,yyminorunion);
2208  }
2209  yypParser->yyerrcnt = 3;
2210  yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
2211  if( yyendofinput ){
2212  yy_parse_failed(yypParser);
2213  }
2214  yymajor = YYNOCODE;
2215 #endif
2216  }
2217  }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 );
2218  return;
2219 }