1 /* A Bison parser, made by GNU Bison 3.0.2. */
3 /* Bison implementation for Yacc-like parsers in C
5 Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
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.
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.
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/>. */
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.
30 This special exception was added by the Free Software Foundation in
31 version 2.2 of Bison. */
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34 simplifying the original so-called "semantic" parser. */
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. */
43 /* Identify Bison output. */
47 #define YYBISON_VERSION "3.0.2"
50 #define YYSKELETON_NAME "yacc.c"
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
70 /* Copy the first part of user declarations. */
71 #line 19 "parser.y" /* yacc.c:339 */
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
*);
82 typedef struct _statement_list_t
{
87 static literal_t
*new_string_literal(parser_ctx_t
*,const WCHAR
*);
88 static literal_t
*new_null_literal(parser_ctx_t
*);
90 typedef struct _property_list_t
{
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
*);
98 typedef struct _element_list_t
{
99 array_element_t
*head
;
100 array_element_t
*tail
;
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
*);
106 typedef struct _argument_list_t
{
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
*);
114 typedef struct _case_list_t
{
115 case_clausule_t
*head
;
116 case_clausule_t
*tail
;
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
*);
125 typedef struct _variable_list_t
{
126 variable_declaration_t
*head
;
127 variable_declaration_t
*tail
;
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
*);
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
*);
152 struct statement_list_t
{
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
*);
160 typedef struct _parameter_list_t
{
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
*);
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
*);
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
*);
186 #line 193 "parser.tab.c" /* yacc.c:339 */
189 # if defined __cplusplus && 201103L <= __cplusplus
190 # define YY_NULLPTR nullptr
192 # define YY_NULLPTR 0
196 /* Enabling verbose error messages. */
197 #ifdef YYERROR_VERBOSE
198 # undef YYERROR_VERBOSE
199 # define YYERROR_VERBOSE 1
201 # define YYERROR_VERBOSE 0
210 extern int parser_debug
;
258 tNumericLiteral
= 298,
259 tBooleanLiteral
= 299,
260 tStringLiteral
= 300,
262 LOWER_THAN_ELSE
= 302
267 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
268 typedef union YYSTYPE YYSTYPE
;
271 #line 145 "parser.y" /* yacc.c:355 */
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
;
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
;
292 #line 299 "parser.tab.c" /* yacc.c:355 */
294 # define YYSTYPE_IS_TRIVIAL 1
295 # define YYSTYPE_IS_DECLARED 1
300 int parser_parse (parser_ctx_t
*ctx
);
304 /* Copy the second part of user declarations. */
306 #line 313 "parser.tab.c" /* yacc.c:358 */
313 typedef YYTYPE_UINT8 yytype_uint8
;
315 typedef unsigned char yytype_uint8
;
319 typedef YYTYPE_INT8 yytype_int8
;
321 typedef signed char yytype_int8
;
325 typedef YYTYPE_UINT16 yytype_uint16
;
327 typedef unsigned short int yytype_uint16
;
331 typedef YYTYPE_INT16 yytype_int16
;
333 typedef short int yytype_int16
;
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
345 # define YYSIZE_T unsigned int
349 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
352 # if defined YYENABLE_NLS && YYENABLE_NLS
354 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
355 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
359 # define YY_(Msgid) Msgid
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)
369 # define YY_ATTRIBUTE(Spec) /* empty */
373 #ifndef YY_ATTRIBUTE_PURE
374 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
377 #ifndef YY_ATTRIBUTE_UNUSED
378 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
381 #if !defined _Noreturn \
382 && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
383 # if defined _MSC_VER && 1200 <= _MSC_VER
384 # define _Noreturn __declspec (noreturn)
386 # define _Noreturn YY_ATTRIBUTE ((__noreturn__))
390 /* Suppress unused-variable warnings by "using" E. */
391 #if ! defined lint || defined __GNUC__
392 # define YYUSE(E) ((void) (E))
394 # define YYUSE(E) /* empty */
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")
406 # define YY_INITIAL_VALUE(Value) Value
408 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
409 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
410 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
412 #ifndef YY_INITIAL_VALUE
413 # define YY_INITIAL_VALUE(Value) /* Nothing. */
417 #if ! defined yyoverflow || YYERROR_VERBOSE
419 /* The parser invokes alloca or malloc; define the necessary symbols. */
421 # ifdef YYSTACK_USE_ALLOCA
422 # if YYSTACK_USE_ALLOCA
424 # define YYSTACK_ALLOC __builtin_alloca
425 # elif defined __BUILTIN_VA_ARG_INCR
426 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
428 # define YYSTACK_ALLOC __alloca
429 # elif defined _MSC_VER
430 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
431 # define alloca _alloca
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
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 */
456 # define YYSTACK_ALLOC YYMALLOC
457 # define YYSTACK_FREE YYFREE
458 # ifndef YYSTACK_ALLOC_MAXIMUM
459 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
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
470 # define YYMALLOC malloc
471 # if ! defined malloc && ! defined EXIT_SUCCESS
472 void *malloc (YYSIZE_T
); /* INFRINGES ON USER NAME SPACE */
477 # if ! defined free && ! defined EXIT_SUCCESS
478 void free (void *); /* INFRINGES ON USER NAME SPACE */
482 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
485 #if (! defined yyoverflow \
486 && (! defined __cplusplus \
487 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
489 /* A type that is properly aligned for any stack member. */
492 yytype_int16 yyss_alloc
;
496 /* The size of the maximum gap between one aligned stack and the next. */
497 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
499 /* The size of an array large to enough to hold all stacks, each with
501 # define YYSTACK_BYTES(N) \
502 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
503 + YYSTACK_GAP_MAXIMUM)
505 # define YYCOPY_NEEDED 1
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
512 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
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); \
525 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
526 /* Copy COUNT objects from SRC to DST. The source and destination do
529 # if defined __GNUC__ && 1 < __GNUC__
530 # define YYCOPY(Dst, Src, Count) \
531 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
533 # define YYCOPY(Dst, Src, Count) \
537 for (yyi = 0; yyi < (Count); yyi++) \
538 (Dst)[yyi] = (Src)[yyi]; \
543 #endif /* !YYCOPY_NEEDED */
545 /* YYFINAL -- State number of the termination state. */
547 /* YYLAST -- Last index in YYTABLE. */
550 /* YYNTOKENS -- Number of terminals. */
552 /* YYNNTS -- Number of nonterminals. */
554 /* YYNRULES -- Number of rules. */
556 /* YYNSTATES -- Number of states. */
557 #define YYNSTATES 389
559 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
560 by yylex, with out-of-bounds checking. */
562 #define YYMAXUTOK 302
564 #define YYTRANSLATE(YYX) \
565 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
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
[] =
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,
605 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
606 static const yytype_uint16 yyrline
[] =
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
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
[] =
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
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
[] =
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
695 #define YYPACT_NINF -336
697 #define yypact_value_is_default(Yystate) \
698 (!!((Yystate) == (-336)))
700 #define YYTABLE_NINF -199
702 #define yytable_value_is_error(Yytable_value) \
705 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
707 static const yytype_int16 yypact
[] =
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
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
[] =
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
796 /* YYPGOTO[NTERM-NUM]. */
797 static const yytype_int16 yypgoto
[] =
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
811 /* YYDEFGOTO[NTERM-NUM]. */
812 static const yytype_int16 yydefgoto
[] =
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
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
[] =
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,
942 static const yytype_int16 yycheck
[] =
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
1055 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1056 symbol of state STATE-NUM. */
1057 static const yytype_uint8 yystos
[] =
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
1100 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1101 static const yytype_uint8 yyr1
[] =
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
1127 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
1128 static const yytype_uint8 yyr2
[] =
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
1155 #define yyerrok (yyerrstatus = 0)
1156 #define yyclearin (yychar = YYEMPTY)
1157 #define YYEMPTY (-2)
1160 #define YYACCEPT goto yyacceptlab
1161 #define YYABORT goto yyabortlab
1162 #define YYERROR goto yyerrorlab
1165 #define YYRECOVERING() (!!yyerrstatus)
1167 #define YYBACKUP(Token, Value) \
1169 if (yychar == YYEMPTY) \
1173 YYPOPSTACK (yylen); \
1179 yyerror (ctx, YY_("syntax error: cannot back up")); \
1184 /* Error token number */
1186 #define YYERRCODE 256
1190 /* Enable debugging if requested. */
1194 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1195 # define YYFPRINTF fprintf
1198 # define YYDPRINTF(Args) \
1204 /* This macro is provided for backward compatibility. */
1205 #ifndef YY_LOCATION_PRINT
1206 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1210 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1214 YYFPRINTF (stderr, "%s ", Title); \
1215 yy_symbol_print (stderr, \
1216 Type, Value, ctx); \
1217 YYFPRINTF (stderr, "\n"); \
1222 /*----------------------------------------.
1223 | Print this symbol's value on YYOUTPUT. |
1224 `----------------------------------------*/
1227 yy_symbol_value_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
, parser_ctx_t
*ctx
)
1229 FILE *yyo
= yyoutput
;
1235 if (yytype
< YYNTOKENS
)
1236 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
1242 /*--------------------------------.
1243 | Print this symbol on YYOUTPUT. |
1244 `--------------------------------*/
1247 yy_symbol_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
, parser_ctx_t
*ctx
)
1249 YYFPRINTF (yyoutput
, "%s %s (",
1250 yytype
< YYNTOKENS
? "token" : "nterm", yytname
[yytype
]);
1252 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
, ctx
);
1253 YYFPRINTF (yyoutput
, ")");
1256 /*------------------------------------------------------------------.
1257 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1259 `------------------------------------------------------------------*/
1262 yy_stack_print (yytype_int16
*yybottom
, yytype_int16
*yytop
)
1264 YYFPRINTF (stderr
, "Stack now");
1265 for (; yybottom
<= yytop
; yybottom
++)
1267 int yybot
= *yybottom
;
1268 YYFPRINTF (stderr
, " %d", yybot
);
1270 YYFPRINTF (stderr
, "\n");
1273 # define YY_STACK_PRINT(Bottom, Top) \
1276 yy_stack_print ((Bottom), (Top)); \
1280 /*------------------------------------------------.
1281 | Report that the YYRULE is going to be reduced. |
1282 `------------------------------------------------*/
1285 yy_reduce_print (yytype_int16
*yyssp
, YYSTYPE
*yyvsp
, int yyrule
, parser_ctx_t
*ctx
)
1287 unsigned long int yylno
= yyrline
[yyrule
];
1288 int yynrhs
= yyr2
[yyrule
];
1290 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %lu):\n",
1292 /* The symbols being reduced. */
1293 for (yyi
= 0; yyi
< yynrhs
; yyi
++)
1295 YYFPRINTF (stderr
, " $%d = ", yyi
+ 1);
1296 yy_symbol_print (stderr
,
1297 yystos
[yyssp
[yyi
+ 1 - yynrhs
]],
1298 &(yyvsp
[(yyi
+ 1) - (yynrhs
)])
1300 YYFPRINTF (stderr
, "\n");
1304 # define YY_REDUCE_PRINT(Rule) \
1307 yy_reduce_print (yyssp, yyvsp, Rule, ctx); \
1310 /* Nonzero means print parse trace. It is left uninitialized so that
1311 multiple parsers can coexist. */
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 */
1321 /* YYINITDEPTH -- initial size of the parser's stacks. */
1323 # define YYINITDEPTH 200
1326 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1327 if the built-in stack extension method is used).
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. */
1334 # define YYMAXDEPTH 10000
1341 # if defined __GLIBC__ && defined _STRING_H
1342 # define yystrlen strlen
1344 /* Return the length of YYSTR. */
1346 yystrlen (const char *yystr
)
1349 for (yylen
= 0; yystr
[yylen
]; yylen
++)
1357 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1358 # define yystpcpy stpcpy
1360 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1363 yystpcpy (char *yydest
, const char *yysrc
)
1366 const char *yys
= yysrc
;
1368 while ((*yyd
++ = *yys
++) != '\0')
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
1385 yytnamerr (char *yyres
, const char *yystr
)
1390 char const *yyp
= yystr
;
1397 goto do_not_strip_quotes
;
1401 goto do_not_strip_quotes
;
1414 do_not_strip_quotes
: ;
1418 return yystrlen (yystr
);
1420 return yystpcpy (yyres
, yystr
) - yyres
;
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
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. */
1433 yysyntax_error (YYSIZE_T
*yymsg_alloc
, char **yymsg
,
1434 yytype_int16
*yyssp
, int yytoken
)
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
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.
1470 if (yytoken
!= YYEMPTY
)
1472 int yyn
= yypact
[*yyssp
];
1473 yyarg
[yycount
++] = yytname
[yytoken
];
1474 if (!yypact_value_is_default (yyn
))
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
;
1485 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
1486 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
1487 && !yytable_value_is_error (yytable
[yyx
+ yyn
]))
1489 if (yycount
== YYERROR_VERBOSE_ARGS_MAXIMUM
)
1495 yyarg
[yycount
++] = yytname
[yyx
];
1497 YYSIZE_T yysize1
= yysize
+ yytnamerr (YY_NULLPTR
, yytname
[yyx
]);
1498 if (! (yysize
<= yysize1
1499 && yysize1
<= YYSTACK_ALLOC_MAXIMUM
))
1509 # define YYCASE_(N, S) \
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"));
1523 YYSIZE_T yysize1
= yysize
+ yystrlen (yyformat
);
1524 if (! (yysize
<= yysize1
&& yysize1
<= YYSTACK_ALLOC_MAXIMUM
))
1529 if (*yymsg_alloc
< yysize
)
1531 *yymsg_alloc
= 2 * yysize
;
1532 if (! (yysize
<= *yymsg_alloc
1533 && *yymsg_alloc
<= YYSTACK_ALLOC_MAXIMUM
))
1534 *yymsg_alloc
= YYSTACK_ALLOC_MAXIMUM
;
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. */
1544 while ((*yyp
= *yyformat
) != '\0')
1545 if (*yyp
== '%' && yyformat
[1] == 's' && yyi
< yycount
)
1547 yyp
+= yytnamerr (yyp
, yyarg
[yyi
++]);
1558 #endif /* YYERROR_VERBOSE */
1560 /*-----------------------------------------------.
1561 | Release the memory associated to this symbol. |
1562 `-----------------------------------------------*/
1565 yydestruct (const char *yymsg
, int yytype
, YYSTYPE
*yyvaluep
, parser_ctx_t
*ctx
)
1571 YY_SYMBOL_PRINT (yymsg
, yytype
, yyvaluep
, yylocationp
);
1573 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1575 YY_IGNORE_MAYBE_UNINITIALIZED_END
1586 yyparse (parser_ctx_t
*ctx
)
1588 /* The lookahead symbol. */
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
);
1598 /* Number of syntax errors so far. */
1602 /* Number of tokens to shift before error messages enabled. */
1605 /* The stacks and their tools:
1606 'yyss': related to states.
1607 'yyvs': related to semantic values.
1609 Refer to the stacks through separate pointers, to allow yyoverflow
1610 to reallocate them elsewhere. */
1612 /* The state stack. */
1613 yytype_int16 yyssa
[YYINITDEPTH
];
1615 yytype_int16
*yyssp
;
1617 /* The semantic value stack. */
1618 YYSTYPE yyvsa
[YYINITDEPTH
];
1622 YYSIZE_T yystacksize
;
1626 /* Lookahead token as an internal (translated) token number. */
1628 /* The variables used to return semantic value and location from the
1633 /* Buffer for error messages, and its allocated size. */
1635 char *yymsg
= yymsgbuf
;
1636 YYSIZE_T yymsg_alloc
= sizeof yymsgbuf
;
1639 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1641 /* The number of symbols on the RHS of the reduced rule.
1642 Keep to zero when no symbol should be popped. */
1645 yyssp
= yyss
= yyssa
;
1646 yyvsp
= yyvs
= yyvsa
;
1647 yystacksize
= YYINITDEPTH
;
1649 YYDPRINTF ((stderr
, "Starting parse\n"));
1654 yychar
= YYEMPTY
; /* Cause a token to be read. */
1657 /*------------------------------------------------------------.
1658 | yynewstate -- Push a new state, which is found in yystate. |
1659 `------------------------------------------------------------*/
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. */
1668 if (yyss
+ yystacksize
- 1 <= yyssp
)
1670 /* Get the current used size of the three stacks, in elements. */
1671 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
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
1678 YYSTYPE
*yyvs1
= yyvs
;
1679 yytype_int16
*yyss1
= yyss
;
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
),
1693 #else /* no yyoverflow */
1694 # ifndef YYSTACK_RELOCATE
1695 goto yyexhaustedlab
;
1697 /* Extend the stack our own way. */
1698 if (YYMAXDEPTH
<= yystacksize
)
1699 goto yyexhaustedlab
;
1701 if (YYMAXDEPTH
< yystacksize
)
1702 yystacksize
= YYMAXDEPTH
;
1705 yytype_int16
*yyss1
= yyss
;
1706 union yyalloc
*yyptr
=
1707 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1709 goto yyexhaustedlab
;
1710 YYSTACK_RELOCATE (yyss_alloc
, yyss
);
1711 YYSTACK_RELOCATE (yyvs_alloc
, yyvs
);
1712 # undef YYSTACK_RELOCATE
1714 YYSTACK_FREE (yyss1
);
1717 #endif /* no yyoverflow */
1719 yyssp
= yyss
+ yysize
- 1;
1720 yyvsp
= yyvs
+ yysize
- 1;
1722 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1723 (unsigned long int) yystacksize
));
1725 if (yyss
+ yystacksize
- 1 <= yyssp
)
1729 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1731 if (yystate
== YYFINAL
)
1741 /* Do appropriate processing given the current state. Read a
1742 lookahead token if we need one and don't already have one. */
1744 /* First try to decide what to do without reference to lookahead token. */
1745 yyn
= yypact
[yystate
];
1746 if (yypact_value_is_default (yyn
))
1749 /* Not known => get a lookahead token if don't already have one. */
1751 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1752 if (yychar
== YYEMPTY
)
1754 YYDPRINTF ((stderr
, "Reading a token: "));
1755 yychar
= yylex (&yylval
, ctx
);
1758 if (yychar
<= YYEOF
)
1760 yychar
= yytoken
= YYEOF
;
1761 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1765 yytoken
= YYTRANSLATE (yychar
);
1766 YY_SYMBOL_PRINT ("Next token is", yytoken
, &yylval
, &yylloc
);
1769 /* If the proper action on seeing token YYTOKEN is to reduce or to
1770 detect an error, take that action. */
1772 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1777 if (yytable_value_is_error (yyn
))
1783 /* Count tokens shifted since error; after three, turn off error
1788 /* Shift the lookahead token. */
1789 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
1791 /* Discard the shifted token. */
1795 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1797 YY_IGNORE_MAYBE_UNINITIALIZED_END
1802 /*-----------------------------------------------------------.
1803 | yydefault -- do the default action for the current state. |
1804 `-----------------------------------------------------------*/
1806 yyn
= yydefact
[yystate
];
1812 /*-----------------------------.
1813 | yyreduce -- Do a reduction. |
1814 `-----------------------------*/
1816 /* yyn is the number of a rule to reduce with. */
1819 /* If YYLEN is nonzero, implement the default value of the action:
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
];
1830 YY_REDUCE_PRINT (yyn
);
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 */
1840 #line 256 "parser.y" /* yacc.c:1646 */
1842 #line 1849 "parser.tab.c" /* yacc.c:1646 */
1846 #line 257 "parser.y" /* yacc.c:1646 */
1848 #line 1855 "parser.tab.c" /* yacc.c:1646 */
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 */
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 */
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 */
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 */
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 */
1882 #line 275 "parser.y" /* yacc.c:1646 */
1883 { (yyval
.srcptr
) = (yyvsp
[0].srcptr
); }
1884 #line 1891 "parser.tab.c" /* yacc.c:1646 */
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 */
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 */
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 */
1906 #line 289 "parser.y" /* yacc.c:1646 */
1907 { (yyval
.parameter_list
) = NULL
; }
1908 #line 1915 "parser.tab.c" /* yacc.c:1646 */
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 */
1918 #line 294 "parser.y" /* yacc.c:1646 */
1919 { (yyval
.statement
) = (yyvsp
[0].statement
); }
1920 #line 1927 "parser.tab.c" /* yacc.c:1646 */
1924 #line 295 "parser.y" /* yacc.c:1646 */
1925 { (yyval
.statement
) = (yyvsp
[0].statement
); }
1926 #line 1933 "parser.tab.c" /* yacc.c:1646 */
1930 #line 296 "parser.y" /* yacc.c:1646 */
1931 { (yyval
.statement
) = (yyvsp
[0].statement
); }
1932 #line 1939 "parser.tab.c" /* yacc.c:1646 */
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 */
1942 #line 298 "parser.y" /* yacc.c:1646 */
1943 { (yyval
.statement
) = (yyvsp
[0].statement
); }
1944 #line 1951 "parser.tab.c" /* yacc.c:1646 */
1948 #line 299 "parser.y" /* yacc.c:1646 */
1949 { (yyval
.statement
) = (yyvsp
[0].statement
); }
1950 #line 1957 "parser.tab.c" /* yacc.c:1646 */
1954 #line 300 "parser.y" /* yacc.c:1646 */
1955 { (yyval
.statement
) = (yyvsp
[0].statement
); }
1956 #line 1963 "parser.tab.c" /* yacc.c:1646 */
1960 #line 301 "parser.y" /* yacc.c:1646 */
1961 { (yyval
.statement
) = (yyvsp
[0].statement
); }
1962 #line 1969 "parser.tab.c" /* yacc.c:1646 */
1966 #line 302 "parser.y" /* yacc.c:1646 */
1967 { (yyval
.statement
) = (yyvsp
[0].statement
); }
1968 #line 1975 "parser.tab.c" /* yacc.c:1646 */
1972 #line 303 "parser.y" /* yacc.c:1646 */
1973 { (yyval
.statement
) = (yyvsp
[0].statement
); }
1974 #line 1981 "parser.tab.c" /* yacc.c:1646 */
1978 #line 304 "parser.y" /* yacc.c:1646 */
1979 { (yyval
.statement
) = (yyvsp
[0].statement
); }
1980 #line 1987 "parser.tab.c" /* yacc.c:1646 */
1984 #line 305 "parser.y" /* yacc.c:1646 */
1985 { (yyval
.statement
) = (yyvsp
[0].statement
); }
1986 #line 1993 "parser.tab.c" /* yacc.c:1646 */
1990 #line 306 "parser.y" /* yacc.c:1646 */
1991 { (yyval
.statement
) = (yyvsp
[0].statement
); }
1992 #line 1999 "parser.tab.c" /* yacc.c:1646 */
1996 #line 307 "parser.y" /* yacc.c:1646 */
1997 { (yyval
.statement
) = (yyvsp
[0].statement
); }
1998 #line 2005 "parser.tab.c" /* yacc.c:1646 */
2002 #line 308 "parser.y" /* yacc.c:1646 */
2003 { (yyval
.statement
) = (yyvsp
[0].statement
); }
2004 #line 2011 "parser.tab.c" /* yacc.c:1646 */
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 */
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 */
2020 #line 318 "parser.y" /* yacc.c:1646 */
2021 { (yyval
.statement_list
) = NULL
; }
2022 #line 2029 "parser.tab.c" /* yacc.c:1646 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
2086 #line 356 "parser.y" /* yacc.c:1646 */
2087 { (yyval
.expr
) = NULL
; }
2088 #line 2095 "parser.tab.c" /* yacc.c:1646 */
2092 #line 357 "parser.y" /* yacc.c:1646 */
2093 { (yyval
.expr
) = (yyvsp
[0].expr
); }
2094 #line 2101 "parser.tab.c" /* yacc.c:1646 */
2098 #line 362 "parser.y" /* yacc.c:1646 */
2099 { (yyval
.expr
) = (yyvsp
[0].expr
); }
2100 #line 2107 "parser.tab.c" /* yacc.c:1646 */
2104 #line 366 "parser.y" /* yacc.c:1646 */
2105 { (yyval
.expr
) = NULL
; }
2106 #line 2113 "parser.tab.c" /* yacc.c:1646 */
2110 #line 367 "parser.y" /* yacc.c:1646 */
2111 { (yyval
.expr
) = (yyvsp
[0].expr
); }
2112 #line 2119 "parser.tab.c" /* yacc.c:1646 */
2116 #line 372 "parser.y" /* yacc.c:1646 */
2117 { (yyval
.expr
) = (yyvsp
[0].expr
); }
2118 #line 2125 "parser.tab.c" /* yacc.c:1646 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
2254 #line 452 "parser.y" /* yacc.c:1646 */
2255 { (yyval
.case_list
) = NULL
; }
2256 #line 2263 "parser.tab.c" /* yacc.c:1646 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
2320 #line 490 "parser.y" /* yacc.c:1646 */
2321 { (yyval
.statement
) = (yyvsp
[0].statement
); }
2322 #line 2329 "parser.tab.c" /* yacc.c:1646 */
2326 #line 494 "parser.y" /* yacc.c:1646 */
2327 { (yyval
.expr
) = NULL
; }
2328 #line 2335 "parser.tab.c" /* yacc.c:1646 */
2332 #line 495 "parser.y" /* yacc.c:1646 */
2333 { (yyval
.expr
) = (yyvsp
[0].expr
); }
2334 #line 2341 "parser.tab.c" /* yacc.c:1646 */
2338 #line 498 "parser.y" /* yacc.c:1646 */
2339 { (yyval
.expr
) = (yyvsp
[0].expr
); }
2340 #line 2347 "parser.tab.c" /* yacc.c:1646 */
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 */
2350 #line 503 "parser.y" /* yacc.c:1646 */
2351 { (yyval
.expr
) = (yyvsp
[0].expr
); }
2352 #line 2359 "parser.tab.c" /* yacc.c:1646 */
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 */
2362 #line 509 "parser.y" /* yacc.c:1646 */
2363 { (yyval
.expr
) = NULL
; }
2364 #line 2371 "parser.tab.c" /* yacc.c:1646 */
2368 #line 510 "parser.y" /* yacc.c:1646 */
2369 { (yyval
.expr
) = (yyvsp
[0].expr
); }
2370 #line 2377 "parser.tab.c" /* yacc.c:1646 */
2374 #line 515 "parser.y" /* yacc.c:1646 */
2375 { (yyval
.expr
) = (yyvsp
[0].expr
); }
2376 #line 2383 "parser.tab.c" /* yacc.c:1646 */
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 */
2386 #line 520 "parser.y" /* yacc.c:1646 */
2387 { (yyval
.ival
) = (yyvsp
[0].ival
); }
2388 #line 2395 "parser.tab.c" /* yacc.c:1646 */
2392 #line 521 "parser.y" /* yacc.c:1646 */
2393 { (yyval
.ival
) = EXPR_ASSIGNDIV
; }
2394 #line 2401 "parser.tab.c" /* yacc.c:1646 */
2398 #line 525 "parser.y" /* yacc.c:1646 */
2399 { (yyval
.expr
) = (yyvsp
[0].expr
); }
2400 #line 2407 "parser.tab.c" /* yacc.c:1646 */
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 */
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 */
2416 #line 534 "parser.y" /* yacc.c:1646 */
2417 { (yyval
.expr
) = (yyvsp
[0].expr
); }
2418 #line 2425 "parser.tab.c" /* yacc.c:1646 */
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 */
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 */
2434 #line 542 "parser.y" /* yacc.c:1646 */
2435 { (yyval
.expr
) = (yyvsp
[0].expr
); }
2436 #line 2443 "parser.tab.c" /* yacc.c:1646 */
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 */
2446 #line 549 "parser.y" /* yacc.c:1646 */
2447 { (yyval
.expr
) = (yyvsp
[0].expr
); }
2448 #line 2455 "parser.tab.c" /* yacc.c:1646 */
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 */
2458 #line 555 "parser.y" /* yacc.c:1646 */
2459 { (yyval
.expr
) = (yyvsp
[0].expr
); }
2460 #line 2467 "parser.tab.c" /* yacc.c:1646 */
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 */
2470 #line 562 "parser.y" /* yacc.c:1646 */
2471 { (yyval
.expr
) = (yyvsp
[0].expr
); }
2472 #line 2479 "parser.tab.c" /* yacc.c:1646 */
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 */
2482 #line 568 "parser.y" /* yacc.c:1646 */
2483 { (yyval
.expr
) = (yyvsp
[0].expr
); }
2484 #line 2491 "parser.tab.c" /* yacc.c:1646 */
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 */
2494 #line 575 "parser.y" /* yacc.c:1646 */
2495 { (yyval
.expr
) = (yyvsp
[0].expr
); }
2496 #line 2503 "parser.tab.c" /* yacc.c:1646 */
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 */
2506 #line 581 "parser.y" /* yacc.c:1646 */
2507 { (yyval
.expr
) = (yyvsp
[0].expr
); }
2508 #line 2515 "parser.tab.c" /* yacc.c:1646 */
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 */
2518 #line 588 "parser.y" /* yacc.c:1646 */
2519 { (yyval
.expr
) = (yyvsp
[0].expr
); }
2520 #line 2527 "parser.tab.c" /* yacc.c:1646 */
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 */
2530 #line 594 "parser.y" /* yacc.c:1646 */
2531 { (yyval
.expr
) = (yyvsp
[0].expr
); }
2532 #line 2539 "parser.tab.c" /* yacc.c:1646 */
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 */
2542 #line 601 "parser.y" /* yacc.c:1646 */
2543 { (yyval
.expr
) = (yyvsp
[0].expr
); }
2544 #line 2551 "parser.tab.c" /* yacc.c:1646 */
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 */
2554 #line 607 "parser.y" /* yacc.c:1646 */
2555 { (yyval
.expr
) = (yyvsp
[0].expr
); }
2556 #line 2563 "parser.tab.c" /* yacc.c:1646 */
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 */
2566 #line 614 "parser.y" /* yacc.c:1646 */
2567 { (yyval
.expr
) = (yyvsp
[0].expr
); }
2568 #line 2575 "parser.tab.c" /* yacc.c:1646 */
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 */
2578 #line 620 "parser.y" /* yacc.c:1646 */
2579 { (yyval
.expr
) = (yyvsp
[0].expr
); }
2580 #line 2587 "parser.tab.c" /* yacc.c:1646 */
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 */
2590 #line 626 "parser.y" /* yacc.c:1646 */
2591 { (yyval
.expr
) = (yyvsp
[0].expr
); }
2592 #line 2599 "parser.tab.c" /* yacc.c:1646 */
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 */
2602 #line 632 "parser.y" /* yacc.c:1646 */
2603 { (yyval
.expr
) = (yyvsp
[0].expr
); }
2604 #line 2611 "parser.tab.c" /* yacc.c:1646 */
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 */
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 */
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 */
2626 #line 642 "parser.y" /* yacc.c:1646 */
2627 { (yyval
.expr
) = (yyvsp
[0].expr
); }
2628 #line 2635 "parser.tab.c" /* yacc.c:1646 */
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 */
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 */
2644 #line 650 "parser.y" /* yacc.c:1646 */
2645 { (yyval
.expr
) = (yyvsp
[0].expr
); }
2646 #line 2653 "parser.tab.c" /* yacc.c:1646 */
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 */
2656 #line 657 "parser.y" /* yacc.c:1646 */
2657 { (yyval
.expr
) = (yyvsp
[0].expr
); }
2658 #line 2665 "parser.tab.c" /* yacc.c:1646 */
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 */
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 */
2674 #line 665 "parser.y" /* yacc.c:1646 */
2675 { (yyval
.expr
) = (yyvsp
[0].expr
); }
2676 #line 2683 "parser.tab.c" /* yacc.c:1646 */
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 */
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 */
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 */
2698 #line 675 "parser.y" /* yacc.c:1646 */
2699 { (yyval
.expr
) = (yyvsp
[0].expr
); }
2700 #line 2707 "parser.tab.c" /* yacc.c:1646 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
2758 #line 691 "parser.y" /* yacc.c:1646 */
2759 { (yyval
.expr
) = (yyvsp
[0].expr
); }
2760 #line 2767 "parser.tab.c" /* yacc.c:1646 */
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 */
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 */
2776 #line 700 "parser.y" /* yacc.c:1646 */
2777 { (yyval
.expr
) = (yyvsp
[0].expr
); }
2778 #line 2785 "parser.tab.c" /* yacc.c:1646 */
2782 #line 701 "parser.y" /* yacc.c:1646 */
2783 { (yyval
.expr
) = (yyvsp
[0].expr
); }
2784 #line 2791 "parser.tab.c" /* yacc.c:1646 */
2788 #line 705 "parser.y" /* yacc.c:1646 */
2789 { (yyval
.expr
) = (yyvsp
[0].expr
); }
2790 #line 2797 "parser.tab.c" /* yacc.c:1646 */
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 */
2800 #line 710 "parser.y" /* yacc.c:1646 */
2801 { (yyval
.expr
) = (yyvsp
[0].expr
); }
2802 #line 2809 "parser.tab.c" /* yacc.c:1646 */
2806 #line 711 "parser.y" /* yacc.c:1646 */
2807 { (yyval
.expr
) = (yyvsp
[0].expr
); }
2808 #line 2815 "parser.tab.c" /* yacc.c:1646 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
2854 #line 732 "parser.y" /* yacc.c:1646 */
2855 { (yyval
.argument_list
) = NULL
; }
2856 #line 2863 "parser.tab.c" /* yacc.c:1646 */
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 */
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 */
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 */
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 */
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 */
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 */
2896 #line 746 "parser.y" /* yacc.c:1646 */
2897 { (yyval
.expr
) = (yyvsp
[0].expr
); }
2898 #line 2905 "parser.tab.c" /* yacc.c:1646 */
2902 #line 747 "parser.y" /* yacc.c:1646 */
2903 { (yyval
.expr
) = (yyvsp
[0].expr
); }
2904 #line 2911 "parser.tab.c" /* yacc.c:1646 */
2908 #line 748 "parser.y" /* yacc.c:1646 */
2909 { (yyval
.expr
) = (yyvsp
[-1].expr
); }
2910 #line 2917 "parser.tab.c" /* yacc.c:1646 */
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 */
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 */
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 */
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 */
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 */
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 */
2950 #line 767 "parser.y" /* yacc.c:1646 */
2951 { (yyval
.ival
) = 1; }
2952 #line 2959 "parser.tab.c" /* yacc.c:1646 */
2956 #line 768 "parser.y" /* yacc.c:1646 */
2957 { (yyval
.ival
) = (yyvsp
[-1].ival
) + 1; }
2958 #line 2965 "parser.tab.c" /* yacc.c:1646 */
2962 #line 772 "parser.y" /* yacc.c:1646 */
2963 { (yyval
.ival
) = 0; }
2964 #line 2971 "parser.tab.c" /* yacc.c:1646 */
2968 #line 773 "parser.y" /* yacc.c:1646 */
2969 { (yyval
.ival
) = (yyvsp
[0].ival
); }
2970 #line 2977 "parser.tab.c" /* yacc.c:1646 */
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 */
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 */
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 */
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 */
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 */
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 */
3010 #line 792 "parser.y" /* yacc.c:1646 */
3011 { (yyval
.literal
) = (yyvsp
[0].literal
); }
3012 #line 3019 "parser.tab.c" /* yacc.c:1646 */
3016 #line 796 "parser.y" /* yacc.c:1646 */
3017 { (yyval
.identifier
) = NULL
; }
3018 #line 3025 "parser.tab.c" /* yacc.c:1646 */
3022 #line 797 "parser.y" /* yacc.c:1646 */
3023 { (yyval
.identifier
) = (yyvsp
[0].identifier
); }
3024 #line 3031 "parser.tab.c" /* yacc.c:1646 */
3028 #line 801 "parser.y" /* yacc.c:1646 */
3029 { (yyval
.literal
) = new_null_literal(ctx
); }
3030 #line 3037 "parser.tab.c" /* yacc.c:1646 */
3034 #line 802 "parser.y" /* yacc.c:1646 */
3035 { (yyval
.literal
) = (yyvsp
[0].literal
); }
3036 #line 3043 "parser.tab.c" /* yacc.c:1646 */
3040 #line 803 "parser.y" /* yacc.c:1646 */
3041 { (yyval
.literal
) = (yyvsp
[0].literal
); }
3042 #line 3049 "parser.tab.c" /* yacc.c:1646 */
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 */
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 */
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 */
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 */
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 */
3078 #line 814 "parser.y" /* yacc.c:1646 */
3079 { (yyval
.literal
) = (yyvsp
[0].literal
); }
3080 #line 3087 "parser.tab.c" /* yacc.c:1646 */
3084 #line 818 "parser.y" /* yacc.c:1646 */
3085 { if(!allow_auto_semicolon(ctx
)) {YYABORT
;} }
3086 #line 3093 "parser.tab.c" /* yacc.c:1646 */
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 */
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 */
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 */
3108 #line 3115 "parser.tab.c" /* yacc.c:1646 */
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
);
3126 YY_STACK_PRINT (yyss
, yyssp
);
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. */
3136 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
3137 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
3138 yystate
= yytable
[yystate
];
3140 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
3145 /*--------------------------------------.
3146 | yyerrlab -- here on detecting error. |
3147 `--------------------------------------*/
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
);
3153 /* If not already recovering from an error, report this error. */
3157 #if ! YYERROR_VERBOSE
3158 yyerror (ctx
, YY_("syntax error"));
3160 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
3163 char const *yymsgp
= YY_("syntax error");
3164 int yysyntax_error_status
;
3165 yysyntax_error_status
= YYSYNTAX_ERROR
;
3166 if (yysyntax_error_status
== 0)
3168 else if (yysyntax_error_status
== 1)
3170 if (yymsg
!= yymsgbuf
)
3171 YYSTACK_FREE (yymsg
);
3172 yymsg
= (char *) YYSTACK_ALLOC (yymsg_alloc
);
3176 yymsg_alloc
= sizeof yymsgbuf
;
3177 yysyntax_error_status
= 2;
3181 yysyntax_error_status
= YYSYNTAX_ERROR
;
3185 yyerror (ctx
, yymsgp
);
3186 if (yysyntax_error_status
== 2)
3187 goto yyexhaustedlab
;
3189 # undef YYSYNTAX_ERROR
3195 if (yyerrstatus
== 3)
3197 /* If just tried and failed to reuse lookahead token after an
3198 error, discard it. */
3200 if (yychar
<= YYEOF
)
3202 /* Return failure if at end of input. */
3203 if (yychar
== YYEOF
)
3208 yydestruct ("Error: discarding",
3209 yytoken
, &yylval
, ctx
);
3214 /* Else will try to reuse lookahead token after shifting the error
3219 /*---------------------------------------------------.
3220 | yyerrorlab -- error raised explicitly by YYERROR. |
3221 `---------------------------------------------------*/
3224 /* Pacify compilers like GCC when the user code never invokes
3225 YYERROR and the label yyerrorlab therefore never appears in user
3227 if (/*CONSTCOND*/ 0)
3230 /* Do not reclaim the symbols of the rule whose action triggered
3234 YY_STACK_PRINT (yyss
, yyssp
);
3239 /*-------------------------------------------------------------.
3240 | yyerrlab1 -- common code for both syntax error and YYERROR. |
3241 `-------------------------------------------------------------*/
3243 yyerrstatus
= 3; /* Each real token shifted decrements this. */
3247 yyn
= yypact
[yystate
];
3248 if (!yypact_value_is_default (yyn
))
3251 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
3259 /* Pop the current state because it cannot handle the error token. */
3264 yydestruct ("Error: popping",
3265 yystos
[yystate
], yyvsp
, ctx
);
3268 YY_STACK_PRINT (yyss
, yyssp
);
3271 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
3273 YY_IGNORE_MAYBE_UNINITIALIZED_END
3276 /* Shift the error token. */
3277 YY_SYMBOL_PRINT ("Shifting", yystos
[yyn
], yyvsp
, yylsp
);
3283 /*-------------------------------------.
3284 | yyacceptlab -- YYACCEPT comes here. |
3285 `-------------------------------------*/
3290 /*-----------------------------------.
3291 | yyabortlab -- YYABORT comes here. |
3292 `-----------------------------------*/
3297 #if !defined yyoverflow || YYERROR_VERBOSE
3298 /*-------------------------------------------------.
3299 | yyexhaustedlab -- memory exhaustion comes here. |
3300 `-------------------------------------------------*/
3302 yyerror (ctx
, YY_("memory exhausted"));
3308 if (yychar
!= YYEMPTY
)
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
);
3316 /* Do not reclaim the symbols of the rule whose action triggered
3317 this YYABORT or YYACCEPT. */
3319 YY_STACK_PRINT (yyss
, yyssp
);
3320 while (yyssp
!= yyss
)
3322 yydestruct ("Cleanup: popping",
3323 yystos
[*yyssp
], yyvsp
, ctx
);
3328 YYSTACK_FREE (yyss
);
3331 if (yymsg
!= yymsgbuf
)
3332 YYSTACK_FREE (yymsg
);
3336 #line 832 "parser.y" /* yacc.c:1906 */
3339 static BOOL
allow_auto_semicolon(parser_ctx_t
*ctx
)
3341 return ctx
->nl
|| ctx
->ptr
== ctx
->end
|| *(ctx
->ptr
-1) == '}';
3344 static void *new_statement(parser_ctx_t
*ctx
, statement_type_t type
, size_t size
)
3348 stat
= parser_alloc(ctx
, size
? size
: sizeof(*stat
));
3358 static literal_t
*new_string_literal(parser_ctx_t
*ctx
, const WCHAR
*str
)
3360 literal_t
*ret
= parser_alloc(ctx
, sizeof(literal_t
));
3362 ret
->type
= LT_STRING
;
3368 static literal_t
*new_null_literal(parser_ctx_t
*ctx
)
3370 literal_t
*ret
= parser_alloc(ctx
, sizeof(literal_t
));
3372 ret
->type
= LT_NULL
;
3377 static prop_val_t
*new_prop_val(parser_ctx_t
*ctx
, literal_t
*name
, expression_t
*value
)
3379 prop_val_t
*ret
= parser_alloc(ctx
, sizeof(prop_val_t
));
3388 static property_list_t
*new_property_list(parser_ctx_t
*ctx
, literal_t
*name
, expression_t
*value
)
3390 property_list_t
*ret
= parser_alloc_tmp(ctx
, sizeof(property_list_t
));
3392 ret
->head
= ret
->tail
= new_prop_val(ctx
, name
, value
);
3397 static property_list_t
*property_list_add(parser_ctx_t
*ctx
, property_list_t
*list
, literal_t
*name
, expression_t
*value
)
3399 list
->tail
= list
->tail
->next
= new_prop_val(ctx
, name
, value
);
3404 static array_element_t
*new_array_element(parser_ctx_t
*ctx
, int elision
, expression_t
*expr
)
3406 array_element_t
*ret
= parser_alloc(ctx
, sizeof(array_element_t
));
3408 ret
->elision
= elision
;
3415 static element_list_t
*new_element_list(parser_ctx_t
*ctx
, int elision
, expression_t
*expr
)
3417 element_list_t
*ret
= parser_alloc_tmp(ctx
, sizeof(element_list_t
));
3419 ret
->head
= ret
->tail
= new_array_element(ctx
, elision
, expr
);
3424 static element_list_t
*element_list_add(parser_ctx_t
*ctx
, element_list_t
*list
, int elision
, expression_t
*expr
)
3426 list
->tail
= list
->tail
->next
= new_array_element(ctx
, elision
, expr
);
3431 static argument_t
*new_argument(parser_ctx_t
*ctx
, expression_t
*expr
)
3433 argument_t
*ret
= parser_alloc(ctx
, sizeof(argument_t
));
3441 static argument_list_t
*new_argument_list(parser_ctx_t
*ctx
, expression_t
*expr
)
3443 argument_list_t
*ret
= parser_alloc_tmp(ctx
, sizeof(argument_list_t
));
3445 ret
->head
= ret
->tail
= new_argument(ctx
, expr
);
3450 static argument_list_t
*argument_list_add(parser_ctx_t
*ctx
, argument_list_t
*list
, expression_t
*expr
)
3452 list
->tail
= list
->tail
->next
= new_argument(ctx
, expr
);
3457 static catch_block_t
*new_catch_block(parser_ctx_t
*ctx
, const WCHAR
*identifier
, statement_t
*statement
)
3459 catch_block_t
*ret
= parser_alloc(ctx
, sizeof(catch_block_t
));
3461 ret
->identifier
= identifier
;
3462 ret
->statement
= statement
;
3467 static case_clausule_t
*new_case_clausule(parser_ctx_t
*ctx
, expression_t
*expr
, statement_list_t
*stat_list
)
3469 case_clausule_t
*ret
= parser_alloc(ctx
, sizeof(case_clausule_t
));
3472 ret
->stat
= stat_list
? stat_list
->head
: NULL
;
3478 static case_list_t
*new_case_list(parser_ctx_t
*ctx
, case_clausule_t
*case_clausule
)
3480 case_list_t
*ret
= parser_alloc_tmp(ctx
, sizeof(case_list_t
));
3482 ret
->head
= ret
->tail
= case_clausule
;
3487 static case_list_t
*case_list_add(parser_ctx_t
*ctx
, case_list_t
*list
, case_clausule_t
*case_clausule
)
3489 list
->tail
= list
->tail
->next
= case_clausule
;
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
)
3497 case_clausule_t
*ret
= NULL
, *iter
= NULL
, *iter2
;
3498 statement_t
*stat
= NULL
;
3501 ret
= case_list1
->head
;
3502 iter
= case_list1
->tail
;
3505 if(default_clausule
) {
3507 iter
= iter
->next
= default_clausule
;
3509 ret
= iter
= default_clausule
;
3514 iter
->next
= case_list2
->head
;
3516 ret
= case_list2
->head
;
3522 for(iter
= ret
; iter
; iter
= iter
->next
) {
3523 for(iter2
= iter
; iter2
&& !iter2
->stat
; iter2
= iter2
->next
);
3527 while(iter
!= iter2
) {
3528 iter
->stat
= iter2
->stat
;
3535 stat
->next
= iter
->stat
;
3544 static statement_t
*new_block_statement(parser_ctx_t
*ctx
, statement_list_t
*list
)
3546 block_statement_t
*ret
;
3548 ret
= new_statement(ctx
, STAT_BLOCK
, sizeof(*ret
));
3552 ret
->stat_list
= list
? list
->head
: NULL
;
3557 static variable_declaration_t
*new_variable_declaration(parser_ctx_t
*ctx
, const WCHAR
*identifier
, expression_t
*expr
)
3559 variable_declaration_t
*ret
= parser_alloc(ctx
, sizeof(variable_declaration_t
));
3561 ret
->identifier
= identifier
;
3564 ret
->global_next
= NULL
;
3569 static variable_list_t
*new_variable_list(parser_ctx_t
*ctx
, variable_declaration_t
*decl
)
3571 variable_list_t
*ret
= parser_alloc_tmp(ctx
, sizeof(variable_list_t
));
3573 ret
->head
= ret
->tail
= decl
;
3578 static variable_list_t
*variable_list_add(parser_ctx_t
*ctx
, variable_list_t
*list
, variable_declaration_t
*decl
)
3580 list
->tail
= list
->tail
->next
= decl
;
3585 static statement_t
*new_var_statement(parser_ctx_t
*ctx
, variable_list_t
*variable_list
)
3587 var_statement_t
*ret
;
3589 ret
= new_statement(ctx
, STAT_VAR
, sizeof(*ret
));
3593 ret
->variable_list
= variable_list
->head
;
3598 static statement_t
*new_expression_statement(parser_ctx_t
*ctx
, expression_t
*expr
)
3600 expression_statement_t
*ret
;
3602 ret
= new_statement(ctx
, STAT_EXPR
, sizeof(*ret
));
3611 static statement_t
*new_if_statement(parser_ctx_t
*ctx
, expression_t
*expr
, statement_t
*if_stat
, statement_t
*else_stat
)
3613 if_statement_t
*ret
;
3615 ret
= new_statement(ctx
, STAT_IF
, sizeof(*ret
));
3620 ret
->if_stat
= if_stat
;
3621 ret
->else_stat
= else_stat
;
3626 static statement_t
*new_while_statement(parser_ctx_t
*ctx
, BOOL dowhile
, expression_t
*expr
, statement_t
*stat
)
3628 while_statement_t
*ret
;
3630 ret
= new_statement(ctx
, STAT_WHILE
, sizeof(*ret
));
3634 ret
->do_while
= dowhile
;
3636 ret
->statement
= stat
;
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
)
3644 for_statement_t
*ret
;
3646 ret
= new_statement(ctx
, STAT_FOR
, sizeof(*ret
));
3650 ret
->variable_list
= variable_list
? variable_list
->head
: NULL
;
3651 ret
->begin_expr
= begin_expr
;
3653 ret
->end_expr
= end_expr
;
3654 ret
->statement
= statement
;
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
)
3662 forin_statement_t
*ret
;
3664 ret
= new_statement(ctx
, STAT_FORIN
, sizeof(*ret
));
3668 ret
->variable
= variable
;
3670 ret
->in_expr
= in_expr
;
3671 ret
->statement
= statement
;
3676 static statement_t
*new_continue_statement(parser_ctx_t
*ctx
, const WCHAR
*identifier
)
3678 branch_statement_t
*ret
;
3680 ret
= new_statement(ctx
, STAT_CONTINUE
, sizeof(*ret
));
3684 ret
->identifier
= identifier
;
3689 static statement_t
*new_break_statement(parser_ctx_t
*ctx
, const WCHAR
*identifier
)
3691 branch_statement_t
*ret
;
3693 ret
= new_statement(ctx
, STAT_BREAK
, sizeof(*ret
));
3697 ret
->identifier
= identifier
;
3702 static statement_t
*new_return_statement(parser_ctx_t
*ctx
, expression_t
*expr
)
3704 expression_statement_t
*ret
;
3706 ret
= new_statement(ctx
, STAT_RETURN
, sizeof(*ret
));
3715 static statement_t
*new_with_statement(parser_ctx_t
*ctx
, expression_t
*expr
, statement_t
*statement
)
3717 with_statement_t
*ret
;
3719 ret
= new_statement(ctx
, STAT_WITH
, sizeof(*ret
));
3724 ret
->statement
= statement
;
3729 static statement_t
*new_labelled_statement(parser_ctx_t
*ctx
, const WCHAR
*identifier
, statement_t
*statement
)
3731 labelled_statement_t
*ret
;
3733 ret
= new_statement(ctx
, STAT_LABEL
, sizeof(*ret
));
3737 ret
->identifier
= identifier
;
3738 ret
->statement
= statement
;
3743 static statement_t
*new_switch_statement(parser_ctx_t
*ctx
, expression_t
*expr
, case_clausule_t
*case_list
)
3745 switch_statement_t
*ret
;
3747 ret
= new_statement(ctx
, STAT_SWITCH
, sizeof(*ret
));
3752 ret
->case_list
= case_list
;
3757 static statement_t
*new_throw_statement(parser_ctx_t
*ctx
, expression_t
*expr
)
3759 expression_statement_t
*ret
;
3761 ret
= new_statement(ctx
, STAT_THROW
, sizeof(*ret
));
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
)
3773 try_statement_t
*ret
;
3775 ret
= new_statement(ctx
, STAT_TRY
, sizeof(*ret
));
3779 ret
->try_statement
= try_statement
;
3780 ret
->catch_block
= catch_block
;
3781 ret
->finally_statement
= finally_statement
;
3786 static parameter_t
*new_parameter(parser_ctx_t
*ctx
, const WCHAR
*identifier
)
3788 parameter_t
*ret
= parser_alloc(ctx
, sizeof(parameter_t
));
3790 ret
->identifier
= identifier
;
3796 static parameter_list_t
*new_parameter_list(parser_ctx_t
*ctx
, const WCHAR
*identifier
)
3798 parameter_list_t
*ret
= parser_alloc_tmp(ctx
, sizeof(parameter_list_t
));
3800 ret
->head
= ret
->tail
= new_parameter(ctx
, identifier
);
3805 static parameter_list_t
*parameter_list_add(parser_ctx_t
*ctx
, parameter_list_t
*list
, const WCHAR
*identifier
)
3807 list
->tail
= list
->tail
->next
= new_parameter(ctx
, identifier
);
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
)
3815 function_expression_t
*ret
= new_expression(ctx
, EXPR_FUNC
, sizeof(*ret
));
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
;
3828 static void *new_expression(parser_ctx_t
*ctx
, expression_type_t type
, size_t size
)
3830 expression_t
*ret
= parser_alloc(ctx
, size
? size
: sizeof(*ret
));
3837 static expression_t
*new_binary_expression(parser_ctx_t
*ctx
, expression_type_t type
,
3838 expression_t
*expression1
, expression_t
*expression2
)
3840 binary_expression_t
*ret
= new_expression(ctx
, type
, sizeof(*ret
));
3842 ret
->expression1
= expression1
;
3843 ret
->expression2
= expression2
;
3848 static expression_t
*new_unary_expression(parser_ctx_t
*ctx
, expression_type_t type
, expression_t
*expression
)
3850 unary_expression_t
*ret
= new_expression(ctx
, type
, sizeof(*ret
));
3852 ret
->expression
= expression
;
3857 static expression_t
*new_conditional_expression(parser_ctx_t
*ctx
, expression_t
*expression
,
3858 expression_t
*true_expression
, expression_t
*false_expression
)
3860 conditional_expression_t
*ret
= new_expression(ctx
, EXPR_COND
, sizeof(*ret
));
3862 ret
->expression
= expression
;
3863 ret
->true_expression
= true_expression
;
3864 ret
->false_expression
= false_expression
;
3869 static expression_t
*new_member_expression(parser_ctx_t
*ctx
, expression_t
*expression
, const WCHAR
*identifier
)
3871 member_expression_t
*ret
= new_expression(ctx
, EXPR_MEMBER
, sizeof(*ret
));
3873 ret
->expression
= expression
;
3874 ret
->identifier
= identifier
;
3879 static expression_t
*new_new_expression(parser_ctx_t
*ctx
, expression_t
*expression
, argument_list_t
*argument_list
)
3881 call_expression_t
*ret
= new_expression(ctx
, EXPR_NEW
, sizeof(*ret
));
3883 ret
->expression
= expression
;
3884 ret
->argument_list
= argument_list
? argument_list
->head
: NULL
;
3889 static expression_t
*new_call_expression(parser_ctx_t
*ctx
, expression_t
*expression
, argument_list_t
*argument_list
)
3891 call_expression_t
*ret
= new_expression(ctx
, EXPR_CALL
, sizeof(*ret
));
3893 ret
->expression
= expression
;
3894 ret
->argument_list
= argument_list
? argument_list
->head
: NULL
;
3899 static int parser_error(parser_ctx_t
*ctx
, const char *str
)
3904 static void set_error(parser_ctx_t
*ctx
, UINT error
)
3909 static BOOL
explicit_error(parser_ctx_t
*ctx
, void *obj
, WCHAR next
)
3911 if(obj
|| *(ctx
->ptr
-1)==next
) return TRUE
;
3913 set_error(ctx
, JS_E_SYNTAX
);
3918 static expression_t
*new_identifier_expression(parser_ctx_t
*ctx
, const WCHAR
*identifier
)
3920 identifier_expression_t
*ret
= new_expression(ctx
, EXPR_IDENT
, sizeof(*ret
));
3922 ret
->identifier
= identifier
;
3927 static expression_t
*new_array_literal_expression(parser_ctx_t
*ctx
, element_list_t
*element_list
, int length
)
3929 array_literal_expression_t
*ret
= new_expression(ctx
, EXPR_ARRAYLIT
, sizeof(*ret
));
3931 ret
->element_list
= element_list
? element_list
->head
: NULL
;
3932 ret
->length
= length
;
3937 static expression_t
*new_prop_and_value_expression(parser_ctx_t
*ctx
, property_list_t
*property_list
)
3939 property_value_expression_t
*ret
= new_expression(ctx
, EXPR_PROPVAL
, sizeof(*ret
));
3941 ret
->property_list
= property_list
? property_list
->head
: NULL
;
3946 static expression_t
*new_literal_expression(parser_ctx_t
*ctx
, literal_t
*literal
)
3948 literal_expression_t
*ret
= new_expression(ctx
, EXPR_LITERAL
, sizeof(*ret
));
3950 ret
->literal
= literal
;
3955 static source_elements_t
*new_source_elements(parser_ctx_t
*ctx
)
3957 source_elements_t
*ret
= parser_alloc(ctx
, sizeof(source_elements_t
));
3959 memset(ret
, 0, sizeof(*ret
));
3964 static source_elements_t
*source_elements_add_statement(source_elements_t
*source_elements
, statement_t
*statement
)
3966 if(source_elements
->statement_tail
)
3967 source_elements
->statement_tail
= source_elements
->statement_tail
->next
= statement
;
3969 source_elements
->statement
= source_elements
->statement_tail
= statement
;
3971 return source_elements
;
3974 static statement_list_t
*new_statement_list(parser_ctx_t
*ctx
, statement_t
*statement
)
3976 statement_list_t
*ret
= parser_alloc_tmp(ctx
, sizeof(statement_list_t
));
3978 ret
->head
= ret
->tail
= statement
;
3983 static statement_list_t
*statement_list_add(statement_list_t
*list
, statement_t
*statement
)
3985 list
->tail
= list
->tail
->next
= statement
;
3990 static void program_parsed(parser_ctx_t
*ctx
, source_elements_t
*source
)
3992 ctx
->source
= source
;
3993 if(!ctx
->lexer_error
)
3997 void parser_release(parser_ctx_t
*ctx
)
3999 script_release(ctx
->script
);
4000 heap_pool_free(&ctx
->heap
);
4004 HRESULT
script_parse(script_ctx_t
*ctx
, const WCHAR
*code
, const WCHAR
*delimiter
, BOOL from_eval
,
4007 parser_ctx_t
*parser_ctx
;
4011 const WCHAR html_tagW
[] = {'<','/','s','c','r','i','p','t','>',0};
4013 parser_ctx
= heap_alloc_zero(sizeof(parser_ctx_t
));
4015 return E_OUTOFMEMORY
;
4017 parser_ctx
->hres
= JS_E_SYNTAX
;
4018 parser_ctx
->is_html
= delimiter
&& !strcmpiW(delimiter
, html_tagW
);
4020 parser_ctx
->begin
= parser_ctx
->ptr
= code
;
4021 parser_ctx
->end
= parser_ctx
->begin
+ strlenW(parser_ctx
->begin
);
4024 parser_ctx
->script
= ctx
;
4026 mark
= heap_pool_mark(&ctx
->tmp_heap
);
4027 heap_pool_init(&parser_ctx
->heap
);
4029 parser_parse(parser_ctx
);
4030 heap_pool_clear(mark
);
4031 hres
= parser_ctx
->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
);