2 /* A Bison parser, made by GNU Bison 2.4.1. */
4 /* Skeleton implementation for Bison's Yacc-like parsers in C
6 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
7 Free Software Foundation, Inc.
9 This program is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
22 /* As a special exception, you may create a larger work that contains
23 part or all of the Bison parser skeleton and distribute that work
24 under terms of your choice, so long as that work isn't itself a
25 parser generator using the skeleton or a modified version thereof
26 as a parser skeleton. Alternatively, if you modify or redistribute
27 the parser skeleton itself, you may (at your option) remove this
28 special exception, which will cause the skeleton and the resulting
29 Bison output files to be licensed under the GNU General Public
30 License without this special exception.
32 This special exception was added by the Free Software Foundation in
33 version 2.2 of Bison. */
35 /* C LALR(1) parser skeleton written by Richard Stallman, by
36 simplifying the original so-called "semantic" parser. */
38 /* All symbols defined below should begin with yy or YY, to avoid
39 infringing on user name space. This should be done even for local
40 variables, as they might otherwise be expanded by user macros.
41 There are some unavoidable exceptions within include files to
42 define necessary library symbols; they are noted "INFRINGES ON
43 USER NAME SPACE" below. */
45 /* Identify Bison output. */
49 #define YYBISON_VERSION "2.4.1"
52 #define YYSKELETON_NAME "yacc.c"
63 /* Using locations. */
64 #define YYLSP_NEEDED 0
66 /* Substitute the variable and function names. */
67 #define yyparse parser_parse
68 #define yylex parser_lex
69 #define yyerror parser_error
70 #define yylval parser_lval
71 #define yychar parser_char
72 #define yydebug parser_debug
73 #define yynerrs parser_nerrs
76 /* Copy the first part of user declarations. */
78 /* Line 189 of yacc.c */
85 #define YYLEX_PARAM ctx
86 #define YYPARSE_PARAM ctx
88 static int parser_error(const char*);
89 static void set_error(parser_ctx_t
*,UINT
);
90 static BOOL
explicit_error(parser_ctx_t
*,void*,WCHAR
);
91 static BOOL
allow_auto_semicolon(parser_ctx_t
*);
92 static void program_parsed(parser_ctx_t
*,source_elements_t
*);
93 static source_elements_t
*function_body_parsed(parser_ctx_t
*,source_elements_t
*);
95 typedef struct _statement_list_t
{
100 static literal_t
*new_string_literal(parser_ctx_t
*,const WCHAR
*);
101 static literal_t
*new_null_literal(parser_ctx_t
*);
102 static literal_t
*new_boolean_literal(parser_ctx_t
*,VARIANT_BOOL
);
104 typedef struct _property_list_t
{
109 static property_list_t
*new_property_list(parser_ctx_t
*,literal_t
*,expression_t
*);
110 static property_list_t
*property_list_add(parser_ctx_t
*,property_list_t
*,literal_t
*,expression_t
*);
112 typedef struct _element_list_t
{
113 array_element_t
*head
;
114 array_element_t
*tail
;
117 static element_list_t
*new_element_list(parser_ctx_t
*,int,expression_t
*);
118 static element_list_t
*element_list_add(parser_ctx_t
*,element_list_t
*,int,expression_t
*);
120 typedef struct _argument_list_t
{
125 static argument_list_t
*new_argument_list(parser_ctx_t
*,expression_t
*);
126 static argument_list_t
*argument_list_add(parser_ctx_t
*,argument_list_t
*,expression_t
*);
128 typedef struct _case_list_t
{
129 case_clausule_t
*head
;
130 case_clausule_t
*tail
;
133 static catch_block_t
*new_catch_block(parser_ctx_t
*,const WCHAR
*,statement_t
*);
134 static case_clausule_t
*new_case_clausule(parser_ctx_t
*,expression_t
*,statement_list_t
*);
135 static case_list_t
*new_case_list(parser_ctx_t
*,case_clausule_t
*);
136 static case_list_t
*case_list_add(parser_ctx_t
*,case_list_t
*,case_clausule_t
*);
137 static case_clausule_t
*new_case_block(parser_ctx_t
*,case_list_t
*,case_clausule_t
*,case_list_t
*);
139 typedef struct _variable_list_t
{
140 variable_declaration_t
*head
;
141 variable_declaration_t
*tail
;
144 static variable_declaration_t
*new_variable_declaration(parser_ctx_t
*,const WCHAR
*,expression_t
*);
145 static variable_list_t
*new_variable_list(parser_ctx_t
*,variable_declaration_t
*);
146 static variable_list_t
*variable_list_add(parser_ctx_t
*,variable_list_t
*,variable_declaration_t
*);
148 static statement_t
*new_block_statement(parser_ctx_t
*,statement_list_t
*);
149 static statement_t
*new_var_statement(parser_ctx_t
*,variable_list_t
*);
150 static statement_t
*new_empty_statement(parser_ctx_t
*);
151 static statement_t
*new_expression_statement(parser_ctx_t
*,expression_t
*);
152 static statement_t
*new_if_statement(parser_ctx_t
*,expression_t
*,statement_t
*,statement_t
*);
153 static statement_t
*new_while_statement(parser_ctx_t
*,BOOL
,expression_t
*,statement_t
*);
154 static statement_t
*new_for_statement(parser_ctx_t
*,variable_list_t
*,expression_t
*,expression_t
*,
155 expression_t
*,statement_t
*);
156 static statement_t
*new_forin_statement(parser_ctx_t
*,variable_declaration_t
*,expression_t
*,expression_t
*,statement_t
*);
157 static statement_t
*new_continue_statement(parser_ctx_t
*,const WCHAR
*);
158 static statement_t
*new_break_statement(parser_ctx_t
*,const WCHAR
*);
159 static statement_t
*new_return_statement(parser_ctx_t
*,expression_t
*);
160 static statement_t
*new_with_statement(parser_ctx_t
*,expression_t
*,statement_t
*);
161 static statement_t
*new_labelled_statement(parser_ctx_t
*,const WCHAR
*,statement_t
*);
162 static statement_t
*new_switch_statement(parser_ctx_t
*,expression_t
*,case_clausule_t
*);
163 static statement_t
*new_throw_statement(parser_ctx_t
*,expression_t
*);
164 static statement_t
*new_try_statement(parser_ctx_t
*,statement_t
*,catch_block_t
*,statement_t
*);
166 struct statement_list_t
{
171 static statement_list_t
*new_statement_list(parser_ctx_t
*,statement_t
*);
172 static statement_list_t
*statement_list_add(statement_list_t
*,statement_t
*);
174 typedef struct _parameter_list_t
{
179 static parameter_list_t
*new_parameter_list(parser_ctx_t
*,const WCHAR
*);
180 static parameter_list_t
*parameter_list_add(parser_ctx_t
*,parameter_list_t
*,const WCHAR
*);
182 static void push_func(parser_ctx_t
*);
183 static inline void pop_func(parser_ctx_t
*ctx
)
185 ctx
->func_stack
= ctx
->func_stack
->next
;
188 static expression_t
*new_function_expression(parser_ctx_t
*,const WCHAR
*,parameter_list_t
*,
189 source_elements_t
*,const WCHAR
*,DWORD
);
190 static expression_t
*new_binary_expression(parser_ctx_t
*,expression_type_t
,expression_t
*,expression_t
*);
191 static expression_t
*new_unary_expression(parser_ctx_t
*,expression_type_t
,expression_t
*);
192 static expression_t
*new_conditional_expression(parser_ctx_t
*,expression_t
*,expression_t
*,expression_t
*);
193 static expression_t
*new_array_expression(parser_ctx_t
*,expression_t
*,expression_t
*);
194 static expression_t
*new_member_expression(parser_ctx_t
*,expression_t
*,const WCHAR
*);
195 static expression_t
*new_new_expression(parser_ctx_t
*,expression_t
*,argument_list_t
*);
196 static expression_t
*new_call_expression(parser_ctx_t
*,expression_t
*,argument_list_t
*);
197 static expression_t
*new_this_expression(parser_ctx_t
*);
198 static expression_t
*new_identifier_expression(parser_ctx_t
*,const WCHAR
*);
199 static expression_t
*new_literal_expression(parser_ctx_t
*,literal_t
*);
200 static expression_t
*new_array_literal_expression(parser_ctx_t
*,element_list_t
*,int);
201 static expression_t
*new_prop_and_value_expression(parser_ctx_t
*,property_list_t
*);
203 static source_elements_t
*new_source_elements(parser_ctx_t
*);
204 static source_elements_t
*source_elements_add_statement(source_elements_t
*,statement_t
*);
208 /* Line 189 of yacc.c */
209 #line 210 "parser.tab.c"
211 /* Enabling traces. */
216 /* Enabling verbose error messages. */
217 #ifdef YYERROR_VERBOSE
218 # undef YYERROR_VERBOSE
219 # define YYERROR_VERBOSE 1
221 # define YYERROR_VERBOSE 0
224 /* Enabling the token table. */
225 #ifndef YYTOKEN_TABLE
226 # define YYTOKEN_TABLE 0
233 /* Put the tokens into the symbol table, so that GDB and other debuggers
275 tNumericLiteral
= 297,
276 tStringLiteral
= 298,
277 LOWER_THAN_ELSE
= 299
283 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
284 typedef union YYSTYPE
287 /* Line 214 of yacc.c */
294 struct _argument_list_t
*argument_list
;
295 case_clausule_t
*case_clausule
;
296 struct _case_list_t
*case_list
;
297 catch_block_t
*catch_block
;
298 struct _element_list_t
*element_list
;
300 const WCHAR
*identifier
;
301 struct _parameter_list_t
*parameter_list
;
302 struct _property_list_t
*property_list
;
303 source_elements_t
*source_elements
;
304 statement_t
*statement
;
305 struct _statement_list_t
*statement_list
;
306 struct _variable_list_t
*variable_list
;
307 variable_declaration_t
*variable_declaration
;
311 /* Line 214 of yacc.c */
312 #line 313 "parser.tab.c"
314 # define YYSTYPE_IS_TRIVIAL 1
315 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
316 # define YYSTYPE_IS_DECLARED 1
320 /* Copy the second part of user declarations. */
323 /* Line 264 of yacc.c */
324 #line 325 "parser.tab.c"
331 typedef YYTYPE_UINT8 yytype_uint8
;
333 typedef unsigned char yytype_uint8
;
337 typedef YYTYPE_INT8 yytype_int8
;
338 #elif (defined __STDC__ || defined __C99__FUNC__ \
339 || defined __cplusplus || defined _MSC_VER)
340 typedef signed char yytype_int8
;
342 typedef short int yytype_int8
;
346 typedef YYTYPE_UINT16 yytype_uint16
;
348 typedef unsigned short int yytype_uint16
;
352 typedef YYTYPE_INT16 yytype_int16
;
354 typedef short int yytype_int16
;
358 # ifdef __SIZE_TYPE__
359 # define YYSIZE_T __SIZE_TYPE__
360 # elif defined size_t
361 # define YYSIZE_T size_t
362 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
363 || defined __cplusplus || defined _MSC_VER)
364 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
365 # define YYSIZE_T size_t
367 # define YYSIZE_T unsigned int
371 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
376 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
377 # define YY_(msgid) dgettext ("bison-runtime", msgid)
381 # define YY_(msgid) msgid
385 /* Suppress unused-variable warnings by "using" E. */
386 #if ! defined lint || defined __GNUC__
387 # define YYUSE(e) ((void) (e))
389 # define YYUSE(e) /* empty */
392 /* Identity function, used to suppress warnings about constant conditions. */
396 #if (defined __STDC__ || defined __C99__FUNC__ \
397 || defined __cplusplus || defined _MSC_VER)
410 #if ! defined yyoverflow || YYERROR_VERBOSE
412 /* The parser invokes alloca or malloc; define the necessary symbols. */
414 # ifdef YYSTACK_USE_ALLOCA
415 # if YYSTACK_USE_ALLOCA
417 # define YYSTACK_ALLOC __builtin_alloca
418 # elif defined __BUILTIN_VA_ARG_INCR
419 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
421 # define YYSTACK_ALLOC __alloca
422 # elif defined _MSC_VER
423 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
424 # define alloca _alloca
426 # define YYSTACK_ALLOC alloca
427 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
428 || defined __cplusplus || defined _MSC_VER)
429 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
438 # ifdef YYSTACK_ALLOC
439 /* Pacify GCC's `empty if-body' warning. */
440 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
441 # ifndef YYSTACK_ALLOC_MAXIMUM
442 /* The OS might guarantee only one guard page at the bottom of the stack,
443 and a page size can be as small as 4096 bytes. So we cannot safely
444 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
445 to allow for a few compiler-allocated temporary stack slots. */
446 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
449 # define YYSTACK_ALLOC YYMALLOC
450 # define YYSTACK_FREE YYFREE
451 # ifndef YYSTACK_ALLOC_MAXIMUM
452 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
454 # if (defined __cplusplus && ! defined _STDLIB_H \
455 && ! ((defined YYMALLOC || defined malloc) \
456 && (defined YYFREE || defined free)))
457 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
463 # define YYMALLOC malloc
464 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
465 || defined __cplusplus || defined _MSC_VER)
466 void *malloc (YYSIZE_T
); /* INFRINGES ON USER NAME SPACE */
471 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
472 || defined __cplusplus || defined _MSC_VER)
473 void free (void *); /* INFRINGES ON USER NAME SPACE */
477 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
480 #if (! defined yyoverflow \
481 && (! defined __cplusplus \
482 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
484 /* A type that is properly aligned for any stack member. */
487 yytype_int16 yyss_alloc
;
491 /* The size of the maximum gap between one aligned stack and the next. */
492 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
494 /* The size of an array large to enough to hold all stacks, each with
496 # define YYSTACK_BYTES(N) \
497 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
498 + YYSTACK_GAP_MAXIMUM)
500 /* Copy COUNT objects from FROM to TO. The source and destination do
503 # if defined __GNUC__ && 1 < __GNUC__
504 # define YYCOPY(To, From, Count) \
505 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
507 # define YYCOPY(To, From, Count) \
511 for (yyi = 0; yyi < (Count); yyi++) \
512 (To)[yyi] = (From)[yyi]; \
518 /* Relocate STACK from its old location to the new one. The
519 local variables YYSIZE and YYSTACKSIZE give the old and new number of
520 elements in the stack, and YYPTR gives the new location of the
521 stack. Advance YYPTR to a properly aligned location for the next
523 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
526 YYSIZE_T yynewbytes; \
527 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
528 Stack = &yyptr->Stack_alloc; \
529 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
530 yyptr += yynewbytes / sizeof (*yyptr); \
536 /* YYFINAL -- State number of the termination state. */
538 /* YYLAST -- Last index in YYTABLE. */
541 /* YYNTOKENS -- Number of terminals. */
543 /* YYNNTS -- Number of nonterminals. */
545 /* YYNRULES -- Number of rules. */
547 /* YYNRULES -- Number of states. */
548 #define YYNSTATES 373
550 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
552 #define YYMAXUTOK 299
554 #define YYTRANSLATE(YYX) \
555 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
557 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
558 static const yytype_uint8 yytranslate
[] =
560 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
561 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
562 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
563 2, 2, 2, 61, 2, 2, 2, 59, 54, 2,
564 65, 66, 57, 55, 47, 56, 64, 58, 2, 2,
565 2, 2, 2, 2, 2, 2, 2, 2, 50, 49,
566 2, 48, 2, 51, 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, 62, 2, 63, 53, 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, 46, 52, 37, 60, 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, 2, 2, 2, 2,
576 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
577 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
578 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
579 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
580 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
581 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
582 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
583 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
584 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
585 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
586 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
587 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
588 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
589 35, 36, 38, 39, 40, 41, 42, 43, 44, 45
593 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
595 static const yytype_uint16 yyprhs
[] =
597 0, 0, 3, 6, 8, 9, 10, 13, 22, 24,
598 26, 28, 32, 33, 35, 37, 39, 41, 43, 45,
599 47, 49, 51, 53, 55, 57, 59, 61, 63, 65,
600 67, 70, 71, 73, 77, 80, 84, 86, 90, 92,
601 96, 99, 102, 103, 105, 108, 109, 111, 114, 116,
602 119, 127, 133, 141, 147, 148, 149, 161, 162, 163,
603 176, 184, 193, 197, 201, 205, 211, 215, 221, 225,
604 231, 232, 234, 236, 239, 244, 248, 252, 256, 260,
605 265, 271, 274, 275, 277, 279, 281, 283, 287, 288,
606 290, 292, 296, 298, 300, 302, 306, 310, 312, 316,
607 320, 322, 328, 330, 336, 338, 342, 344, 348, 350,
608 354, 356, 360, 362, 366, 368, 372, 374, 378, 380,
609 384, 386, 390, 392, 396, 398, 402, 404, 408, 410,
610 414, 418, 422, 424, 428, 432, 434, 438, 440, 444,
611 448, 450, 454, 458, 462, 464, 467, 470, 473, 476,
612 479, 482, 485, 488, 491, 493, 496, 499, 501, 503,
613 505, 508, 510, 512, 517, 521, 525, 528, 531, 536,
614 540, 543, 547, 549, 553, 555, 557, 559, 561, 563,
615 567, 570, 574, 578, 584, 587, 592, 594, 597, 598,
616 600, 603, 607, 611, 617, 619, 621, 623, 624, 626,
617 628, 630, 632, 634, 636, 638, 640, 642, 644, 646,
618 648, 650, 652, 654, 656
621 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
622 static const yytype_int16 yyrhs
[] =
624 68, 0, -1, 70, 69, -1, 34, -1, -1, -1,
625 70, 76, -1, 72, 155, 159, 75, 160, 46, 73,
626 37, -1, 36, -1, 70, -1, 38, -1, 74, 47,
627 38, -1, -1, 74, -1, 79, -1, 80, -1, 89,
628 -1, 71, -1, 90, -1, 91, -1, 92, -1, 97,
629 -1, 98, -1, 99, -1, 100, -1, 101, -1, 102,
630 -1, 108, -1, 109, -1, 76, -1, 77, 76, -1,
631 -1, 77, -1, 46, 77, 37, -1, 46, 37, -1,
632 26, 81, 158, -1, 83, -1, 81, 47, 83, -1,
633 84, -1, 82, 47, 84, -1, 38, 85, -1, 38,
634 87, -1, -1, 86, -1, 48, 118, -1, -1, 88,
635 -1, 48, 119, -1, 49, -1, 114, 158, -1, 11,
636 159, 113, 160, 76, 10, 76, -1, 11, 159, 113,
637 160, 76, -1, 9, 76, 28, 159, 113, 160, 158,
638 -1, 28, 159, 113, 160, 76, -1, -1, -1, 13,
639 159, 115, 93, 161, 112, 94, 161, 112, 160, 76,
640 -1, -1, -1, 13, 159, 26, 82, 95, 161, 112,
641 96, 161, 112, 160, 76, -1, 13, 159, 141, 14,
642 113, 160, 76, -1, 13, 159, 26, 84, 14, 113,
643 160, 76, -1, 6, 155, 158, -1, 3, 155, 158,
644 -1, 18, 112, 158, -1, 29, 159, 114, 160, 76,
645 -1, 38, 50, 76, -1, 19, 159, 114, 160, 103,
646 -1, 46, 104, 37, -1, 46, 104, 107, 104, 37,
647 -1, -1, 105, -1, 106, -1, 105, 106, -1, 4,
648 114, 50, 78, -1, 7, 50, 78, -1, 21, 114,
649 158, -1, 24, 79, 110, -1, 24, 79, 111, -1,
650 24, 79, 110, 111, -1, 5, 159, 38, 160, 79,
651 -1, 12, 79, -1, -1, 114, -1, 114, -1, 1,
652 -1, 118, -1, 114, 47, 118, -1, -1, 116, -1,
653 119, -1, 116, 47, 119, -1, 39, -1, 35, -1,
654 120, -1, 141, 48, 118, -1, 141, 117, 118, -1,
655 121, -1, 141, 48, 119, -1, 141, 117, 119, -1,
656 122, -1, 122, 51, 118, 50, 118, -1, 123, -1,
657 123, 51, 119, 50, 119, -1, 124, -1, 122, 31,
658 124, -1, 125, -1, 123, 31, 125, -1, 126, -1,
659 124, 30, 126, -1, 127, -1, 125, 30, 127, -1,
660 128, -1, 126, 52, 128, -1, 129, -1, 127, 52,
661 129, -1, 130, -1, 128, 53, 130, -1, 131, -1,
662 129, 53, 131, -1, 132, -1, 130, 54, 132, -1,
663 133, -1, 131, 54, 133, -1, 134, -1, 132, 40,
664 134, -1, 135, -1, 133, 40, 135, -1, 136, -1,
665 134, 42, 136, -1, 134, 15, 136, -1, 134, 14,
666 136, -1, 136, -1, 135, 42, 136, -1, 135, 15,
667 136, -1, 137, -1, 136, 41, 137, -1, 138, -1,
668 137, 55, 138, -1, 137, 56, 138, -1, 139, -1,
669 138, 57, 139, -1, 138, 58, 139, -1, 138, 59,
670 139, -1, 140, -1, 8, 139, -1, 27, 139, -1,
671 25, 139, -1, 32, 139, -1, 33, 139, -1, 55,
672 139, -1, 56, 139, -1, 60, 139, -1, 61, 139,
673 -1, 141, -1, 141, 32, -1, 141, 33, -1, 142,
674 -1, 144, -1, 143, -1, 16, 142, -1, 147, -1,
675 71, -1, 143, 62, 114, 63, -1, 143, 64, 38,
676 -1, 16, 143, 145, -1, 143, 145, -1, 144, 145,
677 -1, 144, 62, 114, 63, -1, 144, 64, 38, -1,
678 65, 66, -1, 65, 146, 66, -1, 118, -1, 146,
679 47, 118, -1, 20, -1, 38, -1, 156, -1, 148,
680 -1, 152, -1, 65, 114, 66, -1, 62, 63, -1,
681 62, 150, 63, -1, 62, 149, 63, -1, 62, 149,
682 47, 151, 63, -1, 151, 118, -1, 149, 47, 151,
683 118, -1, 47, -1, 150, 47, -1, -1, 150, -1,
684 46, 37, -1, 46, 153, 37, -1, 154, 50, 118,
685 -1, 153, 47, 154, 50, 118, -1, 38, -1, 44,
686 -1, 43, -1, -1, 38, -1, 17, -1, 157, -1,
687 43, -1, 44, -1, 58, -1, 35, -1, 22, -1,
688 23, -1, 49, -1, 1, -1, 65, -1, 1, -1,
689 66, -1, 1, -1, 49, -1, 1, -1
692 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
693 static const yytype_uint16 yyrline
[] =
695 0, 256, 256, 260, 261, 265, 266, 271, 275, 279,
696 283, 284, 289, 290, 294, 295, 296, 297, 298, 299,
697 300, 301, 302, 303, 304, 305, 306, 307, 308, 312,
698 313, 318, 319, 323, 324, 328, 333, 334, 339, 341,
699 346, 351, 356, 357, 361, 366, 367, 371, 376, 380,
700 385, 387, 392, 394, 397, 399, 396, 403, 405, 402,
701 408, 410, 415, 420, 425, 430, 435, 440, 445, 447,
702 452, 453, 457, 458, 463, 468, 473, 478, 479, 480,
703 485, 490, 494, 495, 498, 499, 503, 504, 509, 510,
704 514, 516, 520, 521, 525, 526, 528, 533, 535, 537,
705 542, 543, 548, 550, 555, 556, 561, 563, 568, 569,
706 574, 576, 581, 582, 587, 589, 594, 595, 600, 602,
707 607, 608, 613, 615, 620, 621, 626, 627, 632, 633,
708 635, 637, 642, 643, 645, 650, 651, 656, 658, 660,
709 665, 666, 668, 670, 675, 676, 678, 679, 681, 682,
710 683, 684, 685, 686, 690, 692, 694, 700, 701, 705,
711 706, 710, 711, 712, 714, 716, 721, 723, 725, 727,
712 732, 733, 737, 738, 743, 744, 745, 746, 747, 748,
713 752, 753, 754, 755, 760, 762, 767, 768, 772, 773,
714 777, 778, 783, 785, 790, 791, 792, 796, 797, 801,
715 802, 803, 804, 805, 807, 812, 813, 816, 817, 820,
716 821, 824, 825, 828, 829
720 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
721 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
722 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
723 static const char *const yytname
[] =
725 "$end", "error", "$undefined", "kBREAK", "kCASE", "kCATCH", "kCONTINUE",
726 "kDEFAULT", "kDELETE", "kDO", "kELSE", "kIF", "kFINALLY", "kFOR", "kIN",
727 "kINSTANCEOF", "kNEW", "kNULL", "kRETURN", "kSWITCH", "kTHIS", "kTHROW",
728 "kTRUE", "kFALSE", "kTRY", "kTYPEOF", "kVAR", "kVOID", "kWHILE", "kWITH",
729 "tANDAND", "tOROR", "tINC", "tDEC", "tHTMLCOMMENT", "kDIVEQ",
730 "kFUNCTION", "'}'", "tIdentifier", "tAssignOper", "tEqOper",
731 "tShiftOper", "tRelOper", "tNumericLiteral", "tStringLiteral",
732 "LOWER_THAN_ELSE", "'{'", "','", "'='", "';'", "':'", "'?'", "'|'",
733 "'^'", "'&'", "'+'", "'-'", "'*'", "'/'", "'%'", "'~'", "'!'", "'['",
734 "']'", "'.'", "'('", "')'", "$accept", "Program", "HtmlComment",
735 "SourceElements", "FunctionExpression", "KFunction", "FunctionBody",
736 "FormalParameterList", "FormalParameterList_opt", "Statement",
737 "StatementList", "StatementList_opt", "Block", "VariableStatement",
738 "VariableDeclarationList", "VariableDeclarationListNoIn",
739 "VariableDeclaration", "VariableDeclarationNoIn", "Initialiser_opt",
740 "Initialiser", "InitialiserNoIn_opt", "InitialiserNoIn",
741 "EmptyStatement", "ExpressionStatement", "IfStatement",
742 "IterationStatement", "$@1", "$@2", "$@3", "$@4", "ContinueStatement",
743 "BreakStatement", "ReturnStatement", "WithStatement",
744 "LabelledStatement", "SwitchStatement", "CaseBlock", "CaseClausules_opt",
745 "CaseClausules", "CaseClausule", "DefaultClausule", "ThrowStatement",
746 "TryStatement", "Catch", "Finally", "Expression_opt", "Expression_err",
747 "Expression", "ExpressionNoIn_opt", "ExpressionNoIn", "AssignOper",
748 "AssignmentExpression", "AssignmentExpressionNoIn",
749 "ConditionalExpression", "ConditionalExpressionNoIn",
750 "LogicalORExpression", "LogicalORExpressionNoIn", "LogicalANDExpression",
751 "LogicalANDExpressionNoIn", "BitwiseORExpression",
752 "BitwiseORExpressionNoIn", "BitwiseXORExpression",
753 "BitwiseXORExpressionNoIn", "BitwiseANDExpression",
754 "BitwiseANDExpressionNoIn", "EqualityExpression",
755 "EqualityExpressionNoIn", "RelationalExpression",
756 "RelationalExpressionNoIn", "ShiftExpression", "AdditiveExpression",
757 "MultiplicativeExpression", "UnaryExpression", "PostfixExpression",
758 "LeftHandSideExpression", "NewExpression", "MemberExpression",
759 "CallExpression", "Arguments", "ArgumentList", "PrimaryExpression",
760 "ArrayLiteral", "ElementList", "Elision", "Elision_opt", "ObjectLiteral",
761 "PropertyNameAndValueList", "PropertyName", "Identifier_opt", "Literal",
762 "BooleanLiteral", "semicolon_opt", "left_bracket", "right_bracket",
768 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
770 static const yytype_uint16 yytoknum
[] =
772 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
773 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
774 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
775 285, 286, 287, 288, 289, 290, 291, 125, 292, 293,
776 294, 295, 296, 297, 298, 299, 123, 44, 61, 59,
777 58, 63, 124, 94, 38, 43, 45, 42, 47, 37,
778 126, 33, 91, 93, 46, 40, 41
782 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
783 static const yytype_uint8 yyr1
[] =
785 0, 67, 68, 69, 69, 70, 70, 71, 72, 73,
786 74, 74, 75, 75, 76, 76, 76, 76, 76, 76,
787 76, 76, 76, 76, 76, 76, 76, 76, 76, 77,
788 77, 78, 78, 79, 79, 80, 81, 81, 82, 82,
789 83, 84, 85, 85, 86, 87, 87, 88, 89, 90,
790 91, 91, 92, 92, 93, 94, 92, 95, 96, 92,
791 92, 92, 97, 98, 99, 100, 101, 102, 103, 103,
792 104, 104, 105, 105, 106, 107, 108, 109, 109, 109,
793 110, 111, 112, 112, 113, 113, 114, 114, 115, 115,
794 116, 116, 117, 117, 118, 118, 118, 119, 119, 119,
795 120, 120, 121, 121, 122, 122, 123, 123, 124, 124,
796 125, 125, 126, 126, 127, 127, 128, 128, 129, 129,
797 130, 130, 131, 131, 132, 132, 133, 133, 134, 134,
798 134, 134, 135, 135, 135, 136, 136, 137, 137, 137,
799 138, 138, 138, 138, 139, 139, 139, 139, 139, 139,
800 139, 139, 139, 139, 140, 140, 140, 141, 141, 142,
801 142, 143, 143, 143, 143, 143, 144, 144, 144, 144,
802 145, 145, 146, 146, 147, 147, 147, 147, 147, 147,
803 148, 148, 148, 148, 149, 149, 150, 150, 151, 151,
804 152, 152, 153, 153, 154, 154, 154, 155, 155, 156,
805 156, 156, 156, 156, 156, 157, 157, 158, 158, 159,
806 159, 160, 160, 161, 161
809 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
810 static const yytype_uint8 yyr2
[] =
812 0, 2, 2, 1, 0, 0, 2, 8, 1, 1,
813 1, 3, 0, 1, 1, 1, 1, 1, 1, 1,
814 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
815 2, 0, 1, 3, 2, 3, 1, 3, 1, 3,
816 2, 2, 0, 1, 2, 0, 1, 2, 1, 2,
817 7, 5, 7, 5, 0, 0, 11, 0, 0, 12,
818 7, 8, 3, 3, 3, 5, 3, 5, 3, 5,
819 0, 1, 1, 2, 4, 3, 3, 3, 3, 4,
820 5, 2, 0, 1, 1, 1, 1, 3, 0, 1,
821 1, 3, 1, 1, 1, 3, 3, 1, 3, 3,
822 1, 5, 1, 5, 1, 3, 1, 3, 1, 3,
823 1, 3, 1, 3, 1, 3, 1, 3, 1, 3,
824 1, 3, 1, 3, 1, 3, 1, 3, 1, 3,
825 3, 3, 1, 3, 3, 1, 3, 1, 3, 3,
826 1, 3, 3, 3, 1, 2, 2, 2, 2, 2,
827 2, 2, 2, 2, 1, 2, 2, 1, 1, 1,
828 2, 1, 1, 4, 3, 3, 2, 2, 4, 3,
829 2, 3, 1, 3, 1, 1, 1, 1, 1, 3,
830 2, 3, 3, 5, 2, 4, 1, 2, 0, 1,
831 2, 3, 3, 5, 1, 1, 1, 0, 1, 1,
832 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
836 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
837 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
838 means the default is an error. */
839 static const yytype_uint8 yydefact
[] =
841 5, 0, 4, 1, 197, 197, 0, 0, 0, 0,
842 0, 199, 82, 0, 174, 0, 205, 206, 0, 0,
843 0, 0, 0, 0, 0, 0, 3, 204, 8, 175,
844 201, 202, 0, 48, 0, 0, 203, 0, 0, 188,
845 0, 2, 17, 197, 6, 14, 15, 16, 18, 19,
846 20, 21, 22, 23, 24, 25, 26, 27, 28, 0,
847 86, 94, 100, 104, 108, 112, 116, 120, 124, 128,
848 135, 137, 140, 144, 154, 157, 159, 158, 161, 177,
849 178, 176, 200, 198, 0, 0, 175, 0, 162, 145,
850 154, 0, 210, 209, 0, 88, 160, 159, 0, 83,
851 0, 0, 0, 0, 147, 42, 0, 36, 146, 0,
852 0, 148, 149, 0, 34, 175, 201, 202, 29, 0,
853 0, 0, 150, 151, 152, 153, 186, 180, 0, 189,
854 0, 0, 0, 208, 0, 207, 49, 0, 0, 0,
855 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
856 0, 0, 0, 155, 156, 93, 92, 0, 0, 0,
857 0, 0, 166, 0, 0, 167, 63, 62, 190, 194,
858 196, 195, 0, 85, 0, 84, 0, 54, 89, 90,
859 97, 102, 106, 110, 114, 118, 122, 126, 132, 154,
860 165, 64, 0, 76, 34, 0, 0, 77, 78, 0,
861 40, 43, 0, 35, 0, 0, 66, 33, 30, 191,
862 0, 0, 188, 182, 187, 181, 184, 179, 12, 87,
863 105, 0, 109, 113, 117, 121, 125, 131, 130, 129,
864 136, 138, 139, 141, 142, 143, 95, 96, 0, 164,
865 170, 172, 0, 0, 169, 0, 212, 211, 0, 45,
866 57, 38, 0, 0, 0, 0, 0, 0, 0, 0,
867 0, 0, 0, 0, 0, 0, 0, 0, 81, 79,
868 44, 37, 0, 0, 0, 192, 189, 0, 10, 13,
869 0, 0, 163, 0, 171, 168, 0, 51, 0, 41,
870 46, 0, 0, 0, 214, 213, 82, 91, 154, 107,
871 0, 111, 115, 119, 123, 127, 134, 133, 0, 98,
872 99, 70, 67, 0, 53, 65, 0, 183, 185, 0,
873 0, 101, 173, 0, 0, 47, 39, 82, 0, 55,
874 0, 0, 0, 0, 71, 72, 0, 193, 11, 5,
875 52, 50, 58, 0, 0, 103, 60, 0, 0, 68,
876 70, 73, 80, 9, 0, 0, 61, 82, 31, 31,
877 0, 7, 82, 0, 32, 74, 75, 69, 0, 0,
881 /* YYDEFGOTO[NTERM-NUM]. */
882 static const yytype_int16 yydefgoto
[] =
884 -1, 1, 41, 2, 88, 43, 354, 279, 280, 118,
885 119, 365, 45, 46, 106, 250, 107, 251, 200, 201,
886 289, 290, 47, 48, 49, 50, 252, 344, 292, 355,
887 51, 52, 53, 54, 55, 56, 312, 333, 334, 335,
888 350, 57, 58, 197, 198, 98, 174, 59, 177, 178,
889 265, 60, 179, 61, 180, 62, 181, 63, 182, 64,
890 183, 65, 184, 66, 185, 67, 186, 68, 187, 69,
891 70, 71, 72, 73, 74, 75, 76, 77, 162, 242,
892 78, 79, 128, 129, 130, 80, 120, 121, 84, 81,
893 82, 136, 94, 248, 296
896 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
898 #define YYPACT_NINF -287
899 static const yytype_int16 yypact
[] =
901 -287, 29, 490, -287, -18, -18, 934, 730, 21, 21,
902 965, -287, 934, 21, -287, 934, -287, -287, 36, 934,
903 89, 934, 21, 21, 934, 934, -287, -287, -287, 105,
904 -287, -287, 550, -287, 934, 934, -287, 934, 934, 61,
905 934, -287, 403, -18, -287, -287, -287, -287, -287, -287,
906 -287, -287, -287, -287, -287, -287, -287, -287, -287, 15,
907 -287, -287, 41, 106, 117, 129, 142, 158, 76, 162,
908 131, 47, -287, -287, 141, -287, 113, 148, -287, -287,
909 -287, -287, -287, -287, 5, 5, -287, 147, -287, -287,
910 169, 177, -287, -287, 370, 832, -287, 113, 5, 164,
911 934, 15, 610, 123, -287, 159, 16, -287, -287, 370,
912 934, -287, -287, 730, 438, 105, 175, 176, -287, 670,
913 86, 178, -287, -287, -287, -287, -287, -287, 62, 63,
914 934, 28, 21, -287, 934, -287, -287, 934, 934, 934,
915 934, 934, 934, 934, 934, 934, 934, 934, 934, 934,
916 934, 934, 934, -287, -287, -287, -287, 934, 934, 934,
917 181, 781, -287, 934, 189, -287, -287, -287, -287, -287,
918 -287, -287, 21, -287, 8, 164, 191, -287, 183, -287,
919 -287, 56, 201, 180, 182, 179, 194, 53, 162, 10,
920 -287, -287, 12, -287, -287, 21, 36, 225, -287, 934,
921 -287, -287, 89, -287, 8, 12, -287, -287, -287, -287,
922 94, 934, 193, -287, -287, -287, -287, -287, 200, -287,
923 106, 192, 117, 129, 142, 158, 76, 162, 162, 162,
924 131, 47, 47, -287, -287, -287, -287, -287, 68, -287,
925 -287, -287, 46, 109, -287, 370, -287, -287, 730, 195,
926 197, 227, 18, 934, 934, 934, 934, 934, 934, 934,
927 934, 934, 934, 370, 934, 934, 199, 209, -287, -287,
928 -287, -287, 730, 730, 202, -287, 204, 883, -287, 206,
929 8, 934, -287, 934, -287, -287, 8, 239, 934, -287,
930 -287, 191, 18, 370, -287, -287, 934, -287, 160, 201,
931 218, 180, 182, 179, 194, 53, 162, 162, 8, -287,
932 -287, 250, -287, 8, -287, -287, 934, -287, -287, 231,
933 228, -287, -287, 5, 730, -287, -287, 934, 8, -287,
934 934, 730, 934, 66, 250, -287, 36, -287, -287, -287,
935 -287, -287, -287, 730, 18, -287, -287, -32, 226, -287,
936 250, -287, -287, 730, 238, 18, -287, 934, 730, 730,
937 240, -287, 934, 8, 730, -287, -287, -287, 8, 730,
941 /* YYPGOTO[NTERM-NUM]. */
942 static const yytype_int16 yypgoto
[] =
944 -287, -287, -287, -61, -2, -287, -287, -287, -287, 0,
945 -141, -80, -15, -287, -287, -287, 78, -10, -287, -287,
946 -287, -287, -287, -287, -287, -287, -287, -287, -287, -287,
947 -287, -287, -287, -287, -287, -287, -287, -68, -287, -50,
948 -287, -287, -287, -287, 88, -286, -105, 20, -287, -287,
949 212, -77, -209, -287, -287, -287, -287, 150, 34, 152,
950 33, 153, 35, 154, 38, 156, 40, 151, 42, -94,
951 157, 75, 64, -287, 2, 290, 291, -287, 19, -287,
952 -287, -287, -287, 93, 95, -287, -287, 96, 26, -287,
953 -287, -73, 25, 17, -278
956 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
957 positive, shift that token. If negative, reduce the rule which
958 number is the opposite. If zero, do what YYDEFACT says.
959 If YYTABLE_NINF, syntax error. */
960 #define YYTABLE_NINF -197
961 static const yytype_int16 yytable
[] =
963 42, 188, 44, 103, 204, 42, 133, 91, 90, 246,
964 329, 166, 167, 246, 327, 134, 133, 133, 358, 294,
965 83, 90, 92, 90, 263, 191, 90, 90, 193, 3,
966 42, 85, 99, 203, 95, 101, 90, 90, 100, 90,
967 90, 342, 153, 154, 297, 155, 300, 109, 110, 156,
968 227, 228, 229, 216, 135, 309, 310, 219, 264, 134,
969 131, 221, 134, 202, 135, 135, 357, 295, 261, 132,
970 89, 363, 137, 348, 247, 134, 368, 362, 247, 325,
971 236, 237, 102, 104, 241, 108, 93, 254, 111, 112,
972 144, 145, 138, 283, 217, 262, 165, 189, 122, 123,
973 42, 124, 125, 349, 150, 151, 152, 255, 126, 212,
974 214, 42, 284, 206, 175, 134, 190, 42, 146, 208,
975 192, 345, 270, 209, 127, 213, 215, 105, 195, 175,
976 205, 282, 169, 210, 275, 196, 139, 170, 171, 90,
977 286, 90, 90, 90, 90, 90, 90, 90, 90, 90,
978 90, 90, 90, 90, 90, 113, 134, 218, 308, 188,
979 188, 188, 188, 188, 188, 188, 188, 306, 307, 140,
980 188, 188, 285, 153, 154, 159, 155, 160, 161, 238,
981 156, 268, 141, 243, 168, 169, 148, 149, 328, 157,
982 170, 171, 153, 154, 188, 155, 142, 245, 143, 156,
983 318, 153, 154, 147, 321, 172, 322, 199, 264, 266,
984 163, 134, 164, 161, 233, 234, 235, 364, 364, 239,
985 267, 272, 273, 231, 232, -196, -195, 244, 211, 249,
986 253, 256, 257, 259, 260, 258, 188, 196, 278, 337,
987 126, 293, 281, 288, 291, 311, 42, 313, 287, 324,
988 340, 214, 316, 319, 332, 298, 90, 298, 90, 90,
989 90, 90, 90, 90, 90, 175, 298, 298, 330, 338,
990 42, 42, 314, 315, 339, 361, 359, 367, 353, 366,
991 271, 326, 360, 175, 351, 269, 158, 220, 299, 301,
992 298, 222, 302, 223, 226, 224, 303, 320, 225, 304,
993 96, 97, 305, 323, 230, 276, 274, 277, 0, 0,
994 0, 0, 0, 175, 0, 0, 99, 0, 0, 0,
995 0, 352, 42, 0, 341, 331, 0, 0, 0, 42,
996 336, 346, 298, 0, 0, 0, 0, 0, 0, 0,
997 0, 42, 0, 356, 0, 343, 0, 99, 0, 0,
998 0, 42, 347, 44, 0, 0, 42, 42, 0, 0,
999 0, 0, 42, 0, 208, 0, 0, 42, 42, 371,
1000 372, 173, 0, 0, 0, 0, 0, 99, 6, 0,
1001 369, 0, 99, 0, 0, 370, 10, 11, 0, 0,
1002 14, 0, 16, 17, 0, 19, 0, 21, 0, 0,
1003 0, 0, 24, 25, -162, 27, 28, 0, 86, 0,
1004 0, 0, 0, 30, 31, 0, 87, -162, -162, 0,
1005 0, 0, 0, 0, 0, 34, 35, 0, 36, 0,
1006 37, 38, 39, -162, -162, 40, 0, 0, 0, -190,
1007 0, 0, -162, -162, -162, -162, 0, 0, 0, 0,
1008 -162, -162, -190, -190, -162, -162, -162, -162, 0, 0,
1009 -162, 0, -162, 0, 0, 0, 0, -162, -190, -190,
1010 0, 0, 0, 0, 0, 0, 0, -190, -190, -190,
1011 -190, 0, 0, 0, 0, -190, -190, 0, 0, -190,
1012 -190, -190, -190, 4, 0, -190, 5, -190, 6, 7,
1013 0, 8, -190, 9, 0, 0, 10, 11, 12, 13,
1014 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
1015 0, 0, 24, 25, 26, 27, 28, 0, 29, 0,
1016 0, 0, 0, 30, 31, 0, 32, 0, 0, 33,
1017 0, 0, 0, 0, 0, 34, 35, 0, 36, 0,
1018 37, 38, 39, 4, 0, 40, 5, 0, 6, 7,
1019 0, 8, 0, 9, 0, 0, 10, 11, 12, 13,
1020 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
1021 0, 0, 24, 25, 0, 27, 28, 114, 115, 0,
1022 0, 0, 0, 116, 117, 0, 32, 0, 0, 33,
1023 0, 0, 0, 0, 0, 34, 35, 0, 36, 0,
1024 37, 38, 39, 4, 0, 40, 5, 0, 6, 7,
1025 0, 8, 0, 9, 0, 0, 10, 11, 12, 13,
1026 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
1027 0, 0, 24, 25, 0, 27, 28, 194, 29, 0,
1028 0, 0, 0, 30, 31, 0, 32, 0, 0, 33,
1029 0, 0, 0, 0, 0, 34, 35, 0, 36, 0,
1030 37, 38, 39, 4, 0, 40, 5, 0, 6, 7,
1031 0, 8, 0, 9, 0, 0, 10, 11, 12, 13,
1032 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
1033 0, 0, 24, 25, 0, 27, 28, 207, 29, 0,
1034 0, 0, 0, 30, 31, 0, 32, 0, 0, 33,
1035 0, 0, 0, 0, 0, 34, 35, 0, 36, 0,
1036 37, 38, 39, 4, 0, 40, 5, 0, 6, 7,
1037 0, 8, 0, 9, 0, 0, 10, 11, 12, 13,
1038 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
1039 0, 0, 24, 25, 0, 27, 28, 0, 29, 0,
1040 0, 0, 0, 30, 31, 0, 32, 0, 0, 33,
1041 0, 0, 0, 0, 0, 34, 35, 0, 36, 6,
1042 37, 38, 39, 0, 0, 40, 0, 10, 11, 0,
1043 0, 14, 0, 16, 17, 0, 19, 0, 21, 0,
1044 0, 0, 0, 24, 25, 0, 27, 28, 0, 86,
1045 0, 0, 0, 0, 30, 31, 0, 87, 0, 0,
1046 0, 0, 0, 0, 0, 0, 34, 35, 0, 36,
1047 6, 37, 38, 39, 0, 0, 40, 240, 10, 11,
1048 0, 0, 14, 0, 16, 17, 0, 19, 176, 21,
1049 0, 0, 0, 0, 24, 25, 0, 27, 28, 0,
1050 86, 0, 0, 0, 0, 30, 31, 0, 87, 0,
1051 0, 0, 0, 0, 0, 0, 0, 34, 35, 0,
1052 36, 6, 37, 38, 39, 0, 0, 40, 0, 10,
1053 11, 0, 0, 14, 0, 16, 17, 0, 19, 0,
1054 21, 0, 0, 0, 0, 24, 25, 0, 27, 28,
1055 0, 86, 0, 0, 0, 0, 30, 31, 0, 87,
1056 0, 0, 0, 0, 0, 0, 0, 0, 34, 35,
1057 0, 36, 6, 37, 38, 39, 317, 0, 40, 0,
1058 10, 11, 0, 0, 14, 0, 16, 17, 0, 19,
1059 0, 21, 0, 0, 0, 0, 24, 25, 0, 27,
1060 28, 0, 86, 0, 0, 0, 0, 30, 31, 0,
1061 87, 10, 11, 0, 0, 14, 0, 16, 17, 34,
1062 35, 0, 36, 0, 37, 38, 39, 0, 0, 40,
1063 27, 28, 0, 86, 0, 0, 0, 0, 30, 31,
1064 0, 87, 0, 0, 0, 0, 0, 0, 0, 0,
1065 0, 0, 0, 36, 0, 0, 0, 39, 0, 0,
1069 static const yytype_int16 yycheck
[] =
1071 2, 95, 2, 18, 109, 7, 1, 7, 6, 1,
1072 296, 84, 85, 1, 292, 47, 1, 1, 50, 1,
1073 38, 19, 1, 21, 14, 98, 24, 25, 101, 0,
1074 32, 5, 12, 106, 9, 15, 34, 35, 13, 37,
1075 38, 327, 32, 33, 253, 35, 255, 22, 23, 39,
1076 144, 145, 146, 130, 49, 264, 265, 134, 48, 47,
1077 40, 138, 47, 47, 49, 49, 344, 49, 15, 43,
1078 6, 357, 31, 7, 66, 47, 362, 355, 66, 288,
1079 157, 158, 46, 19, 161, 21, 65, 31, 24, 25,
1080 14, 15, 51, 47, 66, 42, 77, 95, 34, 35,
1081 102, 37, 38, 37, 57, 58, 59, 51, 47, 47,
1082 47, 113, 66, 113, 94, 47, 97, 119, 42, 119,
1083 100, 330, 199, 37, 63, 63, 63, 38, 5, 109,
1084 110, 63, 38, 47, 211, 12, 30, 43, 44, 137,
1085 245, 139, 140, 141, 142, 143, 144, 145, 146, 147,
1086 148, 149, 150, 151, 152, 50, 47, 132, 263, 253,
1087 254, 255, 256, 257, 258, 259, 260, 261, 262, 52,
1088 264, 265, 63, 32, 33, 62, 35, 64, 65, 159,
1089 39, 196, 53, 163, 37, 38, 55, 56, 293, 48,
1090 43, 44, 32, 33, 288, 35, 54, 172, 40, 39,
1091 277, 32, 33, 41, 281, 28, 283, 48, 48, 192,
1092 62, 47, 64, 65, 150, 151, 152, 358, 359, 38,
1093 195, 204, 205, 148, 149, 50, 50, 38, 50, 38,
1094 47, 30, 52, 54, 40, 53, 330, 12, 38, 316,
1095 47, 14, 50, 48, 47, 46, 248, 38, 248, 10,
1096 323, 47, 50, 47, 4, 253, 254, 255, 256, 257,
1097 258, 259, 260, 261, 262, 245, 264, 265, 50, 38,
1098 272, 273, 272, 273, 46, 37, 50, 37, 339, 359,
1099 202, 291, 350, 263, 334, 197, 74, 137, 254, 256,
1100 288, 139, 257, 140, 143, 141, 258, 280, 142, 259,
1101 10, 10, 260, 286, 147, 212, 210, 212, -1, -1,
1102 -1, -1, -1, 293, -1, -1, 296, -1, -1, -1,
1103 -1, 336, 324, -1, 324, 308, -1, -1, -1, 331,
1104 313, 331, 330, -1, -1, -1, -1, -1, -1, -1,
1105 -1, 343, -1, 343, -1, 328, -1, 327, -1, -1,
1106 -1, 353, 332, 353, -1, -1, 358, 359, -1, -1,
1107 -1, -1, 364, -1, 364, -1, -1, 369, 370, 369,
1108 370, 1, -1, -1, -1, -1, -1, 357, 8, -1,
1109 363, -1, 362, -1, -1, 368, 16, 17, -1, -1,
1110 20, -1, 22, 23, -1, 25, -1, 27, -1, -1,
1111 -1, -1, 32, 33, 1, 35, 36, -1, 38, -1,
1112 -1, -1, -1, 43, 44, -1, 46, 14, 15, -1,
1113 -1, -1, -1, -1, -1, 55, 56, -1, 58, -1,
1114 60, 61, 62, 30, 31, 65, -1, -1, -1, 1,
1115 -1, -1, 39, 40, 41, 42, -1, -1, -1, -1,
1116 47, 48, 14, 15, 51, 52, 53, 54, -1, -1,
1117 57, -1, 59, -1, -1, -1, -1, 64, 30, 31,
1118 -1, -1, -1, -1, -1, -1, -1, 39, 40, 41,
1119 42, -1, -1, -1, -1, 47, 48, -1, -1, 51,
1120 52, 53, 54, 3, -1, 57, 6, 59, 8, 9,
1121 -1, 11, 64, 13, -1, -1, 16, 17, 18, 19,
1122 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
1123 -1, -1, 32, 33, 34, 35, 36, -1, 38, -1,
1124 -1, -1, -1, 43, 44, -1, 46, -1, -1, 49,
1125 -1, -1, -1, -1, -1, 55, 56, -1, 58, -1,
1126 60, 61, 62, 3, -1, 65, 6, -1, 8, 9,
1127 -1, 11, -1, 13, -1, -1, 16, 17, 18, 19,
1128 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
1129 -1, -1, 32, 33, -1, 35, 36, 37, 38, -1,
1130 -1, -1, -1, 43, 44, -1, 46, -1, -1, 49,
1131 -1, -1, -1, -1, -1, 55, 56, -1, 58, -1,
1132 60, 61, 62, 3, -1, 65, 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, -1, 46, -1, -1, 49,
1137 -1, -1, -1, -1, -1, 55, 56, -1, 58, -1,
1138 60, 61, 62, 3, -1, 65, 6, -1, 8, 9,
1139 -1, 11, -1, 13, -1, -1, 16, 17, 18, 19,
1140 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
1141 -1, -1, 32, 33, -1, 35, 36, 37, 38, -1,
1142 -1, -1, -1, 43, 44, -1, 46, -1, -1, 49,
1143 -1, -1, -1, -1, -1, 55, 56, -1, 58, -1,
1144 60, 61, 62, 3, -1, 65, 6, -1, 8, 9,
1145 -1, 11, -1, 13, -1, -1, 16, 17, 18, 19,
1146 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
1147 -1, -1, 32, 33, -1, 35, 36, -1, 38, -1,
1148 -1, -1, -1, 43, 44, -1, 46, -1, -1, 49,
1149 -1, -1, -1, -1, -1, 55, 56, -1, 58, 8,
1150 60, 61, 62, -1, -1, 65, -1, 16, 17, -1,
1151 -1, 20, -1, 22, 23, -1, 25, -1, 27, -1,
1152 -1, -1, -1, 32, 33, -1, 35, 36, -1, 38,
1153 -1, -1, -1, -1, 43, 44, -1, 46, -1, -1,
1154 -1, -1, -1, -1, -1, -1, 55, 56, -1, 58,
1155 8, 60, 61, 62, -1, -1, 65, 66, 16, 17,
1156 -1, -1, 20, -1, 22, 23, -1, 25, 26, 27,
1157 -1, -1, -1, -1, 32, 33, -1, 35, 36, -1,
1158 38, -1, -1, -1, -1, 43, 44, -1, 46, -1,
1159 -1, -1, -1, -1, -1, -1, -1, 55, 56, -1,
1160 58, 8, 60, 61, 62, -1, -1, 65, -1, 16,
1161 17, -1, -1, 20, -1, 22, 23, -1, 25, -1,
1162 27, -1, -1, -1, -1, 32, 33, -1, 35, 36,
1163 -1, 38, -1, -1, -1, -1, 43, 44, -1, 46,
1164 -1, -1, -1, -1, -1, -1, -1, -1, 55, 56,
1165 -1, 58, 8, 60, 61, 62, 63, -1, 65, -1,
1166 16, 17, -1, -1, 20, -1, 22, 23, -1, 25,
1167 -1, 27, -1, -1, -1, -1, 32, 33, -1, 35,
1168 36, -1, 38, -1, -1, -1, -1, 43, 44, -1,
1169 46, 16, 17, -1, -1, 20, -1, 22, 23, 55,
1170 56, -1, 58, -1, 60, 61, 62, -1, -1, 65,
1171 35, 36, -1, 38, -1, -1, -1, -1, 43, 44,
1172 -1, 46, -1, -1, -1, -1, -1, -1, -1, -1,
1173 -1, -1, -1, 58, -1, -1, -1, 62, -1, -1,
1177 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1178 symbol of state STATE-NUM. */
1179 static const yytype_uint8 yystos
[] =
1181 0, 68, 70, 0, 3, 6, 8, 9, 11, 13,
1182 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
1183 26, 27, 28, 29, 32, 33, 34, 35, 36, 38,
1184 43, 44, 46, 49, 55, 56, 58, 60, 61, 62,
1185 65, 69, 71, 72, 76, 79, 80, 89, 90, 91,
1186 92, 97, 98, 99, 100, 101, 102, 108, 109, 114,
1187 118, 120, 122, 124, 126, 128, 130, 132, 134, 136,
1188 137, 138, 139, 140, 141, 142, 143, 144, 147, 148,
1189 152, 156, 157, 38, 155, 155, 38, 46, 71, 139,
1190 141, 76, 1, 65, 159, 159, 142, 143, 112, 114,
1191 159, 114, 46, 79, 139, 38, 81, 83, 139, 159,
1192 159, 139, 139, 50, 37, 38, 43, 44, 76, 77,
1193 153, 154, 139, 139, 139, 139, 47, 63, 149, 150,
1194 151, 114, 155, 1, 47, 49, 158, 31, 51, 30,
1195 52, 53, 54, 40, 14, 15, 42, 41, 55, 56,
1196 57, 58, 59, 32, 33, 35, 39, 48, 117, 62,
1197 64, 65, 145, 62, 64, 145, 158, 158, 37, 38,
1198 43, 44, 28, 1, 113, 114, 26, 115, 116, 119,
1199 121, 123, 125, 127, 129, 131, 133, 135, 136, 141,
1200 145, 158, 114, 158, 37, 5, 12, 110, 111, 48,
1201 85, 86, 47, 158, 113, 114, 76, 37, 76, 37,
1202 47, 50, 47, 63, 47, 63, 118, 66, 159, 118,
1203 124, 118, 126, 128, 130, 132, 134, 136, 136, 136,
1204 137, 138, 138, 139, 139, 139, 118, 118, 114, 38,
1205 66, 118, 146, 114, 38, 159, 1, 66, 160, 38,
1206 82, 84, 93, 47, 31, 51, 30, 52, 53, 54,
1207 40, 15, 42, 14, 48, 117, 160, 159, 79, 111,
1208 118, 83, 160, 160, 154, 118, 150, 151, 38, 74,
1209 75, 50, 63, 47, 66, 63, 113, 76, 48, 87,
1210 88, 47, 95, 14, 1, 49, 161, 119, 141, 125,
1211 119, 127, 129, 131, 133, 135, 136, 136, 113, 119,
1212 119, 46, 103, 38, 76, 76, 50, 63, 118, 47,
1213 160, 118, 118, 160, 10, 119, 84, 161, 113, 112,
1214 50, 160, 4, 104, 105, 106, 160, 118, 38, 46,
1215 158, 76, 112, 160, 94, 119, 76, 114, 7, 37,
1216 107, 106, 79, 70, 73, 96, 76, 161, 50, 50,
1217 104, 37, 161, 112, 77, 78, 78, 37, 112, 160,
1221 #define yyerrok (yyerrstatus = 0)
1222 #define yyclearin (yychar = YYEMPTY)
1223 #define YYEMPTY (-2)
1226 #define YYACCEPT goto yyacceptlab
1227 #define YYABORT goto yyabortlab
1228 #define YYERROR goto yyerrorlab
1231 /* Like YYERROR except do call yyerror. This remains here temporarily
1232 to ease the transition to the new meaning of YYERROR, for GCC.
1233 Once GCC version 2 has supplanted version 1, this can go. */
1235 #define YYFAIL goto yyerrlab
1237 #define YYRECOVERING() (!!yyerrstatus)
1239 #define YYBACKUP(Token, Value) \
1241 if (yychar == YYEMPTY && yylen == 1) \
1245 yytoken = YYTRANSLATE (yychar); \
1251 yyerror (YY_("syntax error: cannot back up")); \
1258 #define YYERRCODE 256
1261 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
1262 If N is 0, then set CURRENT to the empty location which ends
1263 the previous symbol: RHS[0] (always defined). */
1265 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
1266 #ifndef YYLLOC_DEFAULT
1267 # define YYLLOC_DEFAULT(Current, Rhs, N) \
1271 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
1272 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
1273 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
1274 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
1278 (Current).first_line = (Current).last_line = \
1279 YYRHSLOC (Rhs, 0).last_line; \
1280 (Current).first_column = (Current).last_column = \
1281 YYRHSLOC (Rhs, 0).last_column; \
1287 /* YY_LOCATION_PRINT -- Print the location on the stream.
1288 This macro was not mandated originally: define only if we know
1289 we won't break user code: when these are the locations we know. */
1291 #ifndef YY_LOCATION_PRINT
1292 # if YYLTYPE_IS_TRIVIAL
1293 # define YY_LOCATION_PRINT(File, Loc) \
1294 fprintf (File, "%d.%d-%d.%d", \
1295 (Loc).first_line, (Loc).first_column, \
1296 (Loc).last_line, (Loc).last_column)
1298 # 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)
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, \
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
)
1348 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
)
1351 YYSTYPE
const * const yyvaluep
;
1357 if (yytype
< YYNTOKENS
)
1358 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
1370 /*--------------------------------.
1371 | Print this symbol on YYOUTPUT. |
1372 `--------------------------------*/
1374 #if (defined __STDC__ || defined __C99__FUNC__ \
1375 || defined __cplusplus || defined _MSC_VER)
1377 yy_symbol_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
)
1380 yy_symbol_print (yyoutput
, yytype
, yyvaluep
)
1383 YYSTYPE
const * const yyvaluep
;
1386 if (yytype
< YYNTOKENS
)
1387 YYFPRINTF (yyoutput
, "token %s (", yytname
[yytype
]);
1389 YYFPRINTF (yyoutput
, "nterm %s (", yytname
[yytype
]);
1391 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
);
1392 YYFPRINTF (yyoutput
, ")");
1395 /*------------------------------------------------------------------.
1396 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1398 `------------------------------------------------------------------*/
1400 #if (defined __STDC__ || defined __C99__FUNC__ \
1401 || defined __cplusplus || defined _MSC_VER)
1403 yy_stack_print (yytype_int16
*yybottom
, yytype_int16
*yytop
)
1406 yy_stack_print (yybottom
, yytop
)
1407 yytype_int16
*yybottom
;
1408 yytype_int16
*yytop
;
1411 YYFPRINTF (stderr
, "Stack now");
1412 for (; yybottom
<= yytop
; yybottom
++)
1414 int yybot
= *yybottom
;
1415 YYFPRINTF (stderr
, " %d", yybot
);
1417 YYFPRINTF (stderr
, "\n");
1420 # define YY_STACK_PRINT(Bottom, Top) \
1423 yy_stack_print ((Bottom), (Top)); \
1427 /*------------------------------------------------.
1428 | Report that the YYRULE is going to be reduced. |
1429 `------------------------------------------------*/
1431 #if (defined __STDC__ || defined __C99__FUNC__ \
1432 || defined __cplusplus || defined _MSC_VER)
1434 yy_reduce_print (YYSTYPE
*yyvsp
, int yyrule
)
1437 yy_reduce_print (yyvsp
, yyrule
)
1442 int yynrhs
= yyr2
[yyrule
];
1444 unsigned long int yylno
= yyrline
[yyrule
];
1445 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %lu):\n",
1447 /* The symbols being reduced. */
1448 for (yyi
= 0; yyi
< yynrhs
; yyi
++)
1450 YYFPRINTF (stderr
, " $%d = ", yyi
+ 1);
1451 yy_symbol_print (stderr
, yyrhs
[yyprhs
[yyrule
] + yyi
],
1452 &(yyvsp
[(yyi
+ 1) - (yynrhs
)])
1454 YYFPRINTF (stderr
, "\n");
1458 # define YY_REDUCE_PRINT(Rule) \
1461 yy_reduce_print (yyvsp, Rule); \
1464 /* Nonzero means print parse trace. It is left uninitialized so that
1465 multiple parsers can coexist. */
1467 #else /* !YYDEBUG */
1468 # define YYDPRINTF(Args)
1469 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1470 # define YY_STACK_PRINT(Bottom, Top)
1471 # define YY_REDUCE_PRINT(Rule)
1472 #endif /* !YYDEBUG */
1475 /* YYINITDEPTH -- initial size of the parser's stacks. */
1477 # define YYINITDEPTH 200
1480 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1481 if the built-in stack extension method is used).
1483 Do not make this value too large; the results are undefined if
1484 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1485 evaluated with infinite-precision integer arithmetic. */
1488 # define YYMAXDEPTH 10000
1496 # if defined __GLIBC__ && defined _STRING_H
1497 # define yystrlen strlen
1499 /* Return the length of YYSTR. */
1500 #if (defined __STDC__ || defined __C99__FUNC__ \
1501 || defined __cplusplus || defined _MSC_VER)
1503 yystrlen (const char *yystr
)
1511 for (yylen
= 0; yystr
[yylen
]; yylen
++)
1519 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1520 # define yystpcpy stpcpy
1522 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1524 #if (defined __STDC__ || defined __C99__FUNC__ \
1525 || defined __cplusplus || defined _MSC_VER)
1527 yystpcpy (char *yydest
, const char *yysrc
)
1530 yystpcpy (yydest
, yysrc
)
1536 const char *yys
= yysrc
;
1538 while ((*yyd
++ = *yys
++) != '\0')
1547 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1548 quotes and backslashes, so that it's suitable for yyerror. The
1549 heuristic is that double-quoting is unnecessary unless the string
1550 contains an apostrophe, a comma, or backslash (other than
1551 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1552 null, do not copy; instead, return the length of what the result
1555 yytnamerr (char *yyres
, const char *yystr
)
1560 char const *yyp
= yystr
;
1567 goto do_not_strip_quotes
;
1571 goto do_not_strip_quotes
;
1584 do_not_strip_quotes
: ;
1588 return yystrlen (yystr
);
1590 return yystpcpy (yyres
, yystr
) - yyres
;
1594 /* Copy into YYRESULT an error message about the unexpected token
1595 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1596 including the terminating null byte. If YYRESULT is null, do not
1597 copy anything; just return the number of bytes that would be
1598 copied. As a special case, return 0 if an ordinary "syntax error"
1599 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1600 size calculation. */
1602 yysyntax_error (char *yyresult
, int yystate
, int yychar
)
1604 int yyn
= yypact
[yystate
];
1606 if (! (YYPACT_NINF
< yyn
&& yyn
<= YYLAST
))
1610 int yytype
= YYTRANSLATE (yychar
);
1611 YYSIZE_T yysize0
= yytnamerr (0, yytname
[yytype
]);
1612 YYSIZE_T yysize
= yysize0
;
1614 int yysize_overflow
= 0;
1615 enum { YYERROR_VERBOSE_ARGS_MAXIMUM
= 5 };
1616 char const *yyarg
[YYERROR_VERBOSE_ARGS_MAXIMUM
];
1620 /* This is so xgettext sees the translatable formats that are
1621 constructed on the fly. */
1622 YY_("syntax error, unexpected %s");
1623 YY_("syntax error, unexpected %s, expecting %s");
1624 YY_("syntax error, unexpected %s, expecting %s or %s");
1625 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1626 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1630 static char const yyunexpected
[] = "syntax error, unexpected %s";
1631 static char const yyexpecting
[] = ", expecting %s";
1632 static char const yyor
[] = " or %s";
1633 char yyformat
[sizeof yyunexpected
1634 + sizeof yyexpecting
- 1
1635 + ((YYERROR_VERBOSE_ARGS_MAXIMUM
- 2)
1636 * (sizeof yyor
- 1))];
1637 char const *yyprefix
= yyexpecting
;
1639 /* Start YYX at -YYN if negative to avoid negative indexes in
1641 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
1643 /* Stay within bounds of both yycheck and yytname. */
1644 int yychecklim
= YYLAST
- yyn
+ 1;
1645 int yyxend
= yychecklim
< YYNTOKENS
? yychecklim
: YYNTOKENS
;
1648 yyarg
[0] = yytname
[yytype
];
1649 yyfmt
= yystpcpy (yyformat
, yyunexpected
);
1651 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
1652 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1654 if (yycount
== YYERROR_VERBOSE_ARGS_MAXIMUM
)
1658 yyformat
[sizeof yyunexpected
- 1] = '\0';
1661 yyarg
[yycount
++] = yytname
[yyx
];
1662 yysize1
= yysize
+ yytnamerr (0, yytname
[yyx
]);
1663 yysize_overflow
|= (yysize1
< yysize
);
1665 yyfmt
= yystpcpy (yyfmt
, yyprefix
);
1669 yyf
= YY_(yyformat
);
1670 yysize1
= yysize
+ yystrlen (yyf
);
1671 yysize_overflow
|= (yysize1
< yysize
);
1674 if (yysize_overflow
)
1675 return YYSIZE_MAXIMUM
;
1679 /* Avoid sprintf, as that infringes on the user's name space.
1680 Don't have undefined behavior even if the translation
1681 produced a string with the wrong number of "%s"s. */
1682 char *yyp
= yyresult
;
1684 while ((*yyp
= *yyf
) != '\0')
1686 if (*yyp
== '%' && yyf
[1] == 's' && yyi
< yycount
)
1688 yyp
+= yytnamerr (yyp
, yyarg
[yyi
++]);
1701 #endif /* YYERROR_VERBOSE */
1704 /*-----------------------------------------------.
1705 | Release the memory associated to this symbol. |
1706 `-----------------------------------------------*/
1709 #if (defined __STDC__ || defined __C99__FUNC__ \
1710 || defined __cplusplus || defined _MSC_VER)
1712 yydestruct (const char *yymsg
, int yytype
, YYSTYPE
*yyvaluep
)
1715 yydestruct (yymsg
, yytype
, yyvaluep
)
1725 YY_SYMBOL_PRINT (yymsg
, yytype
, yyvaluep
, yylocationp
);
1735 /* Prevent warnings from -Wmissing-prototypes. */
1736 #ifdef YYPARSE_PARAM
1737 #if defined __STDC__ || defined __cplusplus
1738 int yyparse (void *YYPARSE_PARAM
);
1742 #else /* ! YYPARSE_PARAM */
1743 #if defined __STDC__ || defined __cplusplus
1748 #endif /* ! YYPARSE_PARAM */
1754 /*-------------------------.
1755 | yyparse or yypush_parse. |
1756 `-------------------------*/
1758 #ifdef YYPARSE_PARAM
1759 #if (defined __STDC__ || defined __C99__FUNC__ \
1760 || defined __cplusplus || defined _MSC_VER)
1762 yyparse (void *YYPARSE_PARAM
)
1765 yyparse (YYPARSE_PARAM
)
1766 void *YYPARSE_PARAM
;
1768 #else /* ! YYPARSE_PARAM */
1769 #if (defined __STDC__ || defined __C99__FUNC__ \
1770 || defined __cplusplus || defined _MSC_VER)
1780 /* The lookahead symbol. */
1783 /* The semantic value of the lookahead symbol. */
1786 /* Number of syntax errors so far. */
1790 /* Number of tokens to shift before error messages enabled. */
1793 /* The stacks and their tools:
1794 `yyss': related to states.
1795 `yyvs': related to semantic values.
1797 Refer to the stacks thru separate pointers, to allow yyoverflow
1798 to reallocate them elsewhere. */
1800 /* The state stack. */
1801 yytype_int16 yyssa
[YYINITDEPTH
];
1803 yytype_int16
*yyssp
;
1805 /* The semantic value stack. */
1806 YYSTYPE yyvsa
[YYINITDEPTH
];
1810 YYSIZE_T yystacksize
;
1814 /* Lookahead token as an internal (translated) token number. */
1816 /* The variables used to return semantic value and location from the
1821 /* Buffer for error messages, and its allocated size. */
1823 char *yymsg
= yymsgbuf
;
1824 YYSIZE_T yymsg_alloc
= sizeof yymsgbuf
;
1827 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1829 /* The number of symbols on the RHS of the reduced rule.
1830 Keep to zero when no symbol should be popped. */
1836 yystacksize
= YYINITDEPTH
;
1838 YYDPRINTF ((stderr
, "Starting parse\n"));
1843 yychar
= YYEMPTY
; /* Cause a token to be read. */
1845 /* Initialize stack pointers.
1846 Waste one element of value and location stack
1847 so that they stay on the same level as the state stack.
1848 The wasted elements are never initialized. */
1854 /*------------------------------------------------------------.
1855 | yynewstate -- Push a new state, which is found in yystate. |
1856 `------------------------------------------------------------*/
1858 /* In all cases, when you get here, the value and location stacks
1859 have just been pushed. So pushing a state here evens the stacks. */
1865 if (yyss
+ yystacksize
- 1 <= yyssp
)
1867 /* Get the current used size of the three stacks, in elements. */
1868 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1872 /* Give user a chance to reallocate the stack. Use copies of
1873 these so that the &'s don't force the real ones into
1875 YYSTYPE
*yyvs1
= yyvs
;
1876 yytype_int16
*yyss1
= yyss
;
1878 /* Each stack pointer address is followed by the size of the
1879 data in use in that stack, in bytes. This used to be a
1880 conditional around just the two extra args, but that might
1881 be undefined if yyoverflow is a macro. */
1882 yyoverflow (YY_("memory exhausted"),
1883 &yyss1
, yysize
* sizeof (*yyssp
),
1884 &yyvs1
, yysize
* sizeof (*yyvsp
),
1890 #else /* no yyoverflow */
1891 # ifndef YYSTACK_RELOCATE
1892 goto yyexhaustedlab
;
1894 /* Extend the stack our own way. */
1895 if (YYMAXDEPTH
<= yystacksize
)
1896 goto yyexhaustedlab
;
1898 if (YYMAXDEPTH
< yystacksize
)
1899 yystacksize
= YYMAXDEPTH
;
1902 yytype_int16
*yyss1
= yyss
;
1903 union yyalloc
*yyptr
=
1904 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1906 goto yyexhaustedlab
;
1907 YYSTACK_RELOCATE (yyss_alloc
, yyss
);
1908 YYSTACK_RELOCATE (yyvs_alloc
, yyvs
);
1909 # undef YYSTACK_RELOCATE
1911 YYSTACK_FREE (yyss1
);
1914 #endif /* no yyoverflow */
1916 yyssp
= yyss
+ yysize
- 1;
1917 yyvsp
= yyvs
+ yysize
- 1;
1919 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1920 (unsigned long int) yystacksize
));
1922 if (yyss
+ yystacksize
- 1 <= yyssp
)
1926 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1928 if (yystate
== YYFINAL
)
1938 /* Do appropriate processing given the current state. Read a
1939 lookahead token if we need one and don't already have one. */
1941 /* First try to decide what to do without reference to lookahead token. */
1942 yyn
= yypact
[yystate
];
1943 if (yyn
== YYPACT_NINF
)
1946 /* Not known => get a lookahead token if don't already have one. */
1948 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1949 if (yychar
== YYEMPTY
)
1951 YYDPRINTF ((stderr
, "Reading a token: "));
1955 if (yychar
<= YYEOF
)
1957 yychar
= yytoken
= YYEOF
;
1958 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1962 yytoken
= YYTRANSLATE (yychar
);
1963 YY_SYMBOL_PRINT ("Next token is", yytoken
, &yylval
, &yylloc
);
1966 /* If the proper action on seeing token YYTOKEN is to reduce or to
1967 detect an error, take that action. */
1969 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1974 if (yyn
== 0 || yyn
== YYTABLE_NINF
)
1980 /* Count tokens shifted since error; after three, turn off error
1985 /* Shift the lookahead token. */
1986 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
1988 /* Discard the shifted token. */
1997 /*-----------------------------------------------------------.
1998 | yydefault -- do the default action for the current state. |
1999 `-----------------------------------------------------------*/
2001 yyn
= yydefact
[yystate
];
2007 /*-----------------------------.
2008 | yyreduce -- Do a reduction. |
2009 `-----------------------------*/
2011 /* yyn is the number of a rule to reduce with. */
2014 /* If YYLEN is nonzero, implement the default value of the action:
2017 Otherwise, the following line sets YYVAL to garbage.
2018 This behavior is undocumented and Bison
2019 users should not rely upon it. Assigning to YYVAL
2020 unconditionally makes the parser a bit smaller, and it avoids a
2021 GCC warning that YYVAL may be used uninitialized. */
2022 yyval
= yyvsp
[1-yylen
];
2025 YY_REDUCE_PRINT (yyn
);
2030 /* Line 1455 of yacc.c */
2031 #line 257 "parser.y"
2032 { program_parsed(ctx
, (yyvsp
[(1) - (2)].source_elements
)); ;}
2037 /* Line 1455 of yacc.c */
2038 #line 260 "parser.y"
2044 /* Line 1455 of yacc.c */
2045 #line 261 "parser.y"
2051 /* Line 1455 of yacc.c */
2052 #line 265 "parser.y"
2053 { (yyval
.source_elements
) = new_source_elements(ctx
); ;}
2058 /* Line 1455 of yacc.c */
2059 #line 267 "parser.y"
2060 { (yyval
.source_elements
) = source_elements_add_statement((yyvsp
[(1) - (2)].source_elements
), (yyvsp
[(2) - (2)].statement
)); ;}
2065 /* Line 1455 of yacc.c */
2066 #line 272 "parser.y"
2067 { (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); ;}
2072 /* Line 1455 of yacc.c */
2073 #line 275 "parser.y"
2074 { push_func(ctx
); (yyval
.srcptr
) = (yyvsp
[(1) - (1)].srcptr
); ;}
2079 /* Line 1455 of yacc.c */
2080 #line 279 "parser.y"
2081 { (yyval
.source_elements
) = function_body_parsed(ctx
, (yyvsp
[(1) - (1)].source_elements
)); ;}
2086 /* Line 1455 of yacc.c */
2087 #line 283 "parser.y"
2088 { (yyval
.parameter_list
) = new_parameter_list(ctx
, (yyvsp
[(1) - (1)].identifier
)); ;}
2093 /* Line 1455 of yacc.c */
2094 #line 285 "parser.y"
2095 { (yyval
.parameter_list
) = parameter_list_add(ctx
, (yyvsp
[(1) - (3)].parameter_list
), (yyvsp
[(3) - (3)].identifier
)); ;}
2100 /* Line 1455 of yacc.c */
2101 #line 289 "parser.y"
2102 { (yyval
.parameter_list
) = NULL
; ;}
2107 /* Line 1455 of yacc.c */
2108 #line 290 "parser.y"
2109 { (yyval
.parameter_list
) = (yyvsp
[(1) - (1)].parameter_list
); ;}
2114 /* Line 1455 of yacc.c */
2115 #line 294 "parser.y"
2116 { (yyval
.statement
) = (yyvsp
[(1) - (1)].statement
); ;}
2121 /* Line 1455 of yacc.c */
2122 #line 295 "parser.y"
2123 { (yyval
.statement
) = (yyvsp
[(1) - (1)].statement
); ;}
2128 /* Line 1455 of yacc.c */
2129 #line 296 "parser.y"
2130 { (yyval
.statement
) = (yyvsp
[(1) - (1)].statement
); ;}
2135 /* Line 1455 of yacc.c */
2136 #line 297 "parser.y"
2137 { (yyval
.statement
) = new_empty_statement(ctx
); ;}
2142 /* Line 1455 of yacc.c */
2143 #line 298 "parser.y"
2144 { (yyval
.statement
) = (yyvsp
[(1) - (1)].statement
); ;}
2149 /* Line 1455 of yacc.c */
2150 #line 299 "parser.y"
2151 { (yyval
.statement
) = (yyvsp
[(1) - (1)].statement
); ;}
2156 /* Line 1455 of yacc.c */
2157 #line 300 "parser.y"
2158 { (yyval
.statement
) = (yyvsp
[(1) - (1)].statement
); ;}
2163 /* Line 1455 of yacc.c */
2164 #line 301 "parser.y"
2165 { (yyval
.statement
) = (yyvsp
[(1) - (1)].statement
); ;}
2170 /* Line 1455 of yacc.c */
2171 #line 302 "parser.y"
2172 { (yyval
.statement
) = (yyvsp
[(1) - (1)].statement
); ;}
2177 /* Line 1455 of yacc.c */
2178 #line 303 "parser.y"
2179 { (yyval
.statement
) = (yyvsp
[(1) - (1)].statement
); ;}
2184 /* Line 1455 of yacc.c */
2185 #line 304 "parser.y"
2186 { (yyval
.statement
) = (yyvsp
[(1) - (1)].statement
); ;}
2191 /* Line 1455 of yacc.c */
2192 #line 305 "parser.y"
2193 { (yyval
.statement
) = (yyvsp
[(1) - (1)].statement
); ;}
2198 /* Line 1455 of yacc.c */
2199 #line 306 "parser.y"
2200 { (yyval
.statement
) = (yyvsp
[(1) - (1)].statement
); ;}
2205 /* Line 1455 of yacc.c */
2206 #line 307 "parser.y"
2207 { (yyval
.statement
) = (yyvsp
[(1) - (1)].statement
); ;}
2212 /* Line 1455 of yacc.c */
2213 #line 308 "parser.y"
2214 { (yyval
.statement
) = (yyvsp
[(1) - (1)].statement
); ;}
2219 /* Line 1455 of yacc.c */
2220 #line 312 "parser.y"
2221 { (yyval
.statement_list
) = new_statement_list(ctx
, (yyvsp
[(1) - (1)].statement
)); ;}
2226 /* Line 1455 of yacc.c */
2227 #line 314 "parser.y"
2228 { (yyval
.statement_list
) = statement_list_add((yyvsp
[(1) - (2)].statement_list
), (yyvsp
[(2) - (2)].statement
)); ;}
2233 /* Line 1455 of yacc.c */
2234 #line 318 "parser.y"
2235 { (yyval
.statement_list
) = NULL
; ;}
2240 /* Line 1455 of yacc.c */
2241 #line 319 "parser.y"
2242 { (yyval
.statement_list
) = (yyvsp
[(1) - (1)].statement_list
); ;}
2247 /* Line 1455 of yacc.c */
2248 #line 323 "parser.y"
2249 { (yyval
.statement
) = new_block_statement(ctx
, (yyvsp
[(2) - (3)].statement_list
)); ;}
2254 /* Line 1455 of yacc.c */
2255 #line 324 "parser.y"
2256 { (yyval
.statement
) = new_block_statement(ctx
, NULL
); ;}
2261 /* Line 1455 of yacc.c */
2262 #line 329 "parser.y"
2263 { (yyval
.statement
) = new_var_statement(ctx
, (yyvsp
[(2) - (3)].variable_list
)); ;}
2268 /* Line 1455 of yacc.c */
2269 #line 333 "parser.y"
2270 { (yyval
.variable_list
) = new_variable_list(ctx
, (yyvsp
[(1) - (1)].variable_declaration
)); ;}
2275 /* Line 1455 of yacc.c */
2276 #line 335 "parser.y"
2277 { (yyval
.variable_list
) = variable_list_add(ctx
, (yyvsp
[(1) - (3)].variable_list
), (yyvsp
[(3) - (3)].variable_declaration
)); ;}
2282 /* Line 1455 of yacc.c */
2283 #line 340 "parser.y"
2284 { (yyval
.variable_list
) = new_variable_list(ctx
, (yyvsp
[(1) - (1)].variable_declaration
)); ;}
2289 /* Line 1455 of yacc.c */
2290 #line 342 "parser.y"
2291 { (yyval
.variable_list
) = variable_list_add(ctx
, (yyvsp
[(1) - (3)].variable_list
), (yyvsp
[(3) - (3)].variable_declaration
)); ;}
2296 /* Line 1455 of yacc.c */
2297 #line 347 "parser.y"
2298 { (yyval
.variable_declaration
) = new_variable_declaration(ctx
, (yyvsp
[(1) - (2)].identifier
), (yyvsp
[(2) - (2)].expr
)); ;}
2303 /* Line 1455 of yacc.c */
2304 #line 352 "parser.y"
2305 { (yyval
.variable_declaration
) = new_variable_declaration(ctx
, (yyvsp
[(1) - (2)].identifier
), (yyvsp
[(2) - (2)].expr
)); ;}
2310 /* Line 1455 of yacc.c */
2311 #line 356 "parser.y"
2312 { (yyval
.expr
) = NULL
; ;}
2317 /* Line 1455 of yacc.c */
2318 #line 357 "parser.y"
2319 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); ;}
2324 /* Line 1455 of yacc.c */
2325 #line 362 "parser.y"
2326 { (yyval
.expr
) = (yyvsp
[(2) - (2)].expr
); ;}
2331 /* Line 1455 of yacc.c */
2332 #line 366 "parser.y"
2333 { (yyval
.expr
) = NULL
; ;}
2338 /* Line 1455 of yacc.c */
2339 #line 367 "parser.y"
2340 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); ;}
2345 /* Line 1455 of yacc.c */
2346 #line 372 "parser.y"
2347 { (yyval
.expr
) = (yyvsp
[(2) - (2)].expr
); ;}
2352 /* Line 1455 of yacc.c */
2353 #line 376 "parser.y"
2354 { (yyval
.statement
) = new_empty_statement(ctx
); ;}
2359 /* Line 1455 of yacc.c */
2360 #line 381 "parser.y"
2361 { (yyval
.statement
) = new_expression_statement(ctx
, (yyvsp
[(1) - (2)].expr
)); ;}
2366 /* Line 1455 of yacc.c */
2367 #line 386 "parser.y"
2368 { (yyval
.statement
) = new_if_statement(ctx
, (yyvsp
[(3) - (7)].expr
), (yyvsp
[(5) - (7)].statement
), (yyvsp
[(7) - (7)].statement
)); ;}
2373 /* Line 1455 of yacc.c */
2374 #line 388 "parser.y"
2375 { (yyval
.statement
) = new_if_statement(ctx
, (yyvsp
[(3) - (5)].expr
), (yyvsp
[(5) - (5)].statement
), NULL
); ;}
2380 /* Line 1455 of yacc.c */
2381 #line 393 "parser.y"
2382 { (yyval
.statement
) = new_while_statement(ctx
, TRUE
, (yyvsp
[(5) - (7)].expr
), (yyvsp
[(2) - (7)].statement
)); ;}
2387 /* Line 1455 of yacc.c */
2388 #line 395 "parser.y"
2389 { (yyval
.statement
) = new_while_statement(ctx
, FALSE
, (yyvsp
[(3) - (5)].expr
), (yyvsp
[(5) - (5)].statement
)); ;}
2394 /* Line 1455 of yacc.c */
2395 #line 397 "parser.y"
2396 { if(!explicit_error(ctx
, (yyvsp
[(3) - (3)].expr
), ';')) YYABORT
; ;}
2401 /* Line 1455 of yacc.c */
2402 #line 399 "parser.y"
2403 { if(!explicit_error(ctx
, (yyvsp
[(6) - (6)].expr
), ';')) YYABORT
; ;}
2408 /* Line 1455 of yacc.c */
2409 #line 401 "parser.y"
2410 { (yyval
.statement
) = new_for_statement(ctx
, NULL
, (yyvsp
[(3) - (11)].expr
), (yyvsp
[(6) - (11)].expr
), (yyvsp
[(9) - (11)].expr
), (yyvsp
[(11) - (11)].statement
)); ;}
2415 /* Line 1455 of yacc.c */
2416 #line 403 "parser.y"
2417 { if(!explicit_error(ctx
, (yyvsp
[(4) - (4)].variable_list
), ';')) YYABORT
; ;}
2422 /* Line 1455 of yacc.c */
2423 #line 405 "parser.y"
2424 { if(!explicit_error(ctx
, (yyvsp
[(7) - (7)].expr
), ';')) YYABORT
; ;}
2429 /* Line 1455 of yacc.c */
2430 #line 407 "parser.y"
2431 { (yyval
.statement
) = new_for_statement(ctx
, (yyvsp
[(4) - (12)].variable_list
), NULL
, (yyvsp
[(7) - (12)].expr
), (yyvsp
[(10) - (12)].expr
), (yyvsp
[(12) - (12)].statement
)); ;}
2436 /* Line 1455 of yacc.c */
2437 #line 409 "parser.y"
2438 { (yyval
.statement
) = new_forin_statement(ctx
, NULL
, (yyvsp
[(3) - (7)].expr
), (yyvsp
[(5) - (7)].expr
), (yyvsp
[(7) - (7)].statement
)); ;}
2443 /* Line 1455 of yacc.c */
2444 #line 411 "parser.y"
2445 { (yyval
.statement
) = new_forin_statement(ctx
, (yyvsp
[(4) - (8)].variable_declaration
), NULL
, (yyvsp
[(6) - (8)].expr
), (yyvsp
[(8) - (8)].statement
)); ;}
2450 /* Line 1455 of yacc.c */
2451 #line 416 "parser.y"
2452 { (yyval
.statement
) = new_continue_statement(ctx
, (yyvsp
[(2) - (3)].identifier
)); ;}
2457 /* Line 1455 of yacc.c */
2458 #line 421 "parser.y"
2459 { (yyval
.statement
) = new_break_statement(ctx
, (yyvsp
[(2) - (3)].identifier
)); ;}
2464 /* Line 1455 of yacc.c */
2465 #line 426 "parser.y"
2466 { (yyval
.statement
) = new_return_statement(ctx
, (yyvsp
[(2) - (3)].expr
)); ;}
2471 /* Line 1455 of yacc.c */
2472 #line 431 "parser.y"
2473 { (yyval
.statement
) = new_with_statement(ctx
, (yyvsp
[(3) - (5)].expr
), (yyvsp
[(5) - (5)].statement
)); ;}
2478 /* Line 1455 of yacc.c */
2479 #line 436 "parser.y"
2480 { (yyval
.statement
) = new_labelled_statement(ctx
, (yyvsp
[(1) - (3)].identifier
), (yyvsp
[(3) - (3)].statement
)); ;}
2485 /* Line 1455 of yacc.c */
2486 #line 441 "parser.y"
2487 { (yyval
.statement
) = new_switch_statement(ctx
, (yyvsp
[(3) - (5)].expr
), (yyvsp
[(5) - (5)].case_clausule
)); ;}
2492 /* Line 1455 of yacc.c */
2493 #line 446 "parser.y"
2494 { (yyval
.case_clausule
) = new_case_block(ctx
, (yyvsp
[(2) - (3)].case_list
), NULL
, NULL
); ;}
2499 /* Line 1455 of yacc.c */
2500 #line 448 "parser.y"
2501 { (yyval
.case_clausule
) = new_case_block(ctx
, (yyvsp
[(2) - (5)].case_list
), (yyvsp
[(3) - (5)].case_clausule
), (yyvsp
[(4) - (5)].case_list
)); ;}
2506 /* Line 1455 of yacc.c */
2507 #line 452 "parser.y"
2508 { (yyval
.case_list
) = NULL
; ;}
2513 /* Line 1455 of yacc.c */
2514 #line 453 "parser.y"
2515 { (yyval
.case_list
) = (yyvsp
[(1) - (1)].case_list
); ;}
2520 /* Line 1455 of yacc.c */
2521 #line 457 "parser.y"
2522 { (yyval
.case_list
) = new_case_list(ctx
, (yyvsp
[(1) - (1)].case_clausule
)); ;}
2527 /* Line 1455 of yacc.c */
2528 #line 459 "parser.y"
2529 { (yyval
.case_list
) = case_list_add(ctx
, (yyvsp
[(1) - (2)].case_list
), (yyvsp
[(2) - (2)].case_clausule
)); ;}
2534 /* Line 1455 of yacc.c */
2535 #line 464 "parser.y"
2536 { (yyval
.case_clausule
) = new_case_clausule(ctx
, (yyvsp
[(2) - (4)].expr
), (yyvsp
[(4) - (4)].statement_list
)); ;}
2541 /* Line 1455 of yacc.c */
2542 #line 469 "parser.y"
2543 { (yyval
.case_clausule
) = new_case_clausule(ctx
, NULL
, (yyvsp
[(3) - (3)].statement_list
)); ;}
2548 /* Line 1455 of yacc.c */
2549 #line 474 "parser.y"
2550 { (yyval
.statement
) = new_throw_statement(ctx
, (yyvsp
[(2) - (3)].expr
)); ;}
2555 /* Line 1455 of yacc.c */
2556 #line 478 "parser.y"
2557 { (yyval
.statement
) = new_try_statement(ctx
, (yyvsp
[(2) - (3)].statement
), (yyvsp
[(3) - (3)].catch_block
), NULL
); ;}
2562 /* Line 1455 of yacc.c */
2563 #line 479 "parser.y"
2564 { (yyval
.statement
) = new_try_statement(ctx
, (yyvsp
[(2) - (3)].statement
), NULL
, (yyvsp
[(3) - (3)].statement
)); ;}
2569 /* Line 1455 of yacc.c */
2570 #line 481 "parser.y"
2571 { (yyval
.statement
) = new_try_statement(ctx
, (yyvsp
[(2) - (4)].statement
), (yyvsp
[(3) - (4)].catch_block
), (yyvsp
[(4) - (4)].statement
)); ;}
2576 /* Line 1455 of yacc.c */
2577 #line 486 "parser.y"
2578 { (yyval
.catch_block
) = new_catch_block(ctx
, (yyvsp
[(3) - (5)].identifier
), (yyvsp
[(5) - (5)].statement
)); ;}
2583 /* Line 1455 of yacc.c */
2584 #line 490 "parser.y"
2585 { (yyval
.statement
) = (yyvsp
[(2) - (2)].statement
); ;}
2590 /* Line 1455 of yacc.c */
2591 #line 494 "parser.y"
2592 { (yyval
.expr
) = NULL
; ;}
2597 /* Line 1455 of yacc.c */
2598 #line 495 "parser.y"
2599 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); ;}
2604 /* Line 1455 of yacc.c */
2605 #line 498 "parser.y"
2606 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); ;}
2611 /* Line 1455 of yacc.c */
2612 #line 499 "parser.y"
2613 { set_error(ctx
, IDS_SYNTAX_ERROR
); YYABORT
; ;}
2618 /* Line 1455 of yacc.c */
2619 #line 503 "parser.y"
2620 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); ;}
2625 /* Line 1455 of yacc.c */
2626 #line 505 "parser.y"
2627 { (yyval
.expr
) = new_binary_expression(ctx
, EXPR_COMMA
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); ;}
2632 /* Line 1455 of yacc.c */
2633 #line 509 "parser.y"
2634 { (yyval
.expr
) = NULL
; ;}
2639 /* Line 1455 of yacc.c */
2640 #line 510 "parser.y"
2641 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); ;}
2646 /* Line 1455 of yacc.c */
2647 #line 515 "parser.y"
2648 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); ;}
2653 /* Line 1455 of yacc.c */
2654 #line 517 "parser.y"
2655 { (yyval
.expr
) = new_binary_expression(ctx
, EXPR_COMMA
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); ;}
2660 /* Line 1455 of yacc.c */
2661 #line 520 "parser.y"
2662 { (yyval
.ival
) = (yyvsp
[(1) - (1)].ival
); ;}
2667 /* Line 1455 of yacc.c */
2668 #line 521 "parser.y"
2669 { (yyval
.ival
) = EXPR_ASSIGNDIV
; ;}
2674 /* Line 1455 of yacc.c */
2675 #line 525 "parser.y"
2676 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); ;}
2681 /* Line 1455 of yacc.c */
2682 #line 527 "parser.y"
2683 { (yyval
.expr
) = new_binary_expression(ctx
, EXPR_ASSIGN
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); ;}
2688 /* Line 1455 of yacc.c */
2689 #line 529 "parser.y"
2690 { (yyval
.expr
) = new_binary_expression(ctx
, (yyvsp
[(2) - (3)].ival
), (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); ;}
2695 /* Line 1455 of yacc.c */
2696 #line 534 "parser.y"
2697 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); ;}
2702 /* Line 1455 of yacc.c */
2703 #line 536 "parser.y"
2704 { (yyval
.expr
) = new_binary_expression(ctx
, EXPR_ASSIGN
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); ;}
2709 /* Line 1455 of yacc.c */
2710 #line 538 "parser.y"
2711 { (yyval
.expr
) = new_binary_expression(ctx
, (yyvsp
[(2) - (3)].ival
), (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); ;}
2716 /* Line 1455 of yacc.c */
2717 #line 542 "parser.y"
2718 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); ;}
2723 /* Line 1455 of yacc.c */
2724 #line 544 "parser.y"
2725 { (yyval
.expr
) = new_conditional_expression(ctx
, (yyvsp
[(1) - (5)].expr
), (yyvsp
[(3) - (5)].expr
), (yyvsp
[(5) - (5)].expr
)); ;}
2730 /* Line 1455 of yacc.c */
2731 #line 549 "parser.y"
2732 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); ;}
2737 /* Line 1455 of yacc.c */
2738 #line 551 "parser.y"
2739 { (yyval
.expr
) = new_conditional_expression(ctx
, (yyvsp
[(1) - (5)].expr
), (yyvsp
[(3) - (5)].expr
), (yyvsp
[(5) - (5)].expr
)); ;}
2744 /* Line 1455 of yacc.c */
2745 #line 555 "parser.y"
2746 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); ;}
2751 /* Line 1455 of yacc.c */
2752 #line 557 "parser.y"
2753 { (yyval
.expr
) = new_binary_expression(ctx
, EXPR_OR
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); ;}
2758 /* Line 1455 of yacc.c */
2759 #line 562 "parser.y"
2760 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); ;}
2765 /* Line 1455 of yacc.c */
2766 #line 564 "parser.y"
2767 { (yyval
.expr
) = new_binary_expression(ctx
, EXPR_OR
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); ;}
2772 /* Line 1455 of yacc.c */
2773 #line 568 "parser.y"
2774 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); ;}
2779 /* Line 1455 of yacc.c */
2780 #line 570 "parser.y"
2781 { (yyval
.expr
) = new_binary_expression(ctx
, EXPR_AND
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); ;}
2786 /* Line 1455 of yacc.c */
2787 #line 575 "parser.y"
2788 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); ;}
2793 /* Line 1455 of yacc.c */
2794 #line 577 "parser.y"
2795 { (yyval
.expr
) = new_binary_expression(ctx
, EXPR_AND
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); ;}
2800 /* Line 1455 of yacc.c */
2801 #line 581 "parser.y"
2802 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); ;}
2807 /* Line 1455 of yacc.c */
2808 #line 583 "parser.y"
2809 { (yyval
.expr
) = new_binary_expression(ctx
, EXPR_BOR
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); ;}
2814 /* Line 1455 of yacc.c */
2815 #line 588 "parser.y"
2816 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); ;}
2821 /* Line 1455 of yacc.c */
2822 #line 590 "parser.y"
2823 { (yyval
.expr
) = new_binary_expression(ctx
, EXPR_BOR
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); ;}
2828 /* Line 1455 of yacc.c */
2829 #line 594 "parser.y"
2830 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); ;}
2835 /* Line 1455 of yacc.c */
2836 #line 596 "parser.y"
2837 { (yyval
.expr
) = new_binary_expression(ctx
, EXPR_BXOR
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); ;}
2842 /* Line 1455 of yacc.c */
2843 #line 601 "parser.y"
2844 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); ;}
2849 /* Line 1455 of yacc.c */
2850 #line 603 "parser.y"
2851 { (yyval
.expr
) = new_binary_expression(ctx
, EXPR_BXOR
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); ;}
2856 /* Line 1455 of yacc.c */
2857 #line 607 "parser.y"
2858 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); ;}
2863 /* Line 1455 of yacc.c */
2864 #line 609 "parser.y"
2865 { (yyval
.expr
) = new_binary_expression(ctx
, EXPR_BAND
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); ;}
2870 /* Line 1455 of yacc.c */
2871 #line 614 "parser.y"
2872 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); ;}
2877 /* Line 1455 of yacc.c */
2878 #line 616 "parser.y"
2879 { (yyval
.expr
) = new_binary_expression(ctx
, EXPR_BAND
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); ;}
2884 /* Line 1455 of yacc.c */
2885 #line 620 "parser.y"
2886 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); ;}
2891 /* Line 1455 of yacc.c */
2892 #line 622 "parser.y"
2893 { (yyval
.expr
) = new_binary_expression(ctx
, (yyvsp
[(2) - (3)].ival
), (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); ;}
2898 /* Line 1455 of yacc.c */
2899 #line 626 "parser.y"
2900 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); ;}
2905 /* Line 1455 of yacc.c */
2906 #line 628 "parser.y"
2907 { (yyval
.expr
) = new_binary_expression(ctx
, (yyvsp
[(2) - (3)].ival
), (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); ;}
2912 /* Line 1455 of yacc.c */
2913 #line 632 "parser.y"
2914 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); ;}
2919 /* Line 1455 of yacc.c */
2920 #line 634 "parser.y"
2921 { (yyval
.expr
) = new_binary_expression(ctx
, (yyvsp
[(2) - (3)].ival
), (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); ;}
2926 /* Line 1455 of yacc.c */
2927 #line 636 "parser.y"
2928 { (yyval
.expr
) = new_binary_expression(ctx
, EXPR_INSTANCEOF
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); ;}
2933 /* Line 1455 of yacc.c */
2934 #line 638 "parser.y"
2935 { (yyval
.expr
) = new_binary_expression(ctx
, EXPR_IN
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); ;}
2940 /* Line 1455 of yacc.c */
2941 #line 642 "parser.y"
2942 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); ;}
2947 /* Line 1455 of yacc.c */
2948 #line 644 "parser.y"
2949 { (yyval
.expr
) = new_binary_expression(ctx
, (yyvsp
[(2) - (3)].ival
), (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); ;}
2954 /* Line 1455 of yacc.c */
2955 #line 646 "parser.y"
2956 { (yyval
.expr
) = new_binary_expression(ctx
, EXPR_INSTANCEOF
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); ;}
2961 /* Line 1455 of yacc.c */
2962 #line 650 "parser.y"
2963 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); ;}
2968 /* Line 1455 of yacc.c */
2969 #line 652 "parser.y"
2970 { (yyval
.expr
) = new_binary_expression(ctx
, (yyvsp
[(2) - (3)].ival
), (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); ;}
2975 /* Line 1455 of yacc.c */
2976 #line 657 "parser.y"
2977 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); ;}
2982 /* Line 1455 of yacc.c */
2983 #line 659 "parser.y"
2984 { (yyval
.expr
) = new_binary_expression(ctx
, EXPR_ADD
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); ;}
2989 /* Line 1455 of yacc.c */
2990 #line 661 "parser.y"
2991 { (yyval
.expr
) = new_binary_expression(ctx
, EXPR_SUB
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); ;}
2996 /* Line 1455 of yacc.c */
2997 #line 665 "parser.y"
2998 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); ;}
3003 /* Line 1455 of yacc.c */
3004 #line 667 "parser.y"
3005 { (yyval
.expr
) = new_binary_expression(ctx
, EXPR_MUL
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); ;}
3010 /* Line 1455 of yacc.c */
3011 #line 669 "parser.y"
3012 { (yyval
.expr
) = new_binary_expression(ctx
, EXPR_DIV
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); ;}
3017 /* Line 1455 of yacc.c */
3018 #line 671 "parser.y"
3019 { (yyval
.expr
) = new_binary_expression(ctx
, EXPR_MOD
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].expr
)); ;}
3024 /* Line 1455 of yacc.c */
3025 #line 675 "parser.y"
3026 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); ;}
3031 /* Line 1455 of yacc.c */
3032 #line 677 "parser.y"
3033 { (yyval
.expr
) = new_unary_expression(ctx
, EXPR_DELETE
, (yyvsp
[(2) - (2)].expr
)); ;}
3038 /* Line 1455 of yacc.c */
3039 #line 678 "parser.y"
3040 { (yyval
.expr
) = new_unary_expression(ctx
, EXPR_VOID
, (yyvsp
[(2) - (2)].expr
)); ;}
3045 /* Line 1455 of yacc.c */
3046 #line 680 "parser.y"
3047 { (yyval
.expr
) = new_unary_expression(ctx
, EXPR_TYPEOF
, (yyvsp
[(2) - (2)].expr
)); ;}
3052 /* Line 1455 of yacc.c */
3053 #line 681 "parser.y"
3054 { (yyval
.expr
) = new_unary_expression(ctx
, EXPR_PREINC
, (yyvsp
[(2) - (2)].expr
)); ;}
3059 /* Line 1455 of yacc.c */
3060 #line 682 "parser.y"
3061 { (yyval
.expr
) = new_unary_expression(ctx
, EXPR_PREDEC
, (yyvsp
[(2) - (2)].expr
)); ;}
3066 /* Line 1455 of yacc.c */
3067 #line 683 "parser.y"
3068 { (yyval
.expr
) = new_unary_expression(ctx
, EXPR_PLUS
, (yyvsp
[(2) - (2)].expr
)); ;}
3073 /* Line 1455 of yacc.c */
3074 #line 684 "parser.y"
3075 { (yyval
.expr
) = new_unary_expression(ctx
, EXPR_MINUS
, (yyvsp
[(2) - (2)].expr
)); ;}
3080 /* Line 1455 of yacc.c */
3081 #line 685 "parser.y"
3082 { (yyval
.expr
) = new_unary_expression(ctx
, EXPR_BITNEG
, (yyvsp
[(2) - (2)].expr
)); ;}
3087 /* Line 1455 of yacc.c */
3088 #line 686 "parser.y"
3089 { (yyval
.expr
) = new_unary_expression(ctx
, EXPR_LOGNEG
, (yyvsp
[(2) - (2)].expr
)); ;}
3094 /* Line 1455 of yacc.c */
3095 #line 691 "parser.y"
3096 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); ;}
3101 /* Line 1455 of yacc.c */
3102 #line 693 "parser.y"
3103 { (yyval
.expr
) = new_unary_expression(ctx
, EXPR_POSTINC
, (yyvsp
[(1) - (2)].expr
)); ;}
3108 /* Line 1455 of yacc.c */
3109 #line 695 "parser.y"
3110 { (yyval
.expr
) = new_unary_expression(ctx
, EXPR_POSTDEC
, (yyvsp
[(1) - (2)].expr
)); ;}
3115 /* Line 1455 of yacc.c */
3116 #line 700 "parser.y"
3117 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); ;}
3122 /* Line 1455 of yacc.c */
3123 #line 701 "parser.y"
3124 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); ;}
3129 /* Line 1455 of yacc.c */
3130 #line 705 "parser.y"
3131 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); ;}
3136 /* Line 1455 of yacc.c */
3137 #line 706 "parser.y"
3138 { (yyval
.expr
) = new_new_expression(ctx
, (yyvsp
[(2) - (2)].expr
), NULL
); ;}
3143 /* Line 1455 of yacc.c */
3144 #line 710 "parser.y"
3145 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); ;}
3150 /* Line 1455 of yacc.c */
3151 #line 711 "parser.y"
3152 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); ;}
3157 /* Line 1455 of yacc.c */
3158 #line 713 "parser.y"
3159 { (yyval
.expr
) = new_array_expression(ctx
, (yyvsp
[(1) - (4)].expr
), (yyvsp
[(3) - (4)].expr
)); ;}
3164 /* Line 1455 of yacc.c */
3165 #line 715 "parser.y"
3166 { (yyval
.expr
) = new_member_expression(ctx
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].identifier
)); ;}
3171 /* Line 1455 of yacc.c */
3172 #line 717 "parser.y"
3173 { (yyval
.expr
) = new_new_expression(ctx
, (yyvsp
[(2) - (3)].expr
), (yyvsp
[(3) - (3)].argument_list
)); ;}
3178 /* Line 1455 of yacc.c */
3179 #line 722 "parser.y"
3180 { (yyval
.expr
) = new_call_expression(ctx
, (yyvsp
[(1) - (2)].expr
), (yyvsp
[(2) - (2)].argument_list
)); ;}
3185 /* Line 1455 of yacc.c */
3186 #line 724 "parser.y"
3187 { (yyval
.expr
) = new_call_expression(ctx
, (yyvsp
[(1) - (2)].expr
), (yyvsp
[(2) - (2)].argument_list
)); ;}
3192 /* Line 1455 of yacc.c */
3193 #line 726 "parser.y"
3194 { (yyval
.expr
) = new_array_expression(ctx
, (yyvsp
[(1) - (4)].expr
), (yyvsp
[(3) - (4)].expr
)); ;}
3199 /* Line 1455 of yacc.c */
3200 #line 728 "parser.y"
3201 { (yyval
.expr
) = new_member_expression(ctx
, (yyvsp
[(1) - (3)].expr
), (yyvsp
[(3) - (3)].identifier
)); ;}
3206 /* Line 1455 of yacc.c */
3207 #line 732 "parser.y"
3208 { (yyval
.argument_list
) = NULL
; ;}
3213 /* Line 1455 of yacc.c */
3214 #line 733 "parser.y"
3215 { (yyval
.argument_list
) = (yyvsp
[(2) - (3)].argument_list
); ;}
3220 /* Line 1455 of yacc.c */
3221 #line 737 "parser.y"
3222 { (yyval
.argument_list
) = new_argument_list(ctx
, (yyvsp
[(1) - (1)].expr
)); ;}
3227 /* Line 1455 of yacc.c */
3228 #line 739 "parser.y"
3229 { (yyval
.argument_list
) = argument_list_add(ctx
, (yyvsp
[(1) - (3)].argument_list
), (yyvsp
[(3) - (3)].expr
)); ;}
3234 /* Line 1455 of yacc.c */
3235 #line 743 "parser.y"
3236 { (yyval
.expr
) = new_this_expression(ctx
); ;}
3241 /* Line 1455 of yacc.c */
3242 #line 744 "parser.y"
3243 { (yyval
.expr
) = new_identifier_expression(ctx
, (yyvsp
[(1) - (1)].identifier
)); ;}
3248 /* Line 1455 of yacc.c */
3249 #line 745 "parser.y"
3250 { (yyval
.expr
) = new_literal_expression(ctx
, (yyvsp
[(1) - (1)].literal
)); ;}
3255 /* Line 1455 of yacc.c */
3256 #line 746 "parser.y"
3257 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); ;}
3262 /* Line 1455 of yacc.c */
3263 #line 747 "parser.y"
3264 { (yyval
.expr
) = (yyvsp
[(1) - (1)].expr
); ;}
3269 /* Line 1455 of yacc.c */
3270 #line 748 "parser.y"
3271 { (yyval
.expr
) = (yyvsp
[(2) - (3)].expr
); ;}
3276 /* Line 1455 of yacc.c */
3277 #line 752 "parser.y"
3278 { (yyval
.expr
) = new_array_literal_expression(ctx
, NULL
, 0); ;}
3283 /* Line 1455 of yacc.c */
3284 #line 753 "parser.y"
3285 { (yyval
.expr
) = new_array_literal_expression(ctx
, NULL
, (yyvsp
[(2) - (3)].ival
)+1); ;}
3290 /* Line 1455 of yacc.c */
3291 #line 754 "parser.y"
3292 { (yyval
.expr
) = new_array_literal_expression(ctx
, (yyvsp
[(2) - (3)].element_list
), 0); ;}
3297 /* Line 1455 of yacc.c */
3298 #line 756 "parser.y"
3299 { (yyval
.expr
) = new_array_literal_expression(ctx
, (yyvsp
[(2) - (5)].element_list
), (yyvsp
[(4) - (5)].ival
)+1); ;}
3304 /* Line 1455 of yacc.c */
3305 #line 761 "parser.y"
3306 { (yyval
.element_list
) = new_element_list(ctx
, (yyvsp
[(1) - (2)].ival
), (yyvsp
[(2) - (2)].expr
)); ;}
3311 /* Line 1455 of yacc.c */
3312 #line 763 "parser.y"
3313 { (yyval
.element_list
) = element_list_add(ctx
, (yyvsp
[(1) - (4)].element_list
), (yyvsp
[(3) - (4)].ival
), (yyvsp
[(4) - (4)].expr
)); ;}
3318 /* Line 1455 of yacc.c */
3319 #line 767 "parser.y"
3320 { (yyval
.ival
) = 1; ;}
3325 /* Line 1455 of yacc.c */
3326 #line 768 "parser.y"
3327 { (yyval
.ival
) = (yyvsp
[(1) - (2)].ival
) + 1; ;}
3332 /* Line 1455 of yacc.c */
3333 #line 772 "parser.y"
3334 { (yyval
.ival
) = 0; ;}
3339 /* Line 1455 of yacc.c */
3340 #line 773 "parser.y"
3341 { (yyval
.ival
) = (yyvsp
[(1) - (1)].ival
); ;}
3346 /* Line 1455 of yacc.c */
3347 #line 777 "parser.y"
3348 { (yyval
.expr
) = new_prop_and_value_expression(ctx
, NULL
); ;}
3353 /* Line 1455 of yacc.c */
3354 #line 779 "parser.y"
3355 { (yyval
.expr
) = new_prop_and_value_expression(ctx
, (yyvsp
[(2) - (3)].property_list
)); ;}
3360 /* Line 1455 of yacc.c */
3361 #line 784 "parser.y"
3362 { (yyval
.property_list
) = new_property_list(ctx
, (yyvsp
[(1) - (3)].literal
), (yyvsp
[(3) - (3)].expr
)); ;}
3367 /* Line 1455 of yacc.c */
3368 #line 786 "parser.y"
3369 { (yyval
.property_list
) = property_list_add(ctx
, (yyvsp
[(1) - (5)].property_list
), (yyvsp
[(3) - (5)].literal
), (yyvsp
[(5) - (5)].expr
)); ;}
3374 /* Line 1455 of yacc.c */
3375 #line 790 "parser.y"
3376 { (yyval
.literal
) = new_string_literal(ctx
, (yyvsp
[(1) - (1)].identifier
)); ;}
3381 /* Line 1455 of yacc.c */
3382 #line 791 "parser.y"
3383 { (yyval
.literal
) = new_string_literal(ctx
, (yyvsp
[(1) - (1)].wstr
)); ;}
3388 /* Line 1455 of yacc.c */
3389 #line 792 "parser.y"
3390 { (yyval
.literal
) = (yyvsp
[(1) - (1)].literal
); ;}
3395 /* Line 1455 of yacc.c */
3396 #line 796 "parser.y"
3397 { (yyval
.identifier
) = NULL
; ;}
3402 /* Line 1455 of yacc.c */
3403 #line 797 "parser.y"
3404 { (yyval
.identifier
) = (yyvsp
[(1) - (1)].identifier
); ;}
3409 /* Line 1455 of yacc.c */
3410 #line 801 "parser.y"
3411 { (yyval
.literal
) = new_null_literal(ctx
); ;}
3416 /* Line 1455 of yacc.c */
3417 #line 802 "parser.y"
3418 { (yyval
.literal
) = (yyvsp
[(1) - (1)].literal
); ;}
3423 /* Line 1455 of yacc.c */
3424 #line 803 "parser.y"
3425 { (yyval
.literal
) = (yyvsp
[(1) - (1)].literal
); ;}
3430 /* Line 1455 of yacc.c */
3431 #line 804 "parser.y"
3432 { (yyval
.literal
) = new_string_literal(ctx
, (yyvsp
[(1) - (1)].wstr
)); ;}
3437 /* Line 1455 of yacc.c */
3438 #line 805 "parser.y"
3439 { (yyval
.literal
) = parse_regexp(ctx
);
3440 if(!(yyval
.literal
)) YYABORT
; ;}
3445 /* Line 1455 of yacc.c */
3446 #line 807 "parser.y"
3447 { (yyval
.literal
) = parse_regexp(ctx
);
3448 if(!(yyval
.literal
)) YYABORT
; ;}
3453 /* Line 1455 of yacc.c */
3454 #line 812 "parser.y"
3455 { (yyval
.literal
) = new_boolean_literal(ctx
, VARIANT_TRUE
); ;}
3460 /* Line 1455 of yacc.c */
3461 #line 813 "parser.y"
3462 { (yyval
.literal
) = new_boolean_literal(ctx
, VARIANT_FALSE
); ;}
3467 /* Line 1455 of yacc.c */
3468 #line 817 "parser.y"
3469 { if(!allow_auto_semicolon(ctx
)) {YYABORT
;} ;}
3474 /* Line 1455 of yacc.c */
3475 #line 821 "parser.y"
3476 { set_error(ctx
, IDS_LBRACKET
); YYABORT
; ;}
3481 /* Line 1455 of yacc.c */
3482 #line 825 "parser.y"
3483 { set_error(ctx
, IDS_RBRACKET
); YYABORT
; ;}
3488 /* Line 1455 of yacc.c */
3489 #line 829 "parser.y"
3490 { set_error(ctx
, IDS_SEMICOLON
); YYABORT
; ;}
3495 /* Line 1455 of yacc.c */
3496 #line 3497 "parser.tab.c"
3499 YY_SYMBOL_PRINT ("-> $$ =", yyr1
[yyn
], &yyval
, &yyloc
);
3503 YY_STACK_PRINT (yyss
, yyssp
);
3507 /* Now `shift' the result of the reduction. Determine what state
3508 that goes to, based on the state we popped back to and the rule
3509 number reduced by. */
3513 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
3514 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
3515 yystate
= yytable
[yystate
];
3517 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
3522 /*------------------------------------.
3523 | yyerrlab -- here on detecting error |
3524 `------------------------------------*/
3526 /* If not already recovering from an error, report this error. */
3530 #if ! YYERROR_VERBOSE
3531 yyerror (YY_("syntax error"));
3534 YYSIZE_T yysize
= yysyntax_error (0, yystate
, yychar
);
3535 if (yymsg_alloc
< yysize
&& yymsg_alloc
< YYSTACK_ALLOC_MAXIMUM
)
3537 YYSIZE_T yyalloc
= 2 * yysize
;
3538 if (! (yysize
<= yyalloc
&& yyalloc
<= YYSTACK_ALLOC_MAXIMUM
))
3539 yyalloc
= YYSTACK_ALLOC_MAXIMUM
;
3540 if (yymsg
!= yymsgbuf
)
3541 YYSTACK_FREE (yymsg
);
3542 yymsg
= (char *) YYSTACK_ALLOC (yyalloc
);
3544 yymsg_alloc
= yyalloc
;
3548 yymsg_alloc
= sizeof yymsgbuf
;
3552 if (0 < yysize
&& yysize
<= yymsg_alloc
)
3554 (void) yysyntax_error (yymsg
, yystate
, yychar
);
3559 yyerror (YY_("syntax error"));
3561 goto yyexhaustedlab
;
3569 if (yyerrstatus
== 3)
3571 /* If just tried and failed to reuse lookahead token after an
3572 error, discard it. */
3574 if (yychar
<= YYEOF
)
3576 /* Return failure if at end of input. */
3577 if (yychar
== YYEOF
)
3582 yydestruct ("Error: discarding",
3588 /* Else will try to reuse lookahead token after shifting the error
3593 /*---------------------------------------------------.
3594 | yyerrorlab -- error raised explicitly by YYERROR. |
3595 `---------------------------------------------------*/
3598 /* Pacify compilers like GCC when the user code never invokes
3599 YYERROR and the label yyerrorlab therefore never appears in user
3601 if (/*CONSTCOND*/ 0)
3604 /* Do not reclaim the symbols of the rule which action triggered
3608 YY_STACK_PRINT (yyss
, yyssp
);
3613 /*-------------------------------------------------------------.
3614 | yyerrlab1 -- common code for both syntax error and YYERROR. |
3615 `-------------------------------------------------------------*/
3617 yyerrstatus
= 3; /* Each real token shifted decrements this. */
3621 yyn
= yypact
[yystate
];
3622 if (yyn
!= YYPACT_NINF
)
3625 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
3633 /* Pop the current state because it cannot handle the error token. */
3638 yydestruct ("Error: popping",
3639 yystos
[yystate
], yyvsp
);
3642 YY_STACK_PRINT (yyss
, yyssp
);
3648 /* Shift the error token. */
3649 YY_SYMBOL_PRINT ("Shifting", yystos
[yyn
], yyvsp
, yylsp
);
3655 /*-------------------------------------.
3656 | yyacceptlab -- YYACCEPT comes here. |
3657 `-------------------------------------*/
3662 /*-----------------------------------.
3663 | yyabortlab -- YYABORT comes here. |
3664 `-----------------------------------*/
3669 #if !defined(yyoverflow) || YYERROR_VERBOSE
3670 /*-------------------------------------------------.
3671 | yyexhaustedlab -- memory exhaustion comes here. |
3672 `-------------------------------------------------*/
3674 yyerror (YY_("memory exhausted"));
3680 if (yychar
!= YYEMPTY
)
3681 yydestruct ("Cleanup: discarding lookahead",
3683 /* Do not reclaim the symbols of the rule which action triggered
3684 this YYABORT or YYACCEPT. */
3686 YY_STACK_PRINT (yyss
, yyssp
);
3687 while (yyssp
!= yyss
)
3689 yydestruct ("Cleanup: popping",
3690 yystos
[*yyssp
], yyvsp
);
3695 YYSTACK_FREE (yyss
);
3698 if (yymsg
!= yymsgbuf
)
3699 YYSTACK_FREE (yymsg
);
3701 /* Make sure YYID is used. */
3702 return YYID (yyresult
);
3707 /* Line 1675 of yacc.c */
3708 #line 831 "parser.y"
3711 static BOOL
allow_auto_semicolon(parser_ctx_t
*ctx
)
3713 return ctx
->nl
|| ctx
->ptr
== ctx
->end
|| *(ctx
->ptr
-1) == '}';
3716 static literal_t
*new_string_literal(parser_ctx_t
*ctx
, const WCHAR
*str
)
3718 literal_t
*ret
= parser_alloc(ctx
, sizeof(literal_t
));
3720 ret
->type
= LT_STRING
;
3726 static literal_t
*new_null_literal(parser_ctx_t
*ctx
)
3728 literal_t
*ret
= parser_alloc(ctx
, sizeof(literal_t
));
3730 ret
->type
= LT_NULL
;
3735 static literal_t
*new_boolean_literal(parser_ctx_t
*ctx
, VARIANT_BOOL bval
)
3737 literal_t
*ret
= parser_alloc(ctx
, sizeof(literal_t
));
3739 ret
->type
= LT_BOOL
;
3745 static prop_val_t
*new_prop_val(parser_ctx_t
*ctx
, literal_t
*name
, expression_t
*value
)
3747 prop_val_t
*ret
= parser_alloc(ctx
, sizeof(prop_val_t
));
3756 static property_list_t
*new_property_list(parser_ctx_t
*ctx
, literal_t
*name
, expression_t
*value
)
3758 property_list_t
*ret
= parser_alloc_tmp(ctx
, sizeof(property_list_t
));
3760 ret
->head
= ret
->tail
= new_prop_val(ctx
, name
, value
);
3765 static property_list_t
*property_list_add(parser_ctx_t
*ctx
, property_list_t
*list
, literal_t
*name
, expression_t
*value
)
3767 list
->tail
= list
->tail
->next
= new_prop_val(ctx
, name
, value
);
3772 static array_element_t
*new_array_element(parser_ctx_t
*ctx
, int elision
, expression_t
*expr
)
3774 array_element_t
*ret
= parser_alloc(ctx
, sizeof(array_element_t
));
3776 ret
->elision
= elision
;
3783 static element_list_t
*new_element_list(parser_ctx_t
*ctx
, int elision
, expression_t
*expr
)
3785 element_list_t
*ret
= parser_alloc_tmp(ctx
, sizeof(element_list_t
));
3787 ret
->head
= ret
->tail
= new_array_element(ctx
, elision
, expr
);
3792 static element_list_t
*element_list_add(parser_ctx_t
*ctx
, element_list_t
*list
, int elision
, expression_t
*expr
)
3794 list
->tail
= list
->tail
->next
= new_array_element(ctx
, elision
, expr
);
3799 static argument_t
*new_argument(parser_ctx_t
*ctx
, expression_t
*expr
)
3801 argument_t
*ret
= parser_alloc(ctx
, sizeof(argument_t
));
3809 static argument_list_t
*new_argument_list(parser_ctx_t
*ctx
, expression_t
*expr
)
3811 argument_list_t
*ret
= parser_alloc_tmp(ctx
, sizeof(argument_list_t
));
3813 ret
->head
= ret
->tail
= new_argument(ctx
, expr
);
3818 static argument_list_t
*argument_list_add(parser_ctx_t
*ctx
, argument_list_t
*list
, expression_t
*expr
)
3820 list
->tail
= list
->tail
->next
= new_argument(ctx
, expr
);
3825 static catch_block_t
*new_catch_block(parser_ctx_t
*ctx
, const WCHAR
*identifier
, statement_t
*statement
)
3827 catch_block_t
*ret
= parser_alloc(ctx
, sizeof(catch_block_t
));
3829 ret
->identifier
= identifier
;
3830 ret
->statement
= statement
;
3835 static case_clausule_t
*new_case_clausule(parser_ctx_t
*ctx
, expression_t
*expr
, statement_list_t
*stat_list
)
3837 case_clausule_t
*ret
= parser_alloc(ctx
, sizeof(case_clausule_t
));
3840 ret
->stat
= stat_list
? stat_list
->head
: NULL
;
3846 static case_list_t
*new_case_list(parser_ctx_t
*ctx
, case_clausule_t
*case_clausule
)
3848 case_list_t
*ret
= parser_alloc_tmp(ctx
, sizeof(case_list_t
));
3850 ret
->head
= ret
->tail
= case_clausule
;
3855 static case_list_t
*case_list_add(parser_ctx_t
*ctx
, case_list_t
*list
, case_clausule_t
*case_clausule
)
3857 list
->tail
= list
->tail
->next
= case_clausule
;
3862 static case_clausule_t
*new_case_block(parser_ctx_t
*ctx
, case_list_t
*case_list1
,
3863 case_clausule_t
*default_clausule
, case_list_t
*case_list2
)
3865 case_clausule_t
*ret
= NULL
, *iter
= NULL
, *iter2
;
3866 statement_t
*stat
= NULL
;
3869 ret
= case_list1
->head
;
3870 iter
= case_list1
->tail
;
3873 if(default_clausule
) {
3875 iter
= iter
->next
= default_clausule
;
3877 ret
= iter
= default_clausule
;
3882 iter
->next
= case_list2
->head
;
3884 ret
= case_list2
->head
;
3890 for(iter
= ret
; iter
; iter
= iter
->next
) {
3891 for(iter2
= iter
; iter2
&& !iter2
->stat
; iter2
= iter2
->next
);
3895 while(iter
!= iter2
) {
3896 iter
->stat
= iter2
->stat
;
3903 stat
->next
= iter
->stat
;
3912 static statement_t
*new_block_statement(parser_ctx_t
*ctx
, statement_list_t
*list
)
3914 block_statement_t
*ret
= parser_alloc(ctx
, sizeof(block_statement_t
));
3916 ret
->stat
.eval
= block_statement_eval
;
3917 ret
->stat
.next
= NULL
;
3918 ret
->stat_list
= list
? list
->head
: NULL
;
3923 static variable_declaration_t
*new_variable_declaration(parser_ctx_t
*ctx
, const WCHAR
*identifier
, expression_t
*expr
)
3925 variable_declaration_t
*ret
= parser_alloc(ctx
, sizeof(variable_declaration_t
));
3926 var_list_t
*var_list
= parser_alloc(ctx
, sizeof(var_list_t
));
3928 ret
->identifier
= identifier
;
3932 var_list
->identifier
= identifier
;
3933 var_list
->next
= NULL
;
3935 if(ctx
->func_stack
->var_tail
)
3936 ctx
->func_stack
->var_tail
= ctx
->func_stack
->var_tail
->next
= var_list
;
3938 ctx
->func_stack
->var_head
= ctx
->func_stack
->var_tail
= var_list
;
3943 static variable_list_t
*new_variable_list(parser_ctx_t
*ctx
, variable_declaration_t
*decl
)
3945 variable_list_t
*ret
= parser_alloc_tmp(ctx
, sizeof(variable_list_t
));
3947 ret
->head
= ret
->tail
= decl
;
3952 static variable_list_t
*variable_list_add(parser_ctx_t
*ctx
, variable_list_t
*list
, variable_declaration_t
*decl
)
3954 list
->tail
= list
->tail
->next
= decl
;
3959 static statement_t
*new_var_statement(parser_ctx_t
*ctx
, variable_list_t
*variable_list
)
3961 var_statement_t
*ret
= parser_alloc(ctx
, sizeof(var_statement_t
));
3963 ret
->stat
.eval
= var_statement_eval
;
3964 ret
->stat
.next
= NULL
;
3965 ret
->variable_list
= variable_list
->head
;
3970 static statement_t
*new_empty_statement(parser_ctx_t
*ctx
)
3972 statement_t
*ret
= parser_alloc(ctx
, sizeof(statement_t
));
3974 ret
->eval
= empty_statement_eval
;
3980 static statement_t
*new_expression_statement(parser_ctx_t
*ctx
, expression_t
*expr
)
3982 expression_statement_t
*ret
= parser_alloc(ctx
, sizeof(expression_statement_t
));
3984 ret
->stat
.eval
= expression_statement_eval
;
3985 ret
->stat
.next
= NULL
;
3991 static statement_t
*new_if_statement(parser_ctx_t
*ctx
, expression_t
*expr
, statement_t
*if_stat
, statement_t
*else_stat
)
3993 if_statement_t
*ret
= parser_alloc(ctx
, sizeof(if_statement_t
));
3995 ret
->stat
.eval
= if_statement_eval
;
3996 ret
->stat
.next
= NULL
;
3998 ret
->if_stat
= if_stat
;
3999 ret
->else_stat
= else_stat
;
4004 static statement_t
*new_while_statement(parser_ctx_t
*ctx
, BOOL dowhile
, expression_t
*expr
, statement_t
*stat
)
4006 while_statement_t
*ret
= parser_alloc(ctx
, sizeof(while_statement_t
));
4008 ret
->stat
.eval
= while_statement_eval
;
4009 ret
->stat
.next
= NULL
;
4010 ret
->do_while
= dowhile
;
4012 ret
->statement
= stat
;
4017 static statement_t
*new_for_statement(parser_ctx_t
*ctx
, variable_list_t
*variable_list
, expression_t
*begin_expr
,
4018 expression_t
*expr
, expression_t
*end_expr
, statement_t
*statement
)
4020 for_statement_t
*ret
= parser_alloc(ctx
, sizeof(for_statement_t
));
4022 ret
->stat
.eval
= for_statement_eval
;
4023 ret
->stat
.next
= NULL
;
4024 ret
->variable_list
= variable_list
? variable_list
->head
: NULL
;
4025 ret
->begin_expr
= begin_expr
;
4027 ret
->end_expr
= end_expr
;
4028 ret
->statement
= statement
;
4033 static statement_t
*new_forin_statement(parser_ctx_t
*ctx
, variable_declaration_t
*variable
, expression_t
*expr
,
4034 expression_t
*in_expr
, statement_t
*statement
)
4036 forin_statement_t
*ret
= parser_alloc(ctx
, sizeof(forin_statement_t
));
4038 ret
->stat
.eval
= forin_statement_eval
;
4039 ret
->stat
.next
= NULL
;
4040 ret
->variable
= variable
;
4042 ret
->in_expr
= in_expr
;
4043 ret
->statement
= statement
;
4048 static statement_t
*new_continue_statement(parser_ctx_t
*ctx
, const WCHAR
*identifier
)
4050 branch_statement_t
*ret
= parser_alloc(ctx
, sizeof(branch_statement_t
));
4052 ret
->stat
.eval
= continue_statement_eval
;
4053 ret
->stat
.next
= NULL
;
4054 ret
->identifier
= identifier
;
4059 static statement_t
*new_break_statement(parser_ctx_t
*ctx
, const WCHAR
*identifier
)
4061 branch_statement_t
*ret
= parser_alloc(ctx
, sizeof(branch_statement_t
));
4063 ret
->stat
.eval
= break_statement_eval
;
4064 ret
->stat
.next
= NULL
;
4065 ret
->identifier
= identifier
;
4070 static statement_t
*new_return_statement(parser_ctx_t
*ctx
, expression_t
*expr
)
4072 expression_statement_t
*ret
= parser_alloc(ctx
, sizeof(expression_statement_t
));
4074 ret
->stat
.eval
= return_statement_eval
;
4075 ret
->stat
.next
= NULL
;
4081 static statement_t
*new_with_statement(parser_ctx_t
*ctx
, expression_t
*expr
, statement_t
*statement
)
4083 with_statement_t
*ret
= parser_alloc(ctx
, sizeof(with_statement_t
));
4085 ret
->stat
.eval
= with_statement_eval
;
4086 ret
->stat
.next
= NULL
;
4088 ret
->statement
= statement
;
4093 static statement_t
*new_labelled_statement(parser_ctx_t
*ctx
, const WCHAR
*identifier
, statement_t
*statement
)
4095 labelled_statement_t
*ret
= parser_alloc(ctx
, sizeof(labelled_statement_t
));
4097 ret
->stat
.eval
= labelled_statement_eval
;
4098 ret
->stat
.next
= NULL
;
4099 ret
->identifier
= identifier
;
4100 ret
->statement
= statement
;
4105 static statement_t
*new_switch_statement(parser_ctx_t
*ctx
, expression_t
*expr
, case_clausule_t
*case_list
)
4107 switch_statement_t
*ret
= parser_alloc(ctx
, sizeof(switch_statement_t
));
4109 ret
->stat
.eval
= switch_statement_eval
;
4110 ret
->stat
.next
= NULL
;
4112 ret
->case_list
= case_list
;
4117 static statement_t
*new_throw_statement(parser_ctx_t
*ctx
, expression_t
*expr
)
4119 expression_statement_t
*ret
= parser_alloc(ctx
, sizeof(expression_statement_t
));
4121 ret
->stat
.eval
= throw_statement_eval
;
4122 ret
->stat
.next
= NULL
;
4128 static statement_t
*new_try_statement(parser_ctx_t
*ctx
, statement_t
*try_statement
,
4129 catch_block_t
*catch_block
, statement_t
*finally_statement
)
4131 try_statement_t
*ret
= parser_alloc(ctx
, sizeof(try_statement_t
));
4133 ret
->stat
.eval
= try_statement_eval
;
4134 ret
->stat
.next
= NULL
;
4135 ret
->try_statement
= try_statement
;
4136 ret
->catch_block
= catch_block
;
4137 ret
->finally_statement
= finally_statement
;
4142 static parameter_t
*new_parameter(parser_ctx_t
*ctx
, const WCHAR
*identifier
)
4144 parameter_t
*ret
= parser_alloc(ctx
, sizeof(parameter_t
));
4146 ret
->identifier
= identifier
;
4152 static parameter_list_t
*new_parameter_list(parser_ctx_t
*ctx
, const WCHAR
*identifier
)
4154 parameter_list_t
*ret
= parser_alloc_tmp(ctx
, sizeof(parameter_list_t
));
4156 ret
->head
= ret
->tail
= new_parameter(ctx
, identifier
);
4161 static parameter_list_t
*parameter_list_add(parser_ctx_t
*ctx
, parameter_list_t
*list
, const WCHAR
*identifier
)
4163 list
->tail
= list
->tail
->next
= new_parameter(ctx
, identifier
);
4168 static expression_t
*new_function_expression(parser_ctx_t
*ctx
, const WCHAR
*identifier
,
4169 parameter_list_t
*parameter_list
, source_elements_t
*source_elements
, const WCHAR
*src_str
, DWORD src_len
)
4171 function_expression_t
*ret
= parser_alloc(ctx
, sizeof(function_expression_t
));
4173 ret
->expr
.eval
= function_expression_eval
;
4174 ret
->identifier
= identifier
;
4175 ret
->parameter_list
= parameter_list
? parameter_list
->head
: NULL
;
4176 ret
->source_elements
= source_elements
;
4177 ret
->src_str
= src_str
;
4178 ret
->src_len
= src_len
;
4180 if(ret
->identifier
) {
4181 function_declaration_t
*decl
= parser_alloc(ctx
, sizeof(function_declaration_t
));
4186 if(ctx
->func_stack
->func_tail
)
4187 ctx
->func_stack
->func_tail
= ctx
->func_stack
->func_tail
->next
= decl
;
4189 ctx
->func_stack
->func_head
= ctx
->func_stack
->func_tail
= decl
;
4195 static const expression_eval_t expression_eval_table
[] = {
4196 comma_expression_eval
,
4197 logical_or_expression_eval
,
4198 logical_and_expression_eval
,
4199 binary_or_expression_eval
,
4200 binary_xor_expression_eval
,
4201 binary_and_expression_eval
,
4202 instanceof_expression_eval
,
4204 add_expression_eval
,
4205 sub_expression_eval
,
4206 mul_expression_eval
,
4207 div_expression_eval
,
4208 mod_expression_eval
,
4209 delete_expression_eval
,
4210 void_expression_eval
,
4211 typeof_expression_eval
,
4212 minus_expression_eval
,
4213 plus_expression_eval
,
4214 post_increment_expression_eval
,
4215 post_decrement_expression_eval
,
4216 pre_increment_expression_eval
,
4217 pre_decrement_expression_eval
,
4218 equal_expression_eval
,
4219 equal2_expression_eval
,
4220 not_equal_expression_eval
,
4221 not_equal2_expression_eval
,
4222 less_expression_eval
,
4223 lesseq_expression_eval
,
4224 greater_expression_eval
,
4225 greatereq_expression_eval
,
4226 binary_negation_expression_eval
,
4227 logical_negation_expression_eval
,
4228 left_shift_expression_eval
,
4229 right_shift_expression_eval
,
4230 right2_shift_expression_eval
,
4231 assign_expression_eval
,
4232 assign_lshift_expression_eval
,
4233 assign_rshift_expression_eval
,
4234 assign_rrshift_expression_eval
,
4235 assign_add_expression_eval
,
4236 assign_sub_expression_eval
,
4237 assign_mul_expression_eval
,
4238 assign_div_expression_eval
,
4239 assign_mod_expression_eval
,
4240 assign_and_expression_eval
,
4241 assign_or_expression_eval
,
4242 assign_xor_expression_eval
,
4245 static expression_t
*new_binary_expression(parser_ctx_t
*ctx
, expression_type_t type
,
4246 expression_t
*expression1
, expression_t
*expression2
)
4248 binary_expression_t
*ret
= parser_alloc(ctx
, sizeof(binary_expression_t
));
4250 ret
->expr
.eval
= expression_eval_table
[type
];
4251 ret
->expression1
= expression1
;
4252 ret
->expression2
= expression2
;
4257 static expression_t
*new_unary_expression(parser_ctx_t
*ctx
, expression_type_t type
, expression_t
*expression
)
4259 unary_expression_t
*ret
= parser_alloc(ctx
, sizeof(unary_expression_t
));
4261 ret
->expr
.eval
= expression_eval_table
[type
];
4262 ret
->expression
= expression
;
4267 static expression_t
*new_conditional_expression(parser_ctx_t
*ctx
, expression_t
*expression
,
4268 expression_t
*true_expression
, expression_t
*false_expression
)
4270 conditional_expression_t
*ret
= parser_alloc(ctx
, sizeof(conditional_expression_t
));
4272 ret
->expr
.eval
= conditional_expression_eval
;
4273 ret
->expression
= expression
;
4274 ret
->true_expression
= true_expression
;
4275 ret
->false_expression
= false_expression
;
4280 static expression_t
*new_array_expression(parser_ctx_t
*ctx
, expression_t
*member_expr
, expression_t
*expression
)
4282 array_expression_t
*ret
= parser_alloc(ctx
, sizeof(array_expression_t
));
4284 ret
->expr
.eval
= array_expression_eval
;
4285 ret
->member_expr
= member_expr
;
4286 ret
->expression
= expression
;
4291 static expression_t
*new_member_expression(parser_ctx_t
*ctx
, expression_t
*expression
, const WCHAR
*identifier
)
4293 member_expression_t
*ret
= parser_alloc(ctx
, sizeof(member_expression_t
));
4295 ret
->expr
.eval
= member_expression_eval
;
4296 ret
->expression
= expression
;
4297 ret
->identifier
= identifier
;
4302 static expression_t
*new_new_expression(parser_ctx_t
*ctx
, expression_t
*expression
, argument_list_t
*argument_list
)
4304 call_expression_t
*ret
= parser_alloc(ctx
, sizeof(call_expression_t
));
4306 ret
->expr
.eval
= new_expression_eval
;
4307 ret
->expression
= expression
;
4308 ret
->argument_list
= argument_list
? argument_list
->head
: NULL
;
4313 static expression_t
*new_call_expression(parser_ctx_t
*ctx
, expression_t
*expression
, argument_list_t
*argument_list
)
4315 call_expression_t
*ret
= parser_alloc(ctx
, sizeof(call_expression_t
));
4317 ret
->expr
.eval
= call_expression_eval
;
4318 ret
->expression
= expression
;
4319 ret
->argument_list
= argument_list
? argument_list
->head
: NULL
;
4324 static expression_t
*new_this_expression(parser_ctx_t
*ctx
)
4326 expression_t
*ret
= parser_alloc(ctx
, sizeof(expression_t
));
4328 ret
->eval
= this_expression_eval
;
4333 static int parser_error(const char *str
)
4338 static void set_error(parser_ctx_t
*ctx
, UINT error
)
4340 ctx
->hres
= JSCRIPT_ERROR
|error
;
4343 static BOOL
explicit_error(parser_ctx_t
*ctx
, void *obj
, WCHAR next
)
4345 if(obj
|| *(ctx
->ptr
-1)==next
) return TRUE
;
4347 set_error(ctx
, IDS_SYNTAX_ERROR
);
4352 static expression_t
*new_identifier_expression(parser_ctx_t
*ctx
, const WCHAR
*identifier
)
4354 identifier_expression_t
*ret
= parser_alloc(ctx
, sizeof(identifier_expression_t
));
4356 ret
->expr
.eval
= identifier_expression_eval
;
4357 ret
->identifier
= identifier
;
4362 static expression_t
*new_array_literal_expression(parser_ctx_t
*ctx
, element_list_t
*element_list
, int length
)
4364 array_literal_expression_t
*ret
= parser_alloc(ctx
, sizeof(array_literal_expression_t
));
4366 ret
->expr
.eval
= array_literal_expression_eval
;
4367 ret
->element_list
= element_list
? element_list
->head
: NULL
;
4368 ret
->length
= length
;
4373 static expression_t
*new_prop_and_value_expression(parser_ctx_t
*ctx
, property_list_t
*property_list
)
4375 property_value_expression_t
*ret
= parser_alloc(ctx
, sizeof(property_value_expression_t
));
4377 ret
->expr
.eval
= property_value_expression_eval
;
4378 ret
->property_list
= property_list
? property_list
->head
: NULL
;
4383 static expression_t
*new_literal_expression(parser_ctx_t
*ctx
, literal_t
*literal
)
4385 literal_expression_t
*ret
= parser_alloc(ctx
, sizeof(literal_expression_t
));
4387 ret
->expr
.eval
= literal_expression_eval
;
4388 ret
->literal
= literal
;
4393 static source_elements_t
*new_source_elements(parser_ctx_t
*ctx
)
4395 source_elements_t
*ret
= parser_alloc(ctx
, sizeof(source_elements_t
));
4397 memset(ret
, 0, sizeof(*ret
));
4402 static source_elements_t
*source_elements_add_statement(source_elements_t
*source_elements
, statement_t
*statement
)
4404 if(source_elements
->statement_tail
)
4405 source_elements
->statement_tail
= source_elements
->statement_tail
->next
= statement
;
4407 source_elements
->statement
= source_elements
->statement_tail
= statement
;
4409 return source_elements
;
4412 static statement_list_t
*new_statement_list(parser_ctx_t
*ctx
, statement_t
*statement
)
4414 statement_list_t
*ret
= parser_alloc_tmp(ctx
, sizeof(statement_list_t
));
4416 ret
->head
= ret
->tail
= statement
;
4421 static statement_list_t
*statement_list_add(statement_list_t
*list
, statement_t
*statement
)
4423 list
->tail
= list
->tail
->next
= statement
;
4428 static void push_func(parser_ctx_t
*ctx
)
4430 func_stack_t
*new_func
= parser_alloc_tmp(ctx
, sizeof(func_stack_t
));
4432 new_func
->func_head
= new_func
->func_tail
= NULL
;
4433 new_func
->var_head
= new_func
->var_tail
= NULL
;
4435 new_func
->next
= ctx
->func_stack
;
4436 ctx
->func_stack
= new_func
;
4439 static source_elements_t
*function_body_parsed(parser_ctx_t
*ctx
, source_elements_t
*source
)
4441 source
->functions
= ctx
->func_stack
->func_head
;
4442 source
->variables
= ctx
->func_stack
->var_head
;
4448 static void program_parsed(parser_ctx_t
*ctx
, source_elements_t
*source
)
4450 source
->functions
= ctx
->func_stack
->func_head
;
4451 source
->variables
= ctx
->func_stack
->var_head
;
4454 ctx
->source
= source
;
4455 if(!ctx
->lexer_error
)
4459 void parser_release(parser_ctx_t
*ctx
)
4464 script_release(ctx
->script
);
4465 heap_free(ctx
->begin
);
4466 jsheap_free(&ctx
->heap
);
4470 HRESULT
script_parse(script_ctx_t
*ctx
, const WCHAR
*code
, const WCHAR
*delimiter
,
4473 parser_ctx_t
*parser_ctx
;
4477 const WCHAR html_tagW
[] = {'<','/','s','c','r','i','p','t','>',0};
4479 parser_ctx
= heap_alloc_zero(sizeof(parser_ctx_t
));
4481 return E_OUTOFMEMORY
;
4483 parser_ctx
->ref
= 1;
4484 parser_ctx
->hres
= JSCRIPT_ERROR
|IDS_SYNTAX_ERROR
;
4485 parser_ctx
->is_html
= delimiter
&& !strcmpiW(delimiter
, html_tagW
);
4487 parser_ctx
->begin
= heap_strdupW(code
);
4488 if(!parser_ctx
->begin
) {
4489 heap_free(parser_ctx
);
4490 return E_OUTOFMEMORY
;
4493 parser_ctx
->ptr
= parser_ctx
->begin
;
4494 parser_ctx
->end
= parser_ctx
->begin
+ strlenW(parser_ctx
->begin
);
4497 parser_ctx
->script
= ctx
;
4499 mark
= jsheap_mark(&ctx
->tmp_heap
);
4500 jsheap_init(&parser_ctx
->heap
);
4502 push_func(parser_ctx
);
4504 parser_parse(parser_ctx
);
4506 if(FAILED(parser_ctx
->hres
)) {
4507 hres
= parser_ctx
->hres
;
4508 parser_release(parser_ctx
);