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