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