1 /* A Bison parser, made by GNU Bison 2.5. */
3 /* Bison implementation for Yacc-like parsers in C
5 Copyright (C) 1984, 1989-1990, 2000-2011 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 "2.5"
50 #define YYSKELETON_NAME "yacc.c"
61 /* Using locations. */
62 #define YYLSP_NEEDED 0
64 /* Substitute the variable and function names. */
65 #define yyparse parser_parse
66 #define yylex parser_lex
67 #define yyerror parser_error
68 #define yylval parser_lval
69 #define yychar parser_char
70 #define yydebug parser_debug
71 #define yynerrs parser_nerrs
74 /* Copy the first part of user declarations. */
76 /* Line 268 of yacc.c */
81 static int parser_error(parser_ctx_t
*,const char*);
82 static void set_error(parser_ctx_t
*,UINT
);
83 static BOOL
explicit_error(parser_ctx_t
*,void*,WCHAR
);
84 static BOOL
allow_auto_semicolon(parser_ctx_t
*);
85 static void program_parsed(parser_ctx_t
*,source_elements_t
*);
87 typedef struct _statement_list_t
{
92 static literal_t
*new_string_literal(parser_ctx_t
*,const WCHAR
*);
93 static literal_t
*new_null_literal(parser_ctx_t
*);
95 typedef struct _property_list_t
{
100 static property_list_t
*new_property_list(parser_ctx_t
*,literal_t
*,expression_t
*);
101 static property_list_t
*property_list_add(parser_ctx_t
*,property_list_t
*,literal_t
*,expression_t
*);
103 typedef struct _element_list_t
{
104 array_element_t
*head
;
105 array_element_t
*tail
;
108 static element_list_t
*new_element_list(parser_ctx_t
*,int,expression_t
*);
109 static element_list_t
*element_list_add(parser_ctx_t
*,element_list_t
*,int,expression_t
*);
111 typedef struct _argument_list_t
{
116 static argument_list_t
*new_argument_list(parser_ctx_t
*,expression_t
*);
117 static argument_list_t
*argument_list_add(parser_ctx_t
*,argument_list_t
*,expression_t
*);
119 typedef struct _case_list_t
{
120 case_clausule_t
*head
;
121 case_clausule_t
*tail
;
124 static catch_block_t
*new_catch_block(parser_ctx_t
*,const WCHAR
*,statement_t
*);
125 static case_clausule_t
*new_case_clausule(parser_ctx_t
*,expression_t
*,statement_list_t
*);
126 static case_list_t
*new_case_list(parser_ctx_t
*,case_clausule_t
*);
127 static case_list_t
*case_list_add(parser_ctx_t
*,case_list_t
*,case_clausule_t
*);
128 static case_clausule_t
*new_case_block(parser_ctx_t
*,case_list_t
*,case_clausule_t
*,case_list_t
*);
130 typedef struct _variable_list_t
{
131 variable_declaration_t
*head
;
132 variable_declaration_t
*tail
;
135 static variable_declaration_t
*new_variable_declaration(parser_ctx_t
*,const WCHAR
*,expression_t
*);
136 static variable_list_t
*new_variable_list(parser_ctx_t
*,variable_declaration_t
*);
137 static variable_list_t
*variable_list_add(parser_ctx_t
*,variable_list_t
*,variable_declaration_t
*);
139 static void *new_statement(parser_ctx_t
*,statement_type_t
,size_t);
140 static statement_t
*new_block_statement(parser_ctx_t
*,statement_list_t
*);
141 static statement_t
*new_var_statement(parser_ctx_t
*,variable_list_t
*);
142 static statement_t
*new_expression_statement(parser_ctx_t
*,expression_t
*);
143 static statement_t
*new_if_statement(parser_ctx_t
*,expression_t
*,statement_t
*,statement_t
*);
144 static statement_t
*new_while_statement(parser_ctx_t
*,BOOL
,expression_t
*,statement_t
*);
145 static statement_t
*new_for_statement(parser_ctx_t
*,variable_list_t
*,expression_t
*,expression_t
*,
146 expression_t
*,statement_t
*);
147 static statement_t
*new_forin_statement(parser_ctx_t
*,variable_declaration_t
*,expression_t
*,expression_t
*,statement_t
*);
148 static statement_t
*new_continue_statement(parser_ctx_t
*,const WCHAR
*);
149 static statement_t
*new_break_statement(parser_ctx_t
*,const WCHAR
*);
150 static statement_t
*new_return_statement(parser_ctx_t
*,expression_t
*);
151 static statement_t
*new_with_statement(parser_ctx_t
*,expression_t
*,statement_t
*);
152 static statement_t
*new_labelled_statement(parser_ctx_t
*,const WCHAR
*,statement_t
*);
153 static statement_t
*new_switch_statement(parser_ctx_t
*,expression_t
*,case_clausule_t
*);
154 static statement_t
*new_throw_statement(parser_ctx_t
*,expression_t
*);
155 static statement_t
*new_try_statement(parser_ctx_t
*,statement_t
*,catch_block_t
*,statement_t
*);
157 struct statement_list_t
{
162 static statement_list_t
*new_statement_list(parser_ctx_t
*,statement_t
*);
163 static statement_list_t
*statement_list_add(statement_list_t
*,statement_t
*);
165 typedef struct _parameter_list_t
{
170 static parameter_list_t
*new_parameter_list(parser_ctx_t
*,const WCHAR
*);
171 static parameter_list_t
*parameter_list_add(parser_ctx_t
*,parameter_list_t
*,const WCHAR
*);
173 static void *new_expression(parser_ctx_t
*ctx
,expression_type_t
,size_t);
174 static expression_t
*new_function_expression(parser_ctx_t
*,const WCHAR
*,parameter_list_t
*,
175 source_elements_t
*,const WCHAR
*,DWORD
);
176 static expression_t
*new_binary_expression(parser_ctx_t
*,expression_type_t
,expression_t
*,expression_t
*);
177 static expression_t
*new_unary_expression(parser_ctx_t
*,expression_type_t
,expression_t
*);
178 static expression_t
*new_conditional_expression(parser_ctx_t
*,expression_t
*,expression_t
*,expression_t
*);
179 static expression_t
*new_member_expression(parser_ctx_t
*,expression_t
*,const WCHAR
*);
180 static expression_t
*new_new_expression(parser_ctx_t
*,expression_t
*,argument_list_t
*);
181 static expression_t
*new_call_expression(parser_ctx_t
*,expression_t
*,argument_list_t
*);
182 static expression_t
*new_identifier_expression(parser_ctx_t
*,const WCHAR
*);
183 static expression_t
*new_literal_expression(parser_ctx_t
*,literal_t
*);
184 static expression_t
*new_array_literal_expression(parser_ctx_t
*,element_list_t
*,int);
185 static expression_t
*new_prop_and_value_expression(parser_ctx_t
*,property_list_t
*);
187 static source_elements_t
*new_source_elements(parser_ctx_t
*);
188 static source_elements_t
*source_elements_add_statement(source_elements_t
*,statement_t
*);
192 /* Line 268 of yacc.c */
193 #line 200 "parser.tab.c"
195 /* Enabling traces. */
200 /* Enabling verbose error messages. */
201 #ifdef YYERROR_VERBOSE
202 # undef YYERROR_VERBOSE
203 # define YYERROR_VERBOSE 1
205 # define YYERROR_VERBOSE 0
208 /* Enabling the token table. */
209 #ifndef YYTOKEN_TABLE
210 # define YYTOKEN_TABLE 0
217 /* Put the tokens into the symbol table, so that GDB and other debuggers
259 tNumericLiteral
= 297,
260 tBooleanLiteral
= 298,
261 tStringLiteral
= 299,
263 LOWER_THAN_ELSE
= 301
269 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
270 typedef union YYSTYPE
273 /* Line 293 of yacc.c */
280 struct _argument_list_t
*argument_list
;
281 case_clausule_t
*case_clausule
;
282 struct _case_list_t
*case_list
;
283 catch_block_t
*catch_block
;
284 struct _element_list_t
*element_list
;
286 const WCHAR
*identifier
;
287 struct _parameter_list_t
*parameter_list
;
288 struct _property_list_t
*property_list
;
289 source_elements_t
*source_elements
;
290 statement_t
*statement
;
291 struct _statement_list_t
*statement_list
;
292 struct _variable_list_t
*variable_list
;
293 variable_declaration_t
*variable_declaration
;
297 /* Line 293 of yacc.c */
298 #line 305 "parser.tab.c"
300 # define YYSTYPE_IS_TRIVIAL 1
301 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
302 # define YYSTYPE_IS_DECLARED 1
306 /* Copy the second part of user declarations. */
309 /* Line 343 of yacc.c */
310 #line 317 "parser.tab.c"
317 typedef YYTYPE_UINT8 yytype_uint8
;
319 typedef unsigned char yytype_uint8
;
323 typedef YYTYPE_INT8 yytype_int8
;
324 #elif (defined __STDC__ || defined __C99__FUNC__ \
325 || defined __cplusplus || defined _MSC_VER)
326 typedef signed char yytype_int8
;
328 typedef short int yytype_int8
;
332 typedef YYTYPE_UINT16 yytype_uint16
;
334 typedef unsigned short int yytype_uint16
;
338 typedef YYTYPE_INT16 yytype_int16
;
340 typedef short int yytype_int16
;
344 # ifdef __SIZE_TYPE__
345 # define YYSIZE_T __SIZE_TYPE__
346 # elif defined size_t
347 # define YYSIZE_T size_t
348 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
349 || defined __cplusplus || defined _MSC_VER)
350 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
351 # define YYSIZE_T size_t
353 # define YYSIZE_T unsigned int
357 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
360 # if defined YYENABLE_NLS && YYENABLE_NLS
362 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
363 # define YY_(msgid) dgettext ("bison-runtime", msgid)
367 # define YY_(msgid) msgid
371 /* Suppress unused-variable warnings by "using" E. */
372 #if ! defined lint || defined __GNUC__
373 # define YYUSE(e) ((void) (e))
375 # define YYUSE(e) /* empty */
378 /* Identity function, used to suppress warnings about constant conditions. */
382 #if (defined __STDC__ || defined __C99__FUNC__ \
383 || defined __cplusplus || defined _MSC_VER)
396 #if ! defined yyoverflow || YYERROR_VERBOSE
398 /* The parser invokes alloca or malloc; define the necessary symbols. */
400 # ifdef YYSTACK_USE_ALLOCA
401 # if YYSTACK_USE_ALLOCA
403 # define YYSTACK_ALLOC __builtin_alloca
404 # elif defined __BUILTIN_VA_ARG_INCR
405 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
407 # define YYSTACK_ALLOC __alloca
408 # elif defined _MSC_VER
409 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
410 # define alloca _alloca
412 # define YYSTACK_ALLOC alloca
413 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
414 || defined __cplusplus || defined _MSC_VER)
415 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
416 # ifndef EXIT_SUCCESS
417 # define EXIT_SUCCESS 0
424 # ifdef YYSTACK_ALLOC
425 /* Pacify GCC's `empty if-body' warning. */
426 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
427 # ifndef YYSTACK_ALLOC_MAXIMUM
428 /* The OS might guarantee only one guard page at the bottom of the stack,
429 and a page size can be as small as 4096 bytes. So we cannot safely
430 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
431 to allow for a few compiler-allocated temporary stack slots. */
432 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
435 # define YYSTACK_ALLOC YYMALLOC
436 # define YYSTACK_FREE YYFREE
437 # ifndef YYSTACK_ALLOC_MAXIMUM
438 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
440 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
441 && ! ((defined YYMALLOC || defined malloc) \
442 && (defined YYFREE || defined free)))
443 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
444 # ifndef EXIT_SUCCESS
445 # define EXIT_SUCCESS 0
449 # define YYMALLOC malloc
450 # if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
451 || defined __cplusplus || defined _MSC_VER)
452 void *malloc (YYSIZE_T
); /* INFRINGES ON USER NAME SPACE */
457 # if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
458 || defined __cplusplus || defined _MSC_VER)
459 void free (void *); /* INFRINGES ON USER NAME SPACE */
463 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
466 #if (! defined yyoverflow \
467 && (! defined __cplusplus \
468 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
470 /* A type that is properly aligned for any stack member. */
473 yytype_int16 yyss_alloc
;
477 /* The size of the maximum gap between one aligned stack and the next. */
478 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
480 /* The size of an array large to enough to hold all stacks, each with
482 # define YYSTACK_BYTES(N) \
483 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
484 + YYSTACK_GAP_MAXIMUM)
486 # define YYCOPY_NEEDED 1
488 /* Relocate STACK from its old location to the new one. The
489 local variables YYSIZE and YYSTACKSIZE give the old and new number of
490 elements in the stack, and YYPTR gives the new location of the
491 stack. Advance YYPTR to a properly aligned location for the next
493 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
496 YYSIZE_T yynewbytes; \
497 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
498 Stack = &yyptr->Stack_alloc; \
499 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
500 yyptr += yynewbytes / sizeof (*yyptr); \
506 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
507 /* Copy COUNT objects from FROM to TO. The source and destination do
510 # if defined __GNUC__ && 1 < __GNUC__
511 # define YYCOPY(To, From, Count) \
512 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
514 # define YYCOPY(To, From, Count) \
518 for (yyi = 0; yyi < (Count); yyi++) \
519 (To)[yyi] = (From)[yyi]; \
524 #endif /* !YYCOPY_NEEDED */
526 /* YYFINAL -- State number of the termination state. */
528 /* YYLAST -- Last index in YYTABLE. */
531 /* YYNTOKENS -- Number of terminals. */
533 /* YYNNTS -- Number of nonterminals. */
535 /* YYNRULES -- Number of rules. */
537 /* YYNRULES -- Number of states. */
538 #define YYNSTATES 375
540 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
542 #define YYMAXUTOK 301
544 #define YYTRANSLATE(YYX) \
545 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
547 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
548 static const yytype_uint8 yytranslate
[] =
550 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
551 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
552 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
553 2, 2, 2, 63, 2, 2, 2, 61, 56, 2,
554 67, 68, 59, 57, 49, 58, 66, 60, 2, 2,
555 2, 2, 2, 2, 2, 2, 2, 2, 52, 51,
556 2, 50, 2, 53, 2, 2, 2, 2, 2, 2,
557 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
558 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
559 2, 64, 2, 65, 55, 2, 2, 2, 2, 2,
560 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
561 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
562 2, 2, 2, 48, 54, 37, 62, 2, 2, 2,
563 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
564 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
565 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
566 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
567 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
568 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
569 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
570 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
571 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
572 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
573 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
574 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
575 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
576 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
577 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
578 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
579 35, 36, 38, 39, 40, 41, 42, 43, 44, 45,
584 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
586 static const yytype_uint16 yyprhs
[] =
588 0, 0, 3, 7, 9, 10, 11, 14, 23, 25,
589 27, 29, 33, 34, 36, 38, 40, 42, 44, 46,
590 48, 50, 52, 54, 56, 58, 60, 62, 64, 66,
591 68, 71, 72, 74, 78, 81, 85, 87, 91, 93,
592 97, 100, 103, 104, 106, 109, 110, 112, 115, 117,
593 120, 128, 134, 142, 148, 149, 150, 162, 163, 164,
594 177, 185, 194, 198, 202, 206, 212, 216, 222, 226,
595 232, 233, 235, 237, 240, 245, 249, 253, 257, 261,
596 266, 272, 275, 276, 278, 280, 282, 284, 288, 289,
597 291, 293, 297, 299, 301, 303, 307, 311, 313, 317,
598 321, 323, 329, 331, 337, 339, 343, 345, 349, 351,
599 355, 357, 361, 363, 367, 369, 373, 375, 379, 381,
600 385, 387, 391, 393, 397, 399, 403, 405, 409, 411,
601 415, 419, 423, 425, 429, 433, 435, 439, 441, 445,
602 449, 451, 455, 459, 463, 465, 468, 471, 474, 477,
603 480, 483, 486, 489, 492, 494, 497, 500, 502, 504,
604 506, 509, 511, 513, 518, 522, 526, 529, 532, 537,
605 541, 544, 548, 550, 554, 556, 558, 560, 562, 564,
606 568, 571, 575, 579, 585, 588, 593, 595, 598, 599,
607 601, 604, 608, 612, 618, 620, 622, 624, 625, 627,
608 629, 631, 633, 635, 637, 639, 641, 643, 645, 647,
609 649, 651, 653, 655, 657, 659
612 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
613 static const yytype_int16 yyrhs
[] =
615 70, 0, -1, 72, 71, 46, -1, 34, -1, -1,
616 -1, 72, 78, -1, 74, 157, 161, 77, 162, 48,
617 75, 37, -1, 36, -1, 72, -1, 38, -1, 76,
618 49, 38, -1, -1, 76, -1, 81, -1, 82, -1,
619 91, -1, 73, -1, 92, -1, 93, -1, 94, -1,
620 99, -1, 100, -1, 101, -1, 102, -1, 103, -1,
621 104, -1, 110, -1, 111, -1, 78, -1, 79, 78,
622 -1, -1, 79, -1, 48, 79, 37, -1, 48, 37,
623 -1, 26, 83, 160, -1, 85, -1, 83, 49, 85,
624 -1, 86, -1, 84, 49, 86, -1, 38, 87, -1,
625 38, 89, -1, -1, 88, -1, 50, 120, -1, -1,
626 90, -1, 50, 121, -1, 51, -1, 116, 160, -1,
627 11, 161, 115, 162, 78, 10, 78, -1, 11, 161,
628 115, 162, 78, -1, 9, 78, 28, 161, 115, 162,
629 160, -1, 28, 161, 115, 162, 78, -1, -1, -1,
630 13, 161, 117, 95, 163, 114, 96, 163, 114, 162,
631 78, -1, -1, -1, 13, 161, 26, 84, 97, 163,
632 114, 98, 163, 114, 162, 78, -1, 13, 161, 143,
633 14, 115, 162, 78, -1, 13, 161, 26, 86, 14,
634 115, 162, 78, -1, 6, 157, 160, -1, 3, 157,
635 160, -1, 18, 114, 160, -1, 29, 161, 116, 162,
636 78, -1, 38, 52, 78, -1, 19, 161, 116, 162,
637 105, -1, 48, 106, 37, -1, 48, 106, 109, 106,
638 37, -1, -1, 107, -1, 108, -1, 107, 108, -1,
639 4, 116, 52, 80, -1, 7, 52, 80, -1, 21,
640 116, 160, -1, 24, 81, 112, -1, 24, 81, 113,
641 -1, 24, 81, 112, 113, -1, 5, 161, 38, 162,
642 81, -1, 12, 81, -1, -1, 116, -1, 116, -1,
643 1, -1, 120, -1, 116, 49, 120, -1, -1, 118,
644 -1, 121, -1, 118, 49, 121, -1, 39, -1, 35,
645 -1, 122, -1, 143, 50, 120, -1, 143, 119, 120,
646 -1, 123, -1, 143, 50, 121, -1, 143, 119, 121,
647 -1, 124, -1, 124, 53, 120, 52, 120, -1, 125,
648 -1, 125, 53, 121, 52, 121, -1, 126, -1, 124,
649 31, 126, -1, 127, -1, 125, 31, 127, -1, 128,
650 -1, 126, 30, 128, -1, 129, -1, 127, 30, 129,
651 -1, 130, -1, 128, 54, 130, -1, 131, -1, 129,
652 54, 131, -1, 132, -1, 130, 55, 132, -1, 133,
653 -1, 131, 55, 133, -1, 134, -1, 132, 56, 134,
654 -1, 135, -1, 133, 56, 135, -1, 136, -1, 134,
655 40, 136, -1, 137, -1, 135, 40, 137, -1, 138,
656 -1, 136, 42, 138, -1, 136, 15, 138, -1, 136,
657 14, 138, -1, 138, -1, 137, 42, 138, -1, 137,
658 15, 138, -1, 139, -1, 138, 41, 139, -1, 140,
659 -1, 139, 57, 140, -1, 139, 58, 140, -1, 141,
660 -1, 140, 59, 141, -1, 140, 60, 141, -1, 140,
661 61, 141, -1, 142, -1, 8, 141, -1, 27, 141,
662 -1, 25, 141, -1, 32, 141, -1, 33, 141, -1,
663 57, 141, -1, 58, 141, -1, 62, 141, -1, 63,
664 141, -1, 143, -1, 143, 32, -1, 143, 33, -1,
665 144, -1, 146, -1, 145, -1, 16, 144, -1, 149,
666 -1, 73, -1, 145, 64, 116, 65, -1, 145, 66,
667 38, -1, 16, 145, 147, -1, 145, 147, -1, 146,
668 147, -1, 146, 64, 116, 65, -1, 146, 66, 38,
669 -1, 67, 68, -1, 67, 148, 68, -1, 120, -1,
670 148, 49, 120, -1, 20, -1, 38, -1, 158, -1,
671 150, -1, 154, -1, 67, 116, 68, -1, 64, 65,
672 -1, 64, 152, 65, -1, 64, 151, 65, -1, 64,
673 151, 49, 153, 65, -1, 153, 120, -1, 151, 49,
674 153, 120, -1, 49, -1, 152, 49, -1, -1, 152,
675 -1, 48, 37, -1, 48, 155, 37, -1, 156, 52,
676 120, -1, 155, 49, 156, 52, 120, -1, 38, -1,
677 45, -1, 43, -1, -1, 38, -1, 17, -1, 159,
678 -1, 43, -1, 45, -1, 60, -1, 35, -1, 22,
679 -1, 23, -1, 44, -1, 51, -1, 1, -1, 67,
680 -1, 1, -1, 68, -1, 1, -1, 51, -1, 1,
684 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
685 static const yytype_uint16 yyrline
[] =
687 0, 251, 251, 255, 256, 260, 261, 266, 270, 274,
688 278, 279, 284, 285, 289, 290, 291, 292, 293, 294,
689 295, 296, 297, 298, 299, 300, 301, 302, 303, 307,
690 308, 313, 314, 318, 319, 323, 328, 329, 334, 336,
691 341, 346, 351, 352, 356, 361, 362, 366, 371, 375,
692 380, 382, 387, 389, 392, 394, 391, 398, 400, 397,
693 403, 405, 410, 415, 420, 425, 430, 435, 440, 442,
694 447, 448, 452, 453, 458, 463, 468, 473, 474, 475,
695 480, 485, 489, 490, 493, 494, 498, 499, 504, 505,
696 509, 511, 515, 516, 520, 521, 523, 528, 530, 532,
697 537, 538, 543, 545, 550, 551, 556, 558, 563, 564,
698 569, 571, 576, 577, 582, 584, 589, 590, 595, 597,
699 602, 603, 608, 610, 615, 616, 621, 622, 627, 628,
700 630, 632, 637, 638, 640, 645, 646, 651, 653, 655,
701 660, 661, 663, 665, 670, 671, 673, 674, 676, 677,
702 678, 679, 680, 681, 685, 687, 689, 695, 696, 700,
703 701, 705, 706, 707, 709, 711, 716, 718, 720, 722,
704 727, 728, 732, 733, 738, 739, 740, 741, 742, 743,
705 747, 748, 749, 750, 755, 757, 762, 763, 767, 768,
706 772, 773, 778, 780, 785, 786, 787, 791, 792, 796,
707 797, 798, 799, 800, 802, 807, 808, 809, 812, 813,
708 816, 817, 820, 821, 824, 825
712 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
713 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
714 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
715 static const char *const yytname
[] =
717 "$end", "error", "$undefined", "kBREAK", "kCASE", "kCATCH", "kCONTINUE",
718 "kDEFAULT", "kDELETE", "kDO", "kELSE", "kIF", "kFINALLY", "kFOR", "kIN",
719 "kINSTANCEOF", "kNEW", "kNULL", "kRETURN", "kSWITCH", "kTHIS", "kTHROW",
720 "kTRUE", "kFALSE", "kTRY", "kTYPEOF", "kVAR", "kVOID", "kWHILE", "kWITH",
721 "tANDAND", "tOROR", "tINC", "tDEC", "tHTMLCOMMENT", "kDIVEQ",
722 "kFUNCTION", "'}'", "tIdentifier", "tAssignOper", "tEqOper",
723 "tShiftOper", "tRelOper", "tNumericLiteral", "tBooleanLiteral",
724 "tStringLiteral", "tEOF", "LOWER_THAN_ELSE", "'{'", "','", "'='", "';'",
725 "':'", "'?'", "'|'", "'^'", "'&'", "'+'", "'-'", "'*'", "'/'", "'%'",
726 "'~'", "'!'", "'['", "']'", "'.'", "'('", "')'", "$accept", "Program",
727 "HtmlComment", "SourceElements", "FunctionExpression", "KFunction",
728 "FunctionBody", "FormalParameterList", "FormalParameterList_opt",
729 "Statement", "StatementList", "StatementList_opt", "Block",
730 "VariableStatement", "VariableDeclarationList",
731 "VariableDeclarationListNoIn", "VariableDeclaration",
732 "VariableDeclarationNoIn", "Initialiser_opt", "Initialiser",
733 "InitialiserNoIn_opt", "InitialiserNoIn", "EmptyStatement",
734 "ExpressionStatement", "IfStatement", "IterationStatement", "$@1", "$@2",
735 "$@3", "$@4", "ContinueStatement", "BreakStatement", "ReturnStatement",
736 "WithStatement", "LabelledStatement", "SwitchStatement", "CaseBlock",
737 "CaseClausules_opt", "CaseClausules", "CaseClausule", "DefaultClausule",
738 "ThrowStatement", "TryStatement", "Catch", "Finally", "Expression_opt",
739 "Expression_err", "Expression", "ExpressionNoIn_opt", "ExpressionNoIn",
740 "AssignOper", "AssignmentExpression", "AssignmentExpressionNoIn",
741 "ConditionalExpression", "ConditionalExpressionNoIn",
742 "LogicalORExpression", "LogicalORExpressionNoIn", "LogicalANDExpression",
743 "LogicalANDExpressionNoIn", "BitwiseORExpression",
744 "BitwiseORExpressionNoIn", "BitwiseXORExpression",
745 "BitwiseXORExpressionNoIn", "BitwiseANDExpression",
746 "BitwiseANDExpressionNoIn", "EqualityExpression",
747 "EqualityExpressionNoIn", "RelationalExpression",
748 "RelationalExpressionNoIn", "ShiftExpression", "AdditiveExpression",
749 "MultiplicativeExpression", "UnaryExpression", "PostfixExpression",
750 "LeftHandSideExpression", "NewExpression", "MemberExpression",
751 "CallExpression", "Arguments", "ArgumentList", "PrimaryExpression",
752 "ArrayLiteral", "ElementList", "Elision", "Elision_opt", "ObjectLiteral",
753 "PropertyNameAndValueList", "PropertyName", "Identifier_opt", "Literal",
754 "BooleanLiteral", "semicolon_opt", "left_bracket", "right_bracket",
760 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
762 static const yytype_uint16 yytoknum
[] =
764 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
765 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
766 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
767 285, 286, 287, 288, 289, 290, 291, 125, 292, 293,
768 294, 295, 296, 297, 298, 299, 300, 301, 123, 44,
769 61, 59, 58, 63, 124, 94, 38, 43, 45, 42,
770 47, 37, 126, 33, 91, 93, 46, 40, 41
774 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
775 static const yytype_uint8 yyr1
[] =
777 0, 69, 70, 71, 71, 72, 72, 73, 74, 75,
778 76, 76, 77, 77, 78, 78, 78, 78, 78, 78,
779 78, 78, 78, 78, 78, 78, 78, 78, 78, 79,
780 79, 80, 80, 81, 81, 82, 83, 83, 84, 84,
781 85, 86, 87, 87, 88, 89, 89, 90, 91, 92,
782 93, 93, 94, 94, 95, 96, 94, 97, 98, 94,
783 94, 94, 99, 100, 101, 102, 103, 104, 105, 105,
784 106, 106, 107, 107, 108, 109, 110, 111, 111, 111,
785 112, 113, 114, 114, 115, 115, 116, 116, 117, 117,
786 118, 118, 119, 119, 120, 120, 120, 121, 121, 121,
787 122, 122, 123, 123, 124, 124, 125, 125, 126, 126,
788 127, 127, 128, 128, 129, 129, 130, 130, 131, 131,
789 132, 132, 133, 133, 134, 134, 135, 135, 136, 136,
790 136, 136, 137, 137, 137, 138, 138, 139, 139, 139,
791 140, 140, 140, 140, 141, 141, 141, 141, 141, 141,
792 141, 141, 141, 141, 142, 142, 142, 143, 143, 144,
793 144, 145, 145, 145, 145, 145, 146, 146, 146, 146,
794 147, 147, 148, 148, 149, 149, 149, 149, 149, 149,
795 150, 150, 150, 150, 151, 151, 152, 152, 153, 153,
796 154, 154, 155, 155, 156, 156, 156, 157, 157, 158,
797 158, 158, 158, 158, 158, 159, 159, 159, 160, 160,
798 161, 161, 162, 162, 163, 163
801 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
802 static const yytype_uint8 yyr2
[] =
804 0, 2, 3, 1, 0, 0, 2, 8, 1, 1,
805 1, 3, 0, 1, 1, 1, 1, 1, 1, 1,
806 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
807 2, 0, 1, 3, 2, 3, 1, 3, 1, 3,
808 2, 2, 0, 1, 2, 0, 1, 2, 1, 2,
809 7, 5, 7, 5, 0, 0, 11, 0, 0, 12,
810 7, 8, 3, 3, 3, 5, 3, 5, 3, 5,
811 0, 1, 1, 2, 4, 3, 3, 3, 3, 4,
812 5, 2, 0, 1, 1, 1, 1, 3, 0, 1,
813 1, 3, 1, 1, 1, 3, 3, 1, 3, 3,
814 1, 5, 1, 5, 1, 3, 1, 3, 1, 3,
815 1, 3, 1, 3, 1, 3, 1, 3, 1, 3,
816 1, 3, 1, 3, 1, 3, 1, 3, 1, 3,
817 3, 3, 1, 3, 3, 1, 3, 1, 3, 3,
818 1, 3, 3, 3, 1, 2, 2, 2, 2, 2,
819 2, 2, 2, 2, 1, 2, 2, 1, 1, 1,
820 2, 1, 1, 4, 3, 3, 2, 2, 4, 3,
821 2, 3, 1, 3, 1, 1, 1, 1, 1, 3,
822 2, 3, 3, 5, 2, 4, 1, 2, 0, 1,
823 2, 3, 3, 5, 1, 1, 1, 0, 1, 1,
824 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
828 /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
829 Performed when YYTABLE doesn't specify something else to do. Zero
830 means the default is an error. */
831 static const yytype_uint8 yydefact
[] =
833 5, 0, 4, 1, 197, 197, 0, 0, 0, 0,
834 0, 199, 82, 0, 174, 0, 205, 206, 0, 0,
835 0, 0, 0, 0, 0, 0, 3, 204, 8, 175,
836 201, 207, 202, 0, 48, 0, 0, 203, 0, 0,
837 188, 0, 0, 17, 197, 6, 14, 15, 16, 18,
838 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
839 0, 86, 94, 100, 104, 108, 112, 116, 120, 124,
840 128, 135, 137, 140, 144, 154, 157, 159, 158, 161,
841 177, 178, 176, 200, 198, 0, 0, 175, 0, 162,
842 145, 154, 0, 211, 210, 0, 88, 160, 159, 0,
843 83, 0, 0, 0, 0, 147, 42, 0, 36, 146,
844 0, 0, 148, 149, 0, 34, 175, 201, 202, 29,
845 0, 0, 0, 150, 151, 152, 153, 186, 180, 0,
846 189, 0, 0, 2, 0, 209, 0, 208, 49, 0,
847 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
848 0, 0, 0, 0, 0, 155, 156, 93, 92, 0,
849 0, 0, 0, 0, 166, 0, 0, 167, 63, 62,
850 190, 194, 196, 195, 0, 85, 0, 84, 0, 54,
851 89, 90, 97, 102, 106, 110, 114, 118, 122, 126,
852 132, 154, 165, 64, 0, 76, 34, 0, 0, 77,
853 78, 0, 40, 43, 0, 35, 0, 0, 66, 33,
854 30, 191, 0, 0, 188, 182, 187, 181, 184, 179,
855 12, 87, 105, 0, 109, 113, 117, 121, 125, 131,
856 130, 129, 136, 138, 139, 141, 142, 143, 95, 96,
857 0, 164, 170, 172, 0, 0, 169, 0, 213, 212,
858 0, 45, 57, 38, 0, 0, 0, 0, 0, 0,
859 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
860 81, 79, 44, 37, 0, 0, 0, 192, 189, 0,
861 10, 13, 0, 0, 163, 0, 171, 168, 0, 51,
862 0, 41, 46, 0, 0, 0, 215, 214, 82, 91,
863 154, 107, 0, 111, 115, 119, 123, 127, 134, 133,
864 0, 98, 99, 70, 67, 0, 53, 65, 0, 183,
865 185, 0, 0, 101, 173, 0, 0, 47, 39, 82,
866 0, 55, 0, 0, 0, 0, 71, 72, 0, 193,
867 11, 5, 52, 50, 58, 0, 0, 103, 60, 0,
868 0, 68, 70, 73, 80, 9, 0, 0, 61, 82,
869 31, 31, 0, 7, 82, 0, 32, 74, 75, 69,
873 /* YYDEFGOTO[NTERM-NUM]. */
874 static const yytype_int16 yydefgoto
[] =
876 -1, 1, 42, 2, 89, 44, 356, 281, 282, 119,
877 120, 367, 46, 47, 107, 252, 108, 253, 202, 203,
878 291, 292, 48, 49, 50, 51, 254, 346, 294, 357,
879 52, 53, 54, 55, 56, 57, 314, 335, 336, 337,
880 352, 58, 59, 199, 200, 99, 176, 60, 179, 180,
881 267, 61, 181, 62, 182, 63, 183, 64, 184, 65,
882 185, 66, 186, 67, 187, 68, 188, 69, 189, 70,
883 71, 72, 73, 74, 75, 76, 77, 78, 164, 244,
884 79, 80, 129, 130, 131, 81, 121, 122, 85, 82,
885 83, 138, 95, 250, 298
888 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
890 #define YYPACT_NINF -293
891 static const yytype_int16 yypact
[] =
893 -293, 53, 496, -293, 26, 26, 956, 744, 8, 8,
894 986, -293, 956, 8, -293, 956, -293, -293, 39, 956,
895 71, 956, 8, 8, 956, 956, -293, -293, -293, 67,
896 -293, -293, -293, 558, -293, 956, 956, -293, 956, 956,
897 41, 956, 76, 410, 26, -293, -293, -293, -293, -293,
898 -293, -293, -293, -293, -293, -293, -293, -293, -293, -293,
899 19, -293, -293, -7, 102, 100, 108, 111, 135, 36,
900 142, -43, 97, -293, -293, 129, -293, 105, 118, -293,
901 -293, -293, -293, -293, -293, 7, 7, -293, 176, -293,
902 -293, 49, 158, -293, -293, 372, 850, -293, 105, 7,
903 140, 956, 19, 620, 125, -293, 153, 47, -293, -293,
904 372, 956, -293, -293, 744, 442, 67, 155, 163, -293,
905 682, 80, 165, -293, -293, -293, -293, -293, -293, 42,
906 48, 956, 31, -293, 8, -293, 956, -293, -293, 956,
907 956, 956, 956, 956, 956, 956, 956, 956, 956, 956,
908 956, 956, 956, 956, 956, -293, -293, -293, -293, 956,
909 956, 956, 180, 797, -293, 956, 182, -293, -293, -293,
910 -293, -293, -293, -293, 8, -293, 3, 140, 184, -293,
911 181, -293, -293, 35, 195, 172, 178, 175, 192, 23,
912 142, 120, -293, -293, 11, -293, -293, 8, 39, 222,
913 -293, 956, -293, -293, 71, -293, 3, 11, -293, -293,
914 -293, -293, 90, 956, 186, -293, -293, -293, -293, -293,
915 198, -293, 102, 185, 100, 108, 111, 135, 36, 142,
916 142, 142, -43, 97, 97, -293, -293, -293, -293, -293,
917 56, -293, -293, -293, 34, 66, -293, 372, -293, -293,
918 744, 188, 190, 226, 10, 956, 956, 956, 956, 956,
919 956, 956, 956, 956, 956, 372, 956, 956, 193, 204,
920 -293, -293, -293, -293, 744, 744, 194, -293, 196, 903,
921 -293, 202, 3, 956, -293, 956, -293, -293, 3, 234,
922 956, -293, -293, 184, 10, 372, -293, -293, 956, -293,
923 177, 195, 214, 172, 178, 175, 192, 23, 142, 142,
924 3, -293, -293, 263, -293, 3, -293, -293, 956, -293,
925 -293, 230, 221, -293, -293, 7, 744, -293, -293, 956,
926 3, -293, 956, 744, 956, 6, 263, -293, 39, -293,
927 -293, -293, -293, -293, -293, 744, 10, -293, -293, 59,
928 219, -293, 263, -293, -293, 744, 239, 10, -293, 956,
929 744, 744, 240, -293, 956, 3, 744, -293, -293, -293,
930 3, 744, 744, -293, -293
933 /* YYPGOTO[NTERM-NUM]. */
934 static const yytype_int16 yypgoto
[] =
936 -293, -293, -293, -63, -2, -293, -293, -293, -293, 0,
937 -187, -82, -17, -293, -293, -293, 77, -10, -293, -293,
938 -293, -293, -293, -293, -293, -293, -293, -293, -293, -293,
939 -293, -293, -293, -293, -293, -293, -293, -68, -293, -51,
940 -293, -293, -293, -293, 87, -292, -87, 15, -293, -293,
941 213, -36, -238, -293, -293, -293, -293, 150, 40, 149,
942 33, 151, 43, 152, 44, 148, 45, 156, 46, -62,
943 145, 37, 38, -293, -3, 287, 288, -293, -9, -293,
944 -293, -293, -293, 86, 89, -293, -293, 95, 5, -293,
945 -293, -60, 32, 17, -254
948 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
949 positive, shift that token. If negative, reduce the rule which
950 number is the opposite. If YYTABLE_NINF, syntax error. */
951 #define YYTABLE_NINF -197
952 static const yytype_int16 yytable
[] =
954 43, 104, 45, 91, 248, 43, 331, 92, 135, 93,
955 86, 296, 248, 350, 150, 151, 91, 299, 91, 302,
956 135, 91, 91, 206, 139, 168, 169, 100, 311, 312,
957 102, 43, 91, 91, 190, 91, 91, 344, 263, 193,
958 329, 96, 195, 351, 90, 101, 140, 205, 135, 134,
959 146, 147, 327, 3, 110, 111, 132, 105, 137, 109,
960 136, 297, 112, 113, 84, 264, 256, 365, 136, 167,
961 137, 249, 370, 123, 124, 94, 125, 126, 148, 249,
962 136, 155, 156, 285, 229, 230, 231, 103, 257, 192,
963 127, 214, 359, 191, 347, 218, 204, 216, 137, 219,
964 221, 43, 286, 364, 223, 136, 128, 215, 136, 106,
965 177, 360, 43, 217, 208, 136, 194, 211, 43, 114,
966 210, 284, 133, 238, 239, 177, 207, 243, 171, 212,
967 197, 287, 141, 172, 265, 173, 91, 198, 91, 91,
968 91, 91, 91, 91, 91, 91, 91, 91, 91, 91,
969 91, 91, 155, 156, 142, 157, 152, 153, 154, 158,
970 288, 155, 156, 143, 157, 272, 220, 144, 158, 161,
971 266, 162, 163, 366, 366, 145, 240, 277, 310, 159,
972 245, 270, 165, 149, 166, 163, 174, 233, 234, 136,
973 235, 236, 237, 190, 190, 190, 190, 190, 190, 190,
974 190, 308, 309, 201, 190, 190, 247, -196, 330, 155,
975 156, 268, 157, 170, 171, -195, 158, 213, 241, 172,
976 246, 173, 251, 274, 275, 258, 259, 266, 190, 269,
977 255, 261, 262, 260, 198, 127, 280, 283, 290, 293,
978 295, 313, 315, 320, 326, 216, 318, 323, 43, 324,
979 289, 321, 300, 91, 300, 91, 91, 91, 91, 91,
980 91, 91, 177, 300, 300, 342, 332, 334, 340, 341,
981 190, 361, 43, 43, 316, 317, 363, 369, 355, 368,
982 177, 273, 339, 328, 362, 353, 271, 300, 160, 222,
983 224, 303, 227, 225, 232, 226, 301, 97, 98, 322,
984 278, 228, 304, 279, 305, 325, 306, 276, 307, 0,
985 177, 0, 0, 100, 0, 0, 0, 0, 0, 0,
986 0, 354, 0, 0, 43, 0, 343, 333, 0, 300,
987 0, 43, 338, 348, 0, 0, 0, 0, 0, 0,
988 0, 0, 0, 43, 100, 358, 0, 345, 0, 349,
989 0, 0, 0, 43, 0, 45, 0, 0, 43, 43,
990 0, 0, 0, 0, 43, 0, 210, 0, 0, 43,
991 43, 373, 374, 175, 100, 0, 0, 0, 0, 100,
992 6, 0, 371, 0, 0, 0, 0, 372, 10, 11,
993 0, 0, 14, 0, 16, 17, 0, 19, 0, 21,
994 0, 0, 0, 0, 24, 25, 0, 27, 28, 0,
995 87, -162, 0, 0, 0, 30, 31, 32, 0, 0,
996 88, 0, 0, 0, -162, -162, 0, 0, 0, 35,
997 36, 0, 37, 0, 38, 39, 40, 0, 0, 41,
998 -162, -162, 0, -190, 0, 0, 0, 0, 0, -162,
999 -162, -162, -162, 0, 0, 0, -190, -190, 0, -162,
1000 -162, 0, 0, -162, -162, -162, -162, 0, 0, -162,
1001 0, -162, -190, -190, 0, 0, -162, 0, 0, 0,
1002 0, -190, -190, -190, -190, 0, 0, 0, 0, 0,
1003 0, -190, -190, 0, 0, -190, -190, -190, -190, 4,
1004 0, -190, 5, -190, 6, 7, 0, 8, -190, 9,
1005 0, 0, 10, 11, 12, 13, 14, 15, 16, 17,
1006 18, 19, 20, 21, 22, 23, 0, 0, 24, 25,
1007 26, 27, 28, 0, 29, 0, 0, 0, 0, 30,
1008 31, 32, 0, 0, 33, 0, 0, 34, 0, 0,
1009 0, 0, 0, 35, 36, 0, 37, 0, 38, 39,
1010 40, 4, 0, 41, 5, 0, 6, 7, 0, 8,
1011 0, 9, 0, 0, 10, 11, 12, 13, 14, 15,
1012 16, 17, 18, 19, 20, 21, 22, 23, 0, 0,
1013 24, 25, 0, 27, 28, 115, 116, 0, 0, 0,
1014 0, 117, 31, 118, 0, 0, 33, 0, 0, 34,
1015 0, 0, 0, 0, 0, 35, 36, 0, 37, 0,
1016 38, 39, 40, 4, 0, 41, 5, 0, 6, 7,
1017 0, 8, 0, 9, 0, 0, 10, 11, 12, 13,
1018 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
1019 0, 0, 24, 25, 0, 27, 28, 196, 29, 0,
1020 0, 0, 0, 30, 31, 32, 0, 0, 33, 0,
1021 0, 34, 0, 0, 0, 0, 0, 35, 36, 0,
1022 37, 0, 38, 39, 40, 4, 0, 41, 5, 0,
1023 6, 7, 0, 8, 0, 9, 0, 0, 10, 11,
1024 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
1025 22, 23, 0, 0, 24, 25, 0, 27, 28, 209,
1026 29, 0, 0, 0, 0, 30, 31, 32, 0, 0,
1027 33, 0, 0, 34, 0, 0, 0, 0, 0, 35,
1028 36, 0, 37, 0, 38, 39, 40, 4, 0, 41,
1029 5, 0, 6, 7, 0, 8, 0, 9, 0, 0,
1030 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
1031 20, 21, 22, 23, 0, 0, 24, 25, 0, 27,
1032 28, 0, 29, 0, 0, 0, 0, 30, 31, 32,
1033 0, 0, 33, 0, 0, 34, 0, 0, 0, 0,
1034 0, 35, 36, 0, 37, 6, 38, 39, 40, 0,
1035 0, 41, 0, 10, 11, 0, 0, 14, 0, 16,
1036 17, 0, 19, 0, 21, 0, 0, 0, 0, 24,
1037 25, 0, 27, 28, 0, 87, 0, 0, 0, 0,
1038 30, 31, 32, 0, 0, 88, 0, 0, 0, 0,
1039 0, 0, 0, 0, 35, 36, 0, 37, 6, 38,
1040 39, 40, 0, 0, 41, 242, 10, 11, 0, 0,
1041 14, 0, 16, 17, 0, 19, 178, 21, 0, 0,
1042 0, 0, 24, 25, 0, 27, 28, 0, 87, 0,
1043 0, 0, 0, 30, 31, 32, 0, 0, 88, 0,
1044 0, 0, 0, 0, 0, 0, 0, 35, 36, 0,
1045 37, 6, 38, 39, 40, 0, 0, 41, 0, 10,
1046 11, 0, 0, 14, 0, 16, 17, 0, 19, 0,
1047 21, 0, 0, 0, 0, 24, 25, 0, 27, 28,
1048 0, 87, 0, 0, 0, 0, 30, 31, 32, 0,
1049 0, 88, 0, 0, 0, 0, 0, 0, 0, 0,
1050 35, 36, 0, 37, 6, 38, 39, 40, 319, 0,
1051 41, 0, 10, 11, 0, 0, 14, 0, 16, 17,
1052 0, 19, 0, 21, 0, 0, 0, 0, 24, 25,
1053 0, 27, 28, 0, 87, 0, 0, 0, 0, 30,
1054 31, 32, 10, 11, 88, 0, 14, 0, 16, 17,
1055 0, 0, 0, 35, 36, 0, 37, 0, 38, 39,
1056 40, 27, 28, 41, 87, 0, 0, 0, 0, 30,
1057 31, 32, 0, 0, 88, 0, 0, 0, 0, 0,
1058 0, 0, 0, 0, 0, 0, 37, 0, 0, 0,
1062 #define yypact_value_is_default(yystate) \
1063 ((yystate) == (-293))
1065 #define yytable_value_is_error(yytable_value) \
1068 static const yytype_int16 yycheck
[] =
1070 2, 18, 2, 6, 1, 7, 298, 7, 1, 1,
1071 5, 1, 1, 7, 57, 58, 19, 255, 21, 257,
1072 1, 24, 25, 110, 31, 85, 86, 12, 266, 267,
1073 15, 33, 35, 36, 96, 38, 39, 329, 15, 99,
1074 294, 9, 102, 37, 6, 13, 53, 107, 1, 44,
1075 14, 15, 290, 0, 22, 23, 41, 19, 51, 21,
1076 49, 51, 24, 25, 38, 42, 31, 359, 49, 78,
1077 51, 68, 364, 35, 36, 67, 38, 39, 42, 68,
1078 49, 32, 33, 49, 146, 147, 148, 48, 53, 98,
1079 49, 49, 346, 96, 332, 131, 49, 49, 51, 68,
1080 136, 103, 68, 357, 140, 49, 65, 65, 49, 38,
1081 95, 52, 114, 65, 114, 49, 101, 37, 120, 52,
1082 120, 65, 46, 159, 160, 110, 111, 163, 38, 49,
1083 5, 65, 30, 43, 14, 45, 139, 12, 141, 142,
1084 143, 144, 145, 146, 147, 148, 149, 150, 151, 152,
1085 153, 154, 32, 33, 54, 35, 59, 60, 61, 39,
1086 247, 32, 33, 55, 35, 201, 134, 56, 39, 64,
1087 50, 66, 67, 360, 361, 40, 161, 213, 265, 50,
1088 165, 198, 64, 41, 66, 67, 28, 150, 151, 49,
1089 152, 153, 154, 255, 256, 257, 258, 259, 260, 261,
1090 262, 263, 264, 50, 266, 267, 174, 52, 295, 32,
1091 33, 194, 35, 37, 38, 52, 39, 52, 38, 43,
1092 38, 45, 38, 206, 207, 30, 54, 50, 290, 197,
1093 49, 56, 40, 55, 12, 49, 38, 52, 50, 49,
1094 14, 48, 38, 279, 10, 49, 52, 283, 250, 285,
1095 250, 49, 255, 256, 257, 258, 259, 260, 261, 262,
1096 263, 264, 247, 266, 267, 325, 52, 4, 38, 48,
1097 332, 52, 274, 275, 274, 275, 37, 37, 341, 361,
1098 265, 204, 318, 293, 352, 336, 199, 290, 75, 139,
1099 141, 258, 144, 142, 149, 143, 256, 10, 10, 282,
1100 214, 145, 259, 214, 260, 288, 261, 212, 262, -1,
1101 295, -1, -1, 298, -1, -1, -1, -1, -1, -1,
1102 -1, 338, -1, -1, 326, -1, 326, 310, -1, 332,
1103 -1, 333, 315, 333, -1, -1, -1, -1, -1, -1,
1104 -1, -1, -1, 345, 329, 345, -1, 330, -1, 334,
1105 -1, -1, -1, 355, -1, 355, -1, -1, 360, 361,
1106 -1, -1, -1, -1, 366, -1, 366, -1, -1, 371,
1107 372, 371, 372, 1, 359, -1, -1, -1, -1, 364,
1108 8, -1, 365, -1, -1, -1, -1, 370, 16, 17,
1109 -1, -1, 20, -1, 22, 23, -1, 25, -1, 27,
1110 -1, -1, -1, -1, 32, 33, -1, 35, 36, -1,
1111 38, 1, -1, -1, -1, 43, 44, 45, -1, -1,
1112 48, -1, -1, -1, 14, 15, -1, -1, -1, 57,
1113 58, -1, 60, -1, 62, 63, 64, -1, -1, 67,
1114 30, 31, -1, 1, -1, -1, -1, -1, -1, 39,
1115 40, 41, 42, -1, -1, -1, 14, 15, -1, 49,
1116 50, -1, -1, 53, 54, 55, 56, -1, -1, 59,
1117 -1, 61, 30, 31, -1, -1, 66, -1, -1, -1,
1118 -1, 39, 40, 41, 42, -1, -1, -1, -1, -1,
1119 -1, 49, 50, -1, -1, 53, 54, 55, 56, 3,
1120 -1, 59, 6, 61, 8, 9, -1, 11, 66, 13,
1121 -1, -1, 16, 17, 18, 19, 20, 21, 22, 23,
1122 24, 25, 26, 27, 28, 29, -1, -1, 32, 33,
1123 34, 35, 36, -1, 38, -1, -1, -1, -1, 43,
1124 44, 45, -1, -1, 48, -1, -1, 51, -1, -1,
1125 -1, -1, -1, 57, 58, -1, 60, -1, 62, 63,
1126 64, 3, -1, 67, 6, -1, 8, 9, -1, 11,
1127 -1, 13, -1, -1, 16, 17, 18, 19, 20, 21,
1128 22, 23, 24, 25, 26, 27, 28, 29, -1, -1,
1129 32, 33, -1, 35, 36, 37, 38, -1, -1, -1,
1130 -1, 43, 44, 45, -1, -1, 48, -1, -1, 51,
1131 -1, -1, -1, -1, -1, 57, 58, -1, 60, -1,
1132 62, 63, 64, 3, -1, 67, 6, -1, 8, 9,
1133 -1, 11, -1, 13, -1, -1, 16, 17, 18, 19,
1134 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
1135 -1, -1, 32, 33, -1, 35, 36, 37, 38, -1,
1136 -1, -1, -1, 43, 44, 45, -1, -1, 48, -1,
1137 -1, 51, -1, -1, -1, -1, -1, 57, 58, -1,
1138 60, -1, 62, 63, 64, 3, -1, 67, 6, -1,
1139 8, 9, -1, 11, -1, 13, -1, -1, 16, 17,
1140 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
1141 28, 29, -1, -1, 32, 33, -1, 35, 36, 37,
1142 38, -1, -1, -1, -1, 43, 44, 45, -1, -1,
1143 48, -1, -1, 51, -1, -1, -1, -1, -1, 57,
1144 58, -1, 60, -1, 62, 63, 64, 3, -1, 67,
1145 6, -1, 8, 9, -1, 11, -1, 13, -1, -1,
1146 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
1147 26, 27, 28, 29, -1, -1, 32, 33, -1, 35,
1148 36, -1, 38, -1, -1, -1, -1, 43, 44, 45,
1149 -1, -1, 48, -1, -1, 51, -1, -1, -1, -1,
1150 -1, 57, 58, -1, 60, 8, 62, 63, 64, -1,
1151 -1, 67, -1, 16, 17, -1, -1, 20, -1, 22,
1152 23, -1, 25, -1, 27, -1, -1, -1, -1, 32,
1153 33, -1, 35, 36, -1, 38, -1, -1, -1, -1,
1154 43, 44, 45, -1, -1, 48, -1, -1, -1, -1,
1155 -1, -1, -1, -1, 57, 58, -1, 60, 8, 62,
1156 63, 64, -1, -1, 67, 68, 16, 17, -1, -1,
1157 20, -1, 22, 23, -1, 25, 26, 27, -1, -1,
1158 -1, -1, 32, 33, -1, 35, 36, -1, 38, -1,
1159 -1, -1, -1, 43, 44, 45, -1, -1, 48, -1,
1160 -1, -1, -1, -1, -1, -1, -1, 57, 58, -1,
1161 60, 8, 62, 63, 64, -1, -1, 67, -1, 16,
1162 17, -1, -1, 20, -1, 22, 23, -1, 25, -1,
1163 27, -1, -1, -1, -1, 32, 33, -1, 35, 36,
1164 -1, 38, -1, -1, -1, -1, 43, 44, 45, -1,
1165 -1, 48, -1, -1, -1, -1, -1, -1, -1, -1,
1166 57, 58, -1, 60, 8, 62, 63, 64, 65, -1,
1167 67, -1, 16, 17, -1, -1, 20, -1, 22, 23,
1168 -1, 25, -1, 27, -1, -1, -1, -1, 32, 33,
1169 -1, 35, 36, -1, 38, -1, -1, -1, -1, 43,
1170 44, 45, 16, 17, 48, -1, 20, -1, 22, 23,
1171 -1, -1, -1, 57, 58, -1, 60, -1, 62, 63,
1172 64, 35, 36, 67, 38, -1, -1, -1, -1, 43,
1173 44, 45, -1, -1, 48, -1, -1, -1, -1, -1,
1174 -1, -1, -1, -1, -1, -1, 60, -1, -1, -1,
1178 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1179 symbol of state STATE-NUM. */
1180 static const yytype_uint8 yystos
[] =
1182 0, 70, 72, 0, 3, 6, 8, 9, 11, 13,
1183 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
1184 26, 27, 28, 29, 32, 33, 34, 35, 36, 38,
1185 43, 44, 45, 48, 51, 57, 58, 60, 62, 63,
1186 64, 67, 71, 73, 74, 78, 81, 82, 91, 92,
1187 93, 94, 99, 100, 101, 102, 103, 104, 110, 111,
1188 116, 120, 122, 124, 126, 128, 130, 132, 134, 136,
1189 138, 139, 140, 141, 142, 143, 144, 145, 146, 149,
1190 150, 154, 158, 159, 38, 157, 157, 38, 48, 73,
1191 141, 143, 78, 1, 67, 161, 161, 144, 145, 114,
1192 116, 161, 116, 48, 81, 141, 38, 83, 85, 141,
1193 161, 161, 141, 141, 52, 37, 38, 43, 45, 78,
1194 79, 155, 156, 141, 141, 141, 141, 49, 65, 151,
1195 152, 153, 116, 46, 157, 1, 49, 51, 160, 31,
1196 53, 30, 54, 55, 56, 40, 14, 15, 42, 41,
1197 57, 58, 59, 60, 61, 32, 33, 35, 39, 50,
1198 119, 64, 66, 67, 147, 64, 66, 147, 160, 160,
1199 37, 38, 43, 45, 28, 1, 115, 116, 26, 117,
1200 118, 121, 123, 125, 127, 129, 131, 133, 135, 137,
1201 138, 143, 147, 160, 116, 160, 37, 5, 12, 112,
1202 113, 50, 87, 88, 49, 160, 115, 116, 78, 37,
1203 78, 37, 49, 52, 49, 65, 49, 65, 120, 68,
1204 161, 120, 126, 120, 128, 130, 132, 134, 136, 138,
1205 138, 138, 139, 140, 140, 141, 141, 141, 120, 120,
1206 116, 38, 68, 120, 148, 116, 38, 161, 1, 68,
1207 162, 38, 84, 86, 95, 49, 31, 53, 30, 54,
1208 55, 56, 40, 15, 42, 14, 50, 119, 162, 161,
1209 81, 113, 120, 85, 162, 162, 156, 120, 152, 153,
1210 38, 76, 77, 52, 65, 49, 68, 65, 115, 78,
1211 50, 89, 90, 49, 97, 14, 1, 51, 163, 121,
1212 143, 127, 121, 129, 131, 133, 135, 137, 138, 138,
1213 115, 121, 121, 48, 105, 38, 78, 78, 52, 65,
1214 120, 49, 162, 120, 120, 162, 10, 121, 86, 163,
1215 115, 114, 52, 162, 4, 106, 107, 108, 162, 120,
1216 38, 48, 160, 78, 114, 162, 96, 121, 78, 116,
1217 7, 37, 109, 108, 81, 72, 75, 98, 78, 163,
1218 52, 52, 106, 37, 163, 114, 79, 80, 80, 37,
1219 114, 162, 162, 78, 78
1222 #define yyerrok (yyerrstatus = 0)
1223 #define yyclearin (yychar = YYEMPTY)
1224 #define YYEMPTY (-2)
1227 #define YYACCEPT goto yyacceptlab
1228 #define YYABORT goto yyabortlab
1229 #define YYERROR goto yyerrorlab
1232 /* Like YYERROR except do call yyerror. This remains here temporarily
1233 to ease the transition to the new meaning of YYERROR, for GCC.
1234 Once GCC version 2 has supplanted version 1, this can go. However,
1235 YYFAIL appears to be in use. Nevertheless, it is formally deprecated
1236 in Bison 2.4.2's NEWS entry, where a plan to phase it out is
1239 #define YYFAIL goto yyerrlab
1241 /* This is here to suppress warnings from the GCC cpp's
1242 -Wunused-macros. Normally we don't worry about that warning, but
1243 some users do, and we want to make it easy for users to remove
1244 YYFAIL uses, which will produce warnings from Bison 2.5. */
1247 #define YYRECOVERING() (!!yyerrstatus)
1249 #define YYBACKUP(Token, Value) \
1251 if (yychar == YYEMPTY && yylen == 1) \
1260 yyerror (ctx, YY_("syntax error: cannot back up")); \
1267 #define YYERRCODE 256
1270 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
1271 If N is 0, then set CURRENT to the empty location which ends
1272 the previous symbol: RHS[0] (always defined). */
1274 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
1275 #ifndef YYLLOC_DEFAULT
1276 # define YYLLOC_DEFAULT(Current, Rhs, N) \
1280 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
1281 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
1282 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
1283 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
1287 (Current).first_line = (Current).last_line = \
1288 YYRHSLOC (Rhs, 0).last_line; \
1289 (Current).first_column = (Current).last_column = \
1290 YYRHSLOC (Rhs, 0).last_column; \
1296 /* This macro is provided for backward compatibility. */
1298 #ifndef YY_LOCATION_PRINT
1299 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1303 /* YYLEX -- calling `yylex' with the right arguments. */
1306 # define YYLEX yylex (&yylval, YYLEX_PARAM)
1308 # define YYLEX yylex (&yylval, ctx)
1311 /* Enable debugging if requested. */
1315 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1316 # define YYFPRINTF fprintf
1319 # define YYDPRINTF(Args) \
1325 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1329 YYFPRINTF (stderr, "%s ", Title); \
1330 yy_symbol_print (stderr, \
1331 Type, Value, ctx); \
1332 YYFPRINTF (stderr, "\n"); \
1337 /*--------------------------------.
1338 | Print this symbol on YYOUTPUT. |
1339 `--------------------------------*/
1342 #if (defined __STDC__ || defined __C99__FUNC__ \
1343 || defined __cplusplus || defined _MSC_VER)
1345 yy_symbol_value_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
, parser_ctx_t
*ctx
)
1348 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
, ctx
)
1351 YYSTYPE
const * const yyvaluep
;
1359 if (yytype
< YYNTOKENS
)
1360 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
1372 /*--------------------------------.
1373 | Print this symbol on YYOUTPUT. |
1374 `--------------------------------*/
1376 #if (defined __STDC__ || defined __C99__FUNC__ \
1377 || defined __cplusplus || defined _MSC_VER)
1379 yy_symbol_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
, parser_ctx_t
*ctx
)
1382 yy_symbol_print (yyoutput
, yytype
, yyvaluep
, ctx
)
1385 YYSTYPE
const * const yyvaluep
;
1389 if (yytype
< YYNTOKENS
)
1390 YYFPRINTF (yyoutput
, "token %s (", yytname
[yytype
]);
1392 YYFPRINTF (yyoutput
, "nterm %s (", yytname
[yytype
]);
1394 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
, ctx
);
1395 YYFPRINTF (yyoutput
, ")");
1398 /*------------------------------------------------------------------.
1399 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1401 `------------------------------------------------------------------*/
1403 #if (defined __STDC__ || defined __C99__FUNC__ \
1404 || defined __cplusplus || defined _MSC_VER)
1406 yy_stack_print (yytype_int16
*yybottom
, yytype_int16
*yytop
)
1409 yy_stack_print (yybottom
, yytop
)
1410 yytype_int16
*yybottom
;
1411 yytype_int16
*yytop
;
1414 YYFPRINTF (stderr
, "Stack now");
1415 for (; yybottom
<= yytop
; yybottom
++)
1417 int yybot
= *yybottom
;
1418 YYFPRINTF (stderr
, " %d", yybot
);
1420 YYFPRINTF (stderr
, "\n");
1423 # define YY_STACK_PRINT(Bottom, Top) \
1426 yy_stack_print ((Bottom), (Top)); \
1430 /*------------------------------------------------.
1431 | Report that the YYRULE is going to be reduced. |
1432 `------------------------------------------------*/
1434 #if (defined __STDC__ || defined __C99__FUNC__ \
1435 || defined __cplusplus || defined _MSC_VER)
1437 yy_reduce_print (YYSTYPE
*yyvsp
, int yyrule
, parser_ctx_t
*ctx
)
1440 yy_reduce_print (yyvsp
, yyrule
, ctx
)
1446 int yynrhs
= yyr2
[yyrule
];
1448 unsigned long int yylno
= yyrline
[yyrule
];
1449 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %lu):\n",
1451 /* The symbols being reduced. */
1452 for (yyi
= 0; yyi
< yynrhs
; yyi
++)
1454 YYFPRINTF (stderr
, " $%d = ", yyi
+ 1);
1455 yy_symbol_print (stderr
, yyrhs
[yyprhs
[yyrule
] + yyi
],
1456 &(yyvsp
[(yyi
+ 1) - (yynrhs
)])
1458 YYFPRINTF (stderr
, "\n");
1462 # define YY_REDUCE_PRINT(Rule) \
1465 yy_reduce_print (yyvsp, Rule, ctx); \
1468 /* Nonzero means print parse trace. It is left uninitialized so that
1469 multiple parsers can coexist. */
1471 #else /* !YYDEBUG */
1472 # define YYDPRINTF(Args)
1473 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1474 # define YY_STACK_PRINT(Bottom, Top)
1475 # define YY_REDUCE_PRINT(Rule)
1476 #endif /* !YYDEBUG */
1479 /* YYINITDEPTH -- initial size of the parser's stacks. */
1481 # define YYINITDEPTH 200
1484 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1485 if the built-in stack extension method is used).
1487 Do not make this value too large; the results are undefined if
1488 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1489 evaluated with infinite-precision integer arithmetic. */
1492 # define YYMAXDEPTH 10000
1499 # if defined __GLIBC__ && defined _STRING_H
1500 # define yystrlen strlen
1502 /* Return the length of YYSTR. */
1503 #if (defined __STDC__ || defined __C99__FUNC__ \
1504 || defined __cplusplus || defined _MSC_VER)
1506 yystrlen (const char *yystr
)
1514 for (yylen
= 0; yystr
[yylen
]; yylen
++)
1522 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1523 # define yystpcpy stpcpy
1525 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1527 #if (defined __STDC__ || defined __C99__FUNC__ \
1528 || defined __cplusplus || defined _MSC_VER)
1530 yystpcpy (char *yydest
, const char *yysrc
)
1533 yystpcpy (yydest
, yysrc
)
1539 const char *yys
= yysrc
;
1541 while ((*yyd
++ = *yys
++) != '\0')
1550 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1551 quotes and backslashes, so that it's suitable for yyerror. The
1552 heuristic is that double-quoting is unnecessary unless the string
1553 contains an apostrophe, a comma, or backslash (other than
1554 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1555 null, do not copy; instead, return the length of what the result
1558 yytnamerr (char *yyres
, const char *yystr
)
1563 char const *yyp
= yystr
;
1570 goto do_not_strip_quotes
;
1574 goto do_not_strip_quotes
;
1587 do_not_strip_quotes
: ;
1591 return yystrlen (yystr
);
1593 return yystpcpy (yyres
, yystr
) - yyres
;
1597 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1598 about the unexpected token YYTOKEN for the state stack whose top is
1601 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1602 not large enough to hold the message. In that case, also set
1603 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1604 required number of bytes is too large to store. */
1606 yysyntax_error (YYSIZE_T
*yymsg_alloc
, char **yymsg
,
1607 yytype_int16
*yyssp
, int yytoken
)
1609 YYSIZE_T yysize0
= yytnamerr (0, yytname
[yytoken
]);
1610 YYSIZE_T yysize
= yysize0
;
1612 enum { YYERROR_VERBOSE_ARGS_MAXIMUM
= 5 };
1613 /* Internationalized format string. */
1614 const char *yyformat
= 0;
1615 /* Arguments of yyformat. */
1616 char const *yyarg
[YYERROR_VERBOSE_ARGS_MAXIMUM
];
1617 /* Number of reported tokens (one for the "unexpected", one per
1621 /* There are many possibilities here to consider:
1622 - Assume YYFAIL is not used. It's too flawed to consider. See
1623 <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
1624 for details. YYERROR is fine as it does not invoke this
1626 - If this state is a consistent state with a default action, then
1627 the only way this function was invoked is if the default action
1628 is an error action. In that case, don't check for expected
1629 tokens because there are none.
1630 - The only way there can be no lookahead present (in yychar) is if
1631 this state is a consistent state with a default action. Thus,
1632 detecting the absence of a lookahead is sufficient to determine
1633 that there is no unexpected or expected token to report. In that
1634 case, just report a simple "syntax error".
1635 - Don't assume there isn't a lookahead just because this state is a
1636 consistent state with a default action. There might have been a
1637 previous inconsistent state, consistent state with a non-default
1638 action, or user semantic action that manipulated yychar.
1639 - Of course, the expected token list depends on states to have
1640 correct lookahead information, and it depends on the parser not
1641 to perform extra reductions after fetching a lookahead from the
1642 scanner and before detecting a syntax error. Thus, state merging
1643 (from LALR or IELR) and default reductions corrupt the expected
1644 token list. However, the list is correct for canonical LR with
1645 one exception: it will still contain any token that will not be
1646 accepted due to an error action in a later state.
1648 if (yytoken
!= YYEMPTY
)
1650 int yyn
= yypact
[*yyssp
];
1651 yyarg
[yycount
++] = yytname
[yytoken
];
1652 if (!yypact_value_is_default (yyn
))
1654 /* Start YYX at -YYN if negative to avoid negative indexes in
1655 YYCHECK. In other words, skip the first -YYN actions for
1656 this state because they are default actions. */
1657 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
1658 /* Stay within bounds of both yycheck and yytname. */
1659 int yychecklim
= YYLAST
- yyn
+ 1;
1660 int yyxend
= yychecklim
< YYNTOKENS
? yychecklim
: YYNTOKENS
;
1663 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
1664 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
1665 && !yytable_value_is_error (yytable
[yyx
+ yyn
]))
1667 if (yycount
== YYERROR_VERBOSE_ARGS_MAXIMUM
)
1673 yyarg
[yycount
++] = yytname
[yyx
];
1674 yysize1
= yysize
+ yytnamerr (0, yytname
[yyx
]);
1675 if (! (yysize
<= yysize1
1676 && yysize1
<= YYSTACK_ALLOC_MAXIMUM
))
1685 # define YYCASE_(N, S) \
1689 YYCASE_(0, YY_("syntax error"));
1690 YYCASE_(1, YY_("syntax error, unexpected %s"));
1691 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1692 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1693 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1694 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1698 yysize1
= yysize
+ yystrlen (yyformat
);
1699 if (! (yysize
<= yysize1
&& yysize1
<= YYSTACK_ALLOC_MAXIMUM
))
1703 if (*yymsg_alloc
< yysize
)
1705 *yymsg_alloc
= 2 * yysize
;
1706 if (! (yysize
<= *yymsg_alloc
1707 && *yymsg_alloc
<= YYSTACK_ALLOC_MAXIMUM
))
1708 *yymsg_alloc
= YYSTACK_ALLOC_MAXIMUM
;
1712 /* Avoid sprintf, as that infringes on the user's name space.
1713 Don't have undefined behavior even if the translation
1714 produced a string with the wrong number of "%s"s. */
1718 while ((*yyp
= *yyformat
) != '\0')
1719 if (*yyp
== '%' && yyformat
[1] == 's' && yyi
< yycount
)
1721 yyp
+= yytnamerr (yyp
, yyarg
[yyi
++]);
1732 #endif /* YYERROR_VERBOSE */
1734 /*-----------------------------------------------.
1735 | Release the memory associated to this symbol. |
1736 `-----------------------------------------------*/
1739 #if (defined __STDC__ || defined __C99__FUNC__ \
1740 || defined __cplusplus || defined _MSC_VER)
1742 yydestruct (const char *yymsg
, int yytype
, YYSTYPE
*yyvaluep
, parser_ctx_t
*ctx
)
1745 yydestruct (yymsg
, yytype
, yyvaluep
, ctx
)
1757 YY_SYMBOL_PRINT (yymsg
, yytype
, yyvaluep
, yylocationp
);
1768 /* Prevent warnings from -Wmissing-prototypes. */
1769 #ifdef YYPARSE_PARAM
1770 #if defined __STDC__ || defined __cplusplus
1771 int yyparse (void *YYPARSE_PARAM
);
1775 #else /* ! YYPARSE_PARAM */
1776 #if defined __STDC__ || defined __cplusplus
1777 int yyparse (parser_ctx_t
*ctx
);
1781 #endif /* ! YYPARSE_PARAM */
1788 #ifdef YYPARSE_PARAM
1789 #if (defined __STDC__ || defined __C99__FUNC__ \
1790 || defined __cplusplus || defined _MSC_VER)
1792 yyparse (void *YYPARSE_PARAM
)
1795 yyparse (YYPARSE_PARAM
)
1796 void *YYPARSE_PARAM
;
1798 #else /* ! YYPARSE_PARAM */
1799 #if (defined __STDC__ || defined __C99__FUNC__ \
1800 || defined __cplusplus || defined _MSC_VER)
1802 yyparse (parser_ctx_t
*ctx
)
1810 /* The lookahead symbol. */
1813 /* The semantic value of the lookahead symbol. */
1816 /* Number of syntax errors so far. */
1820 /* Number of tokens to shift before error messages enabled. */
1823 /* The stacks and their tools:
1824 `yyss': related to states.
1825 `yyvs': related to semantic values.
1827 Refer to the stacks thru separate pointers, to allow yyoverflow
1828 to reallocate them elsewhere. */
1830 /* The state stack. */
1831 yytype_int16 yyssa
[YYINITDEPTH
];
1833 yytype_int16
*yyssp
;
1835 /* The semantic value stack. */
1836 YYSTYPE yyvsa
[YYINITDEPTH
];
1840 YYSIZE_T yystacksize
;
1844 /* Lookahead token as an internal (translated) token number. */
1846 /* The variables used to return semantic value and location from the
1851 /* Buffer for error messages, and its allocated size. */
1853 char *yymsg
= yymsgbuf
;
1854 YYSIZE_T yymsg_alloc
= sizeof yymsgbuf
;
1857 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1859 /* The number of symbols on the RHS of the reduced rule.
1860 Keep to zero when no symbol should be popped. */
1866 yystacksize
= YYINITDEPTH
;
1868 YYDPRINTF ((stderr
, "Starting parse\n"));
1873 yychar
= YYEMPTY
; /* Cause a token to be read. */
1875 /* Initialize stack pointers.
1876 Waste one element of value and location stack
1877 so that they stay on the same level as the state stack.
1878 The wasted elements are never initialized. */
1884 /*------------------------------------------------------------.
1885 | yynewstate -- Push a new state, which is found in yystate. |
1886 `------------------------------------------------------------*/
1888 /* In all cases, when you get here, the value and location stacks
1889 have just been pushed. So pushing a state here evens the stacks. */
1895 if (yyss
+ yystacksize
- 1 <= yyssp
)
1897 /* Get the current used size of the three stacks, in elements. */
1898 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1902 /* Give user a chance to reallocate the stack. Use copies of
1903 these so that the &'s don't force the real ones into
1905 YYSTYPE
*yyvs1
= yyvs
;
1906 yytype_int16
*yyss1
= yyss
;
1908 /* Each stack pointer address is followed by the size of the
1909 data in use in that stack, in bytes. This used to be a
1910 conditional around just the two extra args, but that might
1911 be undefined if yyoverflow is a macro. */
1912 yyoverflow (YY_("memory exhausted"),
1913 &yyss1
, yysize
* sizeof (*yyssp
),
1914 &yyvs1
, yysize
* sizeof (*yyvsp
),
1920 #else /* no yyoverflow */
1921 # ifndef YYSTACK_RELOCATE
1922 goto yyexhaustedlab
;
1924 /* Extend the stack our own way. */
1925 if (YYMAXDEPTH
<= yystacksize
)
1926 goto yyexhaustedlab
;
1928 if (YYMAXDEPTH
< yystacksize
)
1929 yystacksize
= YYMAXDEPTH
;
1932 yytype_int16
*yyss1
= yyss
;
1933 union yyalloc
*yyptr
=
1934 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1936 goto yyexhaustedlab
;
1937 YYSTACK_RELOCATE (yyss_alloc
, yyss
);
1938 YYSTACK_RELOCATE (yyvs_alloc
, yyvs
);
1939 # undef YYSTACK_RELOCATE
1941 YYSTACK_FREE (yyss1
);
1944 #endif /* no yyoverflow */
1946 yyssp
= yyss
+ yysize
- 1;
1947 yyvsp
= yyvs
+ yysize
- 1;
1949 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1950 (unsigned long int) yystacksize
));
1952 if (yyss
+ yystacksize
- 1 <= yyssp
)
1956 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1958 if (yystate
== YYFINAL
)
1968 /* Do appropriate processing given the current state. Read a
1969 lookahead token if we need one and don't already have one. */
1971 /* First try to decide what to do without reference to lookahead token. */
1972 yyn
= yypact
[yystate
];
1973 if (yypact_value_is_default (yyn
))
1976 /* Not known => get a lookahead token if don't already have one. */
1978 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1979 if (yychar
== YYEMPTY
)
1981 YYDPRINTF ((stderr
, "Reading a token: "));
1985 if (yychar
<= YYEOF
)
1987 yychar
= yytoken
= YYEOF
;
1988 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1992 yytoken
= YYTRANSLATE (yychar
);
1993 YY_SYMBOL_PRINT ("Next token is", yytoken
, &yylval
, &yylloc
);
1996 /* If the proper action on seeing token YYTOKEN is to reduce or to
1997 detect an error, take that action. */
1999 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
2004 if (yytable_value_is_error (yyn
))
2010 /* Count tokens shifted since error; after three, turn off error
2015 /* Shift the lookahead token. */
2016 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
2018 /* Discard the shifted token. */
2027 /*-----------------------------------------------------------.
2028 | yydefault -- do the default action for the current state. |
2029 `-----------------------------------------------------------*/
2031 yyn
= yydefact
[yystate
];
2037 /*-----------------------------.
2038 | yyreduce -- Do a reduction. |
2039 `-----------------------------*/
2041 /* yyn is the number of a rule to reduce with. */
2044 /* If YYLEN is nonzero, implement the default value of the action:
2047 Otherwise, the following line sets YYVAL to garbage.
2048 This behavior is undocumented and Bison
2049 users should not rely upon it. Assigning to YYVAL
2050 unconditionally makes the parser a bit smaller, and it avoids a
2051 GCC warning that YYVAL may be used uninitialized. */
2052 yyval
= yyvsp
[1-yylen
];
2055 YY_REDUCE_PRINT (yyn
);
2060 /* Line 1806 of yacc.c */
2061 #line 252 "parser.y"
2062 { program_parsed(ctx
, (yyvsp
[(1) - (3)].source_elements
)); }
2067 /* Line 1806 of yacc.c */
2068 #line 255 "parser.y"
2074 /* Line 1806 of yacc.c */
2075 #line 256 "parser.y"
2081 /* Line 1806 of yacc.c */
2082 #line 260 "parser.y"
2083 { (yyval
.source_elements
) = new_source_elements(ctx
); }
2088 /* Line 1806 of yacc.c */
2089 #line 262 "parser.y"
2090 { (yyval
.source_elements
) = source_elements_add_statement((yyvsp
[(1) - (2)].source_elements
), (yyvsp
[(2) - (2)].statement
)); }
2095 /* Line 1806 of yacc.c */
2096 #line 267 "parser.y"
2097 { (yyval
.expr
) = new_function_expression(ctx
, (yyvsp
[(2) - (8)].identifier
), (yyvsp
[(4) - (8)].parameter_list
), (yyvsp
[(7) - (8)].source_elements
), (yyvsp
[(1) - (8)].srcptr
), (yyvsp
[(8) - (8)].srcptr
)-(yyvsp
[(1) - (8)].srcptr
)+1); }
2102 /* Line 1806 of yacc.c */
2103 #line 270 "parser.y"
2104 { (yyval
.srcptr
) = (yyvsp
[(1) - (1)].srcptr
); }
2109 /* Line 1806 of yacc.c */
2110 #line 274 "parser.y"
2111 { (yyval
.source_elements
) = (yyvsp
[(1) - (1)].source_elements
); }
2116 /* Line 1806 of yacc.c */
2117 #line 278 "parser.y"
2118 { (yyval
.parameter_list
) = new_parameter_list(ctx
, (yyvsp
[(1) - (1)].identifier
)); }
2123 /* Line 1806 of yacc.c */
2124 #line 280 "parser.y"
2125 { (yyval
.parameter_list
) = parameter_list_add(ctx
, (yyvsp
[(1) - (3)].parameter_list
), (yyvsp
[(3) - (3)].identifier
)); }
2130 /* Line 1806 of yacc.c */
2131 #line 284 "parser.y"
2132 { (yyval
.parameter_list
) = NULL
; }
2137 /* Line 1806 of yacc.c */
2138 #line 285 "parser.y"
2139 { (yyval
.parameter_list
) = (yyvsp
[(1) - (1)].parameter_list
); }
2144 /* Line 1806 of yacc.c */
2145 #line 289 "parser.y"
2146 { (yyval
.statement
) = (yyvsp
[(1) - (1)].statement
); }
2151 /* Line 1806 of yacc.c */
2152 #line 290 "parser.y"
2153 { (yyval
.statement
) = (yyvsp
[(1) - (1)].statement
); }
2158 /* Line 1806 of yacc.c */
2159 #line 291 "parser.y"
2160 { (yyval
.statement
) = (yyvsp
[(1) - (1)].statement
); }
2165 /* Line 1806 of yacc.c */
2166 #line 292 "parser.y"
2167 { (yyval
.statement
) = new_expression_statement(ctx
, (yyvsp
[(1) - (1)].expr
)); }
2172 /* Line 1806 of yacc.c */
2173 #line 293 "parser.y"
2174 { (yyval
.statement
) = (yyvsp
[(1) - (1)].statement
); }
2179 /* Line 1806 of yacc.c */
2180 #line 294 "parser.y"
2181 { (yyval
.statement
) = (yyvsp
[(1) - (1)].statement
); }
2186 /* Line 1806 of yacc.c */
2187 #line 295 "parser.y"
2188 { (yyval
.statement
) = (yyvsp
[(1) - (1)].statement
); }
2193 /* Line 1806 of yacc.c */
2194 #line 296 "parser.y"
2195 { (yyval
.statement
) = (yyvsp
[(1) - (1)].statement
); }
2200 /* Line 1806 of yacc.c */
2201 #line 297 "parser.y"
2202 { (yyval
.statement
) = (yyvsp
[(1) - (1)].statement
); }
2207 /* Line 1806 of yacc.c */
2208 #line 298 "parser.y"
2209 { (yyval
.statement
) = (yyvsp
[(1) - (1)].statement
); }
2214 /* Line 1806 of yacc.c */
2215 #line 299 "parser.y"
2216 { (yyval
.statement
) = (yyvsp
[(1) - (1)].statement
); }
2221 /* Line 1806 of yacc.c */
2222 #line 300 "parser.y"
2223 { (yyval
.statement
) = (yyvsp
[(1) - (1)].statement
); }
2228 /* Line 1806 of yacc.c */
2229 #line 301 "parser.y"
2230 { (yyval
.statement
) = (yyvsp
[(1) - (1)].statement
); }
2235 /* Line 1806 of yacc.c */
2236 #line 302 "parser.y"
2237 { (yyval
.statement
) = (yyvsp
[(1) - (1)].statement
); }
2242 /* Line 1806 of yacc.c */
2243 #line 303 "parser.y"
2244 { (yyval
.statement
) = (yyvsp
[(1) - (1)].statement
); }
2249 /* Line 1806 of yacc.c */
2250 #line 307 "parser.y"
2251 { (yyval
.statement_list
) = new_statement_list(ctx
, (yyvsp
[(1) - (1)].statement
)); }
2256 /* Line 1806 of yacc.c */
2257 #line 309 "parser.y"
2258 { (yyval
.statement_list
) = statement_list_add((yyvsp
[(1) - (2)].statement_list
), (yyvsp
[(2) - (2)].statement
)); }
2263 /* Line 1806 of yacc.c */
2264 #line 313 "parser.y"
2265 { (yyval
.statement_list
) = NULL
; }
2270 /* Line 1806 of yacc.c */
2271 #line 314 "parser.y"
2272 { (yyval
.statement_list
) = (yyvsp
[(1) - (1)].statement_list
); }
2277 /* Line 1806 of yacc.c */
2278 #line 318 "parser.y"
2279 { (yyval
.statement
) = new_block_statement(ctx
, (yyvsp
[(2) - (3)].statement_list
)); }
2284 /* Line 1806 of yacc.c */
2285 #line 319 "parser.y"
2286 { (yyval
.statement
) = new_block_statement(ctx
, NULL
); }
2291 /* Line 1806 of yacc.c */
2292 #line 324 "parser.y"
2293 { (yyval
.statement
) = new_var_statement(ctx
, (yyvsp
[(2) - (3)].variable_list
)); }
2298 /* Line 1806 of yacc.c */
2299 #line 328 "parser.y"
2300 { (yyval
.variable_list
) = new_variable_list(ctx
, (yyvsp
[(1) - (1)].variable_declaration
)); }
2305 /* Line 1806 of yacc.c */
2306 #line 330 "parser.y"
2307 { (yyval
.variable_list
) = variable_list_add(ctx
, (yyvsp
[(1) - (3)].variable_list
), (yyvsp
[(3) - (3)].variable_declaration
)); }
2312 /* Line 1806 of yacc.c */
2313 #line 335 "parser.y"
2314 { (yyval
.variable_list
) = new_variable_list(ctx
, (yyvsp
[(1) - (1)].variable_declaration
)); }
2319 /* Line 1806 of yacc.c */
2320 #line 337 "parser.y"
2321 { (yyval
.variable_list
) = variable_list_add(ctx
, (yyvsp
[(1) - (3)].variable_list
), (yyvsp
[(3) - (3)].variable_declaration
)); }
2326 /* Line 1806 of yacc.c */
2327 #line 342 "parser.y"
2328 { (yyval
.variable_declaration
) = new_variable_declaration(ctx
, (yyvsp
[(1) - (2)].identifier
), (yyvsp
[(2) - (2)].expr
)); }
2333 /* Line 1806 of yacc.c */
2334 #line 347 "parser.y"
2335 { (yyval
.variable_declaration
) = new_variable_declaration(ctx
, (yyvsp
[(1) - (2)].identifier
), (yyvsp
[(2) - (2)].expr
)); }
2340 /* Line 1806 of yacc.c */
2341 #line 351 "parser.y"
2342 { (yyval
.expr
) = NULL
; }
2347 /* Line 1806 of yacc.c */
2348 #line 352 "parser.y"
2349 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); }
2354 /* Line 1806 of yacc.c */
2355 #line 357 "parser.y"
2356 { (yyval
.expr
) = (yyvsp
[(2) - (2)].expr
); }
2361 /* Line 1806 of yacc.c */
2362 #line 361 "parser.y"
2363 { (yyval
.expr
) = NULL
; }
2368 /* Line 1806 of yacc.c */
2369 #line 362 "parser.y"
2370 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); }
2375 /* Line 1806 of yacc.c */
2376 #line 367 "parser.y"
2377 { (yyval
.expr
) = (yyvsp
[(2) - (2)].expr
); }
2382 /* Line 1806 of yacc.c */
2383 #line 371 "parser.y"
2384 { (yyval
.statement
) = new_statement(ctx
, STAT_EMPTY
, 0); }
2389 /* Line 1806 of yacc.c */
2390 #line 376 "parser.y"
2391 { (yyval
.statement
) = new_expression_statement(ctx
, (yyvsp
[(1) - (2)].expr
)); }
2396 /* Line 1806 of yacc.c */
2397 #line 381 "parser.y"
2398 { (yyval
.statement
) = new_if_statement(ctx
, (yyvsp
[(3) - (7)].expr
), (yyvsp
[(5) - (7)].statement
), (yyvsp
[(7) - (7)].statement
)); }
2403 /* Line 1806 of yacc.c */
2404 #line 383 "parser.y"
2405 { (yyval
.statement
) = new_if_statement(ctx
, (yyvsp
[(3) - (5)].expr
), (yyvsp
[(5) - (5)].statement
), NULL
); }
2410 /* Line 1806 of yacc.c */
2411 #line 388 "parser.y"
2412 { (yyval
.statement
) = new_while_statement(ctx
, TRUE
, (yyvsp
[(5) - (7)].expr
), (yyvsp
[(2) - (7)].statement
)); }
2417 /* Line 1806 of yacc.c */
2418 #line 390 "parser.y"
2419 { (yyval
.statement
) = new_while_statement(ctx
, FALSE
, (yyvsp
[(3) - (5)].expr
), (yyvsp
[(5) - (5)].statement
)); }
2424 /* Line 1806 of yacc.c */
2425 #line 392 "parser.y"
2426 { if(!explicit_error(ctx
, (yyvsp
[(3) - (3)].expr
), ';')) YYABORT
; }
2431 /* Line 1806 of yacc.c */
2432 #line 394 "parser.y"
2433 { if(!explicit_error(ctx
, (yyvsp
[(6) - (6)].expr
), ';')) YYABORT
; }
2438 /* Line 1806 of yacc.c */
2439 #line 396 "parser.y"
2440 { (yyval
.statement
) = new_for_statement(ctx
, NULL
, (yyvsp
[(3) - (11)].expr
), (yyvsp
[(6) - (11)].expr
), (yyvsp
[(9) - (11)].expr
), (yyvsp
[(11) - (11)].statement
)); }
2445 /* Line 1806 of yacc.c */
2446 #line 398 "parser.y"
2447 { if(!explicit_error(ctx
, (yyvsp
[(4) - (4)].variable_list
), ';')) YYABORT
; }
2452 /* Line 1806 of yacc.c */
2453 #line 400 "parser.y"
2454 { if(!explicit_error(ctx
, (yyvsp
[(7) - (7)].expr
), ';')) YYABORT
; }
2459 /* Line 1806 of yacc.c */
2460 #line 402 "parser.y"
2461 { (yyval
.statement
) = new_for_statement(ctx
, (yyvsp
[(4) - (12)].variable_list
), NULL
, (yyvsp
[(7) - (12)].expr
), (yyvsp
[(10) - (12)].expr
), (yyvsp
[(12) - (12)].statement
)); }
2466 /* Line 1806 of yacc.c */
2467 #line 404 "parser.y"
2468 { (yyval
.statement
) = new_forin_statement(ctx
, NULL
, (yyvsp
[(3) - (7)].expr
), (yyvsp
[(5) - (7)].expr
), (yyvsp
[(7) - (7)].statement
)); }
2473 /* Line 1806 of yacc.c */
2474 #line 406 "parser.y"
2475 { (yyval
.statement
) = new_forin_statement(ctx
, (yyvsp
[(4) - (8)].variable_declaration
), NULL
, (yyvsp
[(6) - (8)].expr
), (yyvsp
[(8) - (8)].statement
)); }
2480 /* Line 1806 of yacc.c */
2481 #line 411 "parser.y"
2482 { (yyval
.statement
) = new_continue_statement(ctx
, (yyvsp
[(2) - (3)].identifier
)); }
2487 /* Line 1806 of yacc.c */
2488 #line 416 "parser.y"
2489 { (yyval
.statement
) = new_break_statement(ctx
, (yyvsp
[(2) - (3)].identifier
)); }
2494 /* Line 1806 of yacc.c */
2495 #line 421 "parser.y"
2496 { (yyval
.statement
) = new_return_statement(ctx
, (yyvsp
[(2) - (3)].expr
)); }
2501 /* Line 1806 of yacc.c */
2502 #line 426 "parser.y"
2503 { (yyval
.statement
) = new_with_statement(ctx
, (yyvsp
[(3) - (5)].expr
), (yyvsp
[(5) - (5)].statement
)); }
2508 /* Line 1806 of yacc.c */
2509 #line 431 "parser.y"
2510 { (yyval
.statement
) = new_labelled_statement(ctx
, (yyvsp
[(1) - (3)].identifier
), (yyvsp
[(3) - (3)].statement
)); }
2515 /* Line 1806 of yacc.c */
2516 #line 436 "parser.y"
2517 { (yyval
.statement
) = new_switch_statement(ctx
, (yyvsp
[(3) - (5)].expr
), (yyvsp
[(5) - (5)].case_clausule
)); }
2522 /* Line 1806 of yacc.c */
2523 #line 441 "parser.y"
2524 { (yyval
.case_clausule
) = new_case_block(ctx
, (yyvsp
[(2) - (3)].case_list
), NULL
, NULL
); }
2529 /* Line 1806 of yacc.c */
2530 #line 443 "parser.y"
2531 { (yyval
.case_clausule
) = new_case_block(ctx
, (yyvsp
[(2) - (5)].case_list
), (yyvsp
[(3) - (5)].case_clausule
), (yyvsp
[(4) - (5)].case_list
)); }
2536 /* Line 1806 of yacc.c */
2537 #line 447 "parser.y"
2538 { (yyval
.case_list
) = NULL
; }
2543 /* Line 1806 of yacc.c */
2544 #line 448 "parser.y"
2545 { (yyval
.case_list
) = (yyvsp
[(1) - (1)].case_list
); }
2550 /* Line 1806 of yacc.c */
2551 #line 452 "parser.y"
2552 { (yyval
.case_list
) = new_case_list(ctx
, (yyvsp
[(1) - (1)].case_clausule
)); }
2557 /* Line 1806 of yacc.c */
2558 #line 454 "parser.y"
2559 { (yyval
.case_list
) = case_list_add(ctx
, (yyvsp
[(1) - (2)].case_list
), (yyvsp
[(2) - (2)].case_clausule
)); }
2564 /* Line 1806 of yacc.c */
2565 #line 459 "parser.y"
2566 { (yyval
.case_clausule
) = new_case_clausule(ctx
, (yyvsp
[(2) - (4)].expr
), (yyvsp
[(4) - (4)].statement_list
)); }
2571 /* Line 1806 of yacc.c */
2572 #line 464 "parser.y"
2573 { (yyval
.case_clausule
) = new_case_clausule(ctx
, NULL
, (yyvsp
[(3) - (3)].statement_list
)); }
2578 /* Line 1806 of yacc.c */
2579 #line 469 "parser.y"
2580 { (yyval
.statement
) = new_throw_statement(ctx
, (yyvsp
[(2) - (3)].expr
)); }
2585 /* Line 1806 of yacc.c */
2586 #line 473 "parser.y"
2587 { (yyval
.statement
) = new_try_statement(ctx
, (yyvsp
[(2) - (3)].statement
), (yyvsp
[(3) - (3)].catch_block
), NULL
); }
2592 /* Line 1806 of yacc.c */
2593 #line 474 "parser.y"
2594 { (yyval
.statement
) = new_try_statement(ctx
, (yyvsp
[(2) - (3)].statement
), NULL
, (yyvsp
[(3) - (3)].statement
)); }
2599 /* Line 1806 of yacc.c */
2600 #line 476 "parser.y"
2601 { (yyval
.statement
) = new_try_statement(ctx
, (yyvsp
[(2) - (4)].statement
), (yyvsp
[(3) - (4)].catch_block
), (yyvsp
[(4) - (4)].statement
)); }
2606 /* Line 1806 of yacc.c */
2607 #line 481 "parser.y"
2608 { (yyval
.catch_block
) = new_catch_block(ctx
, (yyvsp
[(3) - (5)].identifier
), (yyvsp
[(5) - (5)].statement
)); }
2613 /* Line 1806 of yacc.c */
2614 #line 485 "parser.y"
2615 { (yyval
.statement
) = (yyvsp
[(2) - (2)].statement
); }
2620 /* Line 1806 of yacc.c */
2621 #line 489 "parser.y"
2622 { (yyval
.expr
) = NULL
; }
2627 /* Line 1806 of yacc.c */
2628 #line 490 "parser.y"
2629 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); }
2634 /* Line 1806 of yacc.c */
2635 #line 493 "parser.y"
2636 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); }
2641 /* Line 1806 of yacc.c */
2642 #line 494 "parser.y"
2643 { set_error(ctx
, JS_E_SYNTAX
); YYABORT
; }
2648 /* Line 1806 of yacc.c */
2649 #line 498 "parser.y"
2650 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); }
2655 /* Line 1806 of yacc.c */
2656 #line 500 "parser.y"
2657 { (yyval
.expr
) = new_binary_expression(ctx
, EXPR_COMMA
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); }
2662 /* Line 1806 of yacc.c */
2663 #line 504 "parser.y"
2664 { (yyval
.expr
) = NULL
; }
2669 /* Line 1806 of yacc.c */
2670 #line 505 "parser.y"
2671 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); }
2676 /* Line 1806 of yacc.c */
2677 #line 510 "parser.y"
2678 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); }
2683 /* Line 1806 of yacc.c */
2684 #line 512 "parser.y"
2685 { (yyval
.expr
) = new_binary_expression(ctx
, EXPR_COMMA
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); }
2690 /* Line 1806 of yacc.c */
2691 #line 515 "parser.y"
2692 { (yyval
.ival
) = (yyvsp
[(1) - (1)].ival
); }
2697 /* Line 1806 of yacc.c */
2698 #line 516 "parser.y"
2699 { (yyval
.ival
) = EXPR_ASSIGNDIV
; }
2704 /* Line 1806 of yacc.c */
2705 #line 520 "parser.y"
2706 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); }
2711 /* Line 1806 of yacc.c */
2712 #line 522 "parser.y"
2713 { (yyval
.expr
) = new_binary_expression(ctx
, EXPR_ASSIGN
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); }
2718 /* Line 1806 of yacc.c */
2719 #line 524 "parser.y"
2720 { (yyval
.expr
) = new_binary_expression(ctx
, (yyvsp
[(2) - (3)].ival
), (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); }
2725 /* Line 1806 of yacc.c */
2726 #line 529 "parser.y"
2727 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); }
2732 /* Line 1806 of yacc.c */
2733 #line 531 "parser.y"
2734 { (yyval
.expr
) = new_binary_expression(ctx
, EXPR_ASSIGN
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); }
2739 /* Line 1806 of yacc.c */
2740 #line 533 "parser.y"
2741 { (yyval
.expr
) = new_binary_expression(ctx
, (yyvsp
[(2) - (3)].ival
), (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); }
2746 /* Line 1806 of yacc.c */
2747 #line 537 "parser.y"
2748 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); }
2753 /* Line 1806 of yacc.c */
2754 #line 539 "parser.y"
2755 { (yyval
.expr
) = new_conditional_expression(ctx
, (yyvsp
[(1) - (5)].expr
), (yyvsp
[(3) - (5)].expr
), (yyvsp
[(5) - (5)].expr
)); }
2760 /* Line 1806 of yacc.c */
2761 #line 544 "parser.y"
2762 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); }
2767 /* Line 1806 of yacc.c */
2768 #line 546 "parser.y"
2769 { (yyval
.expr
) = new_conditional_expression(ctx
, (yyvsp
[(1) - (5)].expr
), (yyvsp
[(3) - (5)].expr
), (yyvsp
[(5) - (5)].expr
)); }
2774 /* Line 1806 of yacc.c */
2775 #line 550 "parser.y"
2776 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); }
2781 /* Line 1806 of yacc.c */
2782 #line 552 "parser.y"
2783 { (yyval
.expr
) = new_binary_expression(ctx
, EXPR_OR
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); }
2788 /* Line 1806 of yacc.c */
2789 #line 557 "parser.y"
2790 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); }
2795 /* Line 1806 of yacc.c */
2796 #line 559 "parser.y"
2797 { (yyval
.expr
) = new_binary_expression(ctx
, EXPR_OR
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); }
2802 /* Line 1806 of yacc.c */
2803 #line 563 "parser.y"
2804 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); }
2809 /* Line 1806 of yacc.c */
2810 #line 565 "parser.y"
2811 { (yyval
.expr
) = new_binary_expression(ctx
, EXPR_AND
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); }
2816 /* Line 1806 of yacc.c */
2817 #line 570 "parser.y"
2818 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); }
2823 /* Line 1806 of yacc.c */
2824 #line 572 "parser.y"
2825 { (yyval
.expr
) = new_binary_expression(ctx
, EXPR_AND
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); }
2830 /* Line 1806 of yacc.c */
2831 #line 576 "parser.y"
2832 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); }
2837 /* Line 1806 of yacc.c */
2838 #line 578 "parser.y"
2839 { (yyval
.expr
) = new_binary_expression(ctx
, EXPR_BOR
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); }
2844 /* Line 1806 of yacc.c */
2845 #line 583 "parser.y"
2846 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); }
2851 /* Line 1806 of yacc.c */
2852 #line 585 "parser.y"
2853 { (yyval
.expr
) = new_binary_expression(ctx
, EXPR_BOR
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); }
2858 /* Line 1806 of yacc.c */
2859 #line 589 "parser.y"
2860 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); }
2865 /* Line 1806 of yacc.c */
2866 #line 591 "parser.y"
2867 { (yyval
.expr
) = new_binary_expression(ctx
, EXPR_BXOR
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); }
2872 /* Line 1806 of yacc.c */
2873 #line 596 "parser.y"
2874 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); }
2879 /* Line 1806 of yacc.c */
2880 #line 598 "parser.y"
2881 { (yyval
.expr
) = new_binary_expression(ctx
, EXPR_BXOR
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); }
2886 /* Line 1806 of yacc.c */
2887 #line 602 "parser.y"
2888 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); }
2893 /* Line 1806 of yacc.c */
2894 #line 604 "parser.y"
2895 { (yyval
.expr
) = new_binary_expression(ctx
, EXPR_BAND
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); }
2900 /* Line 1806 of yacc.c */
2901 #line 609 "parser.y"
2902 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); }
2907 /* Line 1806 of yacc.c */
2908 #line 611 "parser.y"
2909 { (yyval
.expr
) = new_binary_expression(ctx
, EXPR_BAND
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); }
2914 /* Line 1806 of yacc.c */
2915 #line 615 "parser.y"
2916 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); }
2921 /* Line 1806 of yacc.c */
2922 #line 617 "parser.y"
2923 { (yyval
.expr
) = new_binary_expression(ctx
, (yyvsp
[(2) - (3)].ival
), (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); }
2928 /* Line 1806 of yacc.c */
2929 #line 621 "parser.y"
2930 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); }
2935 /* Line 1806 of yacc.c */
2936 #line 623 "parser.y"
2937 { (yyval
.expr
) = new_binary_expression(ctx
, (yyvsp
[(2) - (3)].ival
), (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); }
2942 /* Line 1806 of yacc.c */
2943 #line 627 "parser.y"
2944 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); }
2949 /* Line 1806 of yacc.c */
2950 #line 629 "parser.y"
2951 { (yyval
.expr
) = new_binary_expression(ctx
, (yyvsp
[(2) - (3)].ival
), (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); }
2956 /* Line 1806 of yacc.c */
2957 #line 631 "parser.y"
2958 { (yyval
.expr
) = new_binary_expression(ctx
, EXPR_INSTANCEOF
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); }
2963 /* Line 1806 of yacc.c */
2964 #line 633 "parser.y"
2965 { (yyval
.expr
) = new_binary_expression(ctx
, EXPR_IN
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); }
2970 /* Line 1806 of yacc.c */
2971 #line 637 "parser.y"
2972 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); }
2977 /* Line 1806 of yacc.c */
2978 #line 639 "parser.y"
2979 { (yyval
.expr
) = new_binary_expression(ctx
, (yyvsp
[(2) - (3)].ival
), (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); }
2984 /* Line 1806 of yacc.c */
2985 #line 641 "parser.y"
2986 { (yyval
.expr
) = new_binary_expression(ctx
, EXPR_INSTANCEOF
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); }
2991 /* Line 1806 of yacc.c */
2992 #line 645 "parser.y"
2993 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); }
2998 /* Line 1806 of yacc.c */
2999 #line 647 "parser.y"
3000 { (yyval
.expr
) = new_binary_expression(ctx
, (yyvsp
[(2) - (3)].ival
), (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); }
3005 /* Line 1806 of yacc.c */
3006 #line 652 "parser.y"
3007 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); }
3012 /* Line 1806 of yacc.c */
3013 #line 654 "parser.y"
3014 { (yyval
.expr
) = new_binary_expression(ctx
, EXPR_ADD
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); }
3019 /* Line 1806 of yacc.c */
3020 #line 656 "parser.y"
3021 { (yyval
.expr
) = new_binary_expression(ctx
, EXPR_SUB
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); }
3026 /* Line 1806 of yacc.c */
3027 #line 660 "parser.y"
3028 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); }
3033 /* Line 1806 of yacc.c */
3034 #line 662 "parser.y"
3035 { (yyval
.expr
) = new_binary_expression(ctx
, EXPR_MUL
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); }
3040 /* Line 1806 of yacc.c */
3041 #line 664 "parser.y"
3042 { (yyval
.expr
) = new_binary_expression(ctx
, EXPR_DIV
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); }
3047 /* Line 1806 of yacc.c */
3048 #line 666 "parser.y"
3049 { (yyval
.expr
) = new_binary_expression(ctx
, EXPR_MOD
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); }
3054 /* Line 1806 of yacc.c */
3055 #line 670 "parser.y"
3056 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); }
3061 /* Line 1806 of yacc.c */
3062 #line 672 "parser.y"
3063 { (yyval
.expr
) = new_unary_expression(ctx
, EXPR_DELETE
, (yyvsp
[(2) - (2)].expr
)); }
3068 /* Line 1806 of yacc.c */
3069 #line 673 "parser.y"
3070 { (yyval
.expr
) = new_unary_expression(ctx
, EXPR_VOID
, (yyvsp
[(2) - (2)].expr
)); }
3075 /* Line 1806 of yacc.c */
3076 #line 675 "parser.y"
3077 { (yyval
.expr
) = new_unary_expression(ctx
, EXPR_TYPEOF
, (yyvsp
[(2) - (2)].expr
)); }
3082 /* Line 1806 of yacc.c */
3083 #line 676 "parser.y"
3084 { (yyval
.expr
) = new_unary_expression(ctx
, EXPR_PREINC
, (yyvsp
[(2) - (2)].expr
)); }
3089 /* Line 1806 of yacc.c */
3090 #line 677 "parser.y"
3091 { (yyval
.expr
) = new_unary_expression(ctx
, EXPR_PREDEC
, (yyvsp
[(2) - (2)].expr
)); }
3096 /* Line 1806 of yacc.c */
3097 #line 678 "parser.y"
3098 { (yyval
.expr
) = new_unary_expression(ctx
, EXPR_PLUS
, (yyvsp
[(2) - (2)].expr
)); }
3103 /* Line 1806 of yacc.c */
3104 #line 679 "parser.y"
3105 { (yyval
.expr
) = new_unary_expression(ctx
, EXPR_MINUS
, (yyvsp
[(2) - (2)].expr
)); }
3110 /* Line 1806 of yacc.c */
3111 #line 680 "parser.y"
3112 { (yyval
.expr
) = new_unary_expression(ctx
, EXPR_BITNEG
, (yyvsp
[(2) - (2)].expr
)); }
3117 /* Line 1806 of yacc.c */
3118 #line 681 "parser.y"
3119 { (yyval
.expr
) = new_unary_expression(ctx
, EXPR_LOGNEG
, (yyvsp
[(2) - (2)].expr
)); }
3124 /* Line 1806 of yacc.c */
3125 #line 686 "parser.y"
3126 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); }
3131 /* Line 1806 of yacc.c */
3132 #line 688 "parser.y"
3133 { (yyval
.expr
) = new_unary_expression(ctx
, EXPR_POSTINC
, (yyvsp
[(1) - (2)].expr
)); }
3138 /* Line 1806 of yacc.c */
3139 #line 690 "parser.y"
3140 { (yyval
.expr
) = new_unary_expression(ctx
, EXPR_POSTDEC
, (yyvsp
[(1) - (2)].expr
)); }
3145 /* Line 1806 of yacc.c */
3146 #line 695 "parser.y"
3147 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); }
3152 /* Line 1806 of yacc.c */
3153 #line 696 "parser.y"
3154 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); }
3159 /* Line 1806 of yacc.c */
3160 #line 700 "parser.y"
3161 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); }
3166 /* Line 1806 of yacc.c */
3167 #line 701 "parser.y"
3168 { (yyval
.expr
) = new_new_expression(ctx
, (yyvsp
[(2) - (2)].expr
), NULL
); }
3173 /* Line 1806 of yacc.c */
3174 #line 705 "parser.y"
3175 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); }
3180 /* Line 1806 of yacc.c */
3181 #line 706 "parser.y"
3182 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); }
3187 /* Line 1806 of yacc.c */
3188 #line 708 "parser.y"
3189 { (yyval
.expr
) = new_binary_expression(ctx
, EXPR_ARRAY
, (yyvsp
[(1) - (4)].expr
), (yyvsp
[(3) - (4)].expr
)); }
3194 /* Line 1806 of yacc.c */
3195 #line 710 "parser.y"
3196 { (yyval
.expr
) = new_member_expression(ctx
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].identifier
)); }
3201 /* Line 1806 of yacc.c */
3202 #line 712 "parser.y"
3203 { (yyval
.expr
) = new_new_expression(ctx
, (yyvsp
[(2) - (3)].expr
), (yyvsp
[(3) - (3)].argument_list
)); }
3208 /* Line 1806 of yacc.c */
3209 #line 717 "parser.y"
3210 { (yyval
.expr
) = new_call_expression(ctx
, (yyvsp
[(1) - (2)].expr
), (yyvsp
[(2) - (2)].argument_list
)); }
3215 /* Line 1806 of yacc.c */
3216 #line 719 "parser.y"
3217 { (yyval
.expr
) = new_call_expression(ctx
, (yyvsp
[(1) - (2)].expr
), (yyvsp
[(2) - (2)].argument_list
)); }
3222 /* Line 1806 of yacc.c */
3223 #line 721 "parser.y"
3224 { (yyval
.expr
) = new_binary_expression(ctx
, EXPR_ARRAY
, (yyvsp
[(1) - (4)].expr
), (yyvsp
[(3) - (4)].expr
)); }
3229 /* Line 1806 of yacc.c */
3230 #line 723 "parser.y"
3231 { (yyval
.expr
) = new_member_expression(ctx
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].identifier
)); }
3236 /* Line 1806 of yacc.c */
3237 #line 727 "parser.y"
3238 { (yyval
.argument_list
) = NULL
; }
3243 /* Line 1806 of yacc.c */
3244 #line 728 "parser.y"
3245 { (yyval
.argument_list
) = (yyvsp
[(2) - (3)].argument_list
); }
3250 /* Line 1806 of yacc.c */
3251 #line 732 "parser.y"
3252 { (yyval
.argument_list
) = new_argument_list(ctx
, (yyvsp
[(1) - (1)].expr
)); }
3257 /* Line 1806 of yacc.c */
3258 #line 734 "parser.y"
3259 { (yyval
.argument_list
) = argument_list_add(ctx
, (yyvsp
[(1) - (3)].argument_list
), (yyvsp
[(3) - (3)].expr
)); }
3264 /* Line 1806 of yacc.c */
3265 #line 738 "parser.y"
3266 { (yyval
.expr
) = new_expression(ctx
, EXPR_THIS
, 0); }
3271 /* Line 1806 of yacc.c */
3272 #line 739 "parser.y"
3273 { (yyval
.expr
) = new_identifier_expression(ctx
, (yyvsp
[(1) - (1)].identifier
)); }
3278 /* Line 1806 of yacc.c */
3279 #line 740 "parser.y"
3280 { (yyval
.expr
) = new_literal_expression(ctx
, (yyvsp
[(1) - (1)].literal
)); }
3285 /* Line 1806 of yacc.c */
3286 #line 741 "parser.y"
3287 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); }
3292 /* Line 1806 of yacc.c */
3293 #line 742 "parser.y"
3294 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); }
3299 /* Line 1806 of yacc.c */
3300 #line 743 "parser.y"
3301 { (yyval
.expr
) = (yyvsp
[(2) - (3)].expr
); }
3306 /* Line 1806 of yacc.c */
3307 #line 747 "parser.y"
3308 { (yyval
.expr
) = new_array_literal_expression(ctx
, NULL
, 0); }
3313 /* Line 1806 of yacc.c */
3314 #line 748 "parser.y"
3315 { (yyval
.expr
) = new_array_literal_expression(ctx
, NULL
, (yyvsp
[(2) - (3)].ival
)+1); }
3320 /* Line 1806 of yacc.c */
3321 #line 749 "parser.y"
3322 { (yyval
.expr
) = new_array_literal_expression(ctx
, (yyvsp
[(2) - (3)].element_list
), 0); }
3327 /* Line 1806 of yacc.c */
3328 #line 751 "parser.y"
3329 { (yyval
.expr
) = new_array_literal_expression(ctx
, (yyvsp
[(2) - (5)].element_list
), (yyvsp
[(4) - (5)].ival
)+1); }
3334 /* Line 1806 of yacc.c */
3335 #line 756 "parser.y"
3336 { (yyval
.element_list
) = new_element_list(ctx
, (yyvsp
[(1) - (2)].ival
), (yyvsp
[(2) - (2)].expr
)); }
3341 /* Line 1806 of yacc.c */
3342 #line 758 "parser.y"
3343 { (yyval
.element_list
) = element_list_add(ctx
, (yyvsp
[(1) - (4)].element_list
), (yyvsp
[(3) - (4)].ival
), (yyvsp
[(4) - (4)].expr
)); }
3348 /* Line 1806 of yacc.c */
3349 #line 762 "parser.y"
3350 { (yyval
.ival
) = 1; }
3355 /* Line 1806 of yacc.c */
3356 #line 763 "parser.y"
3357 { (yyval
.ival
) = (yyvsp
[(1) - (2)].ival
) + 1; }
3362 /* Line 1806 of yacc.c */
3363 #line 767 "parser.y"
3364 { (yyval
.ival
) = 0; }
3369 /* Line 1806 of yacc.c */
3370 #line 768 "parser.y"
3371 { (yyval
.ival
) = (yyvsp
[(1) - (1)].ival
); }
3376 /* Line 1806 of yacc.c */
3377 #line 772 "parser.y"
3378 { (yyval
.expr
) = new_prop_and_value_expression(ctx
, NULL
); }
3383 /* Line 1806 of yacc.c */
3384 #line 774 "parser.y"
3385 { (yyval
.expr
) = new_prop_and_value_expression(ctx
, (yyvsp
[(2) - (3)].property_list
)); }
3390 /* Line 1806 of yacc.c */
3391 #line 779 "parser.y"
3392 { (yyval
.property_list
) = new_property_list(ctx
, (yyvsp
[(1) - (3)].literal
), (yyvsp
[(3) - (3)].expr
)); }
3397 /* Line 1806 of yacc.c */
3398 #line 781 "parser.y"
3399 { (yyval
.property_list
) = property_list_add(ctx
, (yyvsp
[(1) - (5)].property_list
), (yyvsp
[(3) - (5)].literal
), (yyvsp
[(5) - (5)].expr
)); }
3404 /* Line 1806 of yacc.c */
3405 #line 785 "parser.y"
3406 { (yyval
.literal
) = new_string_literal(ctx
, (yyvsp
[(1) - (1)].identifier
)); }
3411 /* Line 1806 of yacc.c */
3412 #line 786 "parser.y"
3413 { (yyval
.literal
) = new_string_literal(ctx
, (yyvsp
[(1) - (1)].wstr
)); }
3418 /* Line 1806 of yacc.c */
3419 #line 787 "parser.y"
3420 { (yyval
.literal
) = (yyvsp
[(1) - (1)].literal
); }
3425 /* Line 1806 of yacc.c */
3426 #line 791 "parser.y"
3427 { (yyval
.identifier
) = NULL
; }
3432 /* Line 1806 of yacc.c */
3433 #line 792 "parser.y"
3434 { (yyval
.identifier
) = (yyvsp
[(1) - (1)].identifier
); }
3439 /* Line 1806 of yacc.c */
3440 #line 796 "parser.y"
3441 { (yyval
.literal
) = new_null_literal(ctx
); }
3446 /* Line 1806 of yacc.c */
3447 #line 797 "parser.y"
3448 { (yyval
.literal
) = (yyvsp
[(1) - (1)].literal
); }
3453 /* Line 1806 of yacc.c */
3454 #line 798 "parser.y"
3455 { (yyval
.literal
) = (yyvsp
[(1) - (1)].literal
); }
3460 /* Line 1806 of yacc.c */
3461 #line 799 "parser.y"
3462 { (yyval
.literal
) = new_string_literal(ctx
, (yyvsp
[(1) - (1)].wstr
)); }
3467 /* Line 1806 of yacc.c */
3468 #line 800 "parser.y"
3469 { (yyval
.literal
) = parse_regexp(ctx
);
3470 if(!(yyval
.literal
)) YYABORT
; }
3475 /* Line 1806 of yacc.c */
3476 #line 802 "parser.y"
3477 { (yyval
.literal
) = parse_regexp(ctx
);
3478 if(!(yyval
.literal
)) YYABORT
; }
3483 /* Line 1806 of yacc.c */
3484 #line 807 "parser.y"
3485 { (yyval
.literal
) = new_boolean_literal(ctx
, VARIANT_TRUE
); }
3490 /* Line 1806 of yacc.c */
3491 #line 808 "parser.y"
3492 { (yyval
.literal
) = new_boolean_literal(ctx
, VARIANT_FALSE
); }
3497 /* Line 1806 of yacc.c */
3498 #line 809 "parser.y"
3499 { (yyval
.literal
) = (yyvsp
[(1) - (1)].literal
); }
3504 /* Line 1806 of yacc.c */
3505 #line 813 "parser.y"
3506 { if(!allow_auto_semicolon(ctx
)) {YYABORT
;} }
3511 /* Line 1806 of yacc.c */
3512 #line 817 "parser.y"
3513 { set_error(ctx
, JS_E_MISSING_LBRACKET
); YYABORT
; }
3518 /* Line 1806 of yacc.c */
3519 #line 821 "parser.y"
3520 { set_error(ctx
, JS_E_MISSING_RBRACKET
); YYABORT
; }
3525 /* Line 1806 of yacc.c */
3526 #line 825 "parser.y"
3527 { set_error(ctx
, JS_E_MISSING_SEMICOLON
); YYABORT
; }
3532 /* Line 1806 of yacc.c */
3533 #line 3540 "parser.tab.c"
3536 /* User semantic actions sometimes alter yychar, and that requires
3537 that yytoken be updated with the new translation. We take the
3538 approach of translating immediately before every use of yytoken.
3539 One alternative is translating here after every semantic action,
3540 but that translation would be missed if the semantic action invokes
3541 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
3542 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
3543 incorrect destructor might then be invoked immediately. In the
3544 case of YYERROR or YYBACKUP, subsequent parser actions might lead
3545 to an incorrect destructor call or verbose syntax error message
3546 before the lookahead is translated. */
3547 YY_SYMBOL_PRINT ("-> $$ =", yyr1
[yyn
], &yyval
, &yyloc
);
3551 YY_STACK_PRINT (yyss
, yyssp
);
3555 /* Now `shift' the result of the reduction. Determine what state
3556 that goes to, based on the state we popped back to and the rule
3557 number reduced by. */
3561 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
3562 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
3563 yystate
= yytable
[yystate
];
3565 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
3570 /*------------------------------------.
3571 | yyerrlab -- here on detecting error |
3572 `------------------------------------*/
3574 /* Make sure we have latest lookahead translation. See comments at
3575 user semantic actions for why this is necessary. */
3576 yytoken
= yychar
== YYEMPTY
? YYEMPTY
: YYTRANSLATE (yychar
);
3578 /* If not already recovering from an error, report this error. */
3582 #if ! YYERROR_VERBOSE
3583 yyerror (ctx
, YY_("syntax error"));
3585 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
3588 char const *yymsgp
= YY_("syntax error");
3589 int yysyntax_error_status
;
3590 yysyntax_error_status
= YYSYNTAX_ERROR
;
3591 if (yysyntax_error_status
== 0)
3593 else if (yysyntax_error_status
== 1)
3595 if (yymsg
!= yymsgbuf
)
3596 YYSTACK_FREE (yymsg
);
3597 yymsg
= (char *) YYSTACK_ALLOC (yymsg_alloc
);
3601 yymsg_alloc
= sizeof yymsgbuf
;
3602 yysyntax_error_status
= 2;
3606 yysyntax_error_status
= YYSYNTAX_ERROR
;
3610 yyerror (ctx
, yymsgp
);
3611 if (yysyntax_error_status
== 2)
3612 goto yyexhaustedlab
;
3614 # undef YYSYNTAX_ERROR
3620 if (yyerrstatus
== 3)
3622 /* If just tried and failed to reuse lookahead token after an
3623 error, discard it. */
3625 if (yychar
<= YYEOF
)
3627 /* Return failure if at end of input. */
3628 if (yychar
== YYEOF
)
3633 yydestruct ("Error: discarding",
3634 yytoken
, &yylval
, ctx
);
3639 /* Else will try to reuse lookahead token after shifting the error
3644 /*---------------------------------------------------.
3645 | yyerrorlab -- error raised explicitly by YYERROR. |
3646 `---------------------------------------------------*/
3649 /* Pacify compilers like GCC when the user code never invokes
3650 YYERROR and the label yyerrorlab therefore never appears in user
3652 if (/*CONSTCOND*/ 0)
3655 /* Do not reclaim the symbols of the rule which action triggered
3659 YY_STACK_PRINT (yyss
, yyssp
);
3664 /*-------------------------------------------------------------.
3665 | yyerrlab1 -- common code for both syntax error and YYERROR. |
3666 `-------------------------------------------------------------*/
3668 yyerrstatus
= 3; /* Each real token shifted decrements this. */
3672 yyn
= yypact
[yystate
];
3673 if (!yypact_value_is_default (yyn
))
3676 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
3684 /* Pop the current state because it cannot handle the error token. */
3689 yydestruct ("Error: popping",
3690 yystos
[yystate
], yyvsp
, ctx
);
3693 YY_STACK_PRINT (yyss
, yyssp
);
3699 /* Shift the error token. */
3700 YY_SYMBOL_PRINT ("Shifting", yystos
[yyn
], yyvsp
, yylsp
);
3706 /*-------------------------------------.
3707 | yyacceptlab -- YYACCEPT comes here. |
3708 `-------------------------------------*/
3713 /*-----------------------------------.
3714 | yyabortlab -- YYABORT comes here. |
3715 `-----------------------------------*/
3720 #if !defined(yyoverflow) || YYERROR_VERBOSE
3721 /*-------------------------------------------------.
3722 | yyexhaustedlab -- memory exhaustion comes here. |
3723 `-------------------------------------------------*/
3725 yyerror (ctx
, YY_("memory exhausted"));
3731 if (yychar
!= YYEMPTY
)
3733 /* Make sure we have latest lookahead translation. See comments at
3734 user semantic actions for why this is necessary. */
3735 yytoken
= YYTRANSLATE (yychar
);
3736 yydestruct ("Cleanup: discarding lookahead",
3737 yytoken
, &yylval
, ctx
);
3739 /* Do not reclaim the symbols of the rule which action triggered
3740 this YYABORT or YYACCEPT. */
3742 YY_STACK_PRINT (yyss
, yyssp
);
3743 while (yyssp
!= yyss
)
3745 yydestruct ("Cleanup: popping",
3746 yystos
[*yyssp
], yyvsp
, ctx
);
3751 YYSTACK_FREE (yyss
);
3754 if (yymsg
!= yymsgbuf
)
3755 YYSTACK_FREE (yymsg
);
3757 /* Make sure YYID is used. */
3758 return YYID (yyresult
);
3763 /* Line 2067 of yacc.c */
3764 #line 827 "parser.y"
3767 static BOOL
allow_auto_semicolon(parser_ctx_t
*ctx
)
3769 return ctx
->nl
|| ctx
->ptr
== ctx
->end
|| *(ctx
->ptr
-1) == '}';
3772 static void *new_statement(parser_ctx_t
*ctx
, statement_type_t type
, size_t size
)
3776 stat
= parser_alloc(ctx
, size
? size
: sizeof(*stat
));
3786 static literal_t
*new_string_literal(parser_ctx_t
*ctx
, const WCHAR
*str
)
3788 literal_t
*ret
= parser_alloc(ctx
, sizeof(literal_t
));
3790 ret
->type
= LT_STRING
;
3796 static literal_t
*new_null_literal(parser_ctx_t
*ctx
)
3798 literal_t
*ret
= parser_alloc(ctx
, sizeof(literal_t
));
3800 ret
->type
= LT_NULL
;
3805 static prop_val_t
*new_prop_val(parser_ctx_t
*ctx
, literal_t
*name
, expression_t
*value
)
3807 prop_val_t
*ret
= parser_alloc(ctx
, sizeof(prop_val_t
));
3816 static property_list_t
*new_property_list(parser_ctx_t
*ctx
, literal_t
*name
, expression_t
*value
)
3818 property_list_t
*ret
= parser_alloc_tmp(ctx
, sizeof(property_list_t
));
3820 ret
->head
= ret
->tail
= new_prop_val(ctx
, name
, value
);
3825 static property_list_t
*property_list_add(parser_ctx_t
*ctx
, property_list_t
*list
, literal_t
*name
, expression_t
*value
)
3827 list
->tail
= list
->tail
->next
= new_prop_val(ctx
, name
, value
);
3832 static array_element_t
*new_array_element(parser_ctx_t
*ctx
, int elision
, expression_t
*expr
)
3834 array_element_t
*ret
= parser_alloc(ctx
, sizeof(array_element_t
));
3836 ret
->elision
= elision
;
3843 static element_list_t
*new_element_list(parser_ctx_t
*ctx
, int elision
, expression_t
*expr
)
3845 element_list_t
*ret
= parser_alloc_tmp(ctx
, sizeof(element_list_t
));
3847 ret
->head
= ret
->tail
= new_array_element(ctx
, elision
, expr
);
3852 static element_list_t
*element_list_add(parser_ctx_t
*ctx
, element_list_t
*list
, int elision
, expression_t
*expr
)
3854 list
->tail
= list
->tail
->next
= new_array_element(ctx
, elision
, expr
);
3859 static argument_t
*new_argument(parser_ctx_t
*ctx
, expression_t
*expr
)
3861 argument_t
*ret
= parser_alloc(ctx
, sizeof(argument_t
));
3869 static argument_list_t
*new_argument_list(parser_ctx_t
*ctx
, expression_t
*expr
)
3871 argument_list_t
*ret
= parser_alloc_tmp(ctx
, sizeof(argument_list_t
));
3873 ret
->head
= ret
->tail
= new_argument(ctx
, expr
);
3878 static argument_list_t
*argument_list_add(parser_ctx_t
*ctx
, argument_list_t
*list
, expression_t
*expr
)
3880 list
->tail
= list
->tail
->next
= new_argument(ctx
, expr
);
3885 static catch_block_t
*new_catch_block(parser_ctx_t
*ctx
, const WCHAR
*identifier
, statement_t
*statement
)
3887 catch_block_t
*ret
= parser_alloc(ctx
, sizeof(catch_block_t
));
3889 ret
->identifier
= identifier
;
3890 ret
->statement
= statement
;
3895 static case_clausule_t
*new_case_clausule(parser_ctx_t
*ctx
, expression_t
*expr
, statement_list_t
*stat_list
)
3897 case_clausule_t
*ret
= parser_alloc(ctx
, sizeof(case_clausule_t
));
3900 ret
->stat
= stat_list
? stat_list
->head
: NULL
;
3906 static case_list_t
*new_case_list(parser_ctx_t
*ctx
, case_clausule_t
*case_clausule
)
3908 case_list_t
*ret
= parser_alloc_tmp(ctx
, sizeof(case_list_t
));
3910 ret
->head
= ret
->tail
= case_clausule
;
3915 static case_list_t
*case_list_add(parser_ctx_t
*ctx
, case_list_t
*list
, case_clausule_t
*case_clausule
)
3917 list
->tail
= list
->tail
->next
= case_clausule
;
3922 static case_clausule_t
*new_case_block(parser_ctx_t
*ctx
, case_list_t
*case_list1
,
3923 case_clausule_t
*default_clausule
, case_list_t
*case_list2
)
3925 case_clausule_t
*ret
= NULL
, *iter
= NULL
, *iter2
;
3926 statement_t
*stat
= NULL
;
3929 ret
= case_list1
->head
;
3930 iter
= case_list1
->tail
;
3933 if(default_clausule
) {
3935 iter
= iter
->next
= default_clausule
;
3937 ret
= iter
= default_clausule
;
3942 iter
->next
= case_list2
->head
;
3944 ret
= case_list2
->head
;
3950 for(iter
= ret
; iter
; iter
= iter
->next
) {
3951 for(iter2
= iter
; iter2
&& !iter2
->stat
; iter2
= iter2
->next
);
3955 while(iter
!= iter2
) {
3956 iter
->stat
= iter2
->stat
;
3963 stat
->next
= iter
->stat
;
3972 static statement_t
*new_block_statement(parser_ctx_t
*ctx
, statement_list_t
*list
)
3974 block_statement_t
*ret
;
3976 ret
= new_statement(ctx
, STAT_BLOCK
, sizeof(*ret
));
3980 ret
->stat_list
= list
? list
->head
: NULL
;
3985 static variable_declaration_t
*new_variable_declaration(parser_ctx_t
*ctx
, const WCHAR
*identifier
, expression_t
*expr
)
3987 variable_declaration_t
*ret
= parser_alloc(ctx
, sizeof(variable_declaration_t
));
3989 ret
->identifier
= identifier
;
3992 ret
->global_next
= NULL
;
3997 static variable_list_t
*new_variable_list(parser_ctx_t
*ctx
, variable_declaration_t
*decl
)
3999 variable_list_t
*ret
= parser_alloc_tmp(ctx
, sizeof(variable_list_t
));
4001 ret
->head
= ret
->tail
= decl
;
4006 static variable_list_t
*variable_list_add(parser_ctx_t
*ctx
, variable_list_t
*list
, variable_declaration_t
*decl
)
4008 list
->tail
= list
->tail
->next
= decl
;
4013 static statement_t
*new_var_statement(parser_ctx_t
*ctx
, variable_list_t
*variable_list
)
4015 var_statement_t
*ret
;
4017 ret
= new_statement(ctx
, STAT_VAR
, sizeof(*ret
));
4021 ret
->variable_list
= variable_list
->head
;
4026 static statement_t
*new_expression_statement(parser_ctx_t
*ctx
, expression_t
*expr
)
4028 expression_statement_t
*ret
;
4030 ret
= new_statement(ctx
, STAT_EXPR
, sizeof(*ret
));
4039 static statement_t
*new_if_statement(parser_ctx_t
*ctx
, expression_t
*expr
, statement_t
*if_stat
, statement_t
*else_stat
)
4041 if_statement_t
*ret
;
4043 ret
= new_statement(ctx
, STAT_IF
, sizeof(*ret
));
4048 ret
->if_stat
= if_stat
;
4049 ret
->else_stat
= else_stat
;
4054 static statement_t
*new_while_statement(parser_ctx_t
*ctx
, BOOL dowhile
, expression_t
*expr
, statement_t
*stat
)
4056 while_statement_t
*ret
;
4058 ret
= new_statement(ctx
, STAT_WHILE
, sizeof(*ret
));
4062 ret
->do_while
= dowhile
;
4064 ret
->statement
= stat
;
4069 static statement_t
*new_for_statement(parser_ctx_t
*ctx
, variable_list_t
*variable_list
, expression_t
*begin_expr
,
4070 expression_t
*expr
, expression_t
*end_expr
, statement_t
*statement
)
4072 for_statement_t
*ret
;
4074 ret
= new_statement(ctx
, STAT_FOR
, sizeof(*ret
));
4078 ret
->variable_list
= variable_list
? variable_list
->head
: NULL
;
4079 ret
->begin_expr
= begin_expr
;
4081 ret
->end_expr
= end_expr
;
4082 ret
->statement
= statement
;
4087 static statement_t
*new_forin_statement(parser_ctx_t
*ctx
, variable_declaration_t
*variable
, expression_t
*expr
,
4088 expression_t
*in_expr
, statement_t
*statement
)
4090 forin_statement_t
*ret
;
4092 ret
= new_statement(ctx
, STAT_FORIN
, sizeof(*ret
));
4096 ret
->variable
= variable
;
4098 ret
->in_expr
= in_expr
;
4099 ret
->statement
= statement
;
4104 static statement_t
*new_continue_statement(parser_ctx_t
*ctx
, const WCHAR
*identifier
)
4106 branch_statement_t
*ret
;
4108 ret
= new_statement(ctx
, STAT_CONTINUE
, sizeof(*ret
));
4112 ret
->identifier
= identifier
;
4117 static statement_t
*new_break_statement(parser_ctx_t
*ctx
, const WCHAR
*identifier
)
4119 branch_statement_t
*ret
;
4121 ret
= new_statement(ctx
, STAT_BREAK
, sizeof(*ret
));
4125 ret
->identifier
= identifier
;
4130 static statement_t
*new_return_statement(parser_ctx_t
*ctx
, expression_t
*expr
)
4132 expression_statement_t
*ret
;
4134 ret
= new_statement(ctx
, STAT_RETURN
, sizeof(*ret
));
4143 static statement_t
*new_with_statement(parser_ctx_t
*ctx
, expression_t
*expr
, statement_t
*statement
)
4145 with_statement_t
*ret
;
4147 ret
= new_statement(ctx
, STAT_WITH
, sizeof(*ret
));
4152 ret
->statement
= statement
;
4157 static statement_t
*new_labelled_statement(parser_ctx_t
*ctx
, const WCHAR
*identifier
, statement_t
*statement
)
4159 labelled_statement_t
*ret
;
4161 ret
= new_statement(ctx
, STAT_LABEL
, sizeof(*ret
));
4165 ret
->identifier
= identifier
;
4166 ret
->statement
= statement
;
4171 static statement_t
*new_switch_statement(parser_ctx_t
*ctx
, expression_t
*expr
, case_clausule_t
*case_list
)
4173 switch_statement_t
*ret
;
4175 ret
= new_statement(ctx
, STAT_SWITCH
, sizeof(*ret
));
4180 ret
->case_list
= case_list
;
4185 static statement_t
*new_throw_statement(parser_ctx_t
*ctx
, expression_t
*expr
)
4187 expression_statement_t
*ret
;
4189 ret
= new_statement(ctx
, STAT_THROW
, sizeof(*ret
));
4198 static statement_t
*new_try_statement(parser_ctx_t
*ctx
, statement_t
*try_statement
,
4199 catch_block_t
*catch_block
, statement_t
*finally_statement
)
4201 try_statement_t
*ret
;
4203 ret
= new_statement(ctx
, STAT_TRY
, sizeof(*ret
));
4207 ret
->try_statement
= try_statement
;
4208 ret
->catch_block
= catch_block
;
4209 ret
->finally_statement
= finally_statement
;
4214 static parameter_t
*new_parameter(parser_ctx_t
*ctx
, const WCHAR
*identifier
)
4216 parameter_t
*ret
= parser_alloc(ctx
, sizeof(parameter_t
));
4218 ret
->identifier
= identifier
;
4224 static parameter_list_t
*new_parameter_list(parser_ctx_t
*ctx
, const WCHAR
*identifier
)
4226 parameter_list_t
*ret
= parser_alloc_tmp(ctx
, sizeof(parameter_list_t
));
4228 ret
->head
= ret
->tail
= new_parameter(ctx
, identifier
);
4233 static parameter_list_t
*parameter_list_add(parser_ctx_t
*ctx
, parameter_list_t
*list
, const WCHAR
*identifier
)
4235 list
->tail
= list
->tail
->next
= new_parameter(ctx
, identifier
);
4240 static expression_t
*new_function_expression(parser_ctx_t
*ctx
, const WCHAR
*identifier
,
4241 parameter_list_t
*parameter_list
, source_elements_t
*source_elements
, const WCHAR
*src_str
, DWORD src_len
)
4243 function_expression_t
*ret
= new_expression(ctx
, EXPR_FUNC
, sizeof(*ret
));
4245 ret
->identifier
= identifier
;
4246 ret
->parameter_list
= parameter_list
? parameter_list
->head
: NULL
;
4247 ret
->source_elements
= source_elements
;
4248 ret
->src_str
= src_str
;
4249 ret
->src_len
= src_len
;
4255 static void *new_expression(parser_ctx_t
*ctx
, expression_type_t type
, size_t size
)
4257 expression_t
*ret
= parser_alloc(ctx
, size
? size
: sizeof(*ret
));
4264 static expression_t
*new_binary_expression(parser_ctx_t
*ctx
, expression_type_t type
,
4265 expression_t
*expression1
, expression_t
*expression2
)
4267 binary_expression_t
*ret
= new_expression(ctx
, type
, sizeof(*ret
));
4269 ret
->expression1
= expression1
;
4270 ret
->expression2
= expression2
;
4275 static expression_t
*new_unary_expression(parser_ctx_t
*ctx
, expression_type_t type
, expression_t
*expression
)
4277 unary_expression_t
*ret
= new_expression(ctx
, type
, sizeof(*ret
));
4279 ret
->expression
= expression
;
4284 static expression_t
*new_conditional_expression(parser_ctx_t
*ctx
, expression_t
*expression
,
4285 expression_t
*true_expression
, expression_t
*false_expression
)
4287 conditional_expression_t
*ret
= new_expression(ctx
, EXPR_COND
, sizeof(*ret
));
4289 ret
->expression
= expression
;
4290 ret
->true_expression
= true_expression
;
4291 ret
->false_expression
= false_expression
;
4296 static expression_t
*new_member_expression(parser_ctx_t
*ctx
, expression_t
*expression
, const WCHAR
*identifier
)
4298 member_expression_t
*ret
= new_expression(ctx
, EXPR_MEMBER
, sizeof(*ret
));
4300 ret
->expression
= expression
;
4301 ret
->identifier
= identifier
;
4306 static expression_t
*new_new_expression(parser_ctx_t
*ctx
, expression_t
*expression
, argument_list_t
*argument_list
)
4308 call_expression_t
*ret
= new_expression(ctx
, EXPR_NEW
, sizeof(*ret
));
4310 ret
->expression
= expression
;
4311 ret
->argument_list
= argument_list
? argument_list
->head
: NULL
;
4316 static expression_t
*new_call_expression(parser_ctx_t
*ctx
, expression_t
*expression
, argument_list_t
*argument_list
)
4318 call_expression_t
*ret
= new_expression(ctx
, EXPR_CALL
, sizeof(*ret
));
4320 ret
->expression
= expression
;
4321 ret
->argument_list
= argument_list
? argument_list
->head
: NULL
;
4326 static int parser_error(parser_ctx_t
*ctx
, const char *str
)
4331 static void set_error(parser_ctx_t
*ctx
, UINT error
)
4336 static BOOL
explicit_error(parser_ctx_t
*ctx
, void *obj
, WCHAR next
)
4338 if(obj
|| *(ctx
->ptr
-1)==next
) return TRUE
;
4340 set_error(ctx
, JS_E_SYNTAX
);
4345 static expression_t
*new_identifier_expression(parser_ctx_t
*ctx
, const WCHAR
*identifier
)
4347 identifier_expression_t
*ret
= new_expression(ctx
, EXPR_IDENT
, sizeof(*ret
));
4349 ret
->identifier
= identifier
;
4354 static expression_t
*new_array_literal_expression(parser_ctx_t
*ctx
, element_list_t
*element_list
, int length
)
4356 array_literal_expression_t
*ret
= new_expression(ctx
, EXPR_ARRAYLIT
, sizeof(*ret
));
4358 ret
->element_list
= element_list
? element_list
->head
: NULL
;
4359 ret
->length
= length
;
4364 static expression_t
*new_prop_and_value_expression(parser_ctx_t
*ctx
, property_list_t
*property_list
)
4366 property_value_expression_t
*ret
= new_expression(ctx
, EXPR_PROPVAL
, sizeof(*ret
));
4368 ret
->property_list
= property_list
? property_list
->head
: NULL
;
4373 static expression_t
*new_literal_expression(parser_ctx_t
*ctx
, literal_t
*literal
)
4375 literal_expression_t
*ret
= new_expression(ctx
, EXPR_LITERAL
, sizeof(*ret
));
4377 ret
->literal
= literal
;
4382 static source_elements_t
*new_source_elements(parser_ctx_t
*ctx
)
4384 source_elements_t
*ret
= parser_alloc(ctx
, sizeof(source_elements_t
));
4386 memset(ret
, 0, sizeof(*ret
));
4391 static source_elements_t
*source_elements_add_statement(source_elements_t
*source_elements
, statement_t
*statement
)
4393 if(source_elements
->statement_tail
)
4394 source_elements
->statement_tail
= source_elements
->statement_tail
->next
= statement
;
4396 source_elements
->statement
= source_elements
->statement_tail
= statement
;
4398 return source_elements
;
4401 static statement_list_t
*new_statement_list(parser_ctx_t
*ctx
, statement_t
*statement
)
4403 statement_list_t
*ret
= parser_alloc_tmp(ctx
, sizeof(statement_list_t
));
4405 ret
->head
= ret
->tail
= statement
;
4410 static statement_list_t
*statement_list_add(statement_list_t
*list
, statement_t
*statement
)
4412 list
->tail
= list
->tail
->next
= statement
;
4417 static void program_parsed(parser_ctx_t
*ctx
, source_elements_t
*source
)
4419 ctx
->source
= source
;
4420 if(!ctx
->lexer_error
)
4424 void parser_release(parser_ctx_t
*ctx
)
4426 script_release(ctx
->script
);
4427 heap_pool_free(&ctx
->heap
);
4431 HRESULT
script_parse(script_ctx_t
*ctx
, const WCHAR
*code
, const WCHAR
*delimiter
, BOOL from_eval
,
4434 parser_ctx_t
*parser_ctx
;
4438 const WCHAR html_tagW
[] = {'<','/','s','c','r','i','p','t','>',0};
4440 parser_ctx
= heap_alloc_zero(sizeof(parser_ctx_t
));
4442 return E_OUTOFMEMORY
;
4444 parser_ctx
->hres
= JS_E_SYNTAX
;
4445 parser_ctx
->is_html
= delimiter
&& !strcmpiW(delimiter
, html_tagW
);
4447 parser_ctx
->begin
= parser_ctx
->ptr
= code
;
4448 parser_ctx
->end
= parser_ctx
->begin
+ strlenW(parser_ctx
->begin
);
4451 parser_ctx
->script
= ctx
;
4453 mark
= heap_pool_mark(&ctx
->tmp_heap
);
4454 heap_pool_init(&parser_ctx
->heap
);
4456 parser_parse(parser_ctx
);
4457 heap_pool_clear(mark
);
4458 hres
= parser_ctx
->hres
;
4460 WARN("parser failed around %s\n",
4461 debugstr_w(parser_ctx
->begin
+20 > parser_ctx
->ptr
? parser_ctx
->begin
: parser_ctx
->ptr
-20));
4462 parser_release(parser_ctx
);