44039655649eff234c4a205acdbc3cec17d376ff
[reactos.git] / reactos / dll / win32 / jscript / parser.tab.c
1 /* A Bison parser, made by GNU Bison 2.5. */
2
3 /* Bison implementation for Yacc-like parsers in C
4
5 Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
6
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
20 /* As a special exception, you may create a larger work that contains
21 part or all of the Bison parser skeleton and distribute that work
22 under terms of your choice, so long as that work isn't itself a
23 parser generator using the skeleton or a modified version thereof
24 as a parser skeleton. Alternatively, if you modify or redistribute
25 the parser skeleton itself, you may (at your option) remove this
26 special exception, which will cause the skeleton and the resulting
27 Bison output files to be licensed under the GNU General Public
28 License without this special exception.
29
30 This special exception was added by the Free Software Foundation in
31 version 2.2 of Bison. */
32
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34 simplifying the original so-called "semantic" parser. */
35
36 /* All symbols defined below should begin with yy or YY, to avoid
37 infringing on user name space. This should be done even for local
38 variables, as they might otherwise be expanded by user macros.
39 There are some unavoidable exceptions within include files to
40 define necessary library symbols; they are noted "INFRINGES ON
41 USER NAME SPACE" below. */
42
43 /* Identify Bison output. */
44 #define YYBISON 1
45
46 /* Bison version. */
47 #define YYBISON_VERSION "2.5"
48
49 /* Skeleton name. */
50 #define YYSKELETON_NAME "yacc.c"
51
52 /* Pure parsers. */
53 #define YYPURE 1
54
55 /* Push parsers. */
56 #define YYPUSH 0
57
58 /* Pull parsers. */
59 #define YYPULL 1
60
61 /* Using locations. */
62 #define YYLSP_NEEDED 0
63
64 /* Substitute the variable and function names. */
65 #define yyparse parser_parse
66 #define yylex parser_lex
67 #define yyerror parser_error
68 #define yylval parser_lval
69 #define yychar parser_char
70 #define yydebug parser_debug
71 #define yynerrs parser_nerrs
72
73
74 /* Copy the first part of user declarations. */
75
76 /* Line 268 of yacc.c */
77 #line 19 "parser.y"
78
79 #include "jscript.h"
80
81 static int parser_error(parser_ctx_t*,const char*);
82 static void set_error(parser_ctx_t*,UINT);
83 static BOOL explicit_error(parser_ctx_t*,void*,WCHAR);
84 static BOOL allow_auto_semicolon(parser_ctx_t*);
85 static void program_parsed(parser_ctx_t*,source_elements_t*);
86
87 typedef struct _statement_list_t {
88 statement_t *head;
89 statement_t *tail;
90 } statement_list_t;
91
92 static literal_t *new_string_literal(parser_ctx_t*,const WCHAR*);
93 static literal_t *new_null_literal(parser_ctx_t*);
94
95 typedef struct _property_list_t {
96 prop_val_t *head;
97 prop_val_t *tail;
98 } property_list_t;
99
100 static property_list_t *new_property_list(parser_ctx_t*,literal_t*,expression_t*);
101 static property_list_t *property_list_add(parser_ctx_t*,property_list_t*,literal_t*,expression_t*);
102
103 typedef struct _element_list_t {
104 array_element_t *head;
105 array_element_t *tail;
106 } element_list_t;
107
108 static element_list_t *new_element_list(parser_ctx_t*,int,expression_t*);
109 static element_list_t *element_list_add(parser_ctx_t*,element_list_t*,int,expression_t*);
110
111 typedef struct _argument_list_t {
112 argument_t *head;
113 argument_t *tail;
114 } argument_list_t;
115
116 static argument_list_t *new_argument_list(parser_ctx_t*,expression_t*);
117 static argument_list_t *argument_list_add(parser_ctx_t*,argument_list_t*,expression_t*);
118
119 typedef struct _case_list_t {
120 case_clausule_t *head;
121 case_clausule_t *tail;
122 } case_list_t;
123
124 static catch_block_t *new_catch_block(parser_ctx_t*,const WCHAR*,statement_t*);
125 static case_clausule_t *new_case_clausule(parser_ctx_t*,expression_t*,statement_list_t*);
126 static case_list_t *new_case_list(parser_ctx_t*,case_clausule_t*);
127 static case_list_t *case_list_add(parser_ctx_t*,case_list_t*,case_clausule_t*);
128 static case_clausule_t *new_case_block(parser_ctx_t*,case_list_t*,case_clausule_t*,case_list_t*);
129
130 typedef struct _variable_list_t {
131 variable_declaration_t *head;
132 variable_declaration_t *tail;
133 } variable_list_t;
134
135 static variable_declaration_t *new_variable_declaration(parser_ctx_t*,const WCHAR*,expression_t*);
136 static variable_list_t *new_variable_list(parser_ctx_t*,variable_declaration_t*);
137 static variable_list_t *variable_list_add(parser_ctx_t*,variable_list_t*,variable_declaration_t*);
138
139 static void *new_statement(parser_ctx_t*,statement_type_t,size_t);
140 static statement_t *new_block_statement(parser_ctx_t*,statement_list_t*);
141 static statement_t *new_var_statement(parser_ctx_t*,variable_list_t*);
142 static statement_t *new_expression_statement(parser_ctx_t*,expression_t*);
143 static statement_t *new_if_statement(parser_ctx_t*,expression_t*,statement_t*,statement_t*);
144 static statement_t *new_while_statement(parser_ctx_t*,BOOL,expression_t*,statement_t*);
145 static statement_t *new_for_statement(parser_ctx_t*,variable_list_t*,expression_t*,expression_t*,
146 expression_t*,statement_t*);
147 static statement_t *new_forin_statement(parser_ctx_t*,variable_declaration_t*,expression_t*,expression_t*,statement_t*);
148 static statement_t *new_continue_statement(parser_ctx_t*,const WCHAR*);
149 static statement_t *new_break_statement(parser_ctx_t*,const WCHAR*);
150 static statement_t *new_return_statement(parser_ctx_t*,expression_t*);
151 static statement_t *new_with_statement(parser_ctx_t*,expression_t*,statement_t*);
152 static statement_t *new_labelled_statement(parser_ctx_t*,const WCHAR*,statement_t*);
153 static statement_t *new_switch_statement(parser_ctx_t*,expression_t*,case_clausule_t*);
154 static statement_t *new_throw_statement(parser_ctx_t*,expression_t*);
155 static statement_t *new_try_statement(parser_ctx_t*,statement_t*,catch_block_t*,statement_t*);
156
157 struct statement_list_t {
158 statement_t *head;
159 statement_t *tail;
160 };
161
162 static statement_list_t *new_statement_list(parser_ctx_t*,statement_t*);
163 static statement_list_t *statement_list_add(statement_list_t*,statement_t*);
164
165 typedef struct _parameter_list_t {
166 parameter_t *head;
167 parameter_t *tail;
168 } parameter_list_t;
169
170 static parameter_list_t *new_parameter_list(parser_ctx_t*,const WCHAR*);
171 static parameter_list_t *parameter_list_add(parser_ctx_t*,parameter_list_t*,const WCHAR*);
172
173 static void *new_expression(parser_ctx_t *ctx,expression_type_t,size_t);
174 static expression_t *new_function_expression(parser_ctx_t*,const WCHAR*,parameter_list_t*,
175 source_elements_t*,const WCHAR*,DWORD);
176 static expression_t *new_binary_expression(parser_ctx_t*,expression_type_t,expression_t*,expression_t*);
177 static expression_t *new_unary_expression(parser_ctx_t*,expression_type_t,expression_t*);
178 static expression_t *new_conditional_expression(parser_ctx_t*,expression_t*,expression_t*,expression_t*);
179 static expression_t *new_member_expression(parser_ctx_t*,expression_t*,const WCHAR*);
180 static expression_t *new_new_expression(parser_ctx_t*,expression_t*,argument_list_t*);
181 static expression_t *new_call_expression(parser_ctx_t*,expression_t*,argument_list_t*);
182 static expression_t *new_identifier_expression(parser_ctx_t*,const WCHAR*);
183 static expression_t *new_literal_expression(parser_ctx_t*,literal_t*);
184 static expression_t *new_array_literal_expression(parser_ctx_t*,element_list_t*,int);
185 static expression_t *new_prop_and_value_expression(parser_ctx_t*,property_list_t*);
186
187 static source_elements_t *new_source_elements(parser_ctx_t*);
188 static source_elements_t *source_elements_add_statement(source_elements_t*,statement_t*);
189
190
191
192 /* Line 268 of yacc.c */
193 #line 200 "parser.tab.c"
194
195 /* Enabling traces. */
196 #ifndef YYDEBUG
197 # define YYDEBUG 0
198 #endif
199
200 /* Enabling verbose error messages. */
201 #ifdef YYERROR_VERBOSE
202 # undef YYERROR_VERBOSE
203 # define YYERROR_VERBOSE 1
204 #else
205 # define YYERROR_VERBOSE 0
206 #endif
207
208 /* Enabling the token table. */
209 #ifndef YYTOKEN_TABLE
210 # define YYTOKEN_TABLE 0
211 #endif
212
213
214 /* Tokens. */
215 #ifndef YYTOKENTYPE
216 # define YYTOKENTYPE
217 /* Put the tokens into the symbol table, so that GDB and other debuggers
218 know about them. */
219 enum yytokentype {
220 kBREAK = 258,
221 kCASE = 259,
222 kCATCH = 260,
223 kCONTINUE = 261,
224 kDEFAULT = 262,
225 kDELETE = 263,
226 kDO = 264,
227 kELSE = 265,
228 kIF = 266,
229 kFINALLY = 267,
230 kFOR = 268,
231 kIN = 269,
232 kINSTANCEOF = 270,
233 kNEW = 271,
234 kNULL = 272,
235 kRETURN = 273,
236 kSWITCH = 274,
237 kTHIS = 275,
238 kTHROW = 276,
239 kTRUE = 277,
240 kFALSE = 278,
241 kTRY = 279,
242 kTYPEOF = 280,
243 kVAR = 281,
244 kVOID = 282,
245 kWHILE = 283,
246 kWITH = 284,
247 tANDAND = 285,
248 tOROR = 286,
249 tINC = 287,
250 tDEC = 288,
251 tHTMLCOMMENT = 289,
252 kDIVEQ = 290,
253 kFUNCTION = 291,
254 tIdentifier = 292,
255 tAssignOper = 293,
256 tEqOper = 294,
257 tShiftOper = 295,
258 tRelOper = 296,
259 tNumericLiteral = 297,
260 tBooleanLiteral = 298,
261 tStringLiteral = 299,
262 tEOF = 300,
263 LOWER_THAN_ELSE = 301
264 };
265 #endif
266
267
268
269 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
270 typedef union YYSTYPE
271 {
272
273 /* Line 293 of yacc.c */
274 #line 144 "parser.y"
275
276 int ival;
277 const WCHAR *srcptr;
278 LPCWSTR wstr;
279 literal_t *literal;
280 struct _argument_list_t *argument_list;
281 case_clausule_t *case_clausule;
282 struct _case_list_t *case_list;
283 catch_block_t *catch_block;
284 struct _element_list_t *element_list;
285 expression_t *expr;
286 const WCHAR *identifier;
287 struct _parameter_list_t *parameter_list;
288 struct _property_list_t *property_list;
289 source_elements_t *source_elements;
290 statement_t *statement;
291 struct _statement_list_t *statement_list;
292 struct _variable_list_t *variable_list;
293 variable_declaration_t *variable_declaration;
294
295
296
297 /* Line 293 of yacc.c */
298 #line 305 "parser.tab.c"
299 } YYSTYPE;
300 # define YYSTYPE_IS_TRIVIAL 1
301 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
302 # define YYSTYPE_IS_DECLARED 1
303 #endif
304
305
306 /* Copy the second part of user declarations. */
307
308
309 /* Line 343 of yacc.c */
310 #line 317 "parser.tab.c"
311
312 #ifdef short
313 # undef short
314 #endif
315
316 #ifdef YYTYPE_UINT8
317 typedef YYTYPE_UINT8 yytype_uint8;
318 #else
319 typedef unsigned char yytype_uint8;
320 #endif
321
322 #ifdef YYTYPE_INT8
323 typedef YYTYPE_INT8 yytype_int8;
324 #elif (defined __STDC__ || defined __C99__FUNC__ \
325 || defined __cplusplus || defined _MSC_VER)
326 typedef signed char yytype_int8;
327 #else
328 typedef short int yytype_int8;
329 #endif
330
331 #ifdef YYTYPE_UINT16
332 typedef YYTYPE_UINT16 yytype_uint16;
333 #else
334 typedef unsigned short int yytype_uint16;
335 #endif
336
337 #ifdef YYTYPE_INT16
338 typedef YYTYPE_INT16 yytype_int16;
339 #else
340 typedef short int yytype_int16;
341 #endif
342
343 #ifndef YYSIZE_T
344 # ifdef __SIZE_TYPE__
345 # define YYSIZE_T __SIZE_TYPE__
346 # elif defined size_t
347 # define YYSIZE_T size_t
348 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
349 || defined __cplusplus || defined _MSC_VER)
350 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
351 # define YYSIZE_T size_t
352 # else
353 # define YYSIZE_T unsigned int
354 # endif
355 #endif
356
357 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
358
359 #ifndef YY_
360 # if defined YYENABLE_NLS && YYENABLE_NLS
361 # if ENABLE_NLS
362 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
363 # define YY_(msgid) dgettext ("bison-runtime", msgid)
364 # endif
365 # endif
366 # ifndef YY_
367 # define YY_(msgid) msgid
368 # endif
369 #endif
370
371 /* Suppress unused-variable warnings by "using" E. */
372 #if ! defined lint || defined __GNUC__
373 # define YYUSE(e) ((void) (e))
374 #else
375 # define YYUSE(e) /* empty */
376 #endif
377
378 /* Identity function, used to suppress warnings about constant conditions. */
379 #ifndef lint
380 # define YYID(n) (n)
381 #else
382 #if (defined __STDC__ || defined __C99__FUNC__ \
383 || defined __cplusplus || defined _MSC_VER)
384 static int
385 YYID (int yyi)
386 #else
387 static int
388 YYID (yyi)
389 int yyi;
390 #endif
391 {
392 return yyi;
393 }
394 #endif
395
396 #if ! defined yyoverflow || YYERROR_VERBOSE
397
398 /* The parser invokes alloca or malloc; define the necessary symbols. */
399
400 # ifdef YYSTACK_USE_ALLOCA
401 # if YYSTACK_USE_ALLOCA
402 # ifdef __GNUC__
403 # define YYSTACK_ALLOC __builtin_alloca
404 # elif defined __BUILTIN_VA_ARG_INCR
405 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
406 # elif defined _AIX
407 # define YYSTACK_ALLOC __alloca
408 # elif defined _MSC_VER
409 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
410 # define alloca _alloca
411 # else
412 # define YYSTACK_ALLOC alloca
413 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
414 || defined __cplusplus || defined _MSC_VER)
415 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
416 # ifndef EXIT_SUCCESS
417 # define EXIT_SUCCESS 0
418 # endif
419 # endif
420 # endif
421 # endif
422 # endif
423
424 # ifdef YYSTACK_ALLOC
425 /* Pacify GCC's `empty if-body' warning. */
426 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
427 # ifndef YYSTACK_ALLOC_MAXIMUM
428 /* The OS might guarantee only one guard page at the bottom of the stack,
429 and a page size can be as small as 4096 bytes. So we cannot safely
430 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
431 to allow for a few compiler-allocated temporary stack slots. */
432 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
433 # endif
434 # else
435 # define YYSTACK_ALLOC YYMALLOC
436 # define YYSTACK_FREE YYFREE
437 # ifndef YYSTACK_ALLOC_MAXIMUM
438 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
439 # endif
440 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
441 && ! ((defined YYMALLOC || defined malloc) \
442 && (defined YYFREE || defined free)))
443 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
444 # ifndef EXIT_SUCCESS
445 # define EXIT_SUCCESS 0
446 # endif
447 # endif
448 # ifndef YYMALLOC
449 # define YYMALLOC malloc
450 # if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
451 || defined __cplusplus || defined _MSC_VER)
452 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
453 # endif
454 # endif
455 # ifndef YYFREE
456 # define YYFREE free
457 # if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
458 || defined __cplusplus || defined _MSC_VER)
459 void free (void *); /* INFRINGES ON USER NAME SPACE */
460 # endif
461 # endif
462 # endif
463 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
464
465
466 #if (! defined yyoverflow \
467 && (! defined __cplusplus \
468 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
469
470 /* A type that is properly aligned for any stack member. */
471 union yyalloc
472 {
473 yytype_int16 yyss_alloc;
474 YYSTYPE yyvs_alloc;
475 };
476
477 /* The size of the maximum gap between one aligned stack and the next. */
478 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
479
480 /* The size of an array large to enough to hold all stacks, each with
481 N elements. */
482 # define YYSTACK_BYTES(N) \
483 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
484 + YYSTACK_GAP_MAXIMUM)
485
486 # define YYCOPY_NEEDED 1
487
488 /* Relocate STACK from its old location to the new one. The
489 local variables YYSIZE and YYSTACKSIZE give the old and new number of
490 elements in the stack, and YYPTR gives the new location of the
491 stack. Advance YYPTR to a properly aligned location for the next
492 stack. */
493 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
494 do \
495 { \
496 YYSIZE_T yynewbytes; \
497 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
498 Stack = &yyptr->Stack_alloc; \
499 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
500 yyptr += yynewbytes / sizeof (*yyptr); \
501 } \
502 while (YYID (0))
503
504 #endif
505
506 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
507 /* Copy COUNT objects from FROM to TO. The source and destination do
508 not overlap. */
509 # ifndef YYCOPY
510 # if defined __GNUC__ && 1 < __GNUC__
511 # define YYCOPY(To, From, Count) \
512 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
513 # else
514 # define YYCOPY(To, From, Count) \
515 do \
516 { \
517 YYSIZE_T yyi; \
518 for (yyi = 0; yyi < (Count); yyi++) \
519 (To)[yyi] = (From)[yyi]; \
520 } \
521 while (YYID (0))
522 # endif
523 # endif
524 #endif /* !YYCOPY_NEEDED */
525
526 /* YYFINAL -- State number of the termination state. */
527 #define YYFINAL 3
528 /* YYLAST -- Last index in YYTABLE. */
529 #define YYLAST 1053
530
531 /* YYNTOKENS -- Number of terminals. */
532 #define YYNTOKENS 69
533 /* YYNNTS -- Number of nonterminals. */
534 #define YYNNTS 95
535 /* YYNRULES -- Number of rules. */
536 #define YYNRULES 215
537 /* YYNRULES -- Number of states. */
538 #define YYNSTATES 375
539
540 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
541 #define YYUNDEFTOK 2
542 #define YYMAXUTOK 301
543
544 #define YYTRANSLATE(YYX) \
545 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
546
547 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
548 static const yytype_uint8 yytranslate[] =
549 {
550 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
551 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
552 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
553 2, 2, 2, 63, 2, 2, 2, 61, 56, 2,
554 67, 68, 59, 57, 49, 58, 66, 60, 2, 2,
555 2, 2, 2, 2, 2, 2, 2, 2, 52, 51,
556 2, 50, 2, 53, 2, 2, 2, 2, 2, 2,
557 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
558 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
559 2, 64, 2, 65, 55, 2, 2, 2, 2, 2,
560 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
561 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
562 2, 2, 2, 48, 54, 37, 62, 2, 2, 2,
563 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
564 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
565 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
566 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
567 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
568 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
569 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
570 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
571 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
572 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
573 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
574 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
575 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
576 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
577 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
578 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
579 35, 36, 38, 39, 40, 41, 42, 43, 44, 45,
580 46, 47
581 };
582
583 #if YYDEBUG
584 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
585 YYRHS. */
586 static const yytype_uint16 yyprhs[] =
587 {
588 0, 0, 3, 7, 9, 10, 11, 14, 23, 25,
589 27, 29, 33, 34, 36, 38, 40, 42, 44, 46,
590 48, 50, 52, 54, 56, 58, 60, 62, 64, 66,
591 68, 71, 72, 74, 78, 81, 85, 87, 91, 93,
592 97, 100, 103, 104, 106, 109, 110, 112, 115, 117,
593 120, 128, 134, 142, 148, 149, 150, 162, 163, 164,
594 177, 185, 194, 198, 202, 206, 212, 216, 222, 226,
595 232, 233, 235, 237, 240, 245, 249, 253, 257, 261,
596 266, 272, 275, 276, 278, 280, 282, 284, 288, 289,
597 291, 293, 297, 299, 301, 303, 307, 311, 313, 317,
598 321, 323, 329, 331, 337, 339, 343, 345, 349, 351,
599 355, 357, 361, 363, 367, 369, 373, 375, 379, 381,
600 385, 387, 391, 393, 397, 399, 403, 405, 409, 411,
601 415, 419, 423, 425, 429, 433, 435, 439, 441, 445,
602 449, 451, 455, 459, 463, 465, 468, 471, 474, 477,
603 480, 483, 486, 489, 492, 494, 497, 500, 502, 504,
604 506, 509, 511, 513, 518, 522, 526, 529, 532, 537,
605 541, 544, 548, 550, 554, 556, 558, 560, 562, 564,
606 568, 571, 575, 579, 585, 588, 593, 595, 598, 599,
607 601, 604, 608, 612, 618, 620, 622, 624, 625, 627,
608 629, 631, 633, 635, 637, 639, 641, 643, 645, 647,
609 649, 651, 653, 655, 657, 659
610 };
611
612 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
613 static const yytype_int16 yyrhs[] =
614 {
615 70, 0, -1, 72, 71, 46, -1, 34, -1, -1,
616 -1, 72, 78, -1, 74, 157, 161, 77, 162, 48,
617 75, 37, -1, 36, -1, 72, -1, 38, -1, 76,
618 49, 38, -1, -1, 76, -1, 81, -1, 82, -1,
619 91, -1, 73, -1, 92, -1, 93, -1, 94, -1,
620 99, -1, 100, -1, 101, -1, 102, -1, 103, -1,
621 104, -1, 110, -1, 111, -1, 78, -1, 79, 78,
622 -1, -1, 79, -1, 48, 79, 37, -1, 48, 37,
623 -1, 26, 83, 160, -1, 85, -1, 83, 49, 85,
624 -1, 86, -1, 84, 49, 86, -1, 38, 87, -1,
625 38, 89, -1, -1, 88, -1, 50, 120, -1, -1,
626 90, -1, 50, 121, -1, 51, -1, 116, 160, -1,
627 11, 161, 115, 162, 78, 10, 78, -1, 11, 161,
628 115, 162, 78, -1, 9, 78, 28, 161, 115, 162,
629 160, -1, 28, 161, 115, 162, 78, -1, -1, -1,
630 13, 161, 117, 95, 163, 114, 96, 163, 114, 162,
631 78, -1, -1, -1, 13, 161, 26, 84, 97, 163,
632 114, 98, 163, 114, 162, 78, -1, 13, 161, 143,
633 14, 115, 162, 78, -1, 13, 161, 26, 86, 14,
634 115, 162, 78, -1, 6, 157, 160, -1, 3, 157,
635 160, -1, 18, 114, 160, -1, 29, 161, 116, 162,
636 78, -1, 38, 52, 78, -1, 19, 161, 116, 162,
637 105, -1, 48, 106, 37, -1, 48, 106, 109, 106,
638 37, -1, -1, 107, -1, 108, -1, 107, 108, -1,
639 4, 116, 52, 80, -1, 7, 52, 80, -1, 21,
640 116, 160, -1, 24, 81, 112, -1, 24, 81, 113,
641 -1, 24, 81, 112, 113, -1, 5, 161, 38, 162,
642 81, -1, 12, 81, -1, -1, 116, -1, 116, -1,
643 1, -1, 120, -1, 116, 49, 120, -1, -1, 118,
644 -1, 121, -1, 118, 49, 121, -1, 39, -1, 35,
645 -1, 122, -1, 143, 50, 120, -1, 143, 119, 120,
646 -1, 123, -1, 143, 50, 121, -1, 143, 119, 121,
647 -1, 124, -1, 124, 53, 120, 52, 120, -1, 125,
648 -1, 125, 53, 121, 52, 121, -1, 126, -1, 124,
649 31, 126, -1, 127, -1, 125, 31, 127, -1, 128,
650 -1, 126, 30, 128, -1, 129, -1, 127, 30, 129,
651 -1, 130, -1, 128, 54, 130, -1, 131, -1, 129,
652 54, 131, -1, 132, -1, 130, 55, 132, -1, 133,
653 -1, 131, 55, 133, -1, 134, -1, 132, 56, 134,
654 -1, 135, -1, 133, 56, 135, -1, 136, -1, 134,
655 40, 136, -1, 137, -1, 135, 40, 137, -1, 138,
656 -1, 136, 42, 138, -1, 136, 15, 138, -1, 136,
657 14, 138, -1, 138, -1, 137, 42, 138, -1, 137,
658 15, 138, -1, 139, -1, 138, 41, 139, -1, 140,
659 -1, 139, 57, 140, -1, 139, 58, 140, -1, 141,
660 -1, 140, 59, 141, -1, 140, 60, 141, -1, 140,
661 61, 141, -1, 142, -1, 8, 141, -1, 27, 141,
662 -1, 25, 141, -1, 32, 141, -1, 33, 141, -1,
663 57, 141, -1, 58, 141, -1, 62, 141, -1, 63,
664 141, -1, 143, -1, 143, 32, -1, 143, 33, -1,
665 144, -1, 146, -1, 145, -1, 16, 144, -1, 149,
666 -1, 73, -1, 145, 64, 116, 65, -1, 145, 66,
667 38, -1, 16, 145, 147, -1, 145, 147, -1, 146,
668 147, -1, 146, 64, 116, 65, -1, 146, 66, 38,
669 -1, 67, 68, -1, 67, 148, 68, -1, 120, -1,
670 148, 49, 120, -1, 20, -1, 38, -1, 158, -1,
671 150, -1, 154, -1, 67, 116, 68, -1, 64, 65,
672 -1, 64, 152, 65, -1, 64, 151, 65, -1, 64,
673 151, 49, 153, 65, -1, 153, 120, -1, 151, 49,
674 153, 120, -1, 49, -1, 152, 49, -1, -1, 152,
675 -1, 48, 37, -1, 48, 155, 37, -1, 156, 52,
676 120, -1, 155, 49, 156, 52, 120, -1, 38, -1,
677 45, -1, 43, -1, -1, 38, -1, 17, -1, 159,
678 -1, 43, -1, 45, -1, 60, -1, 35, -1, 22,
679 -1, 23, -1, 44, -1, 51, -1, 1, -1, 67,
680 -1, 1, -1, 68, -1, 1, -1, 51, -1, 1,
681 -1
682 };
683
684 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
685 static const yytype_uint16 yyrline[] =
686 {
687 0, 251, 251, 255, 256, 260, 261, 266, 270, 274,
688 278, 279, 284, 285, 289, 290, 291, 292, 293, 294,
689 295, 296, 297, 298, 299, 300, 301, 302, 303, 307,
690 308, 313, 314, 318, 319, 323, 328, 329, 334, 336,
691 341, 346, 351, 352, 356, 361, 362, 366, 371, 375,
692 380, 382, 387, 389, 392, 394, 391, 398, 400, 397,
693 403, 405, 410, 415, 420, 425, 430, 435, 440, 442,
694 447, 448, 452, 453, 458, 463, 468, 473, 474, 475,
695 480, 485, 489, 490, 493, 494, 498, 499, 504, 505,
696 509, 511, 515, 516, 520, 521, 523, 528, 530, 532,
697 537, 538, 543, 545, 550, 551, 556, 558, 563, 564,
698 569, 571, 576, 577, 582, 584, 589, 590, 595, 597,
699 602, 603, 608, 610, 615, 616, 621, 622, 627, 628,
700 630, 632, 637, 638, 640, 645, 646, 651, 653, 655,
701 660, 661, 663, 665, 670, 671, 673, 674, 676, 677,
702 678, 679, 680, 681, 685, 687, 689, 695, 696, 700,
703 701, 705, 706, 707, 709, 711, 716, 718, 720, 722,
704 727, 728, 732, 733, 738, 739, 740, 741, 742, 743,
705 747, 748, 749, 750, 755, 757, 762, 763, 767, 768,
706 772, 773, 778, 780, 785, 786, 787, 791, 792, 796,
707 797, 798, 799, 800, 802, 807, 808, 809, 812, 813,
708 816, 817, 820, 821, 824, 825
709 };
710 #endif
711
712 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
713 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
714 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
715 static const char *const yytname[] =
716 {
717 "$end", "error", "$undefined", "kBREAK", "kCASE", "kCATCH", "kCONTINUE",
718 "kDEFAULT", "kDELETE", "kDO", "kELSE", "kIF", "kFINALLY", "kFOR", "kIN",
719 "kINSTANCEOF", "kNEW", "kNULL", "kRETURN", "kSWITCH", "kTHIS", "kTHROW",
720 "kTRUE", "kFALSE", "kTRY", "kTYPEOF", "kVAR", "kVOID", "kWHILE", "kWITH",
721 "tANDAND", "tOROR", "tINC", "tDEC", "tHTMLCOMMENT", "kDIVEQ",
722 "kFUNCTION", "'}'", "tIdentifier", "tAssignOper", "tEqOper",
723 "tShiftOper", "tRelOper", "tNumericLiteral", "tBooleanLiteral",
724 "tStringLiteral", "tEOF", "LOWER_THAN_ELSE", "'{'", "','", "'='", "';'",
725 "':'", "'?'", "'|'", "'^'", "'&'", "'+'", "'-'", "'*'", "'/'", "'%'",
726 "'~'", "'!'", "'['", "']'", "'.'", "'('", "')'", "$accept", "Program",
727 "HtmlComment", "SourceElements", "FunctionExpression", "KFunction",
728 "FunctionBody", "FormalParameterList", "FormalParameterList_opt",
729 "Statement", "StatementList", "StatementList_opt", "Block",
730 "VariableStatement", "VariableDeclarationList",
731 "VariableDeclarationListNoIn", "VariableDeclaration",
732 "VariableDeclarationNoIn", "Initialiser_opt", "Initialiser",
733 "InitialiserNoIn_opt", "InitialiserNoIn", "EmptyStatement",
734 "ExpressionStatement", "IfStatement", "IterationStatement", "$@1", "$@2",
735 "$@3", "$@4", "ContinueStatement", "BreakStatement", "ReturnStatement",
736 "WithStatement", "LabelledStatement", "SwitchStatement", "CaseBlock",
737 "CaseClausules_opt", "CaseClausules", "CaseClausule", "DefaultClausule",
738 "ThrowStatement", "TryStatement", "Catch", "Finally", "Expression_opt",
739 "Expression_err", "Expression", "ExpressionNoIn_opt", "ExpressionNoIn",
740 "AssignOper", "AssignmentExpression", "AssignmentExpressionNoIn",
741 "ConditionalExpression", "ConditionalExpressionNoIn",
742 "LogicalORExpression", "LogicalORExpressionNoIn", "LogicalANDExpression",
743 "LogicalANDExpressionNoIn", "BitwiseORExpression",
744 "BitwiseORExpressionNoIn", "BitwiseXORExpression",
745 "BitwiseXORExpressionNoIn", "BitwiseANDExpression",
746 "BitwiseANDExpressionNoIn", "EqualityExpression",
747 "EqualityExpressionNoIn", "RelationalExpression",
748 "RelationalExpressionNoIn", "ShiftExpression", "AdditiveExpression",
749 "MultiplicativeExpression", "UnaryExpression", "PostfixExpression",
750 "LeftHandSideExpression", "NewExpression", "MemberExpression",
751 "CallExpression", "Arguments", "ArgumentList", "PrimaryExpression",
752 "ArrayLiteral", "ElementList", "Elision", "Elision_opt", "ObjectLiteral",
753 "PropertyNameAndValueList", "PropertyName", "Identifier_opt", "Literal",
754 "BooleanLiteral", "semicolon_opt", "left_bracket", "right_bracket",
755 "semicolon", 0
756 };
757 #endif
758
759 # ifdef YYPRINT
760 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
761 token YYLEX-NUM. */
762 static const yytype_uint16 yytoknum[] =
763 {
764 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
765 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
766 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
767 285, 286, 287, 288, 289, 290, 291, 125, 292, 293,
768 294, 295, 296, 297, 298, 299, 300, 301, 123, 44,
769 61, 59, 58, 63, 124, 94, 38, 43, 45, 42,
770 47, 37, 126, 33, 91, 93, 46, 40, 41
771 };
772 # endif
773
774 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
775 static const yytype_uint8 yyr1[] =
776 {
777 0, 69, 70, 71, 71, 72, 72, 73, 74, 75,
778 76, 76, 77, 77, 78, 78, 78, 78, 78, 78,
779 78, 78, 78, 78, 78, 78, 78, 78, 78, 79,
780 79, 80, 80, 81, 81, 82, 83, 83, 84, 84,
781 85, 86, 87, 87, 88, 89, 89, 90, 91, 92,
782 93, 93, 94, 94, 95, 96, 94, 97, 98, 94,
783 94, 94, 99, 100, 101, 102, 103, 104, 105, 105,
784 106, 106, 107, 107, 108, 109, 110, 111, 111, 111,
785 112, 113, 114, 114, 115, 115, 116, 116, 117, 117,
786 118, 118, 119, 119, 120, 120, 120, 121, 121, 121,
787 122, 122, 123, 123, 124, 124, 125, 125, 126, 126,
788 127, 127, 128, 128, 129, 129, 130, 130, 131, 131,
789 132, 132, 133, 133, 134, 134, 135, 135, 136, 136,
790 136, 136, 137, 137, 137, 138, 138, 139, 139, 139,
791 140, 140, 140, 140, 141, 141, 141, 141, 141, 141,
792 141, 141, 141, 141, 142, 142, 142, 143, 143, 144,
793 144, 145, 145, 145, 145, 145, 146, 146, 146, 146,
794 147, 147, 148, 148, 149, 149, 149, 149, 149, 149,
795 150, 150, 150, 150, 151, 151, 152, 152, 153, 153,
796 154, 154, 155, 155, 156, 156, 156, 157, 157, 158,
797 158, 158, 158, 158, 158, 159, 159, 159, 160, 160,
798 161, 161, 162, 162, 163, 163
799 };
800
801 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
802 static const yytype_uint8 yyr2[] =
803 {
804 0, 2, 3, 1, 0, 0, 2, 8, 1, 1,
805 1, 3, 0, 1, 1, 1, 1, 1, 1, 1,
806 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
807 2, 0, 1, 3, 2, 3, 1, 3, 1, 3,
808 2, 2, 0, 1, 2, 0, 1, 2, 1, 2,
809 7, 5, 7, 5, 0, 0, 11, 0, 0, 12,
810 7, 8, 3, 3, 3, 5, 3, 5, 3, 5,
811 0, 1, 1, 2, 4, 3, 3, 3, 3, 4,
812 5, 2, 0, 1, 1, 1, 1, 3, 0, 1,
813 1, 3, 1, 1, 1, 3, 3, 1, 3, 3,
814 1, 5, 1, 5, 1, 3, 1, 3, 1, 3,
815 1, 3, 1, 3, 1, 3, 1, 3, 1, 3,
816 1, 3, 1, 3, 1, 3, 1, 3, 1, 3,
817 3, 3, 1, 3, 3, 1, 3, 1, 3, 3,
818 1, 3, 3, 3, 1, 2, 2, 2, 2, 2,
819 2, 2, 2, 2, 1, 2, 2, 1, 1, 1,
820 2, 1, 1, 4, 3, 3, 2, 2, 4, 3,
821 2, 3, 1, 3, 1, 1, 1, 1, 1, 3,
822 2, 3, 3, 5, 2, 4, 1, 2, 0, 1,
823 2, 3, 3, 5, 1, 1, 1, 0, 1, 1,
824 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
825 1, 1, 1, 1, 1, 1
826 };
827
828 /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
829 Performed when YYTABLE doesn't specify something else to do. Zero
830 means the default is an error. */
831 static const yytype_uint8 yydefact[] =
832 {
833 5, 0, 4, 1, 197, 197, 0, 0, 0, 0,
834 0, 199, 82, 0, 174, 0, 205, 206, 0, 0,
835 0, 0, 0, 0, 0, 0, 3, 204, 8, 175,
836 201, 207, 202, 0, 48, 0, 0, 203, 0, 0,
837 188, 0, 0, 17, 197, 6, 14, 15, 16, 18,
838 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
839 0, 86, 94, 100, 104, 108, 112, 116, 120, 124,
840 128, 135, 137, 140, 144, 154, 157, 159, 158, 161,
841 177, 178, 176, 200, 198, 0, 0, 175, 0, 162,
842 145, 154, 0, 211, 210, 0, 88, 160, 159, 0,
843 83, 0, 0, 0, 0, 147, 42, 0, 36, 146,
844 0, 0, 148, 149, 0, 34, 175, 201, 202, 29,
845 0, 0, 0, 150, 151, 152, 153, 186, 180, 0,
846 189, 0, 0, 2, 0, 209, 0, 208, 49, 0,
847 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
848 0, 0, 0, 0, 0, 155, 156, 93, 92, 0,
849 0, 0, 0, 0, 166, 0, 0, 167, 63, 62,
850 190, 194, 196, 195, 0, 85, 0, 84, 0, 54,
851 89, 90, 97, 102, 106, 110, 114, 118, 122, 126,
852 132, 154, 165, 64, 0, 76, 34, 0, 0, 77,
853 78, 0, 40, 43, 0, 35, 0, 0, 66, 33,
854 30, 191, 0, 0, 188, 182, 187, 181, 184, 179,
855 12, 87, 105, 0, 109, 113, 117, 121, 125, 131,
856 130, 129, 136, 138, 139, 141, 142, 143, 95, 96,
857 0, 164, 170, 172, 0, 0, 169, 0, 213, 212,
858 0, 45, 57, 38, 0, 0, 0, 0, 0, 0,
859 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
860 81, 79, 44, 37, 0, 0, 0, 192, 189, 0,
861 10, 13, 0, 0, 163, 0, 171, 168, 0, 51,
862 0, 41, 46, 0, 0, 0, 215, 214, 82, 91,
863 154, 107, 0, 111, 115, 119, 123, 127, 134, 133,
864 0, 98, 99, 70, 67, 0, 53, 65, 0, 183,
865 185, 0, 0, 101, 173, 0, 0, 47, 39, 82,
866 0, 55, 0, 0, 0, 0, 71, 72, 0, 193,
867 11, 5, 52, 50, 58, 0, 0, 103, 60, 0,
868 0, 68, 70, 73, 80, 9, 0, 0, 61, 82,
869 31, 31, 0, 7, 82, 0, 32, 74, 75, 69,
870 0, 0, 0, 56, 59
871 };
872
873 /* YYDEFGOTO[NTERM-NUM]. */
874 static const yytype_int16 yydefgoto[] =
875 {
876 -1, 1, 42, 2, 89, 44, 356, 281, 282, 119,
877 120, 367, 46, 47, 107, 252, 108, 253, 202, 203,
878 291, 292, 48, 49, 50, 51, 254, 346, 294, 357,
879 52, 53, 54, 55, 56, 57, 314, 335, 336, 337,
880 352, 58, 59, 199, 200, 99, 176, 60, 179, 180,
881 267, 61, 181, 62, 182, 63, 183, 64, 184, 65,
882 185, 66, 186, 67, 187, 68, 188, 69, 189, 70,
883 71, 72, 73, 74, 75, 76, 77, 78, 164, 244,
884 79, 80, 129, 130, 131, 81, 121, 122, 85, 82,
885 83, 138, 95, 250, 298
886 };
887
888 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
889 STATE-NUM. */
890 #define YYPACT_NINF -293
891 static const yytype_int16 yypact[] =
892 {
893 -293, 53, 496, -293, 26, 26, 956, 744, 8, 8,
894 986, -293, 956, 8, -293, 956, -293, -293, 39, 956,
895 71, 956, 8, 8, 956, 956, -293, -293, -293, 67,
896 -293, -293, -293, 558, -293, 956, 956, -293, 956, 956,
897 41, 956, 76, 410, 26, -293, -293, -293, -293, -293,
898 -293, -293, -293, -293, -293, -293, -293, -293, -293, -293,
899 19, -293, -293, -7, 102, 100, 108, 111, 135, 36,
900 142, -43, 97, -293, -293, 129, -293, 105, 118, -293,
901 -293, -293, -293, -293, -293, 7, 7, -293, 176, -293,
902 -293, 49, 158, -293, -293, 372, 850, -293, 105, 7,
903 140, 956, 19, 620, 125, -293, 153, 47, -293, -293,
904 372, 956, -293, -293, 744, 442, 67, 155, 163, -293,
905 682, 80, 165, -293, -293, -293, -293, -293, -293, 42,
906 48, 956, 31, -293, 8, -293, 956, -293, -293, 956,
907 956, 956, 956, 956, 956, 956, 956, 956, 956, 956,
908 956, 956, 956, 956, 956, -293, -293, -293, -293, 956,
909 956, 956, 180, 797, -293, 956, 182, -293, -293, -293,
910 -293, -293, -293, -293, 8, -293, 3, 140, 184, -293,
911 181, -293, -293, 35, 195, 172, 178, 175, 192, 23,
912 142, 120, -293, -293, 11, -293, -293, 8, 39, 222,
913 -293, 956, -293, -293, 71, -293, 3, 11, -293, -293,
914 -293, -293, 90, 956, 186, -293, -293, -293, -293, -293,
915 198, -293, 102, 185, 100, 108, 111, 135, 36, 142,
916 142, 142, -43, 97, 97, -293, -293, -293, -293, -293,
917 56, -293, -293, -293, 34, 66, -293, 372, -293, -293,
918 744, 188, 190, 226, 10, 956, 956, 956, 956, 956,
919 956, 956, 956, 956, 956, 372, 956, 956, 193, 204,
920 -293, -293, -293, -293, 744, 744, 194, -293, 196, 903,
921 -293, 202, 3, 956, -293, 956, -293, -293, 3, 234,
922 956, -293, -293, 184, 10, 372, -293, -293, 956, -293,
923 177, 195, 214, 172, 178, 175, 192, 23, 142, 142,
924 3, -293, -293, 263, -293, 3, -293, -293, 956, -293,
925 -293, 230, 221, -293, -293, 7, 744, -293, -293, 956,
926 3, -293, 956, 744, 956, 6, 263, -293, 39, -293,
927 -293, -293, -293, -293, -293, 744, 10, -293, -293, 59,
928 219, -293, 263, -293, -293, 744, 239, 10, -293, 956,
929 744, 744, 240, -293, 956, 3, 744, -293, -293, -293,
930 3, 744, 744, -293, -293
931 };
932
933 /* YYPGOTO[NTERM-NUM]. */
934 static const yytype_int16 yypgoto[] =
935 {
936 -293, -293, -293, -63, -2, -293, -293, -293, -293, 0,
937 -187, -82, -17, -293, -293, -293, 77, -10, -293, -293,
938 -293, -293, -293, -293, -293, -293, -293, -293, -293, -293,
939 -293, -293, -293, -293, -293, -293, -293, -68, -293, -51,
940 -293, -293, -293, -293, 87, -292, -87, 15, -293, -293,
941 213, -36, -238, -293, -293, -293, -293, 150, 40, 149,
942 33, 151, 43, 152, 44, 148, 45, 156, 46, -62,
943 145, 37, 38, -293, -3, 287, 288, -293, -9, -293,
944 -293, -293, -293, 86, 89, -293, -293, 95, 5, -293,
945 -293, -60, 32, 17, -254
946 };
947
948 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
949 positive, shift that token. If negative, reduce the rule which
950 number is the opposite. If YYTABLE_NINF, syntax error. */
951 #define YYTABLE_NINF -197
952 static const yytype_int16 yytable[] =
953 {
954 43, 104, 45, 91, 248, 43, 331, 92, 135, 93,
955 86, 296, 248, 350, 150, 151, 91, 299, 91, 302,
956 135, 91, 91, 206, 139, 168, 169, 100, 311, 312,
957 102, 43, 91, 91, 190, 91, 91, 344, 263, 193,
958 329, 96, 195, 351, 90, 101, 140, 205, 135, 134,
959 146, 147, 327, 3, 110, 111, 132, 105, 137, 109,
960 136, 297, 112, 113, 84, 264, 256, 365, 136, 167,
961 137, 249, 370, 123, 124, 94, 125, 126, 148, 249,
962 136, 155, 156, 285, 229, 230, 231, 103, 257, 192,
963 127, 214, 359, 191, 347, 218, 204, 216, 137, 219,
964 221, 43, 286, 364, 223, 136, 128, 215, 136, 106,
965 177, 360, 43, 217, 208, 136, 194, 211, 43, 114,
966 210, 284, 133, 238, 239, 177, 207, 243, 171, 212,
967 197, 287, 141, 172, 265, 173, 91, 198, 91, 91,
968 91, 91, 91, 91, 91, 91, 91, 91, 91, 91,
969 91, 91, 155, 156, 142, 157, 152, 153, 154, 158,
970 288, 155, 156, 143, 157, 272, 220, 144, 158, 161,
971 266, 162, 163, 366, 366, 145, 240, 277, 310, 159,
972 245, 270, 165, 149, 166, 163, 174, 233, 234, 136,
973 235, 236, 237, 190, 190, 190, 190, 190, 190, 190,
974 190, 308, 309, 201, 190, 190, 247, -196, 330, 155,
975 156, 268, 157, 170, 171, -195, 158, 213, 241, 172,
976 246, 173, 251, 274, 275, 258, 259, 266, 190, 269,
977 255, 261, 262, 260, 198, 127, 280, 283, 290, 293,
978 295, 313, 315, 320, 326, 216, 318, 323, 43, 324,
979 289, 321, 300, 91, 300, 91, 91, 91, 91, 91,
980 91, 91, 177, 300, 300, 342, 332, 334, 340, 341,
981 190, 361, 43, 43, 316, 317, 363, 369, 355, 368,
982 177, 273, 339, 328, 362, 353, 271, 300, 160, 222,
983 224, 303, 227, 225, 232, 226, 301, 97, 98, 322,
984 278, 228, 304, 279, 305, 325, 306, 276, 307, 0,
985 177, 0, 0, 100, 0, 0, 0, 0, 0, 0,
986 0, 354, 0, 0, 43, 0, 343, 333, 0, 300,
987 0, 43, 338, 348, 0, 0, 0, 0, 0, 0,
988 0, 0, 0, 43, 100, 358, 0, 345, 0, 349,
989 0, 0, 0, 43, 0, 45, 0, 0, 43, 43,
990 0, 0, 0, 0, 43, 0, 210, 0, 0, 43,
991 43, 373, 374, 175, 100, 0, 0, 0, 0, 100,
992 6, 0, 371, 0, 0, 0, 0, 372, 10, 11,
993 0, 0, 14, 0, 16, 17, 0, 19, 0, 21,
994 0, 0, 0, 0, 24, 25, 0, 27, 28, 0,
995 87, -162, 0, 0, 0, 30, 31, 32, 0, 0,
996 88, 0, 0, 0, -162, -162, 0, 0, 0, 35,
997 36, 0, 37, 0, 38, 39, 40, 0, 0, 41,
998 -162, -162, 0, -190, 0, 0, 0, 0, 0, -162,
999 -162, -162, -162, 0, 0, 0, -190, -190, 0, -162,
1000 -162, 0, 0, -162, -162, -162, -162, 0, 0, -162,
1001 0, -162, -190, -190, 0, 0, -162, 0, 0, 0,
1002 0, -190, -190, -190, -190, 0, 0, 0, 0, 0,
1003 0, -190, -190, 0, 0, -190, -190, -190, -190, 4,
1004 0, -190, 5, -190, 6, 7, 0, 8, -190, 9,
1005 0, 0, 10, 11, 12, 13, 14, 15, 16, 17,
1006 18, 19, 20, 21, 22, 23, 0, 0, 24, 25,
1007 26, 27, 28, 0, 29, 0, 0, 0, 0, 30,
1008 31, 32, 0, 0, 33, 0, 0, 34, 0, 0,
1009 0, 0, 0, 35, 36, 0, 37, 0, 38, 39,
1010 40, 4, 0, 41, 5, 0, 6, 7, 0, 8,
1011 0, 9, 0, 0, 10, 11, 12, 13, 14, 15,
1012 16, 17, 18, 19, 20, 21, 22, 23, 0, 0,
1013 24, 25, 0, 27, 28, 115, 116, 0, 0, 0,
1014 0, 117, 31, 118, 0, 0, 33, 0, 0, 34,
1015 0, 0, 0, 0, 0, 35, 36, 0, 37, 0,
1016 38, 39, 40, 4, 0, 41, 5, 0, 6, 7,
1017 0, 8, 0, 9, 0, 0, 10, 11, 12, 13,
1018 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
1019 0, 0, 24, 25, 0, 27, 28, 196, 29, 0,
1020 0, 0, 0, 30, 31, 32, 0, 0, 33, 0,
1021 0, 34, 0, 0, 0, 0, 0, 35, 36, 0,
1022 37, 0, 38, 39, 40, 4, 0, 41, 5, 0,
1023 6, 7, 0, 8, 0, 9, 0, 0, 10, 11,
1024 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
1025 22, 23, 0, 0, 24, 25, 0, 27, 28, 209,
1026 29, 0, 0, 0, 0, 30, 31, 32, 0, 0,
1027 33, 0, 0, 34, 0, 0, 0, 0, 0, 35,
1028 36, 0, 37, 0, 38, 39, 40, 4, 0, 41,
1029 5, 0, 6, 7, 0, 8, 0, 9, 0, 0,
1030 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
1031 20, 21, 22, 23, 0, 0, 24, 25, 0, 27,
1032 28, 0, 29, 0, 0, 0, 0, 30, 31, 32,
1033 0, 0, 33, 0, 0, 34, 0, 0, 0, 0,
1034 0, 35, 36, 0, 37, 6, 38, 39, 40, 0,
1035 0, 41, 0, 10, 11, 0, 0, 14, 0, 16,
1036 17, 0, 19, 0, 21, 0, 0, 0, 0, 24,
1037 25, 0, 27, 28, 0, 87, 0, 0, 0, 0,
1038 30, 31, 32, 0, 0, 88, 0, 0, 0, 0,
1039 0, 0, 0, 0, 35, 36, 0, 37, 6, 38,
1040 39, 40, 0, 0, 41, 242, 10, 11, 0, 0,
1041 14, 0, 16, 17, 0, 19, 178, 21, 0, 0,
1042 0, 0, 24, 25, 0, 27, 28, 0, 87, 0,
1043 0, 0, 0, 30, 31, 32, 0, 0, 88, 0,
1044 0, 0, 0, 0, 0, 0, 0, 35, 36, 0,
1045 37, 6, 38, 39, 40, 0, 0, 41, 0, 10,
1046 11, 0, 0, 14, 0, 16, 17, 0, 19, 0,
1047 21, 0, 0, 0, 0, 24, 25, 0, 27, 28,
1048 0, 87, 0, 0, 0, 0, 30, 31, 32, 0,
1049 0, 88, 0, 0, 0, 0, 0, 0, 0, 0,
1050 35, 36, 0, 37, 6, 38, 39, 40, 319, 0,
1051 41, 0, 10, 11, 0, 0, 14, 0, 16, 17,
1052 0, 19, 0, 21, 0, 0, 0, 0, 24, 25,
1053 0, 27, 28, 0, 87, 0, 0, 0, 0, 30,
1054 31, 32, 10, 11, 88, 0, 14, 0, 16, 17,
1055 0, 0, 0, 35, 36, 0, 37, 0, 38, 39,
1056 40, 27, 28, 41, 87, 0, 0, 0, 0, 30,
1057 31, 32, 0, 0, 88, 0, 0, 0, 0, 0,
1058 0, 0, 0, 0, 0, 0, 37, 0, 0, 0,
1059 40, 0, 0, 41
1060 };
1061
1062 #define yypact_value_is_default(yystate) \
1063 ((yystate) == (-293))
1064
1065 #define yytable_value_is_error(yytable_value) \
1066 YYID (0)
1067
1068 static const yytype_int16 yycheck[] =
1069 {
1070 2, 18, 2, 6, 1, 7, 298, 7, 1, 1,
1071 5, 1, 1, 7, 57, 58, 19, 255, 21, 257,
1072 1, 24, 25, 110, 31, 85, 86, 12, 266, 267,
1073 15, 33, 35, 36, 96, 38, 39, 329, 15, 99,
1074 294, 9, 102, 37, 6, 13, 53, 107, 1, 44,
1075 14, 15, 290, 0, 22, 23, 41, 19, 51, 21,
1076 49, 51, 24, 25, 38, 42, 31, 359, 49, 78,
1077 51, 68, 364, 35, 36, 67, 38, 39, 42, 68,
1078 49, 32, 33, 49, 146, 147, 148, 48, 53, 98,
1079 49, 49, 346, 96, 332, 131, 49, 49, 51, 68,
1080 136, 103, 68, 357, 140, 49, 65, 65, 49, 38,
1081 95, 52, 114, 65, 114, 49, 101, 37, 120, 52,
1082 120, 65, 46, 159, 160, 110, 111, 163, 38, 49,
1083 5, 65, 30, 43, 14, 45, 139, 12, 141, 142,
1084 143, 144, 145, 146, 147, 148, 149, 150, 151, 152,
1085 153, 154, 32, 33, 54, 35, 59, 60, 61, 39,
1086 247, 32, 33, 55, 35, 201, 134, 56, 39, 64,
1087 50, 66, 67, 360, 361, 40, 161, 213, 265, 50,
1088 165, 198, 64, 41, 66, 67, 28, 150, 151, 49,
1089 152, 153, 154, 255, 256, 257, 258, 259, 260, 261,
1090 262, 263, 264, 50, 266, 267, 174, 52, 295, 32,
1091 33, 194, 35, 37, 38, 52, 39, 52, 38, 43,
1092 38, 45, 38, 206, 207, 30, 54, 50, 290, 197,
1093 49, 56, 40, 55, 12, 49, 38, 52, 50, 49,
1094 14, 48, 38, 279, 10, 49, 52, 283, 250, 285,
1095 250, 49, 255, 256, 257, 258, 259, 260, 261, 262,
1096 263, 264, 247, 266, 267, 325, 52, 4, 38, 48,
1097 332, 52, 274, 275, 274, 275, 37, 37, 341, 361,
1098 265, 204, 318, 293, 352, 336, 199, 290, 75, 139,
1099 141, 258, 144, 142, 149, 143, 256, 10, 10, 282,
1100 214, 145, 259, 214, 260, 288, 261, 212, 262, -1,
1101 295, -1, -1, 298, -1, -1, -1, -1, -1, -1,
1102 -1, 338, -1, -1, 326, -1, 326, 310, -1, 332,
1103 -1, 333, 315, 333, -1, -1, -1, -1, -1, -1,
1104 -1, -1, -1, 345, 329, 345, -1, 330, -1, 334,
1105 -1, -1, -1, 355, -1, 355, -1, -1, 360, 361,
1106 -1, -1, -1, -1, 366, -1, 366, -1, -1, 371,
1107 372, 371, 372, 1, 359, -1, -1, -1, -1, 364,
1108 8, -1, 365, -1, -1, -1, -1, 370, 16, 17,
1109 -1, -1, 20, -1, 22, 23, -1, 25, -1, 27,
1110 -1, -1, -1, -1, 32, 33, -1, 35, 36, -1,
1111 38, 1, -1, -1, -1, 43, 44, 45, -1, -1,
1112 48, -1, -1, -1, 14, 15, -1, -1, -1, 57,
1113 58, -1, 60, -1, 62, 63, 64, -1, -1, 67,
1114 30, 31, -1, 1, -1, -1, -1, -1, -1, 39,
1115 40, 41, 42, -1, -1, -1, 14, 15, -1, 49,
1116 50, -1, -1, 53, 54, 55, 56, -1, -1, 59,
1117 -1, 61, 30, 31, -1, -1, 66, -1, -1, -1,
1118 -1, 39, 40, 41, 42, -1, -1, -1, -1, -1,
1119 -1, 49, 50, -1, -1, 53, 54, 55, 56, 3,
1120 -1, 59, 6, 61, 8, 9, -1, 11, 66, 13,
1121 -1, -1, 16, 17, 18, 19, 20, 21, 22, 23,
1122 24, 25, 26, 27, 28, 29, -1, -1, 32, 33,
1123 34, 35, 36, -1, 38, -1, -1, -1, -1, 43,
1124 44, 45, -1, -1, 48, -1, -1, 51, -1, -1,
1125 -1, -1, -1, 57, 58, -1, 60, -1, 62, 63,
1126 64, 3, -1, 67, 6, -1, 8, 9, -1, 11,
1127 -1, 13, -1, -1, 16, 17, 18, 19, 20, 21,
1128 22, 23, 24, 25, 26, 27, 28, 29, -1, -1,
1129 32, 33, -1, 35, 36, 37, 38, -1, -1, -1,
1130 -1, 43, 44, 45, -1, -1, 48, -1, -1, 51,
1131 -1, -1, -1, -1, -1, 57, 58, -1, 60, -1,
1132 62, 63, 64, 3, -1, 67, 6, -1, 8, 9,
1133 -1, 11, -1, 13, -1, -1, 16, 17, 18, 19,
1134 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
1135 -1, -1, 32, 33, -1, 35, 36, 37, 38, -1,
1136 -1, -1, -1, 43, 44, 45, -1, -1, 48, -1,
1137 -1, 51, -1, -1, -1, -1, -1, 57, 58, -1,
1138 60, -1, 62, 63, 64, 3, -1, 67, 6, -1,
1139 8, 9, -1, 11, -1, 13, -1, -1, 16, 17,
1140 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
1141 28, 29, -1, -1, 32, 33, -1, 35, 36, 37,
1142 38, -1, -1, -1, -1, 43, 44, 45, -1, -1,
1143 48, -1, -1, 51, -1, -1, -1, -1, -1, 57,
1144 58, -1, 60, -1, 62, 63, 64, 3, -1, 67,
1145 6, -1, 8, 9, -1, 11, -1, 13, -1, -1,
1146 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
1147 26, 27, 28, 29, -1, -1, 32, 33, -1, 35,
1148 36, -1, 38, -1, -1, -1, -1, 43, 44, 45,
1149 -1, -1, 48, -1, -1, 51, -1, -1, -1, -1,
1150 -1, 57, 58, -1, 60, 8, 62, 63, 64, -1,
1151 -1, 67, -1, 16, 17, -1, -1, 20, -1, 22,
1152 23, -1, 25, -1, 27, -1, -1, -1, -1, 32,
1153 33, -1, 35, 36, -1, 38, -1, -1, -1, -1,
1154 43, 44, 45, -1, -1, 48, -1, -1, -1, -1,
1155 -1, -1, -1, -1, 57, 58, -1, 60, 8, 62,
1156 63, 64, -1, -1, 67, 68, 16, 17, -1, -1,
1157 20, -1, 22, 23, -1, 25, 26, 27, -1, -1,
1158 -1, -1, 32, 33, -1, 35, 36, -1, 38, -1,
1159 -1, -1, -1, 43, 44, 45, -1, -1, 48, -1,
1160 -1, -1, -1, -1, -1, -1, -1, 57, 58, -1,
1161 60, 8, 62, 63, 64, -1, -1, 67, -1, 16,
1162 17, -1, -1, 20, -1, 22, 23, -1, 25, -1,
1163 27, -1, -1, -1, -1, 32, 33, -1, 35, 36,
1164 -1, 38, -1, -1, -1, -1, 43, 44, 45, -1,
1165 -1, 48, -1, -1, -1, -1, -1, -1, -1, -1,
1166 57, 58, -1, 60, 8, 62, 63, 64, 65, -1,
1167 67, -1, 16, 17, -1, -1, 20, -1, 22, 23,
1168 -1, 25, -1, 27, -1, -1, -1, -1, 32, 33,
1169 -1, 35, 36, -1, 38, -1, -1, -1, -1, 43,
1170 44, 45, 16, 17, 48, -1, 20, -1, 22, 23,
1171 -1, -1, -1, 57, 58, -1, 60, -1, 62, 63,
1172 64, 35, 36, 67, 38, -1, -1, -1, -1, 43,
1173 44, 45, -1, -1, 48, -1, -1, -1, -1, -1,
1174 -1, -1, -1, -1, -1, -1, 60, -1, -1, -1,
1175 64, -1, -1, 67
1176 };
1177
1178 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1179 symbol of state STATE-NUM. */
1180 static const yytype_uint8 yystos[] =
1181 {
1182 0, 70, 72, 0, 3, 6, 8, 9, 11, 13,
1183 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
1184 26, 27, 28, 29, 32, 33, 34, 35, 36, 38,
1185 43, 44, 45, 48, 51, 57, 58, 60, 62, 63,
1186 64, 67, 71, 73, 74, 78, 81, 82, 91, 92,
1187 93, 94, 99, 100, 101, 102, 103, 104, 110, 111,
1188 116, 120, 122, 124, 126, 128, 130, 132, 134, 136,
1189 138, 139, 140, 141, 142, 143, 144, 145, 146, 149,
1190 150, 154, 158, 159, 38, 157, 157, 38, 48, 73,
1191 141, 143, 78, 1, 67, 161, 161, 144, 145, 114,
1192 116, 161, 116, 48, 81, 141, 38, 83, 85, 141,
1193 161, 161, 141, 141, 52, 37, 38, 43, 45, 78,
1194 79, 155, 156, 141, 141, 141, 141, 49, 65, 151,
1195 152, 153, 116, 46, 157, 1, 49, 51, 160, 31,
1196 53, 30, 54, 55, 56, 40, 14, 15, 42, 41,
1197 57, 58, 59, 60, 61, 32, 33, 35, 39, 50,
1198 119, 64, 66, 67, 147, 64, 66, 147, 160, 160,
1199 37, 38, 43, 45, 28, 1, 115, 116, 26, 117,
1200 118, 121, 123, 125, 127, 129, 131, 133, 135, 137,
1201 138, 143, 147, 160, 116, 160, 37, 5, 12, 112,
1202 113, 50, 87, 88, 49, 160, 115, 116, 78, 37,
1203 78, 37, 49, 52, 49, 65, 49, 65, 120, 68,
1204 161, 120, 126, 120, 128, 130, 132, 134, 136, 138,
1205 138, 138, 139, 140, 140, 141, 141, 141, 120, 120,
1206 116, 38, 68, 120, 148, 116, 38, 161, 1, 68,
1207 162, 38, 84, 86, 95, 49, 31, 53, 30, 54,
1208 55, 56, 40, 15, 42, 14, 50, 119, 162, 161,
1209 81, 113, 120, 85, 162, 162, 156, 120, 152, 153,
1210 38, 76, 77, 52, 65, 49, 68, 65, 115, 78,
1211 50, 89, 90, 49, 97, 14, 1, 51, 163, 121,
1212 143, 127, 121, 129, 131, 133, 135, 137, 138, 138,
1213 115, 121, 121, 48, 105, 38, 78, 78, 52, 65,
1214 120, 49, 162, 120, 120, 162, 10, 121, 86, 163,
1215 115, 114, 52, 162, 4, 106, 107, 108, 162, 120,
1216 38, 48, 160, 78, 114, 162, 96, 121, 78, 116,
1217 7, 37, 109, 108, 81, 72, 75, 98, 78, 163,
1218 52, 52, 106, 37, 163, 114, 79, 80, 80, 37,
1219 114, 162, 162, 78, 78
1220 };
1221
1222 #define yyerrok (yyerrstatus = 0)
1223 #define yyclearin (yychar = YYEMPTY)
1224 #define YYEMPTY (-2)
1225 #define YYEOF 0
1226
1227 #define YYACCEPT goto yyacceptlab
1228 #define YYABORT goto yyabortlab
1229 #define YYERROR goto yyerrorlab
1230
1231
1232 /* Like YYERROR except do call yyerror. This remains here temporarily
1233 to ease the transition to the new meaning of YYERROR, for GCC.
1234 Once GCC version 2 has supplanted version 1, this can go. However,
1235 YYFAIL appears to be in use. Nevertheless, it is formally deprecated
1236 in Bison 2.4.2's NEWS entry, where a plan to phase it out is
1237 discussed. */
1238
1239 #define YYFAIL goto yyerrlab
1240 #if defined YYFAIL
1241 /* This is here to suppress warnings from the GCC cpp's
1242 -Wunused-macros. Normally we don't worry about that warning, but
1243 some users do, and we want to make it easy for users to remove
1244 YYFAIL uses, which will produce warnings from Bison 2.5. */
1245 #endif
1246
1247 #define YYRECOVERING() (!!yyerrstatus)
1248
1249 #define YYBACKUP(Token, Value) \
1250 do \
1251 if (yychar == YYEMPTY && yylen == 1) \
1252 { \
1253 yychar = (Token); \
1254 yylval = (Value); \
1255 YYPOPSTACK (1); \
1256 goto yybackup; \
1257 } \
1258 else \
1259 { \
1260 yyerror (ctx, YY_("syntax error: cannot back up")); \
1261 YYERROR; \
1262 } \
1263 while (YYID (0))
1264
1265
1266 #define YYTERROR 1
1267 #define YYERRCODE 256
1268
1269
1270 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
1271 If N is 0, then set CURRENT to the empty location which ends
1272 the previous symbol: RHS[0] (always defined). */
1273
1274 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
1275 #ifndef YYLLOC_DEFAULT
1276 # define YYLLOC_DEFAULT(Current, Rhs, N) \
1277 do \
1278 if (YYID (N)) \
1279 { \
1280 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
1281 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
1282 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
1283 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
1284 } \
1285 else \
1286 { \
1287 (Current).first_line = (Current).last_line = \
1288 YYRHSLOC (Rhs, 0).last_line; \
1289 (Current).first_column = (Current).last_column = \
1290 YYRHSLOC (Rhs, 0).last_column; \
1291 } \
1292 while (YYID (0))
1293 #endif
1294
1295
1296 /* This macro is provided for backward compatibility. */
1297
1298 #ifndef YY_LOCATION_PRINT
1299 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1300 #endif
1301
1302
1303 /* YYLEX -- calling `yylex' with the right arguments. */
1304
1305 #ifdef YYLEX_PARAM
1306 # define YYLEX yylex (&yylval, YYLEX_PARAM)
1307 #else
1308 # define YYLEX yylex (&yylval, ctx)
1309 #endif
1310
1311 /* Enable debugging if requested. */
1312 #if YYDEBUG
1313
1314 # ifndef YYFPRINTF
1315 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1316 # define YYFPRINTF fprintf
1317 # endif
1318
1319 # define YYDPRINTF(Args) \
1320 do { \
1321 if (yydebug) \
1322 YYFPRINTF Args; \
1323 } while (YYID (0))
1324
1325 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1326 do { \
1327 if (yydebug) \
1328 { \
1329 YYFPRINTF (stderr, "%s ", Title); \
1330 yy_symbol_print (stderr, \
1331 Type, Value, ctx); \
1332 YYFPRINTF (stderr, "\n"); \
1333 } \
1334 } while (YYID (0))
1335
1336
1337 /*--------------------------------.
1338 | Print this symbol on YYOUTPUT. |
1339 `--------------------------------*/
1340
1341 /*ARGSUSED*/
1342 #if (defined __STDC__ || defined __C99__FUNC__ \
1343 || defined __cplusplus || defined _MSC_VER)
1344 static void
1345 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, parser_ctx_t *ctx)
1346 #else
1347 static void
1348 yy_symbol_value_print (yyoutput, yytype, yyvaluep, ctx)
1349 FILE *yyoutput;
1350 int yytype;
1351 YYSTYPE const * const yyvaluep;
1352 parser_ctx_t *ctx;
1353 #endif
1354 {
1355 if (!yyvaluep)
1356 return;
1357 YYUSE (ctx);
1358 # ifdef YYPRINT
1359 if (yytype < YYNTOKENS)
1360 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1361 # else
1362 YYUSE (yyoutput);
1363 # endif
1364 switch (yytype)
1365 {
1366 default:
1367 break;
1368 }
1369 }
1370
1371
1372 /*--------------------------------.
1373 | Print this symbol on YYOUTPUT. |
1374 `--------------------------------*/
1375
1376 #if (defined __STDC__ || defined __C99__FUNC__ \
1377 || defined __cplusplus || defined _MSC_VER)
1378 static void
1379 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, parser_ctx_t *ctx)
1380 #else
1381 static void
1382 yy_symbol_print (yyoutput, yytype, yyvaluep, ctx)
1383 FILE *yyoutput;
1384 int yytype;
1385 YYSTYPE const * const yyvaluep;
1386 parser_ctx_t *ctx;
1387 #endif
1388 {
1389 if (yytype < YYNTOKENS)
1390 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1391 else
1392 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1393
1394 yy_symbol_value_print (yyoutput, yytype, yyvaluep, ctx);
1395 YYFPRINTF (yyoutput, ")");
1396 }
1397
1398 /*------------------------------------------------------------------.
1399 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1400 | TOP (included). |
1401 `------------------------------------------------------------------*/
1402
1403 #if (defined __STDC__ || defined __C99__FUNC__ \
1404 || defined __cplusplus || defined _MSC_VER)
1405 static void
1406 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
1407 #else
1408 static void
1409 yy_stack_print (yybottom, yytop)
1410 yytype_int16 *yybottom;
1411 yytype_int16 *yytop;
1412 #endif
1413 {
1414 YYFPRINTF (stderr, "Stack now");
1415 for (; yybottom <= yytop; yybottom++)
1416 {
1417 int yybot = *yybottom;
1418 YYFPRINTF (stderr, " %d", yybot);
1419 }
1420 YYFPRINTF (stderr, "\n");
1421 }
1422
1423 # define YY_STACK_PRINT(Bottom, Top) \
1424 do { \
1425 if (yydebug) \
1426 yy_stack_print ((Bottom), (Top)); \
1427 } while (YYID (0))
1428
1429
1430 /*------------------------------------------------.
1431 | Report that the YYRULE is going to be reduced. |
1432 `------------------------------------------------*/
1433
1434 #if (defined __STDC__ || defined __C99__FUNC__ \
1435 || defined __cplusplus || defined _MSC_VER)
1436 static void
1437 yy_reduce_print (YYSTYPE *yyvsp, int yyrule, parser_ctx_t *ctx)
1438 #else
1439 static void
1440 yy_reduce_print (yyvsp, yyrule, ctx)
1441 YYSTYPE *yyvsp;
1442 int yyrule;
1443 parser_ctx_t *ctx;
1444 #endif
1445 {
1446 int yynrhs = yyr2[yyrule];
1447 int yyi;
1448 unsigned long int yylno = yyrline[yyrule];
1449 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1450 yyrule - 1, yylno);
1451 /* The symbols being reduced. */
1452 for (yyi = 0; yyi < yynrhs; yyi++)
1453 {
1454 YYFPRINTF (stderr, " $%d = ", yyi + 1);
1455 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1456 &(yyvsp[(yyi + 1) - (yynrhs)])
1457 , ctx);
1458 YYFPRINTF (stderr, "\n");
1459 }
1460 }
1461
1462 # define YY_REDUCE_PRINT(Rule) \
1463 do { \
1464 if (yydebug) \
1465 yy_reduce_print (yyvsp, Rule, ctx); \
1466 } while (YYID (0))
1467
1468 /* Nonzero means print parse trace. It is left uninitialized so that
1469 multiple parsers can coexist. */
1470 int yydebug;
1471 #else /* !YYDEBUG */
1472 # define YYDPRINTF(Args)
1473 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1474 # define YY_STACK_PRINT(Bottom, Top)
1475 # define YY_REDUCE_PRINT(Rule)
1476 #endif /* !YYDEBUG */
1477
1478
1479 /* YYINITDEPTH -- initial size of the parser's stacks. */
1480 #ifndef YYINITDEPTH
1481 # define YYINITDEPTH 200
1482 #endif
1483
1484 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1485 if the built-in stack extension method is used).
1486
1487 Do not make this value too large; the results are undefined if
1488 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1489 evaluated with infinite-precision integer arithmetic. */
1490
1491 #ifndef YYMAXDEPTH
1492 # define YYMAXDEPTH 10000
1493 #endif
1494
1495
1496 #if YYERROR_VERBOSE
1497
1498 # ifndef yystrlen
1499 # if defined __GLIBC__ && defined _STRING_H
1500 # define yystrlen strlen
1501 # else
1502 /* Return the length of YYSTR. */
1503 #if (defined __STDC__ || defined __C99__FUNC__ \
1504 || defined __cplusplus || defined _MSC_VER)
1505 static YYSIZE_T
1506 yystrlen (const char *yystr)
1507 #else
1508 static YYSIZE_T
1509 yystrlen (yystr)
1510 const char *yystr;
1511 #endif
1512 {
1513 YYSIZE_T yylen;
1514 for (yylen = 0; yystr[yylen]; yylen++)
1515 continue;
1516 return yylen;
1517 }
1518 # endif
1519 # endif
1520
1521 # ifndef yystpcpy
1522 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1523 # define yystpcpy stpcpy
1524 # else
1525 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1526 YYDEST. */
1527 #if (defined __STDC__ || defined __C99__FUNC__ \
1528 || defined __cplusplus || defined _MSC_VER)
1529 static char *
1530 yystpcpy (char *yydest, const char *yysrc)
1531 #else
1532 static char *
1533 yystpcpy (yydest, yysrc)
1534 char *yydest;
1535 const char *yysrc;
1536 #endif
1537 {
1538 char *yyd = yydest;
1539 const char *yys = yysrc;
1540
1541 while ((*yyd++ = *yys++) != '\0')
1542 continue;
1543
1544 return yyd - 1;
1545 }
1546 # endif
1547 # endif
1548
1549 # ifndef yytnamerr
1550 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1551 quotes and backslashes, so that it's suitable for yyerror. The
1552 heuristic is that double-quoting is unnecessary unless the string
1553 contains an apostrophe, a comma, or backslash (other than
1554 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1555 null, do not copy; instead, return the length of what the result
1556 would have been. */
1557 static YYSIZE_T
1558 yytnamerr (char *yyres, const char *yystr)
1559 {
1560 if (*yystr == '"')
1561 {
1562 YYSIZE_T yyn = 0;
1563 char const *yyp = yystr;
1564
1565 for (;;)
1566 switch (*++yyp)
1567 {
1568 case '\'':
1569 case ',':
1570 goto do_not_strip_quotes;
1571
1572 case '\\':
1573 if (*++yyp != '\\')
1574 goto do_not_strip_quotes;
1575 /* Fall through. */
1576 default:
1577 if (yyres)
1578 yyres[yyn] = *yyp;
1579 yyn++;
1580 break;
1581
1582 case '"':
1583 if (yyres)
1584 yyres[yyn] = '\0';
1585 return yyn;
1586 }
1587 do_not_strip_quotes: ;
1588 }
1589
1590 if (! yyres)
1591 return yystrlen (yystr);
1592
1593 return yystpcpy (yyres, yystr) - yyres;
1594 }
1595 # endif
1596
1597 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1598 about the unexpected token YYTOKEN for the state stack whose top is
1599 YYSSP.
1600
1601 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1602 not large enough to hold the message. In that case, also set
1603 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1604 required number of bytes is too large to store. */
1605 static int
1606 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1607 yytype_int16 *yyssp, int yytoken)
1608 {
1609 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
1610 YYSIZE_T yysize = yysize0;
1611 YYSIZE_T yysize1;
1612 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1613 /* Internationalized format string. */
1614 const char *yyformat = 0;
1615 /* Arguments of yyformat. */
1616 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1617 /* Number of reported tokens (one for the "unexpected", one per
1618 "expected"). */
1619 int yycount = 0;
1620
1621 /* There are many possibilities here to consider:
1622 - Assume YYFAIL is not used. It's too flawed to consider. See
1623 <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
1624 for details. YYERROR is fine as it does not invoke this
1625 function.
1626 - If this state is a consistent state with a default action, then
1627 the only way this function was invoked is if the default action
1628 is an error action. In that case, don't check for expected
1629 tokens because there are none.
1630 - The only way there can be no lookahead present (in yychar) is if
1631 this state is a consistent state with a default action. Thus,
1632 detecting the absence of a lookahead is sufficient to determine
1633 that there is no unexpected or expected token to report. In that
1634 case, just report a simple "syntax error".
1635 - Don't assume there isn't a lookahead just because this state is a
1636 consistent state with a default action. There might have been a
1637 previous inconsistent state, consistent state with a non-default
1638 action, or user semantic action that manipulated yychar.
1639 - Of course, the expected token list depends on states to have
1640 correct lookahead information, and it depends on the parser not
1641 to perform extra reductions after fetching a lookahead from the
1642 scanner and before detecting a syntax error. Thus, state merging
1643 (from LALR or IELR) and default reductions corrupt the expected
1644 token list. However, the list is correct for canonical LR with
1645 one exception: it will still contain any token that will not be
1646 accepted due to an error action in a later state.
1647 */
1648 if (yytoken != YYEMPTY)
1649 {
1650 int yyn = yypact[*yyssp];
1651 yyarg[yycount++] = yytname[yytoken];
1652 if (!yypact_value_is_default (yyn))
1653 {
1654 /* Start YYX at -YYN if negative to avoid negative indexes in
1655 YYCHECK. In other words, skip the first -YYN actions for
1656 this state because they are default actions. */
1657 int yyxbegin = yyn < 0 ? -yyn : 0;
1658 /* Stay within bounds of both yycheck and yytname. */
1659 int yychecklim = YYLAST - yyn + 1;
1660 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1661 int yyx;
1662
1663 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1664 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1665 && !yytable_value_is_error (yytable[yyx + yyn]))
1666 {
1667 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1668 {
1669 yycount = 1;
1670 yysize = yysize0;
1671 break;
1672 }
1673 yyarg[yycount++] = yytname[yyx];
1674 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1675 if (! (yysize <= yysize1
1676 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1677 return 2;
1678 yysize = yysize1;
1679 }
1680 }
1681 }
1682
1683 switch (yycount)
1684 {
1685 # define YYCASE_(N, S) \
1686 case N: \
1687 yyformat = S; \
1688 break
1689 YYCASE_(0, YY_("syntax error"));
1690 YYCASE_(1, YY_("syntax error, unexpected %s"));
1691 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1692 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1693 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1694 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1695 # undef YYCASE_
1696 }
1697
1698 yysize1 = yysize + yystrlen (yyformat);
1699 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1700 return 2;
1701 yysize = yysize1;
1702
1703 if (*yymsg_alloc < yysize)
1704 {
1705 *yymsg_alloc = 2 * yysize;
1706 if (! (yysize <= *yymsg_alloc
1707 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1708 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1709 return 1;
1710 }
1711
1712 /* Avoid sprintf, as that infringes on the user's name space.
1713 Don't have undefined behavior even if the translation
1714 produced a string with the wrong number of "%s"s. */
1715 {
1716 char *yyp = *yymsg;
1717 int yyi = 0;
1718 while ((*yyp = *yyformat) != '\0')
1719 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1720 {
1721 yyp += yytnamerr (yyp, yyarg[yyi++]);
1722 yyformat += 2;
1723 }
1724 else
1725 {
1726 yyp++;
1727 yyformat++;
1728 }
1729 }
1730 return 0;
1731 }
1732 #endif /* YYERROR_VERBOSE */
1733
1734 /*-----------------------------------------------.
1735 | Release the memory associated to this symbol. |
1736 `-----------------------------------------------*/
1737
1738 /*ARGSUSED*/
1739 #if (defined __STDC__ || defined __C99__FUNC__ \
1740 || defined __cplusplus || defined _MSC_VER)
1741 static void
1742 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, parser_ctx_t *ctx)
1743 #else
1744 static void
1745 yydestruct (yymsg, yytype, yyvaluep, ctx)
1746 const char *yymsg;
1747 int yytype;
1748 YYSTYPE *yyvaluep;
1749 parser_ctx_t *ctx;
1750 #endif
1751 {
1752 YYUSE (yyvaluep);
1753 YYUSE (ctx);
1754
1755 if (!yymsg)
1756 yymsg = "Deleting";
1757 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1758
1759 switch (yytype)
1760 {
1761
1762 default:
1763 break;
1764 }
1765 }
1766
1767
1768 /* Prevent warnings from -Wmissing-prototypes. */
1769 #ifdef YYPARSE_PARAM
1770 #if defined __STDC__ || defined __cplusplus
1771 int yyparse (void *YYPARSE_PARAM);
1772 #else
1773 int yyparse ();
1774 #endif
1775 #else /* ! YYPARSE_PARAM */
1776 #if defined __STDC__ || defined __cplusplus
1777 int yyparse (parser_ctx_t *ctx);
1778 #else
1779 int yyparse ();
1780 #endif
1781 #endif /* ! YYPARSE_PARAM */
1782
1783
1784 /*----------.
1785 | yyparse. |
1786 `----------*/
1787
1788 #ifdef YYPARSE_PARAM
1789 #if (defined __STDC__ || defined __C99__FUNC__ \
1790 || defined __cplusplus || defined _MSC_VER)
1791 int
1792 yyparse (void *YYPARSE_PARAM)
1793 #else
1794 int
1795 yyparse (YYPARSE_PARAM)
1796 void *YYPARSE_PARAM;
1797 #endif
1798 #else /* ! YYPARSE_PARAM */
1799 #if (defined __STDC__ || defined __C99__FUNC__ \
1800 || defined __cplusplus || defined _MSC_VER)
1801 int
1802 yyparse (parser_ctx_t *ctx)
1803 #else
1804 int
1805 yyparse (ctx)
1806 parser_ctx_t *ctx;
1807 #endif
1808 #endif
1809 {
1810 /* The lookahead symbol. */
1811 int yychar;
1812
1813 /* The semantic value of the lookahead symbol. */
1814 YYSTYPE yylval;
1815
1816 /* Number of syntax errors so far. */
1817 int yynerrs;
1818
1819 int yystate;
1820 /* Number of tokens to shift before error messages enabled. */
1821 int yyerrstatus;
1822
1823 /* The stacks and their tools:
1824 `yyss': related to states.
1825 `yyvs': related to semantic values.
1826
1827 Refer to the stacks thru separate pointers, to allow yyoverflow
1828 to reallocate them elsewhere. */
1829
1830 /* The state stack. */
1831 yytype_int16 yyssa[YYINITDEPTH];
1832 yytype_int16 *yyss;
1833 yytype_int16 *yyssp;
1834
1835 /* The semantic value stack. */
1836 YYSTYPE yyvsa[YYINITDEPTH];
1837 YYSTYPE *yyvs;
1838 YYSTYPE *yyvsp;
1839
1840 YYSIZE_T yystacksize;
1841
1842 int yyn;
1843 int yyresult;
1844 /* Lookahead token as an internal (translated) token number. */
1845 int yytoken;
1846 /* The variables used to return semantic value and location from the
1847 action routines. */
1848 YYSTYPE yyval;
1849
1850 #if YYERROR_VERBOSE
1851 /* Buffer for error messages, and its allocated size. */
1852 char yymsgbuf[128];
1853 char *yymsg = yymsgbuf;
1854 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1855 #endif
1856
1857 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1858
1859 /* The number of symbols on the RHS of the reduced rule.
1860 Keep to zero when no symbol should be popped. */
1861 int yylen = 0;
1862
1863 yytoken = 0;
1864 yyss = yyssa;
1865 yyvs = yyvsa;
1866 yystacksize = YYINITDEPTH;
1867
1868 YYDPRINTF ((stderr, "Starting parse\n"));
1869
1870 yystate = 0;
1871 yyerrstatus = 0;
1872 yynerrs = 0;
1873 yychar = YYEMPTY; /* Cause a token to be read. */
1874
1875 /* Initialize stack pointers.
1876 Waste one element of value and location stack
1877 so that they stay on the same level as the state stack.
1878 The wasted elements are never initialized. */
1879 yyssp = yyss;
1880 yyvsp = yyvs;
1881
1882 goto yysetstate;
1883
1884 /*------------------------------------------------------------.
1885 | yynewstate -- Push a new state, which is found in yystate. |
1886 `------------------------------------------------------------*/
1887 yynewstate:
1888 /* In all cases, when you get here, the value and location stacks
1889 have just been pushed. So pushing a state here evens the stacks. */
1890 yyssp++;
1891
1892 yysetstate:
1893 *yyssp = yystate;
1894
1895 if (yyss + yystacksize - 1 <= yyssp)
1896 {
1897 /* Get the current used size of the three stacks, in elements. */
1898 YYSIZE_T yysize = yyssp - yyss + 1;
1899
1900 #ifdef yyoverflow
1901 {
1902 /* Give user a chance to reallocate the stack. Use copies of
1903 these so that the &'s don't force the real ones into
1904 memory. */
1905 YYSTYPE *yyvs1 = yyvs;
1906 yytype_int16 *yyss1 = yyss;
1907
1908 /* Each stack pointer address is followed by the size of the
1909 data in use in that stack, in bytes. This used to be a
1910 conditional around just the two extra args, but that might
1911 be undefined if yyoverflow is a macro. */
1912 yyoverflow (YY_("memory exhausted"),
1913 &yyss1, yysize * sizeof (*yyssp),
1914 &yyvs1, yysize * sizeof (*yyvsp),
1915 &yystacksize);
1916
1917 yyss = yyss1;
1918 yyvs = yyvs1;
1919 }
1920 #else /* no yyoverflow */
1921 # ifndef YYSTACK_RELOCATE
1922 goto yyexhaustedlab;
1923 # else
1924 /* Extend the stack our own way. */
1925 if (YYMAXDEPTH <= yystacksize)
1926 goto yyexhaustedlab;
1927 yystacksize *= 2;
1928 if (YYMAXDEPTH < yystacksize)
1929 yystacksize = YYMAXDEPTH;
1930
1931 {
1932 yytype_int16 *yyss1 = yyss;
1933 union yyalloc *yyptr =
1934 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1935 if (! yyptr)
1936 goto yyexhaustedlab;
1937 YYSTACK_RELOCATE (yyss_alloc, yyss);
1938 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1939 # undef YYSTACK_RELOCATE
1940 if (yyss1 != yyssa)
1941 YYSTACK_FREE (yyss1);
1942 }
1943 # endif
1944 #endif /* no yyoverflow */
1945
1946 yyssp = yyss + yysize - 1;
1947 yyvsp = yyvs + yysize - 1;
1948
1949 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1950 (unsigned long int) yystacksize));
1951
1952 if (yyss + yystacksize - 1 <= yyssp)
1953 YYABORT;
1954 }
1955
1956 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1957
1958 if (yystate == YYFINAL)
1959 YYACCEPT;
1960
1961 goto yybackup;
1962
1963 /*-----------.
1964 | yybackup. |
1965 `-----------*/
1966 yybackup:
1967
1968 /* Do appropriate processing given the current state. Read a
1969 lookahead token if we need one and don't already have one. */
1970
1971 /* First try to decide what to do without reference to lookahead token. */
1972 yyn = yypact[yystate];
1973 if (yypact_value_is_default (yyn))
1974 goto yydefault;
1975
1976 /* Not known => get a lookahead token if don't already have one. */
1977
1978 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1979 if (yychar == YYEMPTY)
1980 {
1981 YYDPRINTF ((stderr, "Reading a token: "));
1982 yychar = YYLEX;
1983 }
1984
1985 if (yychar <= YYEOF)
1986 {
1987 yychar = yytoken = YYEOF;
1988 YYDPRINTF ((stderr, "Now at end of input.\n"));
1989 }
1990 else
1991 {
1992 yytoken = YYTRANSLATE (yychar);
1993 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1994 }
1995
1996 /* If the proper action on seeing token YYTOKEN is to reduce or to
1997 detect an error, take that action. */
1998 yyn += yytoken;
1999 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
2000 goto yydefault;
2001 yyn = yytable[yyn];
2002 if (yyn <= 0)
2003 {
2004 if (yytable_value_is_error (yyn))
2005 goto yyerrlab;
2006 yyn = -yyn;
2007 goto yyreduce;
2008 }
2009
2010 /* Count tokens shifted since error; after three, turn off error
2011 status. */
2012 if (yyerrstatus)
2013 yyerrstatus--;
2014
2015 /* Shift the lookahead token. */
2016 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2017
2018 /* Discard the shifted token. */
2019 yychar = YYEMPTY;
2020
2021 yystate = yyn;
2022 *++yyvsp = yylval;
2023
2024 goto yynewstate;
2025
2026
2027 /*-----------------------------------------------------------.
2028 | yydefault -- do the default action for the current state. |
2029 `-----------------------------------------------------------*/
2030 yydefault:
2031 yyn = yydefact[yystate];
2032 if (yyn == 0)
2033 goto yyerrlab;
2034 goto yyreduce;
2035
2036
2037 /*-----------------------------.
2038 | yyreduce -- Do a reduction. |
2039 `-----------------------------*/
2040 yyreduce:
2041 /* yyn is the number of a rule to reduce with. */
2042 yylen = yyr2[yyn];
2043
2044 /* If YYLEN is nonzero, implement the default value of the action:
2045 `$$ = $1'.
2046
2047 Otherwise, the following line sets YYVAL to garbage.
2048 This behavior is undocumented and Bison
2049 users should not rely upon it. Assigning to YYVAL
2050 unconditionally makes the parser a bit smaller, and it avoids a
2051 GCC warning that YYVAL may be used uninitialized. */
2052 yyval = yyvsp[1-yylen];
2053
2054
2055 YY_REDUCE_PRINT (yyn);
2056 switch (yyn)
2057 {
2058 case 2:
2059
2060 /* Line 1806 of yacc.c */
2061 #line 252 "parser.y"
2062 { program_parsed(ctx, (yyvsp[(1) - (3)].source_elements)); }
2063 break;
2064
2065 case 3:
2066
2067 /* Line 1806 of yacc.c */
2068 #line 255 "parser.y"
2069 {}
2070 break;
2071
2072 case 4:
2073
2074 /* Line 1806 of yacc.c */
2075 #line 256 "parser.y"
2076 {}
2077 break;
2078
2079 case 5:
2080
2081 /* Line 1806 of yacc.c */
2082 #line 260 "parser.y"
2083 { (yyval.source_elements) = new_source_elements(ctx); }
2084 break;
2085
2086 case 6:
2087
2088 /* Line 1806 of yacc.c */
2089 #line 262 "parser.y"
2090 { (yyval.source_elements) = source_elements_add_statement((yyvsp[(1) - (2)].source_elements), (yyvsp[(2) - (2)].statement)); }
2091 break;
2092
2093 case 7:
2094
2095 /* Line 1806 of yacc.c */
2096 #line 267 "parser.y"
2097 { (yyval.expr) = new_function_expression(ctx, (yyvsp[(2) - (8)].identifier), (yyvsp[(4) - (8)].parameter_list), (yyvsp[(7) - (8)].source_elements), (yyvsp[(1) - (8)].srcptr), (yyvsp[(8) - (8)].srcptr)-(yyvsp[(1) - (8)].srcptr)+1); }
2098 break;
2099
2100 case 8:
2101
2102 /* Line 1806 of yacc.c */
2103 #line 270 "parser.y"
2104 { (yyval.srcptr) = (yyvsp[(1) - (1)].srcptr); }
2105 break;
2106
2107 case 9:
2108
2109 /* Line 1806 of yacc.c */
2110 #line 274 "parser.y"
2111 { (yyval.source_elements) = (yyvsp[(1) - (1)].source_elements); }
2112 break;
2113
2114 case 10:
2115
2116 /* Line 1806 of yacc.c */
2117 #line 278 "parser.y"
2118 { (yyval.parameter_list) = new_parameter_list(ctx, (yyvsp[(1) - (1)].identifier)); }
2119 break;
2120
2121 case 11:
2122
2123 /* Line 1806 of yacc.c */
2124 #line 280 "parser.y"
2125 { (yyval.parameter_list) = parameter_list_add(ctx, (yyvsp[(1) - (3)].parameter_list), (yyvsp[(3) - (3)].identifier)); }
2126 break;
2127
2128 case 12:
2129
2130 /* Line 1806 of yacc.c */
2131 #line 284 "parser.y"
2132 { (yyval.parameter_list) = NULL; }
2133 break;
2134
2135 case 13:
2136
2137 /* Line 1806 of yacc.c */
2138 #line 285 "parser.y"
2139 { (yyval.parameter_list) = (yyvsp[(1) - (1)].parameter_list); }
2140 break;
2141
2142 case 14:
2143
2144 /* Line 1806 of yacc.c */
2145 #line 289 "parser.y"
2146 { (yyval.statement) = (yyvsp[(1) - (1)].statement); }
2147 break;
2148
2149 case 15:
2150
2151 /* Line 1806 of yacc.c */
2152 #line 290 "parser.y"
2153 { (yyval.statement) = (yyvsp[(1) - (1)].statement); }
2154 break;
2155
2156 case 16:
2157
2158 /* Line 1806 of yacc.c */
2159 #line 291 "parser.y"
2160 { (yyval.statement) = (yyvsp[(1) - (1)].statement); }
2161 break;
2162
2163 case 17:
2164
2165 /* Line 1806 of yacc.c */
2166 #line 292 "parser.y"
2167 { (yyval.statement) = new_expression_statement(ctx, (yyvsp[(1) - (1)].expr)); }
2168 break;
2169
2170 case 18:
2171
2172 /* Line 1806 of yacc.c */
2173 #line 293 "parser.y"
2174 { (yyval.statement) = (yyvsp[(1) - (1)].statement); }
2175 break;
2176
2177 case 19:
2178
2179 /* Line 1806 of yacc.c */
2180 #line 294 "parser.y"
2181 { (yyval.statement) = (yyvsp[(1) - (1)].statement); }
2182 break;
2183
2184 case 20:
2185
2186 /* Line 1806 of yacc.c */
2187 #line 295 "parser.y"
2188 { (yyval.statement) = (yyvsp[(1) - (1)].statement); }
2189 break;
2190
2191 case 21:
2192
2193 /* Line 1806 of yacc.c */
2194 #line 296 "parser.y"
2195 { (yyval.statement) = (yyvsp[(1) - (1)].statement); }
2196 break;
2197
2198 case 22:
2199
2200 /* Line 1806 of yacc.c */
2201 #line 297 "parser.y"
2202 { (yyval.statement) = (yyvsp[(1) - (1)].statement); }
2203 break;
2204
2205 case 23:
2206
2207 /* Line 1806 of yacc.c */
2208 #line 298 "parser.y"
2209 { (yyval.statement) = (yyvsp[(1) - (1)].statement); }
2210 break;
2211
2212 case 24:
2213
2214 /* Line 1806 of yacc.c */
2215 #line 299 "parser.y"
2216 { (yyval.statement) = (yyvsp[(1) - (1)].statement); }
2217 break;
2218
2219 case 25:
2220
2221 /* Line 1806 of yacc.c */
2222 #line 300 "parser.y"
2223 { (yyval.statement) = (yyvsp[(1) - (1)].statement); }
2224 break;
2225
2226 case 26:
2227
2228 /* Line 1806 of yacc.c */
2229 #line 301 "parser.y"
2230 { (yyval.statement) = (yyvsp[(1) - (1)].statement); }
2231 break;
2232
2233 case 27:
2234
2235 /* Line 1806 of yacc.c */
2236 #line 302 "parser.y"
2237 { (yyval.statement) = (yyvsp[(1) - (1)].statement); }
2238 break;
2239
2240 case 28:
2241
2242 /* Line 1806 of yacc.c */
2243 #line 303 "parser.y"
2244 { (yyval.statement) = (yyvsp[(1) - (1)].statement); }
2245 break;
2246
2247 case 29:
2248
2249 /* Line 1806 of yacc.c */
2250 #line 307 "parser.y"
2251 { (yyval.statement_list) = new_statement_list(ctx, (yyvsp[(1) - (1)].statement)); }
2252 break;
2253
2254 case 30:
2255
2256 /* Line 1806 of yacc.c */
2257 #line 309 "parser.y"
2258 { (yyval.statement_list) = statement_list_add((yyvsp[(1) - (2)].statement_list), (yyvsp[(2) - (2)].statement)); }
2259 break;
2260
2261 case 31:
2262
2263 /* Line 1806 of yacc.c */
2264 #line 313 "parser.y"
2265 { (yyval.statement_list) = NULL; }
2266 break;
2267
2268 case 32:
2269
2270 /* Line 1806 of yacc.c */
2271 #line 314 "parser.y"
2272 { (yyval.statement_list) = (yyvsp[(1) - (1)].statement_list); }
2273 break;
2274
2275 case 33:
2276
2277 /* Line 1806 of yacc.c */
2278 #line 318 "parser.y"
2279 { (yyval.statement) = new_block_statement(ctx, (yyvsp[(2) - (3)].statement_list)); }
2280 break;
2281
2282 case 34:
2283
2284 /* Line 1806 of yacc.c */
2285 #line 319 "parser.y"
2286 { (yyval.statement) = new_block_statement(ctx, NULL); }
2287 break;
2288
2289 case 35:
2290
2291 /* Line 1806 of yacc.c */
2292 #line 324 "parser.y"
2293 { (yyval.statement) = new_var_statement(ctx, (yyvsp[(2) - (3)].variable_list)); }
2294 break;
2295
2296 case 36:
2297
2298 /* Line 1806 of yacc.c */
2299 #line 328 "parser.y"
2300 { (yyval.variable_list) = new_variable_list(ctx, (yyvsp[(1) - (1)].variable_declaration)); }
2301 break;
2302
2303 case 37:
2304
2305 /* Line 1806 of yacc.c */
2306 #line 330 "parser.y"
2307 { (yyval.variable_list) = variable_list_add(ctx, (yyvsp[(1) - (3)].variable_list), (yyvsp[(3) - (3)].variable_declaration)); }
2308 break;
2309
2310 case 38:
2311
2312 /* Line 1806 of yacc.c */
2313 #line 335 "parser.y"
2314 { (yyval.variable_list) = new_variable_list(ctx, (yyvsp[(1) - (1)].variable_declaration)); }
2315 break;
2316
2317 case 39:
2318
2319 /* Line 1806 of yacc.c */
2320 #line 337 "parser.y"
2321 { (yyval.variable_list) = variable_list_add(ctx, (yyvsp[(1) - (3)].variable_list), (yyvsp[(3) - (3)].variable_declaration)); }
2322 break;
2323
2324 case 40:
2325
2326 /* Line 1806 of yacc.c */
2327 #line 342 "parser.y"
2328 { (yyval.variable_declaration) = new_variable_declaration(ctx, (yyvsp[(1) - (2)].identifier), (yyvsp[(2) - (2)].expr)); }
2329 break;
2330
2331 case 41:
2332
2333 /* Line 1806 of yacc.c */
2334 #line 347 "parser.y"
2335 { (yyval.variable_declaration) = new_variable_declaration(ctx, (yyvsp[(1) - (2)].identifier), (yyvsp[(2) - (2)].expr)); }
2336 break;
2337
2338 case 42:
2339
2340 /* Line 1806 of yacc.c */
2341 #line 351 "parser.y"
2342 { (yyval.expr) = NULL; }
2343 break;
2344
2345 case 43:
2346
2347 /* Line 1806 of yacc.c */
2348 #line 352 "parser.y"
2349 { (yyval.expr) = (yyvsp[(1) - (1)].expr); }
2350 break;
2351
2352 case 44:
2353
2354 /* Line 1806 of yacc.c */
2355 #line 357 "parser.y"
2356 { (yyval.expr) = (yyvsp[(2) - (2)].expr); }
2357 break;
2358
2359 case 45:
2360
2361 /* Line 1806 of yacc.c */
2362 #line 361 "parser.y"
2363 { (yyval.expr) = NULL; }
2364 break;
2365
2366 case 46:
2367
2368 /* Line 1806 of yacc.c */
2369 #line 362 "parser.y"
2370 { (yyval.expr) = (yyvsp[(1) - (1)].expr); }
2371 break;
2372
2373 case 47:
2374
2375 /* Line 1806 of yacc.c */
2376 #line 367 "parser.y"
2377 { (yyval.expr) = (yyvsp[(2) - (2)].expr); }
2378 break;
2379
2380 case 48:
2381
2382 /* Line 1806 of yacc.c */
2383 #line 371 "parser.y"
2384 { (yyval.statement) = new_statement(ctx, STAT_EMPTY, 0); }
2385 break;
2386
2387 case 49:
2388
2389 /* Line 1806 of yacc.c */
2390 #line 376 "parser.y"
2391 { (yyval.statement) = new_expression_statement(ctx, (yyvsp[(1) - (2)].expr)); }
2392 break;
2393
2394 case 50:
2395
2396 /* Line 1806 of yacc.c */
2397 #line 381 "parser.y"
2398 { (yyval.statement) = new_if_statement(ctx, (yyvsp[(3) - (7)].expr), (yyvsp[(5) - (7)].statement), (yyvsp[(7) - (7)].statement)); }
2399 break;
2400
2401 case 51:
2402
2403 /* Line 1806 of yacc.c */
2404 #line 383 "parser.y"
2405 { (yyval.statement) = new_if_statement(ctx, (yyvsp[(3) - (5)].expr), (yyvsp[(5) - (5)].statement), NULL); }
2406 break;
2407
2408 case 52:
2409
2410 /* Line 1806 of yacc.c */
2411 #line 388 "parser.y"
2412 { (yyval.statement) = new_while_statement(ctx, TRUE, (yyvsp[(5) - (7)].expr), (yyvsp[(2) - (7)].statement)); }
2413 break;
2414
2415 case 53:
2416
2417 /* Line 1806 of yacc.c */
2418 #line 390 "parser.y"
2419 { (yyval.statement) = new_while_statement(ctx, FALSE, (yyvsp[(3) - (5)].expr), (yyvsp[(5) - (5)].statement)); }
2420 break;
2421
2422 case 54:
2423
2424 /* Line 1806 of yacc.c */
2425 #line 392 "parser.y"
2426 { if(!explicit_error(ctx, (yyvsp[(3) - (3)].expr), ';')) YYABORT; }
2427 break;
2428
2429 case 55:
2430
2431 /* Line 1806 of yacc.c */
2432 #line 394 "parser.y"
2433 { if(!explicit_error(ctx, (yyvsp[(6) - (6)].expr), ';')) YYABORT; }
2434 break;
2435
2436 case 56:
2437
2438 /* Line 1806 of yacc.c */
2439 #line 396 "parser.y"
2440 { (yyval.statement) = new_for_statement(ctx, NULL, (yyvsp[(3) - (11)].expr), (yyvsp[(6) - (11)].expr), (yyvsp[(9) - (11)].expr), (yyvsp[(11) - (11)].statement)); }
2441 break;
2442
2443 case 57:
2444
2445 /* Line 1806 of yacc.c */
2446 #line 398 "parser.y"
2447 { if(!explicit_error(ctx, (yyvsp[(4) - (4)].variable_list), ';')) YYABORT; }
2448 break;
2449
2450 case 58:
2451
2452 /* Line 1806 of yacc.c */
2453 #line 400 "parser.y"
2454 { if(!explicit_error(ctx, (yyvsp[(7) - (7)].expr), ';')) YYABORT; }
2455 break;
2456
2457 case 59:
2458
2459 /* Line 1806 of yacc.c */
2460 #line 402 "parser.y"
2461 { (yyval.statement) = new_for_statement(ctx, (yyvsp[(4) - (12)].variable_list), NULL, (yyvsp[(7) - (12)].expr), (yyvsp[(10) - (12)].expr), (yyvsp[(12) - (12)].statement)); }
2462 break;
2463
2464 case 60:
2465
2466 /* Line 1806 of yacc.c */
2467 #line 404 "parser.y"
2468 { (yyval.statement) = new_forin_statement(ctx, NULL, (yyvsp[(3) - (7)].expr), (yyvsp[(5) - (7)].expr), (yyvsp[(7) - (7)].statement)); }
2469 break;
2470
2471 case 61:
2472
2473 /* Line 1806 of yacc.c */
2474 #line 406 "parser.y"
2475 { (yyval.statement) = new_forin_statement(ctx, (yyvsp[(4) - (8)].variable_declaration), NULL, (yyvsp[(6) - (8)].expr), (yyvsp[(8) - (8)].statement)); }
2476 break;
2477
2478 case 62:
2479
2480 /* Line 1806 of yacc.c */
2481 #line 411 "parser.y"
2482 { (yyval.statement) = new_continue_statement(ctx, (yyvsp[(2) - (3)].identifier)); }
2483 break;
2484
2485 case 63:
2486
2487 /* Line 1806 of yacc.c */
2488 #line 416 "parser.y"
2489 { (yyval.statement) = new_break_statement(ctx, (yyvsp[(2) - (3)].identifier)); }
2490 break;
2491
2492 case 64:
2493
2494 /* Line 1806 of yacc.c */
2495 #line 421 "parser.y"
2496 { (yyval.statement) = new_return_statement(ctx, (yyvsp[(2) - (3)].expr)); }
2497 break;
2498
2499 case 65:
2500
2501 /* Line 1806 of yacc.c */
2502 #line 426 "parser.y"
2503 { (yyval.statement) = new_with_statement(ctx, (yyvsp[(3) - (5)].expr), (yyvsp[(5) - (5)].statement)); }
2504 break;
2505
2506 case 66:
2507
2508 /* Line 1806 of yacc.c */
2509 #line 431 "parser.y"
2510 { (yyval.statement) = new_labelled_statement(ctx, (yyvsp[(1) - (3)].identifier), (yyvsp[(3) - (3)].statement)); }
2511 break;
2512
2513 case 67:
2514
2515 /* Line 1806 of yacc.c */
2516 #line 436 "parser.y"
2517 { (yyval.statement) = new_switch_statement(ctx, (yyvsp[(3) - (5)].expr), (yyvsp[(5) - (5)].case_clausule)); }
2518 break;
2519
2520 case 68:
2521
2522 /* Line 1806 of yacc.c */
2523 #line 441 "parser.y"
2524 { (yyval.case_clausule) = new_case_block(ctx, (yyvsp[(2) - (3)].case_list), NULL, NULL); }
2525 break;
2526
2527 case 69:
2528
2529 /* Line 1806 of yacc.c */
2530 #line 443 "parser.y"
2531 { (yyval.case_clausule) = new_case_block(ctx, (yyvsp[(2) - (5)].case_list), (yyvsp[(3) - (5)].case_clausule), (yyvsp[(4) - (5)].case_list)); }
2532 break;
2533
2534 case 70:
2535
2536 /* Line 1806 of yacc.c */
2537 #line 447 "parser.y"
2538 { (yyval.case_list) = NULL; }
2539 break;
2540
2541 case 71:
2542
2543 /* Line 1806 of yacc.c */
2544 #line 448 "parser.y"
2545 { (yyval.case_list) = (yyvsp[(1) - (1)].case_list); }
2546 break;
2547
2548 case 72:
2549
2550 /* Line 1806 of yacc.c */
2551 #line 452 "parser.y"
2552 { (yyval.case_list) = new_case_list(ctx, (yyvsp[(1) - (1)].case_clausule)); }
2553 break;
2554
2555 case 73:
2556
2557 /* Line 1806 of yacc.c */
2558 #line 454 "parser.y"
2559 { (yyval.case_list) = case_list_add(ctx, (yyvsp[(1) - (2)].case_list), (yyvsp[(2) - (2)].case_clausule)); }
2560 break;
2561
2562 case 74:
2563
2564 /* Line 1806 of yacc.c */
2565 #line 459 "parser.y"
2566 { (yyval.case_clausule) = new_case_clausule(ctx, (yyvsp[(2) - (4)].expr), (yyvsp[(4) - (4)].statement_list)); }
2567 break;
2568
2569 case 75:
2570
2571 /* Line 1806 of yacc.c */
2572 #line 464 "parser.y"
2573 { (yyval.case_clausule) = new_case_clausule(ctx, NULL, (yyvsp[(3) - (3)].statement_list)); }
2574 break;
2575
2576 case 76:
2577
2578 /* Line 1806 of yacc.c */
2579 #line 469 "parser.y"
2580 { (yyval.statement) = new_throw_statement(ctx, (yyvsp[(2) - (3)].expr)); }
2581 break;
2582
2583 case 77:
2584
2585 /* Line 1806 of yacc.c */
2586 #line 473 "parser.y"
2587 { (yyval.statement) = new_try_statement(ctx, (yyvsp[(2) - (3)].statement), (yyvsp[(3) - (3)].catch_block), NULL); }
2588 break;
2589
2590 case 78:
2591
2592 /* Line 1806 of yacc.c */
2593 #line 474 "parser.y"
2594 { (yyval.statement) = new_try_statement(ctx, (yyvsp[(2) - (3)].statement), NULL, (yyvsp[(3) - (3)].statement)); }
2595 break;
2596
2597 case 79:
2598
2599 /* Line 1806 of yacc.c */
2600 #line 476 "parser.y"
2601 { (yyval.statement) = new_try_statement(ctx, (yyvsp[(2) - (4)].statement), (yyvsp[(3) - (4)].catch_block), (yyvsp[(4) - (4)].statement)); }
2602 break;
2603
2604 case 80:
2605
2606 /* Line 1806 of yacc.c */
2607 #line 481 "parser.y"
2608 { (yyval.catch_block) = new_catch_block(ctx, (yyvsp[(3) - (5)].identifier), (yyvsp[(5) - (5)].statement)); }
2609 break;
2610
2611 case 81:
2612
2613 /* Line 1806 of yacc.c */
2614 #line 485 "parser.y"
2615 { (yyval.statement) = (yyvsp[(2) - (2)].statement); }
2616 break;
2617
2618 case 82:
2619
2620 /* Line 1806 of yacc.c */
2621 #line 489 "parser.y"
2622 { (yyval.expr) = NULL; }
2623 break;
2624
2625 case 83:
2626
2627 /* Line 1806 of yacc.c */
2628 #line 490 "parser.y"
2629 { (yyval.expr) = (yyvsp[(1) - (1)].expr); }
2630 break;
2631
2632 case 84:
2633
2634 /* Line 1806 of yacc.c */
2635 #line 493 "parser.y"
2636 { (yyval.expr) = (yyvsp[(1) - (1)].expr); }
2637 break;
2638
2639 case 85:
2640
2641 /* Line 1806 of yacc.c */
2642 #line 494 "parser.y"
2643 { set_error(ctx, JS_E_SYNTAX); YYABORT; }
2644 break;
2645
2646 case 86:
2647
2648 /* Line 1806 of yacc.c */
2649 #line 498 "parser.y"
2650 { (yyval.expr) = (yyvsp[(1) - (1)].expr); }
2651 break;
2652
2653 case 87:
2654
2655 /* Line 1806 of yacc.c */
2656 #line 500 "parser.y"
2657 { (yyval.expr) = new_binary_expression(ctx, EXPR_COMMA, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
2658 break;
2659
2660 case 88:
2661
2662 /* Line 1806 of yacc.c */
2663 #line 504 "parser.y"
2664 { (yyval.expr) = NULL; }
2665 break;
2666
2667 case 89:
2668
2669 /* Line 1806 of yacc.c */
2670 #line 505 "parser.y"
2671 { (yyval.expr) = (yyvsp[(1) - (1)].expr); }
2672 break;
2673
2674 case 90:
2675
2676 /* Line 1806 of yacc.c */
2677 #line 510 "parser.y"
2678 { (yyval.expr) = (yyvsp[(1) - (1)].expr); }
2679 break;
2680
2681 case 91:
2682
2683 /* Line 1806 of yacc.c */
2684 #line 512 "parser.y"
2685 { (yyval.expr) = new_binary_expression(ctx, EXPR_COMMA, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
2686 break;
2687
2688 case 92:
2689
2690 /* Line 1806 of yacc.c */
2691 #line 515 "parser.y"
2692 { (yyval.ival) = (yyvsp[(1) - (1)].ival); }
2693 break;
2694
2695 case 93:
2696
2697 /* Line 1806 of yacc.c */
2698 #line 516 "parser.y"
2699 { (yyval.ival) = EXPR_ASSIGNDIV; }
2700 break;
2701
2702 case 94:
2703
2704 /* Line 1806 of yacc.c */
2705 #line 520 "parser.y"
2706 { (yyval.expr) = (yyvsp[(1) - (1)].expr); }
2707 break;
2708
2709 case 95:
2710
2711 /* Line 1806 of yacc.c */
2712 #line 522 "parser.y"
2713 { (yyval.expr) = new_binary_expression(ctx, EXPR_ASSIGN, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
2714 break;
2715
2716 case 96:
2717
2718 /* Line 1806 of yacc.c */
2719 #line 524 "parser.y"
2720 { (yyval.expr) = new_binary_expression(ctx, (yyvsp[(2) - (3)].ival), (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
2721 break;
2722
2723 case 97:
2724
2725 /* Line 1806 of yacc.c */
2726 #line 529 "parser.y"
2727 { (yyval.expr) = (yyvsp[(1) - (1)].expr); }
2728 break;
2729
2730 case 98:
2731
2732 /* Line 1806 of yacc.c */
2733 #line 531 "parser.y"
2734 { (yyval.expr) = new_binary_expression(ctx, EXPR_ASSIGN, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
2735 break;
2736
2737 case 99:
2738
2739 /* Line 1806 of yacc.c */
2740 #line 533 "parser.y"
2741 { (yyval.expr) = new_binary_expression(ctx, (yyvsp[(2) - (3)].ival), (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
2742 break;
2743
2744 case 100:
2745
2746 /* Line 1806 of yacc.c */
2747 #line 537 "parser.y"
2748 { (yyval.expr) = (yyvsp[(1) - (1)].expr); }
2749 break;
2750
2751 case 101:
2752
2753 /* Line 1806 of yacc.c */
2754 #line 539 "parser.y"
2755 { (yyval.expr) = new_conditional_expression(ctx, (yyvsp[(1) - (5)].expr), (yyvsp[(3) - (5)].expr), (yyvsp[(5) - (5)].expr)); }
2756 break;
2757
2758 case 102:
2759
2760 /* Line 1806 of yacc.c */
2761 #line 544 "parser.y"
2762 { (yyval.expr) = (yyvsp[(1) - (1)].expr); }
2763 break;
2764
2765 case 103:
2766
2767 /* Line 1806 of yacc.c */
2768 #line 546 "parser.y"
2769 { (yyval.expr) = new_conditional_expression(ctx, (yyvsp[(1) - (5)].expr), (yyvsp[(3) - (5)].expr), (yyvsp[(5) - (5)].expr)); }
2770 break;
2771
2772 case 104:
2773
2774 /* Line 1806 of yacc.c */
2775 #line 550 "parser.y"
2776 { (yyval.expr) = (yyvsp[(1) - (1)].expr); }
2777 break;
2778
2779 case 105:
2780
2781 /* Line 1806 of yacc.c */
2782 #line 552 "parser.y"
2783 { (yyval.expr) = new_binary_expression(ctx, EXPR_OR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
2784 break;
2785
2786 case 106:
2787
2788 /* Line 1806 of yacc.c */
2789 #line 557 "parser.y"
2790 { (yyval.expr) = (yyvsp[(1) - (1)].expr); }
2791 break;
2792
2793 case 107:
2794
2795 /* Line 1806 of yacc.c */
2796 #line 559 "parser.y"
2797 { (yyval.expr) = new_binary_expression(ctx, EXPR_OR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
2798 break;
2799
2800 case 108:
2801
2802 /* Line 1806 of yacc.c */
2803 #line 563 "parser.y"
2804 { (yyval.expr) = (yyvsp[(1) - (1)].expr); }
2805 break;
2806
2807 case 109:
2808
2809 /* Line 1806 of yacc.c */
2810 #line 565 "parser.y"
2811 { (yyval.expr) = new_binary_expression(ctx, EXPR_AND, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
2812 break;
2813
2814 case 110:
2815
2816 /* Line 1806 of yacc.c */
2817 #line 570 "parser.y"
2818 { (yyval.expr) = (yyvsp[(1) - (1)].expr); }
2819 break;
2820
2821 case 111:
2822
2823 /* Line 1806 of yacc.c */
2824 #line 572 "parser.y"
2825 { (yyval.expr) = new_binary_expression(ctx, EXPR_AND, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
2826 break;
2827
2828 case 112:
2829
2830 /* Line 1806 of yacc.c */
2831 #line 576 "parser.y"
2832 { (yyval.expr) = (yyvsp[(1) - (1)].expr); }
2833 break;
2834
2835 case 113:
2836
2837 /* Line 1806 of yacc.c */
2838 #line 578 "parser.y"
2839 { (yyval.expr) = new_binary_expression(ctx, EXPR_BOR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
2840 break;
2841
2842 case 114:
2843
2844 /* Line 1806 of yacc.c */
2845 #line 583 "parser.y"
2846 { (yyval.expr) = (yyvsp[(1) - (1)].expr); }
2847 break;
2848
2849 case 115:
2850
2851 /* Line 1806 of yacc.c */
2852 #line 585 "parser.y"
2853 { (yyval.expr) = new_binary_expression(ctx, EXPR_BOR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
2854 break;
2855
2856 case 116:
2857
2858 /* Line 1806 of yacc.c */
2859 #line 589 "parser.y"
2860 { (yyval.expr) = (yyvsp[(1) - (1)].expr); }
2861 break;
2862
2863 case 117:
2864
2865 /* Line 1806 of yacc.c */
2866 #line 591 "parser.y"
2867 { (yyval.expr) = new_binary_expression(ctx, EXPR_BXOR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
2868 break;
2869
2870 case 118:
2871
2872 /* Line 1806 of yacc.c */
2873 #line 596 "parser.y"
2874 { (yyval.expr) = (yyvsp[(1) - (1)].expr); }
2875 break;
2876
2877 case 119:
2878
2879 /* Line 1806 of yacc.c */
2880 #line 598 "parser.y"
2881 { (yyval.expr) = new_binary_expression(ctx, EXPR_BXOR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
2882 break;
2883
2884 case 120:
2885
2886 /* Line 1806 of yacc.c */
2887 #line 602 "parser.y"
2888 { (yyval.expr) = (yyvsp[(1) - (1)].expr); }
2889 break;
2890
2891 case 121:
2892
2893 /* Line 1806 of yacc.c */
2894 #line 604 "parser.y"
2895 { (yyval.expr) = new_binary_expression(ctx, EXPR_BAND, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
2896 break;
2897
2898 case 122:
2899
2900 /* Line 1806 of yacc.c */
2901 #line 609 "parser.y"
2902 { (yyval.expr) = (yyvsp[(1) - (1)].expr); }
2903 break;
2904
2905 case 123:
2906
2907 /* Line 1806 of yacc.c */
2908 #line 611 "parser.y"
2909 { (yyval.expr) = new_binary_expression(ctx, EXPR_BAND, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
2910 break;
2911
2912 case 124:
2913
2914 /* Line 1806 of yacc.c */
2915 #line 615 "parser.y"
2916 { (yyval.expr) = (yyvsp[(1) - (1)].expr); }
2917 break;
2918
2919 case 125:
2920
2921 /* Line 1806 of yacc.c */
2922 #line 617 "parser.y"
2923 { (yyval.expr) = new_binary_expression(ctx, (yyvsp[(2) - (3)].ival), (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
2924 break;
2925
2926 case 126:
2927
2928 /* Line 1806 of yacc.c */
2929 #line 621 "parser.y"
2930 { (yyval.expr) = (yyvsp[(1) - (1)].expr); }
2931 break;
2932
2933 case 127:
2934
2935 /* Line 1806 of yacc.c */
2936 #line 623 "parser.y"
2937 { (yyval.expr) = new_binary_expression(ctx, (yyvsp[(2) - (3)].ival), (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
2938 break;
2939
2940 case 128:
2941
2942 /* Line 1806 of yacc.c */
2943 #line 627 "parser.y"
2944 { (yyval.expr) = (yyvsp[(1) - (1)].expr); }
2945 break;
2946
2947 case 129:
2948
2949 /* Line 1806 of yacc.c */
2950 #line 629 "parser.y"
2951 { (yyval.expr) = new_binary_expression(ctx, (yyvsp[(2) - (3)].ival), (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
2952 break;
2953
2954 case 130:
2955
2956 /* Line 1806 of yacc.c */
2957 #line 631 "parser.y"
2958 { (yyval.expr) = new_binary_expression(ctx, EXPR_INSTANCEOF, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
2959 break;
2960
2961 case 131:
2962
2963 /* Line 1806 of yacc.c */
2964 #line 633 "parser.y"
2965 { (yyval.expr) = new_binary_expression(ctx, EXPR_IN, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
2966 break;
2967
2968 case 132:
2969
2970 /* Line 1806 of yacc.c */
2971 #line 637 "parser.y"
2972 { (yyval.expr) = (yyvsp[(1) - (1)].expr); }
2973 break;
2974
2975 case 133:
2976
2977 /* Line 1806 of yacc.c */
2978 #line 639 "parser.y"
2979 { (yyval.expr) = new_binary_expression(ctx, (yyvsp[(2) - (3)].ival), (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
2980 break;
2981
2982 case 134:
2983
2984 /* Line 1806 of yacc.c */
2985 #line 641 "parser.y"
2986 { (yyval.expr) = new_binary_expression(ctx, EXPR_INSTANCEOF, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
2987 break;
2988
2989 case 135:
2990
2991 /* Line 1806 of yacc.c */
2992 #line 645 "parser.y"
2993 { (yyval.expr) = (yyvsp[(1) - (1)].expr); }
2994 break;
2995
2996 case 136:
2997
2998 /* Line 1806 of yacc.c */
2999 #line 647 "parser.y"
3000 { (yyval.expr) = new_binary_expression(ctx, (yyvsp[(2) - (3)].ival), (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
3001 break;
3002
3003 case 137:
3004
3005 /* Line 1806 of yacc.c */
3006 #line 652 "parser.y"
3007 { (yyval.expr) = (yyvsp[(1) - (1)].expr); }
3008 break;
3009
3010 case 138:
3011
3012 /* Line 1806 of yacc.c */
3013 #line 654 "parser.y"
3014 { (yyval.expr) = new_binary_expression(ctx, EXPR_ADD, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
3015 break;
3016
3017 case 139:
3018
3019 /* Line 1806 of yacc.c */
3020 #line 656 "parser.y"
3021 { (yyval.expr) = new_binary_expression(ctx, EXPR_SUB, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
3022 break;
3023
3024 case 140:
3025
3026 /* Line 1806 of yacc.c */
3027 #line 660 "parser.y"
3028 { (yyval.expr) = (yyvsp[(1) - (1)].expr); }
3029 break;
3030
3031 case 141:
3032
3033 /* Line 1806 of yacc.c */
3034 #line 662 "parser.y"
3035 { (yyval.expr) = new_binary_expression(ctx, EXPR_MUL, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
3036 break;
3037
3038 case 142:
3039
3040 /* Line 1806 of yacc.c */
3041 #line 664 "parser.y"
3042 { (yyval.expr) = new_binary_expression(ctx, EXPR_DIV, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
3043 break;
3044
3045 case 143:
3046
3047 /* Line 1806 of yacc.c */
3048 #line 666 "parser.y"
3049 { (yyval.expr) = new_binary_expression(ctx, EXPR_MOD, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
3050 break;
3051
3052 case 144:
3053
3054 /* Line 1806 of yacc.c */
3055 #line 670 "parser.y"
3056 { (yyval.expr) = (yyvsp[(1) - (1)].expr); }
3057 break;
3058
3059 case 145:
3060
3061 /* Line 1806 of yacc.c */
3062 #line 672 "parser.y"
3063 { (yyval.expr) = new_unary_expression(ctx, EXPR_DELETE, (yyvsp[(2) - (2)].expr)); }
3064 break;
3065
3066 case 146:
3067
3068 /* Line 1806 of yacc.c */
3069 #line 673 "parser.y"
3070 { (yyval.expr) = new_unary_expression(ctx, EXPR_VOID, (yyvsp[(2) - (2)].expr)); }
3071 break;
3072
3073 case 147:
3074
3075 /* Line 1806 of yacc.c */
3076 #line 675 "parser.y"
3077 { (yyval.expr) = new_unary_expression(ctx, EXPR_TYPEOF, (yyvsp[(2) - (2)].expr)); }
3078 break;
3079
3080 case 148:
3081
3082 /* Line 1806 of yacc.c */
3083 #line 676 "parser.y"
3084 { (yyval.expr) = new_unary_expression(ctx, EXPR_PREINC, (yyvsp[(2) - (2)].expr)); }
3085 break;
3086
3087 case 149:
3088
3089 /* Line 1806 of yacc.c */
3090 #line 677 "parser.y"
3091 { (yyval.expr) = new_unary_expression(ctx, EXPR_PREDEC, (yyvsp[(2) - (2)].expr)); }
3092 break;
3093
3094 case 150:
3095
3096 /* Line 1806 of yacc.c */
3097 #line 678 "parser.y"
3098 { (yyval.expr) = new_unary_expression(ctx, EXPR_PLUS, (yyvsp[(2) - (2)].expr)); }
3099 break;
3100
3101 case 151:
3102
3103 /* Line 1806 of yacc.c */
3104 #line 679 "parser.y"
3105 { (yyval.expr) = new_unary_expression(ctx, EXPR_MINUS, (yyvsp[(2) - (2)].expr)); }
3106 break;
3107
3108 case 152:
3109
3110 /* Line 1806 of yacc.c */
3111 #line 680 "parser.y"
3112 { (yyval.expr) = new_unary_expression(ctx, EXPR_BITNEG, (yyvsp[(2) - (2)].expr)); }
3113 break;
3114
3115 case 153:
3116
3117 /* Line 1806 of yacc.c */
3118 #line 681 "parser.y"
3119 { (yyval.expr) = new_unary_expression(ctx, EXPR_LOGNEG, (yyvsp[(2) - (2)].expr)); }
3120 break;
3121
3122 case 154:
3123
3124 /* Line 1806 of yacc.c */
3125 #line 686 "parser.y"
3126 { (yyval.expr) = (yyvsp[(1) - (1)].expr); }
3127 break;
3128
3129 case 155:
3130
3131 /* Line 1806 of yacc.c */
3132 #line 688 "parser.y"
3133 { (yyval.expr) = new_unary_expression(ctx, EXPR_POSTINC, (yyvsp[(1) - (2)].expr)); }
3134 break;
3135
3136 case 156:
3137
3138 /* Line 1806 of yacc.c */
3139 #line 690 "parser.y"
3140 { (yyval.expr) = new_unary_expression(ctx, EXPR_POSTDEC, (yyvsp[(1) - (2)].expr)); }
3141 break;
3142
3143 case 157:
3144
3145 /* Line 1806 of yacc.c */
3146 #line 695 "parser.y"
3147 { (yyval.expr) = (yyvsp[(1) - (1)].expr); }
3148 break;
3149
3150 case 158:
3151
3152 /* Line 1806 of yacc.c */
3153 #line 696 "parser.y"
3154 { (yyval.expr) = (yyvsp[(1) - (1)].expr); }
3155 break;
3156
3157 case 159:
3158
3159 /* Line 1806 of yacc.c */
3160 #line 700 "parser.y"
3161 { (yyval.expr) = (yyvsp[(1) - (1)].expr); }
3162 break;
3163
3164 case 160:
3165
3166 /* Line 1806 of yacc.c */
3167 #line 701 "parser.y"
3168 { (yyval.expr) = new_new_expression(ctx, (yyvsp[(2) - (2)].expr), NULL); }
3169 break;
3170
3171 case 161:
3172
3173 /* Line 1806 of yacc.c */
3174 #line 705 "parser.y"
3175 { (yyval.expr) = (yyvsp[(1) - (1)].expr); }
3176 break;
3177
3178 case 162:
3179
3180 /* Line 1806 of yacc.c */
3181 #line 706 "parser.y"
3182 { (yyval.expr) = (yyvsp[(1) - (1)].expr); }
3183 break;
3184
3185 case 163:
3186
3187 /* Line 1806 of yacc.c */
3188 #line 708 "parser.y"
3189 { (yyval.expr) = new_binary_expression(ctx, EXPR_ARRAY, (yyvsp[(1) - (4)].expr), (yyvsp[(3) - (4)].expr)); }
3190 break;
3191
3192 case 164:
3193
3194 /* Line 1806 of yacc.c */
3195 #line 710 "parser.y"
3196 { (yyval.expr) = new_member_expression(ctx, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].identifier)); }
3197 break;
3198
3199 case 165:
3200
3201 /* Line 1806 of yacc.c */
3202 #line 712 "parser.y"
3203 { (yyval.expr) = new_new_expression(ctx, (yyvsp[(2) - (3)].expr), (yyvsp[(3) - (3)].argument_list)); }
3204 break;
3205
3206 case 166:
3207
3208 /* Line 1806 of yacc.c */
3209 #line 717 "parser.y"
3210 { (yyval.expr) = new_call_expression(ctx, (yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].argument_list)); }
3211 break;
3212
3213 case 167:
3214
3215 /* Line 1806 of yacc.c */
3216 #line 719 "parser.y"
3217 { (yyval.expr) = new_call_expression(ctx, (yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].argument_list)); }
3218 break;
3219
3220 case 168:
3221
3222 /* Line 1806 of yacc.c */
3223 #line 721 "parser.y"
3224 { (yyval.expr) = new_binary_expression(ctx, EXPR_ARRAY, (yyvsp[(1) - (4)].expr), (yyvsp[(3) - (4)].expr)); }
3225 break;
3226
3227 case 169:
3228
3229 /* Line 1806 of yacc.c */
3230 #line 723 "parser.y"
3231 { (yyval.expr) = new_member_expression(ctx, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].identifier)); }
3232 break;
3233
3234 case 170:
3235
3236 /* Line 1806 of yacc.c */
3237 #line 727 "parser.y"
3238 { (yyval.argument_list) = NULL; }
3239 break;
3240
3241 case 171:
3242
3243 /* Line 1806 of yacc.c */
3244 #line 728 "parser.y"
3245 { (yyval.argument_list) = (yyvsp[(2) - (3)].argument_list); }
3246 break;
3247
3248 case 172:
3249
3250 /* Line 1806 of yacc.c */
3251 #line 732 "parser.y"
3252 { (yyval.argument_list) = new_argument_list(ctx, (yyvsp[(1) - (1)].expr)); }
3253 break;
3254
3255 case 173:
3256
3257 /* Line 1806 of yacc.c */
3258 #line 734 "parser.y"
3259 { (yyval.argument_list) = argument_list_add(ctx, (yyvsp[(1) - (3)].argument_list), (yyvsp[(3) - (3)].expr)); }
3260 break;
3261
3262 case 174:
3263
3264 /* Line 1806 of yacc.c */
3265 #line 738 "parser.y"
3266 { (yyval.expr) = new_expression(ctx, EXPR_THIS, 0); }
3267 break;
3268
3269 case 175:
3270
3271 /* Line 1806 of yacc.c */
3272 #line 739 "parser.y"
3273 { (yyval.expr) = new_identifier_expression(ctx, (yyvsp[(1) - (1)].identifier)); }
3274 break;
3275
3276 case 176:
3277
3278 /* Line 1806 of yacc.c */
3279 #line 740 "parser.y"
3280 { (yyval.expr) = new_literal_expression(ctx, (yyvsp[(1) - (1)].literal)); }
3281 break;
3282
3283 case 177:
3284
3285 /* Line 1806 of yacc.c */
3286 #line 741 "parser.y"
3287 { (yyval.expr) = (yyvsp[(1) - (1)].expr); }
3288 break;
3289
3290 case 178:
3291
3292 /* Line 1806 of yacc.c */
3293 #line 742 "parser.y"
3294 { (yyval.expr) = (yyvsp[(1) - (1)].expr); }
3295 break;
3296
3297 case 179:
3298
3299 /* Line 1806 of yacc.c */
3300 #line 743 "parser.y"
3301 { (yyval.expr) = (yyvsp[(2) - (3)].expr); }
3302 break;
3303
3304 case 180:
3305
3306 /* Line 1806 of yacc.c */
3307 #line 747 "parser.y"
3308 { (yyval.expr) = new_array_literal_expression(ctx, NULL, 0); }
3309 break;
3310
3311 case 181:
3312
3313 /* Line 1806 of yacc.c */
3314 #line 748 "parser.y"
3315 { (yyval.expr) = new_array_literal_expression(ctx, NULL, (yyvsp[(2) - (3)].ival)+1); }
3316 break;
3317
3318 case 182:
3319
3320 /* Line 1806 of yacc.c */
3321 #line 749 "parser.y"
3322 { (yyval.expr) = new_array_literal_expression(ctx, (yyvsp[(2) - (3)].element_list), 0); }
3323 break;
3324
3325 case 183:
3326
3327 /* Line 1806 of yacc.c */
3328 #line 751 "parser.y"
3329 { (yyval.expr) = new_array_literal_expression(ctx, (yyvsp[(2) - (5)].element_list), (yyvsp[(4) - (5)].ival)+1); }
3330 break;
3331
3332 case 184:
3333
3334 /* Line 1806 of yacc.c */
3335 #line 756 "parser.y"
3336 { (yyval.element_list) = new_element_list(ctx, (yyvsp[(1) - (2)].ival), (yyvsp[(2) - (2)].expr)); }
3337 break;
3338
3339 case 185:
3340
3341 /* Line 1806 of yacc.c */
3342 #line 758 "parser.y"
3343 { (yyval.element_list) = element_list_add(ctx, (yyvsp[(1) - (4)].element_list), (yyvsp[(3) - (4)].ival), (yyvsp[(4) - (4)].expr)); }
3344 break;
3345
3346 case 186:
3347
3348 /* Line 1806 of yacc.c */
3349 #line 762 "parser.y"
3350 { (yyval.ival) = 1; }
3351 break;
3352
3353 case 187:
3354
3355 /* Line 1806 of yacc.c */
3356 #line 763 "parser.y"
3357 { (yyval.ival) = (yyvsp[(1) - (2)].ival) + 1; }
3358 break;
3359
3360 case 188:
3361
3362 /* Line 1806 of yacc.c */
3363 #line 767 "parser.y"
3364 { (yyval.ival) = 0; }
3365 break;
3366
3367 case 189:
3368
3369 /* Line 1806 of yacc.c */
3370 #line 768 "parser.y"
3371 { (yyval.ival) = (yyvsp[(1) - (1)].ival); }
3372 break;
3373
3374 case 190:
3375
3376 /* Line 1806 of yacc.c */
3377 #line 772 "parser.y"
3378 { (yyval.expr) = new_prop_and_value_expression(ctx, NULL); }
3379 break;
3380
3381 case 191:
3382
3383 /* Line 1806 of yacc.c */
3384 #line 774 "parser.y"
3385 { (yyval.expr) = new_prop_and_value_expression(ctx, (yyvsp[(2) - (3)].property_list)); }
3386 break;
3387
3388 case 192:
3389
3390 /* Line 1806 of yacc.c */
3391 #line 779 "parser.y"
3392 { (yyval.property_list) = new_property_list(ctx, (yyvsp[(1) - (3)].literal), (yyvsp[(3) - (3)].expr)); }
3393 break;
3394
3395 case 193:
3396
3397 /* Line 1806 of yacc.c */
3398 #line 781 "parser.y"
3399 { (yyval.property_list) = property_list_add(ctx, (yyvsp[(1) - (5)].property_list), (yyvsp[(3) - (5)].literal), (yyvsp[(5) - (5)].expr)); }
3400 break;
3401
3402 case 194:
3403
3404 /* Line 1806 of yacc.c */
3405 #line 785 "parser.y"
3406 { (yyval.literal) = new_string_literal(ctx, (yyvsp[(1) - (1)].identifier)); }
3407 break;
3408
3409 case 195:
3410
3411 /* Line 1806 of yacc.c */
3412 #line 786 "parser.y"
3413 { (yyval.literal) = new_string_literal(ctx, (yyvsp[(1) - (1)].wstr)); }
3414 break;
3415
3416 case 196:
3417
3418 /* Line 1806 of yacc.c */
3419 #line 787 "parser.y"
3420 { (yyval.literal) = (yyvsp[(1) - (1)].literal); }
3421 break;
3422
3423 case 197:
3424
3425 /* Line 1806 of yacc.c */
3426 #line 791 "parser.y"
3427 { (yyval.identifier) = NULL; }
3428 break;
3429
3430 case 198:
3431
3432 /* Line 1806 of yacc.c */
3433 #line 792 "parser.y"
3434 { (yyval.identifier) = (yyvsp[(1) - (1)].identifier); }
3435 break;
3436
3437 case 199:
3438
3439 /* Line 1806 of yacc.c */
3440 #line 796 "parser.y"
3441 { (yyval.literal) = new_null_literal(ctx); }
3442 break;
3443
3444 case 200:
3445
3446 /* Line 1806 of yacc.c */
3447 #line 797 "parser.y"
3448 { (yyval.literal) = (yyvsp[(1) - (1)].literal); }
3449 break;
3450
3451 case 201:
3452
3453 /* Line 1806 of yacc.c */
3454 #line 798 "parser.y"
3455 { (yyval.literal) = (yyvsp[(1) - (1)].literal); }
3456 break;
3457
3458 case 202:
3459
3460 /* Line 1806 of yacc.c */
3461 #line 799 "parser.y"
3462 { (yyval.literal) = new_string_literal(ctx, (yyvsp[(1) - (1)].wstr)); }
3463 break;
3464
3465 case 203:
3466
3467 /* Line 1806 of yacc.c */
3468 #line 800 "parser.y"
3469 { (yyval.literal) = parse_regexp(ctx);
3470 if(!(yyval.literal)) YYABORT; }
3471 break;
3472
3473 case 204:
3474
3475 /* Line 1806 of yacc.c */
3476 #line 802 "parser.y"
3477 { (yyval.literal) = parse_regexp(ctx);
3478 if(!(yyval.literal)) YYABORT; }
3479 break;
3480
3481 case 205:
3482
3483 /* Line 1806 of yacc.c */
3484 #line 807 "parser.y"
3485 { (yyval.literal) = new_boolean_literal(ctx, VARIANT_TRUE); }
3486 break;
3487
3488 case 206:
3489
3490 /* Line 1806 of yacc.c */
3491 #line 808 "parser.y"
3492 { (yyval.literal) = new_boolean_literal(ctx, VARIANT_FALSE); }
3493 break;
3494
3495 case 207:
3496
3497 /* Line 1806 of yacc.c */
3498 #line 809 "parser.y"
3499 { (yyval.literal) = (yyvsp[(1) - (1)].literal); }
3500 break;
3501
3502 case 209:
3503
3504 /* Line 1806 of yacc.c */
3505 #line 813 "parser.y"
3506 { if(!allow_auto_semicolon(ctx)) {YYABORT;} }
3507 break;
3508
3509 case 211:
3510
3511 /* Line 1806 of yacc.c */
3512 #line 817 "parser.y"
3513 { set_error(ctx, JS_E_MISSING_LBRACKET); YYABORT; }
3514 break;
3515
3516 case 213:
3517
3518 /* Line 1806 of yacc.c */
3519 #line 821 "parser.y"
3520 { set_error(ctx, JS_E_MISSING_RBRACKET); YYABORT; }
3521 break;
3522
3523 case 215:
3524
3525 /* Line 1806 of yacc.c */
3526 #line 825 "parser.y"
3527 { set_error(ctx, JS_E_MISSING_SEMICOLON); YYABORT; }
3528 break;
3529
3530
3531
3532 /* Line 1806 of yacc.c */
3533 #line 3540 "parser.tab.c"
3534 default: break;
3535 }
3536 /* User semantic actions sometimes alter yychar, and that requires
3537 that yytoken be updated with the new translation. We take the
3538 approach of translating immediately before every use of yytoken.
3539 One alternative is translating here after every semantic action,
3540 but that translation would be missed if the semantic action invokes
3541 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
3542 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
3543 incorrect destructor might then be invoked immediately. In the
3544 case of YYERROR or YYBACKUP, subsequent parser actions might lead
3545 to an incorrect destructor call or verbose syntax error message
3546 before the lookahead is translated. */
3547 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
3548
3549 YYPOPSTACK (yylen);
3550 yylen = 0;
3551 YY_STACK_PRINT (yyss, yyssp);
3552
3553 *++yyvsp = yyval;
3554
3555 /* Now `shift' the result of the reduction. Determine what state
3556 that goes to, based on the state we popped back to and the rule
3557 number reduced by. */
3558
3559 yyn = yyr1[yyn];
3560
3561 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
3562 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
3563 yystate = yytable[yystate];
3564 else
3565 yystate = yydefgoto[yyn - YYNTOKENS];
3566
3567 goto yynewstate;
3568
3569
3570 /*------------------------------------.
3571 | yyerrlab -- here on detecting error |
3572 `------------------------------------*/
3573 yyerrlab:
3574 /* Make sure we have latest lookahead translation. See comments at
3575 user semantic actions for why this is necessary. */
3576 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
3577
3578 /* If not already recovering from an error, report this error. */
3579 if (!yyerrstatus)
3580 {
3581 ++yynerrs;
3582 #if ! YYERROR_VERBOSE
3583 yyerror (ctx, YY_("syntax error"));
3584 #else
3585 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
3586 yyssp, yytoken)
3587 {
3588 char const *yymsgp = YY_("syntax error");
3589 int yysyntax_error_status;
3590 yysyntax_error_status = YYSYNTAX_ERROR;
3591 if (yysyntax_error_status == 0)
3592 yymsgp = yymsg;
3593 else if (yysyntax_error_status == 1)
3594 {
3595 if (yymsg != yymsgbuf)
3596 YYSTACK_FREE (yymsg);
3597 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
3598 if (!yymsg)
3599 {
3600 yymsg = yymsgbuf;
3601 yymsg_alloc = sizeof yymsgbuf;
3602 yysyntax_error_status = 2;
3603 }
3604 else
3605 {
3606 yysyntax_error_status = YYSYNTAX_ERROR;
3607 yymsgp = yymsg;
3608 }
3609 }
3610 yyerror (ctx, yymsgp);
3611 if (yysyntax_error_status == 2)
3612 goto yyexhaustedlab;
3613 }
3614 # undef YYSYNTAX_ERROR
3615 #endif
3616 }
3617
3618
3619
3620 if (yyerrstatus == 3)
3621 {
3622 /* If just tried and failed to reuse lookahead token after an
3623 error, discard it. */
3624
3625 if (yychar <= YYEOF)
3626 {
3627 /* Return failure if at end of input. */
3628 if (yychar == YYEOF)
3629 YYABORT;
3630 }
3631 else
3632 {
3633 yydestruct ("Error: discarding",
3634 yytoken, &yylval, ctx);
3635 yychar = YYEMPTY;
3636 }
3637 }
3638
3639 /* Else will try to reuse lookahead token after shifting the error
3640 token. */
3641 goto yyerrlab1;
3642
3643
3644 /*---------------------------------------------------.
3645 | yyerrorlab -- error raised explicitly by YYERROR. |
3646 `---------------------------------------------------*/
3647 yyerrorlab:
3648
3649 /* Pacify compilers like GCC when the user code never invokes
3650 YYERROR and the label yyerrorlab therefore never appears in user
3651 code. */
3652 if (/*CONSTCOND*/ 0)
3653 goto yyerrorlab;
3654
3655 /* Do not reclaim the symbols of the rule which action triggered
3656 this YYERROR. */
3657 YYPOPSTACK (yylen);
3658 yylen = 0;
3659 YY_STACK_PRINT (yyss, yyssp);
3660 yystate = *yyssp;
3661 goto yyerrlab1;
3662
3663
3664 /*-------------------------------------------------------------.
3665 | yyerrlab1 -- common code for both syntax error and YYERROR. |
3666 `-------------------------------------------------------------*/
3667 yyerrlab1:
3668 yyerrstatus = 3; /* Each real token shifted decrements this. */
3669
3670 for (;;)
3671 {
3672 yyn = yypact[yystate];
3673 if (!yypact_value_is_default (yyn))
3674 {
3675 yyn += YYTERROR;
3676 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
3677 {
3678 yyn = yytable[yyn];
3679 if (0 < yyn)
3680 break;
3681 }
3682 }
3683
3684 /* Pop the current state because it cannot handle the error token. */
3685 if (yyssp == yyss)
3686 YYABORT;
3687
3688
3689 yydestruct ("Error: popping",
3690 yystos[yystate], yyvsp, ctx);
3691 YYPOPSTACK (1);
3692 yystate = *yyssp;
3693 YY_STACK_PRINT (yyss, yyssp);
3694 }
3695
3696 *++yyvsp = yylval;
3697
3698
3699 /* Shift the error token. */
3700 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
3701
3702 yystate = yyn;
3703 goto yynewstate;
3704
3705
3706 /*-------------------------------------.
3707 | yyacceptlab -- YYACCEPT comes here. |
3708 `-------------------------------------*/
3709 yyacceptlab:
3710 yyresult = 0;
3711 goto yyreturn;
3712
3713 /*-----------------------------------.
3714 | yyabortlab -- YYABORT comes here. |
3715 `-----------------------------------*/
3716 yyabortlab:
3717 yyresult = 1;
3718 goto yyreturn;
3719
3720 #if !defined(yyoverflow) || YYERROR_VERBOSE
3721 /*-------------------------------------------------.
3722 | yyexhaustedlab -- memory exhaustion comes here. |
3723 `-------------------------------------------------*/
3724 yyexhaustedlab:
3725 yyerror (ctx, YY_("memory exhausted"));
3726 yyresult = 2;
3727 /* Fall through. */
3728 #endif
3729
3730 yyreturn:
3731 if (yychar != YYEMPTY)
3732 {
3733 /* Make sure we have latest lookahead translation. See comments at
3734 user semantic actions for why this is necessary. */
3735 yytoken = YYTRANSLATE (yychar);
3736 yydestruct ("Cleanup: discarding lookahead",
3737 yytoken, &yylval, ctx);
3738 }
3739 /* Do not reclaim the symbols of the rule which action triggered
3740 this YYABORT or YYACCEPT. */
3741 YYPOPSTACK (yylen);
3742 YY_STACK_PRINT (yyss, yyssp);
3743 while (yyssp != yyss)
3744 {
3745 yydestruct ("Cleanup: popping",
3746 yystos[*yyssp], yyvsp, ctx);
3747 YYPOPSTACK (1);
3748 }
3749 #ifndef yyoverflow
3750 if (yyss != yyssa)
3751 YYSTACK_FREE (yyss);
3752 #endif
3753 #if YYERROR_VERBOSE
3754 if (yymsg != yymsgbuf)
3755 YYSTACK_FREE (yymsg);
3756 #endif
3757 /* Make sure YYID is used. */
3758 return YYID (yyresult);
3759 }
3760
3761
3762
3763 /* Line 2067 of yacc.c */
3764 #line 827 "parser.y"
3765
3766
3767 static BOOL allow_auto_semicolon(parser_ctx_t *ctx)
3768 {
3769 return ctx->nl || ctx->ptr == ctx->end || *(ctx->ptr-1) == '}';
3770 }
3771
3772 static void *new_statement(parser_ctx_t *ctx, statement_type_t type, size_t size)
3773 {
3774 statement_t *stat;
3775
3776 stat = parser_alloc(ctx, size ? size : sizeof(*stat));
3777 if(!stat)
3778 return NULL;
3779
3780 stat->type = type;
3781 stat->next = NULL;
3782
3783 return stat;
3784 }
3785
3786 static literal_t *new_string_literal(parser_ctx_t *ctx, const WCHAR *str)
3787 {
3788 literal_t *ret = parser_alloc(ctx, sizeof(literal_t));
3789
3790 ret->type = LT_STRING;
3791 ret->u.wstr = str;
3792
3793 return ret;
3794 }
3795
3796 static literal_t *new_null_literal(parser_ctx_t *ctx)
3797 {
3798 literal_t *ret = parser_alloc(ctx, sizeof(literal_t));
3799
3800 ret->type = LT_NULL;
3801
3802 return ret;
3803 }
3804
3805 static prop_val_t *new_prop_val(parser_ctx_t *ctx, literal_t *name, expression_t *value)
3806 {
3807 prop_val_t *ret = parser_alloc(ctx, sizeof(prop_val_t));
3808
3809 ret->name = name;
3810 ret->value = value;
3811 ret->next = NULL;
3812
3813 return ret;
3814 }
3815
3816 static property_list_t *new_property_list(parser_ctx_t *ctx, literal_t *name, expression_t *value)
3817 {
3818 property_list_t *ret = parser_alloc_tmp(ctx, sizeof(property_list_t));
3819
3820 ret->head = ret->tail = new_prop_val(ctx, name, value);
3821
3822 return ret;
3823 }
3824
3825 static property_list_t *property_list_add(parser_ctx_t *ctx, property_list_t *list, literal_t *name, expression_t *value)
3826 {
3827 list->tail = list->tail->next = new_prop_val(ctx, name, value);
3828
3829 return list;
3830 }
3831
3832 static array_element_t *new_array_element(parser_ctx_t *ctx, int elision, expression_t *expr)
3833 {
3834 array_element_t *ret = parser_alloc(ctx, sizeof(array_element_t));
3835
3836 ret->elision = elision;
3837 ret->expr = expr;
3838 ret->next = NULL;
3839
3840 return ret;
3841 }
3842
3843 static element_list_t *new_element_list(parser_ctx_t *ctx, int elision, expression_t *expr)
3844 {
3845 element_list_t *ret = parser_alloc_tmp(ctx, sizeof(element_list_t));
3846
3847 ret->head = ret->tail = new_array_element(ctx, elision, expr);
3848
3849 return ret;
3850 }
3851
3852 static element_list_t *element_list_add(parser_ctx_t *ctx, element_list_t *list, int elision, expression_t *expr)
3853 {
3854 list->tail = list->tail->next = new_array_element(ctx, elision, expr);
3855
3856 return list;
3857 }
3858
3859 static argument_t *new_argument(parser_ctx_t *ctx, expression_t *expr)
3860 {
3861 argument_t *ret = parser_alloc(ctx, sizeof(argument_t));
3862
3863 ret->expr = expr;
3864 ret->next = NULL;
3865
3866 return ret;
3867 }
3868
3869 static argument_list_t *new_argument_list(parser_ctx_t *ctx, expression_t *expr)
3870 {
3871 argument_list_t *ret = parser_alloc_tmp(ctx, sizeof(argument_list_t));
3872
3873 ret->head = ret->tail = new_argument(ctx, expr);
3874
3875 return ret;
3876 }
3877
3878 static argument_list_t *argument_list_add(parser_ctx_t *ctx, argument_list_t *list, expression_t *expr)
3879 {
3880 list->tail = list->tail->next = new_argument(ctx, expr);
3881
3882 return list;
3883 }
3884
3885 static catch_block_t *new_catch_block(parser_ctx_t *ctx, const WCHAR *identifier, statement_t *statement)
3886 {
3887 catch_block_t *ret = parser_alloc(ctx, sizeof(catch_block_t));
3888
3889 ret->identifier = identifier;
3890 ret->statement = statement;
3891
3892 return ret;
3893 }
3894
3895 static case_clausule_t *new_case_clausule(parser_ctx_t *ctx, expression_t *expr, statement_list_t *stat_list)
3896 {
3897 case_clausule_t *ret = parser_alloc(ctx, sizeof(case_clausule_t));
3898
3899 ret->expr = expr;
3900 ret->stat = stat_list ? stat_list->head : NULL;
3901 ret->next = NULL;
3902
3903 return ret;
3904 }
3905
3906 static case_list_t *new_case_list(parser_ctx_t *ctx, case_clausule_t *case_clausule)
3907 {
3908 case_list_t *ret = parser_alloc_tmp(ctx, sizeof(case_list_t));
3909
3910 ret->head = ret->tail = case_clausule;
3911
3912 return ret;
3913 }
3914
3915 static case_list_t *case_list_add(parser_ctx_t *ctx, case_list_t *list, case_clausule_t *case_clausule)
3916 {
3917 list->tail = list->tail->next = case_clausule;
3918
3919 return list;
3920 }
3921
3922 static case_clausule_t *new_case_block(parser_ctx_t *ctx, case_list_t *case_list1,
3923 case_clausule_t *default_clausule, case_list_t *case_list2)
3924 {
3925 case_clausule_t *ret = NULL, *iter = NULL, *iter2;
3926 statement_t *stat = NULL;
3927
3928 if(case_list1) {
3929 ret = case_list1->head;
3930 iter = case_list1->tail;
3931 }
3932
3933 if(default_clausule) {
3934 if(ret)
3935 iter = iter->next = default_clausule;
3936 else
3937 ret = iter = default_clausule;
3938 }
3939
3940 if(case_list2) {
3941 if(ret)
3942 iter->next = case_list2->head;
3943 else
3944 ret = case_list2->head;
3945 }
3946
3947 if(!ret)
3948 return NULL;
3949
3950 for(iter = ret; iter; iter = iter->next) {
3951 for(iter2 = iter; iter2 && !iter2->stat; iter2 = iter2->next);
3952 if(!iter2)
3953 break;
3954
3955 while(iter != iter2) {
3956 iter->stat = iter2->stat;
3957 iter = iter->next;
3958 }
3959
3960 if(stat) {
3961 while(stat->next)
3962 stat = stat->next;
3963 stat->next = iter->stat;
3964 }else {
3965 stat = iter->stat;
3966 }
3967 }
3968
3969 return ret;
3970 }
3971
3972 static statement_t *new_block_statement(parser_ctx_t *ctx, statement_list_t *list)
3973 {
3974 block_statement_t *ret;
3975
3976 ret = new_statement(ctx, STAT_BLOCK, sizeof(*ret));
3977 if(!ret)
3978 return NULL;
3979
3980 ret->stat_list = list ? list->head : NULL;
3981
3982 return &ret->stat;
3983 }
3984
3985 static variable_declaration_t *new_variable_declaration(parser_ctx_t *ctx, const WCHAR *identifier, expression_t *expr)
3986 {
3987 variable_declaration_t *ret = parser_alloc(ctx, sizeof(variable_declaration_t));
3988
3989 ret->identifier = identifier;
3990 ret->expr = expr;
3991 ret->next = NULL;
3992 ret->global_next = NULL;
3993
3994 return ret;
3995 }
3996
3997 static variable_list_t *new_variable_list(parser_ctx_t *ctx, variable_declaration_t *decl)
3998 {
3999 variable_list_t *ret = parser_alloc_tmp(ctx, sizeof(variable_list_t));
4000
4001 ret->head = ret->tail = decl;
4002
4003 return ret;
4004 }
4005
4006 static variable_list_t *variable_list_add(parser_ctx_t *ctx, variable_list_t *list, variable_declaration_t *decl)
4007 {
4008 list->tail = list->tail->next = decl;
4009
4010 return list;
4011 }
4012
4013 static statement_t *new_var_statement(parser_ctx_t *ctx, variable_list_t *variable_list)
4014 {
4015 var_statement_t *ret;
4016
4017 ret = new_statement(ctx, STAT_VAR, sizeof(*ret));
4018 if(!ret)
4019 return NULL;
4020
4021 ret->variable_list = variable_list->head;
4022
4023 return &ret->stat;
4024 }
4025
4026 static statement_t *new_expression_statement(parser_ctx_t *ctx, expression_t *expr)
4027 {
4028 expression_statement_t *ret;
4029
4030 ret = new_statement(ctx, STAT_EXPR, sizeof(*ret));
4031 if(!ret)
4032 return NULL;
4033
4034 ret->expr = expr;
4035
4036 return &ret->stat;
4037 }
4038
4039 static statement_t *new_if_statement(parser_ctx_t *ctx, expression_t *expr, statement_t *if_stat, statement_t *else_stat)
4040 {
4041 if_statement_t *ret;
4042
4043 ret = new_statement(ctx, STAT_IF, sizeof(*ret));
4044 if(!ret)
4045 return NULL;
4046
4047 ret->expr = expr;
4048 ret->if_stat = if_stat;
4049 ret->else_stat = else_stat;
4050
4051 return &ret->stat;
4052 }
4053
4054 static statement_t *new_while_statement(parser_ctx_t *ctx, BOOL dowhile, expression_t *expr, statement_t *stat)
4055 {
4056 while_statement_t *ret;
4057
4058 ret = new_statement(ctx, STAT_WHILE, sizeof(*ret));
4059 if(!ret)
4060 return NULL;
4061
4062 ret->do_while = dowhile;
4063 ret->expr = expr;
4064 ret->statement = stat;
4065
4066 return &ret->stat;
4067 }
4068
4069 static statement_t *new_for_statement(parser_ctx_t *ctx, variable_list_t *variable_list, expression_t *begin_expr,
4070 expression_t *expr, expression_t *end_expr, statement_t *statement)
4071 {
4072 for_statement_t *ret;
4073
4074 ret = new_statement(ctx, STAT_FOR, sizeof(*ret));
4075 if(!ret)
4076 return NULL;
4077
4078 ret->variable_list = variable_list ? variable_list->head : NULL;
4079 ret->begin_expr = begin_expr;
4080 ret->expr = expr;
4081 ret->end_expr = end_expr;
4082 ret->statement = statement;
4083
4084 return &ret->stat;
4085 }
4086
4087 static statement_t *new_forin_statement(parser_ctx_t *ctx, variable_declaration_t *variable, expression_t *expr,
4088 expression_t *in_expr, statement_t *statement)
4089 {
4090 forin_statement_t *ret;
4091
4092 ret = new_statement(ctx, STAT_FORIN, sizeof(*ret));
4093 if(!ret)
4094 return NULL;
4095
4096 ret->variable = variable;
4097 ret->expr = expr;
4098 ret->in_expr = in_expr;
4099 ret->statement = statement;
4100
4101 return &ret->stat;
4102 }
4103
4104 static statement_t *new_continue_statement(parser_ctx_t *ctx, const WCHAR *identifier)
4105 {
4106 branch_statement_t *ret;
4107
4108 ret = new_statement(ctx, STAT_CONTINUE, sizeof(*ret));
4109 if(!ret)
4110 return NULL;
4111
4112 ret->identifier = identifier;
4113
4114 return &ret->stat;
4115 }
4116
4117 static statement_t *new_break_statement(parser_ctx_t *ctx, const WCHAR *identifier)
4118 {
4119 branch_statement_t *ret;
4120
4121 ret = new_statement(ctx, STAT_BREAK, sizeof(*ret));
4122 if(!ret)
4123 return NULL;
4124
4125 ret->identifier = identifier;
4126
4127 return &ret->stat;
4128 }
4129
4130 static statement_t *new_return_statement(parser_ctx_t *ctx, expression_t *expr)
4131 {
4132 expression_statement_t *ret;
4133
4134 ret = new_statement(ctx, STAT_RETURN, sizeof(*ret));
4135 if(!ret)
4136 return NULL;
4137
4138 ret->expr = expr;
4139
4140 return &ret->stat;
4141 }
4142
4143 static statement_t *new_with_statement(parser_ctx_t *ctx, expression_t *expr, statement_t *statement)
4144 {
4145 with_statement_t *ret;
4146
4147 ret = new_statement(ctx, STAT_WITH, sizeof(*ret));
4148 if(!ret)
4149 return NULL;
4150
4151 ret->expr = expr;
4152 ret->statement = statement;
4153
4154 return &ret->stat;
4155 }
4156
4157 static statement_t *new_labelled_statement(parser_ctx_t *ctx, const WCHAR *identifier, statement_t *statement)
4158 {
4159 labelled_statement_t *ret;
4160
4161 ret = new_statement(ctx, STAT_LABEL, sizeof(*ret));
4162 if(!ret)
4163 return NULL;
4164
4165 ret->identifier = identifier;
4166 ret->statement = statement;
4167
4168 return &ret->stat;
4169 }
4170
4171 static statement_t *new_switch_statement(parser_ctx_t *ctx, expression_t *expr, case_clausule_t *case_list)
4172 {
4173 switch_statement_t *ret;
4174
4175 ret = new_statement(ctx, STAT_SWITCH, sizeof(*ret));
4176 if(!ret)
4177 return NULL;
4178
4179 ret->expr = expr;
4180 ret->case_list = case_list;
4181
4182 return &ret->stat;
4183 }
4184
4185 static statement_t *new_throw_statement(parser_ctx_t *ctx, expression_t *expr)
4186 {
4187 expression_statement_t *ret;
4188
4189 ret = new_statement(ctx, STAT_THROW, sizeof(*ret));
4190 if(!ret)
4191 return NULL;
4192
4193 ret->expr = expr;
4194
4195 return &ret->stat;
4196 }
4197
4198 static statement_t *new_try_statement(parser_ctx_t *ctx, statement_t *try_statement,
4199 catch_block_t *catch_block, statement_t *finally_statement)
4200 {
4201 try_statement_t *ret;
4202
4203 ret = new_statement(ctx, STAT_TRY, sizeof(*ret));
4204 if(!ret)
4205 return NULL;
4206
4207 ret->try_statement = try_statement;
4208 ret->catch_block = catch_block;
4209 ret->finally_statement = finally_statement;
4210
4211 return &ret->stat;
4212 }
4213
4214 static parameter_t *new_parameter(parser_ctx_t *ctx, const WCHAR *identifier)
4215 {
4216 parameter_t *ret = parser_alloc(ctx, sizeof(parameter_t));
4217
4218 ret->identifier = identifier;
4219 ret->next = NULL;
4220
4221 return ret;
4222 }
4223
4224 static parameter_list_t *new_parameter_list(parser_ctx_t *ctx, const WCHAR *identifier)
4225 {
4226 parameter_list_t *ret = parser_alloc_tmp(ctx, sizeof(parameter_list_t));
4227
4228 ret->head = ret->tail = new_parameter(ctx, identifier);
4229
4230 return ret;
4231 }
4232
4233 static parameter_list_t *parameter_list_add(parser_ctx_t *ctx, parameter_list_t *list, const WCHAR *identifier)
4234 {
4235 list->tail = list->tail->next = new_parameter(ctx, identifier);
4236
4237 return list;
4238 }
4239
4240 static expression_t *new_function_expression(parser_ctx_t *ctx, const WCHAR *identifier,
4241 parameter_list_t *parameter_list, source_elements_t *source_elements, const WCHAR *src_str, DWORD src_len)
4242 {
4243 function_expression_t *ret = new_expression(ctx, EXPR_FUNC, sizeof(*ret));
4244
4245 ret->identifier = identifier;
4246 ret->parameter_list = parameter_list ? parameter_list->head : NULL;
4247 ret->source_elements = source_elements;
4248 ret->src_str = src_str;
4249 ret->src_len = src_len;
4250 ret->next = NULL;
4251
4252 return &ret->expr;
4253 }
4254
4255 static void *new_expression(parser_ctx_t *ctx, expression_type_t type, size_t size)
4256 {
4257 expression_t *ret = parser_alloc(ctx, size ? size : sizeof(*ret));
4258
4259 ret->type = type;
4260
4261 return ret;
4262 }
4263
4264 static expression_t *new_binary_expression(parser_ctx_t *ctx, expression_type_t type,
4265 expression_t *expression1, expression_t *expression2)
4266 {
4267 binary_expression_t *ret = new_expression(ctx, type, sizeof(*ret));
4268
4269 ret->expression1 = expression1;
4270 ret->expression2 = expression2;
4271
4272 return &ret->expr;
4273 }
4274
4275 static expression_t *new_unary_expression(parser_ctx_t *ctx, expression_type_t type, expression_t *expression)
4276 {
4277 unary_expression_t *ret = new_expression(ctx, type, sizeof(*ret));
4278
4279 ret->expression = expression;
4280
4281 return &ret->expr;
4282 }
4283
4284 static expression_t *new_conditional_expression(parser_ctx_t *ctx, expression_t *expression,
4285 expression_t *true_expression, expression_t *false_expression)
4286 {
4287 conditional_expression_t *ret = new_expression(ctx, EXPR_COND, sizeof(*ret));
4288
4289 ret->expression = expression;
4290 ret->true_expression = true_expression;
4291 ret->false_expression = false_expression;
4292
4293 return &ret->expr;
4294 }
4295
4296 static expression_t *new_member_expression(parser_ctx_t *ctx, expression_t *expression, const WCHAR *identifier)
4297 {
4298 member_expression_t *ret = new_expression(ctx, EXPR_MEMBER, sizeof(*ret));
4299
4300 ret->expression = expression;
4301 ret->identifier = identifier;
4302
4303 return &ret->expr;
4304 }
4305
4306 static expression_t *new_new_expression(parser_ctx_t *ctx, expression_t *expression, argument_list_t *argument_list)
4307 {
4308 call_expression_t *ret = new_expression(ctx, EXPR_NEW, sizeof(*ret));
4309
4310 ret->expression = expression;
4311 ret->argument_list = argument_list ? argument_list->head : NULL;
4312
4313 return &ret->expr;
4314 }
4315
4316 static expression_t *new_call_expression(parser_ctx_t *ctx, expression_t *expression, argument_list_t *argument_list)
4317 {
4318 call_expression_t *ret = new_expression(ctx, EXPR_CALL, sizeof(*ret));
4319
4320 ret->expression = expression;
4321 ret->argument_list = argument_list ? argument_list->head : NULL;
4322
4323 return &ret->expr;
4324 }
4325
4326 static int parser_error(parser_ctx_t *ctx, const char *str)
4327 {
4328 return 0;
4329 }
4330
4331 static void set_error(parser_ctx_t *ctx, UINT error)
4332 {
4333 ctx->hres = error;
4334 }
4335
4336 static BOOL explicit_error(parser_ctx_t *ctx, void *obj, WCHAR next)
4337 {
4338 if(obj || *(ctx->ptr-1)==next) return TRUE;
4339
4340 set_error(ctx, JS_E_SYNTAX);
4341 return FALSE;
4342 }
4343
4344
4345 static expression_t *new_identifier_expression(parser_ctx_t *ctx, const WCHAR *identifier)
4346 {
4347 identifier_expression_t *ret = new_expression(ctx, EXPR_IDENT, sizeof(*ret));
4348
4349 ret->identifier = identifier;
4350
4351 return &ret->expr;
4352 }
4353
4354 static expression_t *new_array_literal_expression(parser_ctx_t *ctx, element_list_t *element_list, int length)
4355 {
4356 array_literal_expression_t *ret = new_expression(ctx, EXPR_ARRAYLIT, sizeof(*ret));
4357
4358 ret->element_list = element_list ? element_list->head : NULL;
4359 ret->length = length;
4360
4361 return &ret->expr;
4362 }
4363
4364 static expression_t *new_prop_and_value_expression(parser_ctx_t *ctx, property_list_t *property_list)
4365 {
4366 property_value_expression_t *ret = new_expression(ctx, EXPR_PROPVAL, sizeof(*ret));
4367
4368 ret->property_list = property_list ? property_list->head : NULL;
4369
4370 return &ret->expr;
4371 }
4372
4373 static expression_t *new_literal_expression(parser_ctx_t *ctx, literal_t *literal)
4374 {
4375 literal_expression_t *ret = new_expression(ctx, EXPR_LITERAL, sizeof(*ret));
4376
4377 ret->literal = literal;
4378
4379 return &ret->expr;
4380 }
4381
4382 static source_elements_t *new_source_elements(parser_ctx_t *ctx)
4383 {
4384 source_elements_t *ret = parser_alloc(ctx, sizeof(source_elements_t));
4385
4386 memset(ret, 0, sizeof(*ret));
4387
4388 return ret;
4389 }
4390
4391 static source_elements_t *source_elements_add_statement(source_elements_t *source_elements, statement_t *statement)
4392 {
4393 if(source_elements->statement_tail)
4394 source_elements->statement_tail = source_elements->statement_tail->next = statement;
4395 else
4396 source_elements->statement = source_elements->statement_tail = statement;
4397
4398 return source_elements;
4399 }
4400
4401 static statement_list_t *new_statement_list(parser_ctx_t *ctx, statement_t *statement)
4402 {
4403 statement_list_t *ret = parser_alloc_tmp(ctx, sizeof(statement_list_t));
4404
4405 ret->head = ret->tail = statement;
4406
4407 return ret;
4408 }
4409
4410 static statement_list_t *statement_list_add(statement_list_t *list, statement_t *statement)
4411 {
4412 list->tail = list->tail->next = statement;
4413
4414 return list;
4415 }
4416
4417 static void program_parsed(parser_ctx_t *ctx, source_elements_t *source)
4418 {
4419 ctx->source = source;
4420 if(!ctx->lexer_error)
4421 ctx->hres = S_OK;
4422 }
4423
4424 void parser_release(parser_ctx_t *ctx)
4425 {
4426 script_release(ctx->script);
4427 heap_pool_free(&ctx->heap);
4428 heap_free(ctx);
4429 }
4430
4431 HRESULT script_parse(script_ctx_t *ctx, const WCHAR *code, const WCHAR *delimiter, BOOL from_eval,
4432 parser_ctx_t **ret)
4433 {
4434 parser_ctx_t *parser_ctx;
4435 heap_pool_t *mark;
4436 HRESULT hres;
4437
4438 const WCHAR html_tagW[] = {'<','/','s','c','r','i','p','t','>',0};
4439
4440 parser_ctx = heap_alloc_zero(sizeof(parser_ctx_t));
4441 if(!parser_ctx)
4442 return E_OUTOFMEMORY;
4443
4444 parser_ctx->hres = JS_E_SYNTAX;
4445 parser_ctx->is_html = delimiter && !strcmpiW(delimiter, html_tagW);
4446
4447 parser_ctx->begin = parser_ctx->ptr = code;
4448 parser_ctx->end = parser_ctx->begin + strlenW(parser_ctx->begin);
4449
4450 script_addref(ctx);
4451 parser_ctx->script = ctx;
4452
4453 mark = heap_pool_mark(&ctx->tmp_heap);
4454 heap_pool_init(&parser_ctx->heap);
4455
4456 parser_parse(parser_ctx);
4457 heap_pool_clear(mark);
4458 hres = parser_ctx->hres;
4459 if(FAILED(hres)) {
4460 WARN("parser failed around %s\n",
4461 debugstr_w(parser_ctx->begin+20 > parser_ctx->ptr ? parser_ctx->begin : parser_ctx->ptr-20));
4462 parser_release(parser_ctx);
4463 return hres;
4464 }
4465
4466 *ret = parser_ctx;
4467 return S_OK;
4468 }
4469