1 /* A Bison parser, made by GNU Bison 2.5. */
3 /* Bison implementation for Yacc-like parsers in C
5 Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 /* As a special exception, you may create a larger work that contains
21 part or all of the Bison parser skeleton and distribute that work
22 under terms of your choice, so long as that work isn't itself a
23 parser generator using the skeleton or a modified version thereof
24 as a parser skeleton. Alternatively, if you modify or redistribute
25 the parser skeleton itself, you may (at your option) remove this
26 special exception, which will cause the skeleton and the resulting
27 Bison output files to be licensed under the GNU General Public
28 License without this special exception.
30 This special exception was added by the Free Software Foundation in
31 version 2.2 of Bison. */
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34 simplifying the original so-called "semantic" parser. */
36 /* All symbols defined below should begin with yy or YY, to avoid
37 infringing on user name space. This should be done even for local
38 variables, as they might otherwise be expanded by user macros.
39 There are some unavoidable exceptions within include files to
40 define necessary library symbols; they are noted "INFRINGES ON
41 USER NAME SPACE" below. */
43 /* Identify Bison output. */
47 #define YYBISON_VERSION "2.5"
50 #define YYSKELETON_NAME "yacc.c"
61 /* Using locations. */
62 #define YYLSP_NEEDED 0
64 /* Substitute the variable and function names. */
65 #define yyparse parser_parse
66 #define yylex parser_lex
67 #define yyerror parser_error
68 #define yylval parser_lval
69 #define yychar parser_char
70 #define yydebug parser_debug
71 #define yynerrs parser_nerrs
74 /* Copy the first part of user declarations. */
76 /* Line 268 of yacc.c */
81 static int parser_error(parser_ctx_t
*,const char*);
83 static void parse_complete(parser_ctx_t
*,BOOL
);
85 static void source_add_statement(parser_ctx_t
*,statement_t
*);
86 static void source_add_class(parser_ctx_t
*,class_decl_t
*);
88 static void *new_expression(parser_ctx_t
*,expression_type_t
,size_t);
89 static expression_t
*new_bool_expression(parser_ctx_t
*,VARIANT_BOOL
);
90 static expression_t
*new_string_expression(parser_ctx_t
*,const WCHAR
*);
91 static expression_t
*new_long_expression(parser_ctx_t
*,expression_type_t
,LONG
);
92 static expression_t
*new_double_expression(parser_ctx_t
*,double);
93 static expression_t
*new_unary_expression(parser_ctx_t
*,expression_type_t
,expression_t
*);
94 static expression_t
*new_binary_expression(parser_ctx_t
*,expression_type_t
,expression_t
*,expression_t
*);
95 static expression_t
*new_new_expression(parser_ctx_t
*,const WCHAR
*);
97 static member_expression_t
*new_member_expression(parser_ctx_t
*,expression_t
*,const WCHAR
*);
99 static void *new_statement(parser_ctx_t
*,statement_type_t
,size_t);
100 static statement_t
*new_call_statement(parser_ctx_t
*,BOOL
,member_expression_t
*);
101 static statement_t
*new_assign_statement(parser_ctx_t
*,member_expression_t
*,expression_t
*);
102 static statement_t
*new_set_statement(parser_ctx_t
*,member_expression_t
*,expression_t
*);
103 static statement_t
*new_dim_statement(parser_ctx_t
*,dim_decl_t
*);
104 static statement_t
*new_while_statement(parser_ctx_t
*,statement_type_t
,expression_t
*,statement_t
*);
105 static statement_t
*new_forto_statement(parser_ctx_t
*,const WCHAR
*,expression_t
*,expression_t
*,expression_t
*,statement_t
*);
106 static statement_t
*new_foreach_statement(parser_ctx_t
*,const WCHAR
*,expression_t
*,statement_t
*);
107 static statement_t
*new_if_statement(parser_ctx_t
*,expression_t
*,statement_t
*,elseif_decl_t
*,statement_t
*);
108 static statement_t
*new_function_statement(parser_ctx_t
*,function_decl_t
*);
109 static statement_t
*new_onerror_statement(parser_ctx_t
*,BOOL
);
110 static statement_t
*new_const_statement(parser_ctx_t
*,const_decl_t
*);
111 static statement_t
*new_select_statement(parser_ctx_t
*,expression_t
*,case_clausule_t
*);
113 static dim_decl_t
*new_dim_decl(parser_ctx_t
*,const WCHAR
*,BOOL
,dim_list_t
*);
114 static dim_list_t
*new_dim(parser_ctx_t
*,unsigned,dim_list_t
*);
115 static elseif_decl_t
*new_elseif_decl(parser_ctx_t
*,expression_t
*,statement_t
*);
116 static function_decl_t
*new_function_decl(parser_ctx_t
*,const WCHAR
*,function_type_t
,unsigned,arg_decl_t
*,statement_t
*);
117 static arg_decl_t
*new_argument_decl(parser_ctx_t
*,const WCHAR
*,BOOL
);
118 static const_decl_t
*new_const_decl(parser_ctx_t
*,const WCHAR
*,expression_t
*);
119 static case_clausule_t
*new_case_clausule(parser_ctx_t
*,expression_t
*,statement_t
*,case_clausule_t
*);
121 static class_decl_t
*new_class_decl(parser_ctx_t
*);
122 static class_decl_t
*add_class_function(parser_ctx_t
*,class_decl_t
*,function_decl_t
*);
123 static class_decl_t
*add_dim_prop(parser_ctx_t
*,class_decl_t
*,dim_decl_t
*,unsigned);
125 static statement_t
*link_statements(statement_t
*,statement_t
*);
127 static const WCHAR propertyW
[] = {'p','r','o','p','e','r','t','y',0};
129 #define STORAGE_IS_PRIVATE 1
130 #define STORAGE_IS_DEFAULT 2
132 #define CHECK_ERROR if(((parser_ctx_t*)ctx)->hres != S_OK) YYABORT
136 /* Line 268 of yacc.c */
137 #line 144 "parser.tab.c"
139 /* Enabling traces. */
144 /* Enabling verbose error messages. */
145 #ifdef YYERROR_VERBOSE
146 # undef YYERROR_VERBOSE
147 # define YYERROR_VERBOSE 1
149 # define YYERROR_VERBOSE 0
152 /* Enabling the token table. */
153 #ifndef YYTOKEN_TABLE
154 # define YYTOKEN_TABLE 0
161 /* Put the tokens into the symbol table, so that GDB and other debuggers
167 tEMPTYBRACKETS
= 261,
237 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
238 typedef union YYSTYPE
241 /* Line 293 of yacc.c */
245 statement_t
*statement
;
246 expression_t
*expression
;
247 member_expression_t
*member
;
248 elseif_decl_t
*elseif
;
249 dim_decl_t
*dim_decl
;
250 dim_list_t
*dim_list
;
251 function_decl_t
*func_decl
;
252 arg_decl_t
*arg_decl
;
253 class_decl_t
*class_decl
;
254 const_decl_t
*const_decl
;
255 case_clausule_t
*case_clausule
;
263 /* Line 293 of yacc.c */
264 #line 271 "parser.tab.c"
266 # define YYSTYPE_IS_TRIVIAL 1
267 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
268 # define YYSTYPE_IS_DECLARED 1
272 /* Copy the second part of user declarations. */
275 /* Line 343 of yacc.c */
276 #line 283 "parser.tab.c"
283 typedef YYTYPE_UINT8 yytype_uint8
;
285 typedef unsigned char yytype_uint8
;
289 typedef YYTYPE_INT8 yytype_int8
;
290 #elif (defined __STDC__ || defined __C99__FUNC__ \
291 || defined __cplusplus || defined _MSC_VER)
292 typedef signed char yytype_int8
;
294 typedef short int yytype_int8
;
298 typedef YYTYPE_UINT16 yytype_uint16
;
300 typedef unsigned short int yytype_uint16
;
304 typedef YYTYPE_INT16 yytype_int16
;
306 typedef short int yytype_int16
;
310 # ifdef __SIZE_TYPE__
311 # define YYSIZE_T __SIZE_TYPE__
312 # elif defined size_t
313 # define YYSIZE_T size_t
314 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
315 || defined __cplusplus || defined _MSC_VER)
316 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
317 # define YYSIZE_T size_t
319 # define YYSIZE_T unsigned int
323 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
326 # if defined YYENABLE_NLS && YYENABLE_NLS
328 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
329 # define YY_(msgid) dgettext ("bison-runtime", msgid)
333 # define YY_(msgid) msgid
337 /* Suppress unused-variable warnings by "using" E. */
338 #if ! defined lint || defined __GNUC__
339 # define YYUSE(e) ((void) (e))
341 # define YYUSE(e) /* empty */
344 /* Identity function, used to suppress warnings about constant conditions. */
348 #if (defined __STDC__ || defined __C99__FUNC__ \
349 || defined __cplusplus || defined _MSC_VER)
362 #if ! defined yyoverflow || YYERROR_VERBOSE
364 /* The parser invokes alloca or malloc; define the necessary symbols. */
366 # ifdef YYSTACK_USE_ALLOCA
367 # if YYSTACK_USE_ALLOCA
369 # define YYSTACK_ALLOC __builtin_alloca
370 # elif defined __BUILTIN_VA_ARG_INCR
371 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
373 # define YYSTACK_ALLOC __alloca
374 # elif defined _MSC_VER
375 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
376 # define alloca _alloca
378 # define YYSTACK_ALLOC alloca
379 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
380 || defined __cplusplus || defined _MSC_VER)
381 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
382 # ifndef EXIT_SUCCESS
383 # define EXIT_SUCCESS 0
390 # ifdef YYSTACK_ALLOC
391 /* Pacify GCC's `empty if-body' warning. */
392 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
393 # ifndef YYSTACK_ALLOC_MAXIMUM
394 /* The OS might guarantee only one guard page at the bottom of the stack,
395 and a page size can be as small as 4096 bytes. So we cannot safely
396 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
397 to allow for a few compiler-allocated temporary stack slots. */
398 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
401 # define YYSTACK_ALLOC YYMALLOC
402 # define YYSTACK_FREE YYFREE
403 # ifndef YYSTACK_ALLOC_MAXIMUM
404 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
406 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
407 && ! ((defined YYMALLOC || defined malloc) \
408 && (defined YYFREE || defined free)))
409 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
410 # ifndef EXIT_SUCCESS
411 # define EXIT_SUCCESS 0
415 # define YYMALLOC malloc
416 # if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
417 || defined __cplusplus || defined _MSC_VER)
418 void *malloc (YYSIZE_T
); /* INFRINGES ON USER NAME SPACE */
423 # if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
424 || defined __cplusplus || defined _MSC_VER)
425 void free (void *); /* INFRINGES ON USER NAME SPACE */
429 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
432 #if (! defined yyoverflow \
433 && (! defined __cplusplus \
434 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
436 /* A type that is properly aligned for any stack member. */
439 yytype_int16 yyss_alloc
;
443 /* The size of the maximum gap between one aligned stack and the next. */
444 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
446 /* The size of an array large to enough to hold all stacks, each with
448 # define YYSTACK_BYTES(N) \
449 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
450 + YYSTACK_GAP_MAXIMUM)
452 # define YYCOPY_NEEDED 1
454 /* Relocate STACK from its old location to the new one. The
455 local variables YYSIZE and YYSTACKSIZE give the old and new number of
456 elements in the stack, and YYPTR gives the new location of the
457 stack. Advance YYPTR to a properly aligned location for the next
459 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
462 YYSIZE_T yynewbytes; \
463 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
464 Stack = &yyptr->Stack_alloc; \
465 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
466 yyptr += yynewbytes / sizeof (*yyptr); \
472 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
473 /* Copy COUNT objects from FROM to TO. The source and destination do
476 # if defined __GNUC__ && 1 < __GNUC__
477 # define YYCOPY(To, From, Count) \
478 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
480 # define YYCOPY(To, From, Count) \
484 for (yyi = 0; yyi < (Count); yyi++) \
485 (To)[yyi] = (From)[yyi]; \
490 #endif /* !YYCOPY_NEEDED */
492 /* YYFINAL -- State number of the termination state. */
494 /* YYLAST -- Last index in YYTABLE. */
497 /* YYNTOKENS -- Number of terminals. */
499 /* YYNNTS -- Number of nonterminals. */
501 /* YYNRULES -- Number of rules. */
503 /* YYNRULES -- Number of states. */
504 #define YYNSTATES 335
506 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
508 #define YYMAXUTOK 325
510 #define YYTRANSLATE(YYX) \
511 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
513 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
514 static const yytype_uint8 yytranslate
[] =
516 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
517 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
518 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
519 2, 2, 2, 2, 2, 2, 2, 2, 81, 2,
520 76, 77, 84, 82, 75, 78, 74, 85, 73, 2,
521 2, 2, 2, 2, 2, 2, 2, 2, 71, 2,
522 80, 72, 79, 2, 2, 2, 2, 2, 2, 2,
523 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
524 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
525 2, 2, 83, 2, 86, 2, 2, 2, 2, 2,
526 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
527 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
528 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
529 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
530 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
531 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
532 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
533 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
534 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
535 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
536 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
537 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
538 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
539 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
540 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
541 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
542 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
543 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
544 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
545 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
546 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
547 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
548 65, 66, 67, 68, 69, 70
552 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
554 static const yytype_uint16 yyprhs
[] =
556 0, 0, 3, 7, 8, 12, 13, 16, 19, 20,
557 22, 24, 27, 30, 32, 35, 37, 41, 44, 47,
558 51, 56, 59, 61, 67, 74, 81, 86, 88, 91,
559 94, 97, 100, 103, 109, 111, 116, 121, 124, 135,
560 144, 152, 154, 158, 160, 164, 166, 171, 174, 176,
561 180, 182, 186, 190, 192, 195, 197, 199, 200, 203,
562 213, 218, 226, 227, 230, 231, 233, 235, 238, 244,
563 245, 249, 250, 255, 261, 263, 267, 269, 271, 272,
564 274, 276, 280, 282, 286, 288, 292, 294, 298, 300,
565 304, 306, 310, 312, 315, 317, 321, 325, 329, 333,
566 337, 341, 345, 347, 351, 353, 357, 361, 363, 367,
567 369, 373, 375, 379, 383, 385, 389, 391, 393, 396,
568 399, 401, 404, 406, 408, 410, 412, 414, 416, 418,
569 420, 422, 424, 426, 428, 430, 432, 436, 438, 446,
570 447, 451, 456, 461, 465, 475, 487, 499, 508, 517,
571 518, 520, 523, 525, 527, 529, 533, 535, 539, 542,
572 546, 550, 552, 554, 556
575 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
576 static const yytype_int16 yyrhs
[] =
578 88, 0, -1, 89, 90, 3, -1, -1, 48, 49,
579 4, -1, -1, 90, 93, -1, 90, 135, -1, -1,
580 92, -1, 93, -1, 93, 92, -1, 94, 4, -1,
581 71, -1, 71, 94, -1, 95, -1, 95, 71, 94,
582 -1, 95, 71, -1, 96, 113, -1, 20, 96, 112,
583 -1, 96, 112, 72, 116, -1, 21, 97, -1, 105,
584 -1, 34, 116, 4, 91, 35, -1, 36, 103, 116,
585 4, 91, 37, -1, 36, 4, 91, 37, 103, 116,
586 -1, 36, 4, 91, 37, -1, 138, -1, 33, 36,
587 -1, 33, 39, -1, 33, 23, -1, 33, 24, -1,
588 33, 22, -1, 55, 96, 112, 72, 116, -1, 50,
589 -1, 63, 61, 64, 62, -1, 63, 61, 65, 73,
590 -1, 27, 100, -1, 39, 144, 72, 116, 40, 116,
591 104, 4, 91, 62, -1, 39, 42, 144, 43, 116,
592 4, 91, 62, -1, 44, 45, 116, 145, 111, 31,
593 44, -1, 144, -1, 130, 74, 144, -1, 98, -1,
594 98, 75, 97, -1, 144, -1, 144, 76, 99, 77,
595 -1, 144, 6, -1, 133, -1, 133, 75, 99, -1,
596 101, -1, 101, 75, 100, -1, 144, 72, 102, -1,
597 131, -1, 78, 132, -1, 34, -1, 38, -1, -1,
598 41, 116, -1, 28, 116, 32, 4, 91, 107, 110,
599 31, 28, -1, 28, 116, 32, 94, -1, 28, 116,
600 32, 94, 29, 94, 106, -1, -1, 31, 28, -1,
601 -1, 108, -1, 109, -1, 109, 108, -1, 30, 116,
602 32, 4, 91, -1, -1, 29, 4, 91, -1, -1,
603 45, 29, 145, 92, -1, 45, 115, 145, 91, 111,
604 -1, 114, -1, 76, 115, 77, -1, 114, -1, 115,
605 -1, -1, 6, -1, 116, -1, 116, 75, 115, -1,
606 117, -1, 116, 14, 117, -1, 118, -1, 117, 13,
607 118, -1, 119, -1, 118, 12, 119, -1, 120, -1,
608 119, 11, 120, -1, 121, -1, 120, 10, 121, -1,
609 122, -1, 9, 121, -1, 123, -1, 122, 72, 123,
610 -1, 122, 15, 123, -1, 122, 79, 123, -1, 122,
611 80, 123, -1, 122, 18, 123, -1, 122, 17, 123,
612 -1, 122, 16, 123, -1, 124, -1, 123, 81, 124,
613 -1, 125, -1, 124, 82, 125, -1, 124, 78, 125,
614 -1, 126, -1, 125, 19, 126, -1, 127, -1, 126,
615 83, 127, -1, 128, -1, 127, 84, 128, -1, 127,
616 85, 128, -1, 129, -1, 128, 86, 129, -1, 131,
617 -1, 130, -1, 56, 144, -1, 78, 129, -1, 134,
618 -1, 96, 112, -1, 7, -1, 8, -1, 67, -1,
619 132, -1, 52, -1, 53, -1, 51, -1, 69, -1,
620 73, -1, 68, -1, 70, -1, 69, -1, 73, -1,
621 68, -1, 76, 116, 77, -1, 60, -1, 54, 144,
622 4, 136, 31, 54, 4, -1, -1, 138, 4, 136,
623 -1, 140, 66, 4, 136, -1, 21, 98, 4, 136,
624 -1, 137, 4, 136, -1, 139, 24, 25, 66, 114,
625 4, 91, 31, 24, -1, 139, 24, 26, 66, 76,
626 143, 77, 4, 91, 31, 24, -1, 139, 24, 55,
627 66, 76, 143, 77, 4, 91, 31, 24, -1, 139,
628 22, 144, 141, 4, 91, 31, 22, -1, 139, 23,
629 144, 141, 4, 91, 31, 23, -1, -1, 140, -1,
630 57, 59, -1, 57, -1, 58, -1, 114, -1, 76,
631 142, 77, -1, 143, -1, 143, 75, 142, -1, 144,
632 114, -1, 46, 144, 114, -1, 47, 144, 114, -1,
633 66, -1, 24, -1, 4, -1, 71, -1
636 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
637 static const yytype_uint16 yyrline
[] =
639 0, 147, 147, 150, 151, 153, 155, 156, 159, 160,
640 163, 164, 167, 170, 171, 172, 173, 174, 177, 178,
641 179, 181, 182, 183, 185, 188, 191, 192, 193, 194,
642 195, 196, 197, 198, 200, 201, 202, 203, 204, 206,
643 208, 212, 213, 216, 217, 220, 221, 222, 225, 226,
644 229, 230, 233, 236, 237, 240, 241, 244, 245, 248,
645 250, 251, 254, 256, 259, 260, 263, 264, 267, 271,
646 272, 275, 276, 277, 281, 282, 285, 286, 288, 290,
647 293, 294, 297, 298, 301, 302, 305, 306, 309, 310,
648 313, 314, 317, 318, 321, 322, 323, 324, 325, 326,
649 327, 328, 331, 332, 335, 336, 337, 340, 341, 344,
650 345, 349, 350, 352, 356, 357, 360, 361, 362, 363,
651 366, 367, 370, 371, 372, 373, 374, 375, 376, 379,
652 380, 381, 382, 385, 386, 387, 390, 391, 394, 397,
653 398, 400, 402, 403, 406, 408, 410, 414, 416, 420,
654 421, 424, 425, 426, 429, 430, 433, 434, 437, 438,
655 439, 443, 444, 448, 449
659 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
660 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
661 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
662 static const char *const yytname
[] =
664 "$end", "error", "$undefined", "tEOF", "tNL", "tREM", "tEMPTYBRACKETS",
665 "tTRUE", "tFALSE", "tNOT", "tAND", "tOR", "tXOR", "tEQV", "tIMP", "tNEQ",
666 "tIS", "tLTEQ", "tGTEQ", "tMOD", "tCALL", "tDIM", "tSUB", "tFUNCTION",
667 "tPROPERTY", "tGET", "tLET", "tCONST", "tIF", "tELSE", "tELSEIF", "tEND",
668 "tTHEN", "tEXIT", "tWHILE", "tWEND", "tDO", "tLOOP", "tUNTIL", "tFOR",
669 "tTO", "tSTEP", "tEACH", "tIN", "tSELECT", "tCASE", "tBYREF", "tBYVAL",
670 "tOPTION", "tEXPLICIT", "tSTOP", "tNOTHING", "tEMPTY", "tNULL", "tCLASS",
671 "tSET", "tNEW", "tPUBLIC", "tPRIVATE", "tDEFAULT", "tME", "tERROR",
672 "tNEXT", "tON", "tRESUME", "tGOTO", "tIdentifier", "tString", "tLong",
673 "tShort", "tDouble", "':'", "'='", "'0'", "'.'", "','", "'('", "')'",
674 "'-'", "'>'", "'<'", "'&'", "'+'", "'\\\\'", "'*'", "'/'", "'^'",
675 "$accept", "Program", "OptionExplicit_opt", "SourceElements",
676 "StatementsNl_opt", "StatementsNl", "StatementNl", "Statement",
677 "SimpleStatement", "MemberExpression", "DimDeclList", "DimDecl",
678 "DimList", "ConstDeclList", "ConstDecl", "ConstExpression", "DoType",
679 "Step_opt", "IfStatement", "EndIf_opt", "ElseIfs_opt", "ElseIfs",
680 "ElseIf", "Else_opt", "CaseClausules", "Arguments_opt",
681 "ArgumentList_opt", "EmptyBrackets_opt", "ExpressionList", "Expression",
682 "EqvExpression", "XorExpression", "OrExpression", "AndExpression",
683 "NotExpression", "EqualityExpression", "ConcatExpression",
684 "AdditiveExpression", "ModExpression", "IntdivExpression",
685 "MultiplicativeExpression", "ExpExpression", "UnaryExpression",
686 "CallExpression", "LiteralExpression", "NumericLiteralExpression",
687 "IntegerValue", "PrimaryExpression", "ClassDeclaration", "ClassBody",
688 "PropertyDecl", "FunctionDecl", "Storage_opt", "Storage",
689 "ArgumentsDecl_opt", "ArgumentDeclList", "ArgumentDecl", "Identifier",
695 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
697 static const yytype_uint16 yytoknum
[] =
699 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
700 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
701 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
702 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
703 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
704 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
705 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
706 325, 58, 61, 48, 46, 44, 40, 41, 45, 62,
707 60, 38, 43, 92, 42, 47, 94
711 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
712 static const yytype_uint8 yyr1
[] =
714 0, 87, 88, 89, 89, 90, 90, 90, 91, 91,
715 92, 92, 93, 94, 94, 94, 94, 94, 95, 95,
716 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
717 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
718 95, 96, 96, 97, 97, 98, 98, 98, 99, 99,
719 100, 100, 101, 102, 102, 103, 103, 104, 104, 105,
720 105, 105, 106, 106, 107, 107, 108, 108, 109, 110,
721 110, 111, 111, 111, 112, 112, 113, 113, 114, 114,
722 115, 115, 116, 116, 117, 117, 118, 118, 119, 119,
723 120, 120, 121, 121, 122, 122, 122, 122, 122, 122,
724 122, 122, 123, 123, 124, 124, 124, 125, 125, 126,
725 126, 127, 127, 127, 128, 128, 129, 129, 129, 129,
726 130, 130, 131, 131, 131, 131, 131, 131, 131, 132,
727 132, 132, 132, 133, 133, 133, 134, 134, 135, 136,
728 136, 136, 136, 136, 137, 137, 137, 138, 138, 139,
729 139, 140, 140, 140, 141, 141, 142, 142, 143, 143,
730 143, 144, 144, 145, 145
733 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
734 static const yytype_uint8 yyr2
[] =
736 0, 2, 3, 0, 3, 0, 2, 2, 0, 1,
737 1, 2, 2, 1, 2, 1, 3, 2, 2, 3,
738 4, 2, 1, 5, 6, 6, 4, 1, 2, 2,
739 2, 2, 2, 5, 1, 4, 4, 2, 10, 8,
740 7, 1, 3, 1, 3, 1, 4, 2, 1, 3,
741 1, 3, 3, 1, 2, 1, 1, 0, 2, 9,
742 4, 7, 0, 2, 0, 1, 1, 2, 5, 0,
743 3, 0, 4, 5, 1, 3, 1, 1, 0, 1,
744 1, 3, 1, 3, 1, 3, 1, 3, 1, 3,
745 1, 3, 1, 2, 1, 3, 3, 3, 3, 3,
746 3, 3, 1, 3, 1, 3, 3, 1, 3, 1,
747 3, 1, 3, 3, 1, 3, 1, 1, 2, 2,
748 1, 2, 1, 1, 1, 1, 1, 1, 1, 1,
749 1, 1, 1, 1, 1, 1, 3, 1, 7, 0,
750 3, 4, 4, 3, 9, 11, 11, 8, 8, 0,
751 1, 2, 1, 1, 1, 3, 1, 3, 2, 3,
755 /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
756 Performed when YYTABLE doesn't specify something else to do. Zero
757 means the default is an error. */
758 static const yytype_uint8 yydefact
[] =
760 3, 0, 0, 5, 0, 1, 149, 4, 2, 0,
761 0, 162, 0, 0, 0, 0, 0, 0, 0, 34,
762 0, 0, 152, 153, 137, 0, 161, 13, 0, 6,
763 0, 15, 78, 22, 0, 120, 7, 27, 0, 150,
764 41, 78, 21, 43, 45, 37, 50, 0, 122, 123,
765 0, 128, 126, 127, 0, 124, 131, 129, 132, 130,
766 0, 78, 0, 82, 84, 86, 88, 90, 92, 94,
767 102, 104, 107, 109, 111, 114, 117, 116, 125, 32,
768 30, 31, 28, 29, 0, 149, 55, 56, 0, 0,
769 0, 0, 0, 78, 151, 0, 14, 0, 12, 17,
770 79, 0, 121, 18, 76, 77, 80, 0, 0, 0,
771 0, 19, 74, 0, 47, 0, 0, 0, 93, 118,
772 119, 121, 0, 149, 0, 0, 0, 0, 0, 0,
773 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
774 0, 0, 0, 149, 0, 9, 10, 0, 0, 0,
775 0, 149, 121, 0, 0, 136, 16, 0, 0, 0,
776 0, 42, 78, 78, 44, 135, 133, 134, 0, 48,
777 51, 0, 52, 53, 83, 8, 60, 85, 87, 89,
778 91, 96, 101, 100, 99, 95, 97, 98, 103, 106,
779 105, 108, 110, 112, 113, 115, 0, 26, 11, 149,
780 0, 0, 163, 164, 71, 0, 0, 0, 0, 0,
781 150, 0, 35, 36, 75, 20, 81, 0, 154, 0,
782 0, 46, 0, 54, 64, 149, 23, 0, 0, 0,
783 0, 0, 0, 0, 0, 149, 149, 0, 0, 33,
784 0, 0, 0, 156, 78, 149, 149, 49, 0, 69,
785 65, 66, 62, 25, 24, 149, 57, 0, 0, 0,
786 149, 0, 143, 140, 0, 0, 0, 149, 78, 78,
787 155, 0, 158, 0, 0, 0, 0, 0, 67, 0,
788 61, 0, 0, 0, 149, 8, 40, 142, 138, 78,
789 0, 0, 141, 159, 160, 157, 0, 0, 0, 149,
790 0, 63, 39, 58, 149, 72, 71, 0, 0, 0,
791 147, 148, 8, 70, 59, 0, 73, 149, 0, 0,
792 68, 38, 0, 0, 0, 0, 149, 149, 144, 0,
796 /* YYDEFGOTO[NTERM-NUM]. */
797 static const yytype_int16 yydefgoto
[] =
799 -1, 2, 3, 6, 144, 145, 146, 30, 31, 61,
800 42, 43, 168, 45, 46, 172, 88, 283, 33, 280,
801 249, 250, 251, 277, 232, 102, 103, 112, 157, 106,
802 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
803 73, 74, 75, 76, 77, 78, 169, 35, 36, 206,
804 207, 37, 38, 39, 219, 242, 243, 40, 204
807 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
809 #define YYPACT_NINF -146
810 static const yytype_int16 yypact
[] =
812 -13, 2, 57, -146, 39, -146, 307, -146, -146, 1,
813 -2, -146, -2, 468, 184, 468, 20, -11, 15, -146,
814 -2, 1, 40, -146, -146, 62, -146, 557, 468, -146,
815 59, 84, 388, -146, 94, -146, -146, -146, 109, -146,
816 -146, 4, -146, 101, 8, -146, 106, 111, -146, -146,
817 468, -146, -146, -146, -2, -146, -146, -146, -146, -146,
818 498, 4, 27, 175, 182, 188, 191, -146, 29, 124,
819 38, 193, 130, 68, 129, -146, 94, -146, -146, -146,
820 -146, -146, -146, -146, 24, 598, -146, -146, 468, -2,
821 145, 468, 214, 4, -146, 95, -146, 5, -146, 557,
822 -146, 468, 152, -146, 64, -146, 19, -2, -2, -2,
823 468, 161, -146, -2, -146, 45, -2, 97, -146, -146,
824 -146, -146, 468, 348, 468, 468, 468, 468, 498, 498,
825 498, 498, 498, 498, 498, 498, 498, 498, 498, 498,
826 498, 498, 498, 651, 199, -146, 557, 48, 194, 468,
827 16, 120, 166, 181, 172, -146, -146, 169, 35, 468,
828 468, -146, 10, 10, -146, -146, -146, -146, 170, 173,
829 -146, 117, -146, -146, 175, 557, 221, 182, 188, 191,
830 -146, 124, 124, 124, 124, 124, 124, 124, 38, 193,
831 193, 130, 68, 129, 129, -146, 217, 73, -146, 598,
832 468, 121, -146, -146, 208, -2, 223, 252, 255, 150,
833 195, 468, -146, -146, -146, 246, -146, 26, -146, 258,
834 259, -146, 45, -146, 234, 786, -146, 468, 228, 61,
835 468, 418, 236, 266, 218, 120, 120, 14, 267, 246,
836 -2, -2, 196, 200, 268, 692, 692, -146, 468, 247,
837 -146, 234, 253, 246, -146, 733, 12, 7, 7, 233,
838 120, 279, -146, -146, 220, 224, 225, 120, 268, 268,
839 -146, 26, -146, 256, 261, 34, 290, 265, -146, 269,
840 -146, 237, 468, 297, 786, 557, -146, -146, -146, 268,
841 226, 229, -146, -146, -146, -146, 282, 284, 305, 692,
842 286, -146, -146, 246, 733, -146, 208, 308, 26, 26,
843 -146, -146, 557, -146, -146, 254, -146, 692, 238, 240,
844 -146, -146, 287, 315, 320, 306, 692, 692, -146, 298,
845 301, 309, 312, -146, -146
848 /* YYPGOTO[NTERM-NUM]. */
849 static const yytype_int16 yypgoto
[] =
851 -146, -146, -146, -146, -101, -137, 332, -23, -146, -6,
852 231, 134, 123, 232, -146, -146, 153, -146, -146, -146,
853 -146, 91, -146, -146, 41, -5, -146, 0, -31, 55,
854 227, 230, 235, 245, -42, -146, 99, 239, 43, 215,
855 216, 51, -53, -4, 241, 185, -146, -146, -146, -78,
856 -146, -145, -139, -133, 203, 88, -112, 17, -48
859 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
860 positive, shift that token. If negative, reduce the rule which
861 number is the opposite. If YYTABLE_NINF, syntax error. */
862 #define YYTABLE_NINF -150
863 static const yytype_int16 yytable
[] =
865 32, 105, 34, 41, 96, 34, 208, 120, 118, 198,
866 100, 202, 209, 11, 114, 93, 100, 34, 210, 122,
867 202, 32, 11, 34, 85, 11, 122, 44, 143, 47,
868 122, 89, 104, 122, 90, 1, 111, 92, 122, 264,
869 265, 122, 196, 7, 128, 129, 130, 131, 122, 122,
870 11, 4, 199, 282, 86, 26, 121, 5, 87, 123,
871 91, 24, 122, 98, 26, 255, 298, 26, 62, 266,
872 84, 119, 240, 241, 224, 122, 156, 28, 203, 32,
873 110, 34, 155, 97, 115, 180, 217, 203, 152, 195,
874 208, 208, 26, 32, 160, 34, 209, 209, 228, 94,
875 176, 132, 210, 210, 48, 49, 148, 86, 133, 134,
876 160, 87, 155, 165, 166, 208, 136, 32, 167, 34,
877 137, 209, 208, 95, 161, 162, 163, 210, 209, 216,
878 44, 108, 109, 47, 210, 122, -74, 32, -74, 34,
879 32, 205, 34, 147, 273, 274, 150, 305, 51, 52,
880 53, -139, 140, 141, 281, 99, 158, 262, 263, 153,
881 154, 230, 218, 218, 55, 56, 57, 58, 107, 32,
882 59, 34, 108, 109, 237, 171, 113, 22, 23, 189,
883 190, 116, 287, 117, 306, 56, 57, 58, 124, 292,
884 59, 193, 194, 32, 125, 34, 318, 319, 313, 126,
885 258, 127, 252, 315, 201, 135, 79, 80, 81, 284,
886 285, 320, 138, 139, 215, 142, 322, 149, 151, 32,
887 82, 34, 44, 83, 159, 329, 330, 181, 182, 183,
888 184, 185, 186, 187, 244, -121, 197, 200, 211, 32,
889 32, 34, 34, 212, 272, 213, 214, 221, 222, 32,
890 225, 34, 226, 231, 234, 229, 235, 268, 269, 236,
891 122, 238, 245, 246, 248, 254, 239, 259, 293, 294,
892 260, 267, 261, 270, 100, 271, 276, 286, 32, 32,
893 34, 34, 253, 288, 279, 256, 289, 296, 244, 307,
894 290, 291, 297, 32, 299, 34, 300, 301, 32, 302,
895 34, 304, 308, 275, 310, 309, 32, 311, 34, 312,
896 8, 32, 317, 34, 314, 323, 321, 324, 325, 326,
897 32, 32, 34, 34, 327, 244, 244, 9, 10, 331,
898 328, 11, 332, 333, 12, 13, 334, 303, 29, 233,
899 14, 15, 278, 16, 164, 247, 17, 316, 170, 174,
900 227, 18, 175, 191, 177, 192, 223, 19, 173, 295,
901 178, 20, 21, 0, 22, 23, 220, 24, 9, 10,
902 25, 179, 11, 26, 188, 12, 13, 0, 27, 0,
903 0, 14, 15, 28, 16, 0, 0, 17, 0, 0,
904 0, 0, 18, 0, 100, 48, 49, 50, 19, 0,
905 0, 0, 0, 21, 0, 22, 23, 0, 24, 0,
906 0, 25, 11, 0, 26, 0, 0, 0, 0, 27,
907 0, 0, 0, 0, 28, 48, 49, 50, 0, 0,
908 0, 0, 0, 0, 0, 0, 0, 0, 0, 51,
909 52, 53, 11, 0, 54, 0, 0, 257, 24, 0,
910 0, 0, 0, 0, 26, 55, 56, 57, 58, 0,
911 0, 59, 0, 0, 101, 0, 60, 0, 0, 51,
912 52, 53, 0, 0, 54, 48, 49, 50, 24, 0,
913 0, 0, 0, 0, 26, 55, 56, 57, 58, 0,
914 0, 59, 11, 0, 28, 0, 60, 0, 0, 0,
915 0, 0, 0, 0, 0, 48, 49, 0, 0, 0,
916 0, 0, 0, 0, 0, 0, 0, 0, 0, 51,
917 52, 53, 11, 0, 54, 0, 0, 0, 24, 0,
918 0, 0, 0, 0, 26, 55, 56, 57, 58, 0,
919 0, 59, 0, 0, 28, 0, 60, 0, 0, 51,
920 52, 53, 0, 0, 54, 0, 0, 0, 24, 0,
921 0, 0, 0, 0, 26, 55, 56, 57, 58, 0,
922 0, 59, 0, 0, 28, 0, 60, 9, 10, -149,
923 -149, 11, 0, 0, 12, 13, 0, 0, 0, 0,
924 14, 15, 0, 16, 0, 0, 17, 0, 0, 0,
925 0, 18, 0, 0, 0, 0, 0, 19, 0, 0,
926 0, 0, 21, 0, 22, 23, 0, 24, 9, 10,
927 25, 0, 11, 26, 0, 12, 13, 0, 27, 0,
928 0, 14, 15, 28, 16, -8, 0, 17, 0, 0,
929 0, 0, 18, 0, 0, 0, 0, 0, 19, 0,
930 0, 0, 0, 21, 0, 22, 23, 0, 24, 0,
931 0, 25, 0, 0, 26, 0, 0, 0, 0, 27,
932 0, 9, 10, 0, 28, 11, 0, 0, 12, 13,
933 0, 0, 0, 0, 14, 15, -8, 16, 0, 0,
934 17, 0, 0, 0, 0, 18, 0, 0, 0, 0,
935 0, 19, 0, 0, 0, 0, 21, 0, 22, 23,
936 0, 24, 9, 10, 25, 0, 11, 26, 0, 12,
937 13, 0, 27, -8, 0, 14, 15, 28, 16, 0,
938 0, 17, 0, 0, 0, 0, 18, 0, 0, 0,
939 0, 0, 19, 0, 0, 0, 0, 21, 0, 22,
940 23, 0, 24, 9, 10, 25, 0, 11, 26, 0,
941 12, 13, 0, 27, 0, 0, 14, 15, 28, 16,
942 0, 0, 17, 0, 0, 0, 0, 18, 0, 0,
943 0, 0, 0, 19, 0, 0, 0, 0, 21, 0,
944 22, 23, 0, 24, 0, -8, 25, 0, 0, 26,
945 0, 0, 0, 0, 27, 0, 9, 10, 0, 28,
946 11, 0, 0, 12, 13, 0, 0, 0, 0, 14,
947 15, 0, 16, 0, 0, 17, 0, 0, 0, 0,
948 18, 0, 0, 0, 0, 0, 19, 0, 0, 0,
949 0, 21, 0, 22, 23, 0, 24, 0, 0, 25,
950 0, 0, 26, 0, 0, 0, 0, 27, 0, 0,
954 #define yypact_value_is_default(yystate) \
955 ((yystate) == (-146))
957 #define yytable_value_is_error(yytable_value) \
960 static const yytype_int16 yycheck
[] =
962 6, 32, 6, 9, 27, 9, 151, 60, 50, 146,
963 6, 4, 151, 24, 6, 21, 6, 21, 151, 14,
964 4, 27, 24, 27, 4, 24, 14, 10, 4, 12,
965 14, 42, 32, 14, 17, 48, 41, 20, 14, 25,
966 26, 14, 143, 4, 15, 16, 17, 18, 14, 14,
967 24, 49, 4, 41, 34, 66, 61, 0, 38, 32,
968 45, 60, 14, 4, 66, 4, 32, 66, 13, 55,
969 15, 54, 46, 47, 175, 14, 99, 76, 71, 85,
970 76, 85, 77, 28, 76, 127, 76, 71, 93, 142,
971 235, 236, 66, 99, 75, 99, 235, 236, 199, 59,
972 123, 72, 235, 236, 7, 8, 89, 34, 79, 80,
973 75, 38, 77, 68, 69, 260, 78, 123, 73, 123,
974 82, 260, 267, 61, 107, 108, 109, 260, 267, 160,
975 113, 22, 23, 116, 267, 14, 72, 143, 74, 143,
976 146, 21, 146, 88, 245, 246, 91, 284, 51, 52,
977 53, 31, 84, 85, 255, 71, 101, 235, 236, 64,
978 65, 40, 162, 163, 67, 68, 69, 70, 74, 175,
979 73, 175, 22, 23, 24, 78, 75, 57, 58, 136,
980 137, 75, 260, 72, 285, 68, 69, 70, 13, 267,
981 73, 140, 141, 199, 12, 199, 308, 309, 299, 11,
982 231, 10, 225, 304, 149, 81, 22, 23, 24, 257,
983 258, 312, 19, 83, 159, 86, 317, 72, 4, 225,
984 36, 225, 205, 39, 72, 326, 327, 128, 129, 130,
985 131, 132, 133, 134, 217, 74, 37, 43, 72, 245,
986 246, 245, 246, 62, 244, 73, 77, 77, 75, 255,
987 29, 255, 35, 45, 31, 200, 4, 240, 241, 4,
988 14, 66, 4, 4, 30, 37, 211, 31, 268, 269,
989 4, 4, 54, 77, 6, 75, 29, 44, 284, 285,
990 284, 285, 227, 4, 31, 230, 66, 31, 271, 289,
991 66, 66, 31, 299, 4, 299, 31, 28, 304, 62,
992 304, 4, 76, 248, 22, 76, 312, 23, 312, 4,
993 3, 317, 4, 317, 28, 77, 62, 77, 31, 4,
994 326, 327, 326, 327, 4, 308, 309, 20, 21, 31,
995 24, 24, 31, 24, 27, 28, 24, 282, 6, 205,
996 33, 34, 251, 36, 113, 222, 39, 306, 116, 122,
997 197, 44, 4, 138, 124, 139, 171, 50, 117, 271,
998 125, 54, 55, -1, 57, 58, 163, 60, 20, 21,
999 63, 126, 24, 66, 135, 27, 28, -1, 71, -1,
1000 -1, 33, 34, 76, 36, -1, -1, 39, -1, -1,
1001 -1, -1, 44, -1, 6, 7, 8, 9, 50, -1,
1002 -1, -1, -1, 55, -1, 57, 58, -1, 60, -1,
1003 -1, 63, 24, -1, 66, -1, -1, -1, -1, 71,
1004 -1, -1, -1, -1, 76, 7, 8, 9, -1, -1,
1005 -1, -1, -1, -1, -1, -1, -1, -1, -1, 51,
1006 52, 53, 24, -1, 56, -1, -1, 29, 60, -1,
1007 -1, -1, -1, -1, 66, 67, 68, 69, 70, -1,
1008 -1, 73, -1, -1, 76, -1, 78, -1, -1, 51,
1009 52, 53, -1, -1, 56, 7, 8, 9, 60, -1,
1010 -1, -1, -1, -1, 66, 67, 68, 69, 70, -1,
1011 -1, 73, 24, -1, 76, -1, 78, -1, -1, -1,
1012 -1, -1, -1, -1, -1, 7, 8, -1, -1, -1,
1013 -1, -1, -1, -1, -1, -1, -1, -1, -1, 51,
1014 52, 53, 24, -1, 56, -1, -1, -1, 60, -1,
1015 -1, -1, -1, -1, 66, 67, 68, 69, 70, -1,
1016 -1, 73, -1, -1, 76, -1, 78, -1, -1, 51,
1017 52, 53, -1, -1, 56, -1, -1, -1, 60, -1,
1018 -1, -1, -1, -1, 66, 67, 68, 69, 70, -1,
1019 -1, 73, -1, -1, 76, -1, 78, 20, 21, 22,
1020 23, 24, -1, -1, 27, 28, -1, -1, -1, -1,
1021 33, 34, -1, 36, -1, -1, 39, -1, -1, -1,
1022 -1, 44, -1, -1, -1, -1, -1, 50, -1, -1,
1023 -1, -1, 55, -1, 57, 58, -1, 60, 20, 21,
1024 63, -1, 24, 66, -1, 27, 28, -1, 71, -1,
1025 -1, 33, 34, 76, 36, 37, -1, 39, -1, -1,
1026 -1, -1, 44, -1, -1, -1, -1, -1, 50, -1,
1027 -1, -1, -1, 55, -1, 57, 58, -1, 60, -1,
1028 -1, 63, -1, -1, 66, -1, -1, -1, -1, 71,
1029 -1, 20, 21, -1, 76, 24, -1, -1, 27, 28,
1030 -1, -1, -1, -1, 33, 34, 35, 36, -1, -1,
1031 39, -1, -1, -1, -1, 44, -1, -1, -1, -1,
1032 -1, 50, -1, -1, -1, -1, 55, -1, 57, 58,
1033 -1, 60, 20, 21, 63, -1, 24, 66, -1, 27,
1034 28, -1, 71, 31, -1, 33, 34, 76, 36, -1,
1035 -1, 39, -1, -1, -1, -1, 44, -1, -1, -1,
1036 -1, -1, 50, -1, -1, -1, -1, 55, -1, 57,
1037 58, -1, 60, 20, 21, 63, -1, 24, 66, -1,
1038 27, 28, -1, 71, -1, -1, 33, 34, 76, 36,
1039 -1, -1, 39, -1, -1, -1, -1, 44, -1, -1,
1040 -1, -1, -1, 50, -1, -1, -1, -1, 55, -1,
1041 57, 58, -1, 60, -1, 62, 63, -1, -1, 66,
1042 -1, -1, -1, -1, 71, -1, 20, 21, -1, 76,
1043 24, -1, -1, 27, 28, -1, -1, -1, -1, 33,
1044 34, -1, 36, -1, -1, 39, -1, -1, -1, -1,
1045 44, -1, -1, -1, -1, -1, 50, -1, -1, -1,
1046 -1, 55, -1, 57, 58, -1, 60, -1, -1, 63,
1047 -1, -1, 66, -1, -1, -1, -1, 71, -1, -1,
1051 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1052 symbol of state STATE-NUM. */
1053 static const yytype_uint8 yystos
[] =
1055 0, 48, 88, 89, 49, 0, 90, 4, 3, 20,
1056 21, 24, 27, 28, 33, 34, 36, 39, 44, 50,
1057 54, 55, 57, 58, 60, 63, 66, 71, 76, 93,
1058 94, 95, 96, 105, 130, 134, 135, 138, 139, 140,
1059 144, 96, 97, 98, 144, 100, 101, 144, 7, 8,
1060 9, 51, 52, 53, 56, 67, 68, 69, 70, 73,
1061 78, 96, 116, 117, 118, 119, 120, 121, 122, 123,
1062 124, 125, 126, 127, 128, 129, 130, 131, 132, 22,
1063 23, 24, 36, 39, 116, 4, 34, 38, 103, 42,
1064 144, 45, 144, 96, 59, 61, 94, 116, 4, 71,
1065 6, 76, 112, 113, 114, 115, 116, 74, 22, 23,
1066 76, 112, 114, 75, 6, 76, 75, 72, 121, 144,
1067 129, 112, 14, 32, 13, 12, 11, 10, 15, 16,
1068 17, 18, 72, 79, 80, 81, 78, 82, 19, 83,
1069 84, 85, 86, 4, 91, 92, 93, 116, 144, 72,
1070 116, 4, 112, 64, 65, 77, 94, 115, 116, 72,
1071 75, 144, 144, 144, 97, 68, 69, 73, 99, 133,
1072 100, 78, 102, 131, 117, 4, 94, 118, 119, 120,
1073 121, 123, 123, 123, 123, 123, 123, 123, 124, 125,
1074 125, 126, 127, 128, 128, 129, 91, 37, 92, 4,
1075 43, 116, 4, 71, 145, 21, 136, 137, 138, 139,
1076 140, 72, 62, 73, 77, 116, 115, 76, 114, 141,
1077 141, 77, 75, 132, 91, 29, 35, 103, 91, 116,
1078 40, 45, 111, 98, 31, 4, 4, 24, 66, 116,
1079 46, 47, 142, 143, 144, 4, 4, 99, 30, 107,
1080 108, 109, 94, 116, 37, 4, 116, 29, 115, 31,
1081 4, 54, 136, 136, 25, 26, 55, 4, 144, 144,
1082 77, 75, 114, 91, 91, 116, 29, 110, 108, 31,
1083 106, 91, 41, 104, 145, 145, 44, 136, 4, 66,
1084 66, 66, 136, 114, 114, 142, 31, 31, 32, 4,
1085 31, 28, 62, 116, 4, 92, 91, 114, 76, 76,
1086 22, 23, 4, 91, 28, 91, 111, 4, 143, 143,
1087 91, 62, 91, 77, 77, 31, 4, 4, 24, 91,
1091 #define yyerrok (yyerrstatus = 0)
1092 #define yyclearin (yychar = YYEMPTY)
1093 #define YYEMPTY (-2)
1096 #define YYACCEPT goto yyacceptlab
1097 #define YYABORT goto yyabortlab
1098 #define YYERROR goto yyerrorlab
1101 /* Like YYERROR except do call yyerror. This remains here temporarily
1102 to ease the transition to the new meaning of YYERROR, for GCC.
1103 Once GCC version 2 has supplanted version 1, this can go. However,
1104 YYFAIL appears to be in use. Nevertheless, it is formally deprecated
1105 in Bison 2.4.2's NEWS entry, where a plan to phase it out is
1108 #define YYFAIL goto yyerrlab
1110 /* This is here to suppress warnings from the GCC cpp's
1111 -Wunused-macros. Normally we don't worry about that warning, but
1112 some users do, and we want to make it easy for users to remove
1113 YYFAIL uses, which will produce warnings from Bison 2.5. */
1116 #define YYRECOVERING() (!!yyerrstatus)
1118 #define YYBACKUP(Token, Value) \
1120 if (yychar == YYEMPTY && yylen == 1) \
1129 yyerror (ctx, YY_("syntax error: cannot back up")); \
1136 #define YYERRCODE 256
1139 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
1140 If N is 0, then set CURRENT to the empty location which ends
1141 the previous symbol: RHS[0] (always defined). */
1143 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
1144 #ifndef YYLLOC_DEFAULT
1145 # define YYLLOC_DEFAULT(Current, Rhs, N) \
1149 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
1150 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
1151 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
1152 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
1156 (Current).first_line = (Current).last_line = \
1157 YYRHSLOC (Rhs, 0).last_line; \
1158 (Current).first_column = (Current).last_column = \
1159 YYRHSLOC (Rhs, 0).last_column; \
1165 /* This macro is provided for backward compatibility. */
1167 #ifndef YY_LOCATION_PRINT
1168 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1172 /* YYLEX -- calling `yylex' with the right arguments. */
1175 # define YYLEX yylex (&yylval, YYLEX_PARAM)
1177 # define YYLEX yylex (&yylval, ctx)
1180 /* Enable debugging if requested. */
1184 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1185 # define YYFPRINTF fprintf
1188 # define YYDPRINTF(Args) \
1194 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1198 YYFPRINTF (stderr, "%s ", Title); \
1199 yy_symbol_print (stderr, \
1200 Type, Value, ctx); \
1201 YYFPRINTF (stderr, "\n"); \
1206 /*--------------------------------.
1207 | Print this symbol on YYOUTPUT. |
1208 `--------------------------------*/
1211 #if (defined __STDC__ || defined __C99__FUNC__ \
1212 || defined __cplusplus || defined _MSC_VER)
1214 yy_symbol_value_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
, parser_ctx_t
*ctx
)
1217 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
, ctx
)
1220 YYSTYPE
const * const yyvaluep
;
1228 if (yytype
< YYNTOKENS
)
1229 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
1241 /*--------------------------------.
1242 | Print this symbol on YYOUTPUT. |
1243 `--------------------------------*/
1245 #if (defined __STDC__ || defined __C99__FUNC__ \
1246 || defined __cplusplus || defined _MSC_VER)
1248 yy_symbol_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
, parser_ctx_t
*ctx
)
1251 yy_symbol_print (yyoutput
, yytype
, yyvaluep
, ctx
)
1254 YYSTYPE
const * const yyvaluep
;
1258 if (yytype
< YYNTOKENS
)
1259 YYFPRINTF (yyoutput
, "token %s (", yytname
[yytype
]);
1261 YYFPRINTF (yyoutput
, "nterm %s (", yytname
[yytype
]);
1263 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
, ctx
);
1264 YYFPRINTF (yyoutput
, ")");
1267 /*------------------------------------------------------------------.
1268 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1270 `------------------------------------------------------------------*/
1272 #if (defined __STDC__ || defined __C99__FUNC__ \
1273 || defined __cplusplus || defined _MSC_VER)
1275 yy_stack_print (yytype_int16
*yybottom
, yytype_int16
*yytop
)
1278 yy_stack_print (yybottom
, yytop
)
1279 yytype_int16
*yybottom
;
1280 yytype_int16
*yytop
;
1283 YYFPRINTF (stderr
, "Stack now");
1284 for (; yybottom
<= yytop
; yybottom
++)
1286 int yybot
= *yybottom
;
1287 YYFPRINTF (stderr
, " %d", yybot
);
1289 YYFPRINTF (stderr
, "\n");
1292 # define YY_STACK_PRINT(Bottom, Top) \
1295 yy_stack_print ((Bottom), (Top)); \
1299 /*------------------------------------------------.
1300 | Report that the YYRULE is going to be reduced. |
1301 `------------------------------------------------*/
1303 #if (defined __STDC__ || defined __C99__FUNC__ \
1304 || defined __cplusplus || defined _MSC_VER)
1306 yy_reduce_print (YYSTYPE
*yyvsp
, int yyrule
, parser_ctx_t
*ctx
)
1309 yy_reduce_print (yyvsp
, yyrule
, ctx
)
1315 int yynrhs
= yyr2
[yyrule
];
1317 unsigned long int yylno
= yyrline
[yyrule
];
1318 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %lu):\n",
1320 /* The symbols being reduced. */
1321 for (yyi
= 0; yyi
< yynrhs
; yyi
++)
1323 YYFPRINTF (stderr
, " $%d = ", yyi
+ 1);
1324 yy_symbol_print (stderr
, yyrhs
[yyprhs
[yyrule
] + yyi
],
1325 &(yyvsp
[(yyi
+ 1) - (yynrhs
)])
1327 YYFPRINTF (stderr
, "\n");
1331 # define YY_REDUCE_PRINT(Rule) \
1334 yy_reduce_print (yyvsp, Rule, ctx); \
1337 /* Nonzero means print parse trace. It is left uninitialized so that
1338 multiple parsers can coexist. */
1340 #else /* !YYDEBUG */
1341 # define YYDPRINTF(Args)
1342 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1343 # define YY_STACK_PRINT(Bottom, Top)
1344 # define YY_REDUCE_PRINT(Rule)
1345 #endif /* !YYDEBUG */
1348 /* YYINITDEPTH -- initial size of the parser's stacks. */
1350 # define YYINITDEPTH 200
1353 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1354 if the built-in stack extension method is used).
1356 Do not make this value too large; the results are undefined if
1357 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1358 evaluated with infinite-precision integer arithmetic. */
1361 # define YYMAXDEPTH 10000
1368 # if defined __GLIBC__ && defined _STRING_H
1369 # define yystrlen strlen
1371 /* Return the length of YYSTR. */
1372 #if (defined __STDC__ || defined __C99__FUNC__ \
1373 || defined __cplusplus || defined _MSC_VER)
1375 yystrlen (const char *yystr
)
1383 for (yylen
= 0; yystr
[yylen
]; yylen
++)
1391 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1392 # define yystpcpy stpcpy
1394 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1396 #if (defined __STDC__ || defined __C99__FUNC__ \
1397 || defined __cplusplus || defined _MSC_VER)
1399 yystpcpy (char *yydest
, const char *yysrc
)
1402 yystpcpy (yydest
, yysrc
)
1408 const char *yys
= yysrc
;
1410 while ((*yyd
++ = *yys
++) != '\0')
1419 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1420 quotes and backslashes, so that it's suitable for yyerror. The
1421 heuristic is that double-quoting is unnecessary unless the string
1422 contains an apostrophe, a comma, or backslash (other than
1423 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1424 null, do not copy; instead, return the length of what the result
1427 yytnamerr (char *yyres
, const char *yystr
)
1432 char const *yyp
= yystr
;
1439 goto do_not_strip_quotes
;
1443 goto do_not_strip_quotes
;
1456 do_not_strip_quotes
: ;
1460 return yystrlen (yystr
);
1462 return yystpcpy (yyres
, yystr
) - yyres
;
1466 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1467 about the unexpected token YYTOKEN for the state stack whose top is
1470 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1471 not large enough to hold the message. In that case, also set
1472 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1473 required number of bytes is too large to store. */
1475 yysyntax_error (YYSIZE_T
*yymsg_alloc
, char **yymsg
,
1476 yytype_int16
*yyssp
, int yytoken
)
1478 YYSIZE_T yysize0
= yytnamerr (0, yytname
[yytoken
]);
1479 YYSIZE_T yysize
= yysize0
;
1481 enum { YYERROR_VERBOSE_ARGS_MAXIMUM
= 5 };
1482 /* Internationalized format string. */
1483 const char *yyformat
= 0;
1484 /* Arguments of yyformat. */
1485 char const *yyarg
[YYERROR_VERBOSE_ARGS_MAXIMUM
];
1486 /* Number of reported tokens (one for the "unexpected", one per
1490 /* There are many possibilities here to consider:
1491 - Assume YYFAIL is not used. It's too flawed to consider. See
1492 <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
1493 for details. YYERROR is fine as it does not invoke this
1495 - If this state is a consistent state with a default action, then
1496 the only way this function was invoked is if the default action
1497 is an error action. In that case, don't check for expected
1498 tokens because there are none.
1499 - The only way there can be no lookahead present (in yychar) is if
1500 this state is a consistent state with a default action. Thus,
1501 detecting the absence of a lookahead is sufficient to determine
1502 that there is no unexpected or expected token to report. In that
1503 case, just report a simple "syntax error".
1504 - Don't assume there isn't a lookahead just because this state is a
1505 consistent state with a default action. There might have been a
1506 previous inconsistent state, consistent state with a non-default
1507 action, or user semantic action that manipulated yychar.
1508 - Of course, the expected token list depends on states to have
1509 correct lookahead information, and it depends on the parser not
1510 to perform extra reductions after fetching a lookahead from the
1511 scanner and before detecting a syntax error. Thus, state merging
1512 (from LALR or IELR) and default reductions corrupt the expected
1513 token list. However, the list is correct for canonical LR with
1514 one exception: it will still contain any token that will not be
1515 accepted due to an error action in a later state.
1517 if (yytoken
!= YYEMPTY
)
1519 int yyn
= yypact
[*yyssp
];
1520 yyarg
[yycount
++] = yytname
[yytoken
];
1521 if (!yypact_value_is_default (yyn
))
1523 /* Start YYX at -YYN if negative to avoid negative indexes in
1524 YYCHECK. In other words, skip the first -YYN actions for
1525 this state because they are default actions. */
1526 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
1527 /* Stay within bounds of both yycheck and yytname. */
1528 int yychecklim
= YYLAST
- yyn
+ 1;
1529 int yyxend
= yychecklim
< YYNTOKENS
? yychecklim
: YYNTOKENS
;
1532 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
1533 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
1534 && !yytable_value_is_error (yytable
[yyx
+ yyn
]))
1536 if (yycount
== YYERROR_VERBOSE_ARGS_MAXIMUM
)
1542 yyarg
[yycount
++] = yytname
[yyx
];
1543 yysize1
= yysize
+ yytnamerr (0, yytname
[yyx
]);
1544 if (! (yysize
<= yysize1
1545 && yysize1
<= YYSTACK_ALLOC_MAXIMUM
))
1554 # define YYCASE_(N, S) \
1558 YYCASE_(0, YY_("syntax error"));
1559 YYCASE_(1, YY_("syntax error, unexpected %s"));
1560 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1561 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1562 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1563 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1567 yysize1
= yysize
+ yystrlen (yyformat
);
1568 if (! (yysize
<= yysize1
&& yysize1
<= YYSTACK_ALLOC_MAXIMUM
))
1572 if (*yymsg_alloc
< yysize
)
1574 *yymsg_alloc
= 2 * yysize
;
1575 if (! (yysize
<= *yymsg_alloc
1576 && *yymsg_alloc
<= YYSTACK_ALLOC_MAXIMUM
))
1577 *yymsg_alloc
= YYSTACK_ALLOC_MAXIMUM
;
1581 /* Avoid sprintf, as that infringes on the user's name space.
1582 Don't have undefined behavior even if the translation
1583 produced a string with the wrong number of "%s"s. */
1587 while ((*yyp
= *yyformat
) != '\0')
1588 if (*yyp
== '%' && yyformat
[1] == 's' && yyi
< yycount
)
1590 yyp
+= yytnamerr (yyp
, yyarg
[yyi
++]);
1601 #endif /* YYERROR_VERBOSE */
1603 /*-----------------------------------------------.
1604 | Release the memory associated to this symbol. |
1605 `-----------------------------------------------*/
1608 #if (defined __STDC__ || defined __C99__FUNC__ \
1609 || defined __cplusplus || defined _MSC_VER)
1611 yydestruct (const char *yymsg
, int yytype
, YYSTYPE
*yyvaluep
, parser_ctx_t
*ctx
)
1614 yydestruct (yymsg
, yytype
, yyvaluep
, ctx
)
1626 YY_SYMBOL_PRINT (yymsg
, yytype
, yyvaluep
, yylocationp
);
1637 /* Prevent warnings from -Wmissing-prototypes. */
1638 #ifdef YYPARSE_PARAM
1639 #if defined __STDC__ || defined __cplusplus
1640 int yyparse (void *YYPARSE_PARAM
);
1644 #else /* ! YYPARSE_PARAM */
1645 #if defined __STDC__ || defined __cplusplus
1646 int yyparse (parser_ctx_t
*ctx
);
1650 #endif /* ! YYPARSE_PARAM */
1657 #ifdef YYPARSE_PARAM
1658 #if (defined __STDC__ || defined __C99__FUNC__ \
1659 || defined __cplusplus || defined _MSC_VER)
1661 yyparse (void *YYPARSE_PARAM
)
1664 yyparse (YYPARSE_PARAM
)
1665 void *YYPARSE_PARAM
;
1667 #else /* ! YYPARSE_PARAM */
1668 #if (defined __STDC__ || defined __C99__FUNC__ \
1669 || defined __cplusplus || defined _MSC_VER)
1671 yyparse (parser_ctx_t
*ctx
)
1679 /* The lookahead symbol. */
1682 /* The semantic value of the lookahead symbol. */
1685 /* Number of syntax errors so far. */
1689 /* Number of tokens to shift before error messages enabled. */
1692 /* The stacks and their tools:
1693 `yyss': related to states.
1694 `yyvs': related to semantic values.
1696 Refer to the stacks thru separate pointers, to allow yyoverflow
1697 to reallocate them elsewhere. */
1699 /* The state stack. */
1700 yytype_int16 yyssa
[YYINITDEPTH
];
1702 yytype_int16
*yyssp
;
1704 /* The semantic value stack. */
1705 YYSTYPE yyvsa
[YYINITDEPTH
];
1709 YYSIZE_T yystacksize
;
1713 /* Lookahead token as an internal (translated) token number. */
1715 /* The variables used to return semantic value and location from the
1720 /* Buffer for error messages, and its allocated size. */
1722 char *yymsg
= yymsgbuf
;
1723 YYSIZE_T yymsg_alloc
= sizeof yymsgbuf
;
1726 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1728 /* The number of symbols on the RHS of the reduced rule.
1729 Keep to zero when no symbol should be popped. */
1735 yystacksize
= YYINITDEPTH
;
1737 YYDPRINTF ((stderr
, "Starting parse\n"));
1742 yychar
= YYEMPTY
; /* Cause a token to be read. */
1744 /* Initialize stack pointers.
1745 Waste one element of value and location stack
1746 so that they stay on the same level as the state stack.
1747 The wasted elements are never initialized. */
1753 /*------------------------------------------------------------.
1754 | yynewstate -- Push a new state, which is found in yystate. |
1755 `------------------------------------------------------------*/
1757 /* In all cases, when you get here, the value and location stacks
1758 have just been pushed. So pushing a state here evens the stacks. */
1764 if (yyss
+ yystacksize
- 1 <= yyssp
)
1766 /* Get the current used size of the three stacks, in elements. */
1767 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1771 /* Give user a chance to reallocate the stack. Use copies of
1772 these so that the &'s don't force the real ones into
1774 YYSTYPE
*yyvs1
= yyvs
;
1775 yytype_int16
*yyss1
= yyss
;
1777 /* Each stack pointer address is followed by the size of the
1778 data in use in that stack, in bytes. This used to be a
1779 conditional around just the two extra args, but that might
1780 be undefined if yyoverflow is a macro. */
1781 yyoverflow (YY_("memory exhausted"),
1782 &yyss1
, yysize
* sizeof (*yyssp
),
1783 &yyvs1
, yysize
* sizeof (*yyvsp
),
1789 #else /* no yyoverflow */
1790 # ifndef YYSTACK_RELOCATE
1791 goto yyexhaustedlab
;
1793 /* Extend the stack our own way. */
1794 if (YYMAXDEPTH
<= yystacksize
)
1795 goto yyexhaustedlab
;
1797 if (YYMAXDEPTH
< yystacksize
)
1798 yystacksize
= YYMAXDEPTH
;
1801 yytype_int16
*yyss1
= yyss
;
1802 union yyalloc
*yyptr
=
1803 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1805 goto yyexhaustedlab
;
1806 YYSTACK_RELOCATE (yyss_alloc
, yyss
);
1807 YYSTACK_RELOCATE (yyvs_alloc
, yyvs
);
1808 # undef YYSTACK_RELOCATE
1810 YYSTACK_FREE (yyss1
);
1813 #endif /* no yyoverflow */
1815 yyssp
= yyss
+ yysize
- 1;
1816 yyvsp
= yyvs
+ yysize
- 1;
1818 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1819 (unsigned long int) yystacksize
));
1821 if (yyss
+ yystacksize
- 1 <= yyssp
)
1825 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1827 if (yystate
== YYFINAL
)
1837 /* Do appropriate processing given the current state. Read a
1838 lookahead token if we need one and don't already have one. */
1840 /* First try to decide what to do without reference to lookahead token. */
1841 yyn
= yypact
[yystate
];
1842 if (yypact_value_is_default (yyn
))
1845 /* Not known => get a lookahead token if don't already have one. */
1847 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1848 if (yychar
== YYEMPTY
)
1850 YYDPRINTF ((stderr
, "Reading a token: "));
1854 if (yychar
<= YYEOF
)
1856 yychar
= yytoken
= YYEOF
;
1857 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1861 yytoken
= YYTRANSLATE (yychar
);
1862 YY_SYMBOL_PRINT ("Next token is", yytoken
, &yylval
, &yylloc
);
1865 /* If the proper action on seeing token YYTOKEN is to reduce or to
1866 detect an error, take that action. */
1868 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1873 if (yytable_value_is_error (yyn
))
1879 /* Count tokens shifted since error; after three, turn off error
1884 /* Shift the lookahead token. */
1885 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
1887 /* Discard the shifted token. */
1896 /*-----------------------------------------------------------.
1897 | yydefault -- do the default action for the current state. |
1898 `-----------------------------------------------------------*/
1900 yyn
= yydefact
[yystate
];
1906 /*-----------------------------.
1907 | yyreduce -- Do a reduction. |
1908 `-----------------------------*/
1910 /* yyn is the number of a rule to reduce with. */
1913 /* If YYLEN is nonzero, implement the default value of the action:
1916 Otherwise, the following line sets YYVAL to garbage.
1917 This behavior is undocumented and Bison
1918 users should not rely upon it. Assigning to YYVAL
1919 unconditionally makes the parser a bit smaller, and it avoids a
1920 GCC warning that YYVAL may be used uninitialized. */
1921 yyval
= yyvsp
[1-yylen
];
1924 YY_REDUCE_PRINT (yyn
);
1929 /* Line 1806 of yacc.c */
1930 #line 147 "parser.y"
1931 { parse_complete(ctx
, (yyvsp
[(1) - (3)].bool)); }
1936 /* Line 1806 of yacc.c */
1937 #line 150 "parser.y"
1938 { (yyval
.bool) = FALSE
; }
1943 /* Line 1806 of yacc.c */
1944 #line 151 "parser.y"
1945 { (yyval
.bool) = TRUE
; }
1950 /* Line 1806 of yacc.c */
1951 #line 155 "parser.y"
1952 { source_add_statement(ctx
, (yyvsp
[(2) - (2)].statement
)); }
1957 /* Line 1806 of yacc.c */
1958 #line 156 "parser.y"
1959 { source_add_class(ctx
, (yyvsp
[(2) - (2)].class_decl
)); }
1964 /* Line 1806 of yacc.c */
1965 #line 159 "parser.y"
1966 { (yyval
.statement
) = NULL
; }
1971 /* Line 1806 of yacc.c */
1972 #line 160 "parser.y"
1973 { (yyval
.statement
) = (yyvsp
[(1) - (1)].statement
); }
1978 /* Line 1806 of yacc.c */
1979 #line 163 "parser.y"
1980 { (yyval
.statement
) = (yyvsp
[(1) - (1)].statement
); }
1985 /* Line 1806 of yacc.c */
1986 #line 164 "parser.y"
1987 { (yyval
.statement
) = link_statements((yyvsp
[(1) - (2)].statement
), (yyvsp
[(2) - (2)].statement
)); }
1992 /* Line 1806 of yacc.c */
1993 #line 167 "parser.y"
1994 { (yyval
.statement
) = (yyvsp
[(1) - (2)].statement
); }
1999 /* Line 1806 of yacc.c */
2000 #line 170 "parser.y"
2001 { (yyval
.statement
) = NULL
; }
2006 /* Line 1806 of yacc.c */
2007 #line 171 "parser.y"
2008 { (yyval
.statement
) = (yyvsp
[(2) - (2)].statement
); }
2013 /* Line 1806 of yacc.c */
2014 #line 172 "parser.y"
2015 { (yyval
.statement
) = (yyvsp
[(1) - (1)].statement
); }
2020 /* Line 1806 of yacc.c */
2021 #line 173 "parser.y"
2022 { (yyvsp
[(1) - (3)].statement
)->next
= (yyvsp
[(3) - (3)].statement
); (yyval
.statement
) = (yyvsp
[(1) - (3)].statement
); }
2027 /* Line 1806 of yacc.c */
2028 #line 174 "parser.y"
2029 { (yyval
.statement
) = (yyvsp
[(1) - (2)].statement
); }
2034 /* Line 1806 of yacc.c */
2035 #line 177 "parser.y"
2036 { (yyvsp
[(1) - (2)].member
)->args
= (yyvsp
[(2) - (2)].expression
); (yyval
.statement
) = new_call_statement(ctx
, FALSE
, (yyvsp
[(1) - (2)].member
)); CHECK_ERROR
; }
2041 /* Line 1806 of yacc.c */
2042 #line 178 "parser.y"
2043 { (yyvsp
[(2) - (3)].member
)->args
= (yyvsp
[(3) - (3)].expression
); (yyval
.statement
) = new_call_statement(ctx
, TRUE
, (yyvsp
[(2) - (3)].member
)); CHECK_ERROR
; }
2048 /* Line 1806 of yacc.c */
2049 #line 180 "parser.y"
2050 { (yyvsp
[(1) - (4)].member
)->args
= (yyvsp
[(2) - (4)].expression
); (yyval
.statement
) = new_assign_statement(ctx
, (yyvsp
[(1) - (4)].member
), (yyvsp
[(4) - (4)].expression
)); CHECK_ERROR
; }
2055 /* Line 1806 of yacc.c */
2056 #line 181 "parser.y"
2057 { (yyval
.statement
) = new_dim_statement(ctx
, (yyvsp
[(2) - (2)].dim_decl
)); CHECK_ERROR
; }
2062 /* Line 1806 of yacc.c */
2063 #line 182 "parser.y"
2064 { (yyval
.statement
) = (yyvsp
[(1) - (1)].statement
); }
2069 /* Line 1806 of yacc.c */
2070 #line 184 "parser.y"
2071 { (yyval
.statement
) = new_while_statement(ctx
, STAT_WHILE
, (yyvsp
[(2) - (5)].expression
), (yyvsp
[(4) - (5)].statement
)); CHECK_ERROR
; }
2076 /* Line 1806 of yacc.c */
2077 #line 186 "parser.y"
2078 { (yyval
.statement
) = new_while_statement(ctx
, (yyvsp
[(2) - (6)].bool) ? STAT_WHILELOOP
: STAT_UNTIL
, (yyvsp
[(3) - (6)].expression
), (yyvsp
[(5) - (6)].statement
));
2084 /* Line 1806 of yacc.c */
2085 #line 189 "parser.y"
2086 { (yyval
.statement
) = new_while_statement(ctx
, (yyvsp
[(5) - (6)].bool) ? STAT_DOWHILE
: STAT_DOUNTIL
, (yyvsp
[(6) - (6)].expression
), (yyvsp
[(3) - (6)].statement
));
2092 /* Line 1806 of yacc.c */
2093 #line 191 "parser.y"
2094 { (yyval
.statement
) = new_while_statement(ctx
, STAT_DOWHILE
, NULL
, (yyvsp
[(3) - (4)].statement
)); CHECK_ERROR
; }
2099 /* Line 1806 of yacc.c */
2100 #line 192 "parser.y"
2101 { (yyval
.statement
) = new_function_statement(ctx
, (yyvsp
[(1) - (1)].func_decl
)); CHECK_ERROR
; }
2106 /* Line 1806 of yacc.c */
2107 #line 193 "parser.y"
2108 { (yyval
.statement
) = new_statement(ctx
, STAT_EXITDO
, 0); CHECK_ERROR
; }
2113 /* Line 1806 of yacc.c */
2114 #line 194 "parser.y"
2115 { (yyval
.statement
) = new_statement(ctx
, STAT_EXITFOR
, 0); CHECK_ERROR
; }
2120 /* Line 1806 of yacc.c */
2121 #line 195 "parser.y"
2122 { (yyval
.statement
) = new_statement(ctx
, STAT_EXITFUNC
, 0); CHECK_ERROR
; }
2127 /* Line 1806 of yacc.c */
2128 #line 196 "parser.y"
2129 { (yyval
.statement
) = new_statement(ctx
, STAT_EXITPROP
, 0); CHECK_ERROR
; }
2134 /* Line 1806 of yacc.c */
2135 #line 197 "parser.y"
2136 { (yyval
.statement
) = new_statement(ctx
, STAT_EXITSUB
, 0); CHECK_ERROR
; }
2141 /* Line 1806 of yacc.c */
2142 #line 199 "parser.y"
2143 { (yyvsp
[(2) - (5)].member
)->args
= (yyvsp
[(3) - (5)].expression
); (yyval
.statement
) = new_set_statement(ctx
, (yyvsp
[(2) - (5)].member
), (yyvsp
[(5) - (5)].expression
)); CHECK_ERROR
; }
2148 /* Line 1806 of yacc.c */
2149 #line 200 "parser.y"
2150 { (yyval
.statement
) = new_statement(ctx
, STAT_STOP
, 0); CHECK_ERROR
; }
2155 /* Line 1806 of yacc.c */
2156 #line 201 "parser.y"
2157 { (yyval
.statement
) = new_onerror_statement(ctx
, TRUE
); CHECK_ERROR
; }
2162 /* Line 1806 of yacc.c */
2163 #line 202 "parser.y"
2164 { (yyval
.statement
) = new_onerror_statement(ctx
, FALSE
); CHECK_ERROR
; }
2169 /* Line 1806 of yacc.c */
2170 #line 203 "parser.y"
2171 { (yyval
.statement
) = new_const_statement(ctx
, (yyvsp
[(2) - (2)].const_decl
)); CHECK_ERROR
; }
2176 /* Line 1806 of yacc.c */
2177 #line 205 "parser.y"
2178 { (yyval
.statement
) = new_forto_statement(ctx
, (yyvsp
[(2) - (10)].string
), (yyvsp
[(4) - (10)].expression
), (yyvsp
[(6) - (10)].expression
), (yyvsp
[(7) - (10)].expression
), (yyvsp
[(9) - (10)].statement
)); CHECK_ERROR
; }
2183 /* Line 1806 of yacc.c */
2184 #line 207 "parser.y"
2185 { (yyval
.statement
) = new_foreach_statement(ctx
, (yyvsp
[(3) - (8)].string
), (yyvsp
[(5) - (8)].expression
), (yyvsp
[(7) - (8)].statement
)); }
2190 /* Line 1806 of yacc.c */
2191 #line 209 "parser.y"
2192 { (yyval
.statement
) = new_select_statement(ctx
, (yyvsp
[(3) - (7)].expression
), (yyvsp
[(5) - (7)].case_clausule
)); }
2197 /* Line 1806 of yacc.c */
2198 #line 212 "parser.y"
2199 { (yyval
.member
) = new_member_expression(ctx
, NULL
, (yyvsp
[(1) - (1)].string
)); CHECK_ERROR
; }
2204 /* Line 1806 of yacc.c */
2205 #line 213 "parser.y"
2206 { (yyval
.member
) = new_member_expression(ctx
, (yyvsp
[(1) - (3)].expression
), (yyvsp
[(3) - (3)].string
)); CHECK_ERROR
; }
2211 /* Line 1806 of yacc.c */
2212 #line 216 "parser.y"
2213 { (yyval
.dim_decl
) = (yyvsp
[(1) - (1)].dim_decl
); }
2218 /* Line 1806 of yacc.c */
2219 #line 217 "parser.y"
2220 { (yyvsp
[(1) - (3)].dim_decl
)->next
= (yyvsp
[(3) - (3)].dim_decl
); (yyval
.dim_decl
) = (yyvsp
[(1) - (3)].dim_decl
); }
2225 /* Line 1806 of yacc.c */
2226 #line 220 "parser.y"
2227 { (yyval
.dim_decl
) = new_dim_decl(ctx
, (yyvsp
[(1) - (1)].string
), FALSE
, NULL
); CHECK_ERROR
; }
2232 /* Line 1806 of yacc.c */
2233 #line 221 "parser.y"
2234 { (yyval
.dim_decl
) = new_dim_decl(ctx
, (yyvsp
[(1) - (4)].string
), TRUE
, (yyvsp
[(3) - (4)].dim_list
)); CHECK_ERROR
; }
2239 /* Line 1806 of yacc.c */
2240 #line 222 "parser.y"
2241 { (yyval
.dim_decl
) = new_dim_decl(ctx
, (yyvsp
[(1) - (2)].string
), TRUE
, NULL
); CHECK_ERROR
; }
2246 /* Line 1806 of yacc.c */
2247 #line 225 "parser.y"
2248 { (yyval
.dim_list
) = new_dim(ctx
, (yyvsp
[(1) - (1)].uint
), NULL
); }
2253 /* Line 1806 of yacc.c */
2254 #line 226 "parser.y"
2255 { (yyval
.dim_list
) = new_dim(ctx
, (yyvsp
[(1) - (3)].uint
), (yyvsp
[(3) - (3)].dim_list
)); }
2260 /* Line 1806 of yacc.c */
2261 #line 229 "parser.y"
2262 { (yyval
.const_decl
) = (yyvsp
[(1) - (1)].const_decl
); }
2267 /* Line 1806 of yacc.c */
2268 #line 230 "parser.y"
2269 { (yyvsp
[(1) - (3)].const_decl
)->next
= (yyvsp
[(3) - (3)].const_decl
); (yyval
.const_decl
) = (yyvsp
[(1) - (3)].const_decl
); }
2274 /* Line 1806 of yacc.c */
2275 #line 233 "parser.y"
2276 { (yyval
.const_decl
) = new_const_decl(ctx
, (yyvsp
[(1) - (3)].string
), (yyvsp
[(3) - (3)].expression
)); CHECK_ERROR
; }
2281 /* Line 1806 of yacc.c */
2282 #line 236 "parser.y"
2283 { (yyval
.expression
) = (yyvsp
[(1) - (1)].expression
); }
2288 /* Line 1806 of yacc.c */
2289 #line 237 "parser.y"
2290 { (yyval
.expression
) = new_unary_expression(ctx
, EXPR_NEG
, (yyvsp
[(2) - (2)].expression
)); CHECK_ERROR
; }
2295 /* Line 1806 of yacc.c */
2296 #line 240 "parser.y"
2297 { (yyval
.bool) = TRUE
; }
2302 /* Line 1806 of yacc.c */
2303 #line 241 "parser.y"
2304 { (yyval
.bool) = FALSE
; }
2309 /* Line 1806 of yacc.c */
2310 #line 244 "parser.y"
2311 { (yyval
.expression
) = NULL
;}
2316 /* Line 1806 of yacc.c */
2317 #line 245 "parser.y"
2318 { (yyval
.expression
) = (yyvsp
[(2) - (2)].expression
); }
2323 /* Line 1806 of yacc.c */
2324 #line 249 "parser.y"
2325 { (yyval
.statement
) = new_if_statement(ctx
, (yyvsp
[(2) - (9)].expression
), (yyvsp
[(5) - (9)].statement
), (yyvsp
[(6) - (9)].elseif
), (yyvsp
[(7) - (9)].statement
)); CHECK_ERROR
; }
2330 /* Line 1806 of yacc.c */
2331 #line 250 "parser.y"
2332 { (yyval
.statement
) = new_if_statement(ctx
, (yyvsp
[(2) - (4)].expression
), (yyvsp
[(4) - (4)].statement
), NULL
, NULL
); CHECK_ERROR
; }
2337 /* Line 1806 of yacc.c */
2338 #line 252 "parser.y"
2339 { (yyval
.statement
) = new_if_statement(ctx
, (yyvsp
[(2) - (7)].expression
), (yyvsp
[(4) - (7)].statement
), NULL
, (yyvsp
[(6) - (7)].statement
)); CHECK_ERROR
; }
2344 /* Line 1806 of yacc.c */
2345 #line 259 "parser.y"
2346 { (yyval
.elseif
) = NULL
; }
2351 /* Line 1806 of yacc.c */
2352 #line 260 "parser.y"
2353 { (yyval
.elseif
) = (yyvsp
[(1) - (1)].elseif
); }
2358 /* Line 1806 of yacc.c */
2359 #line 263 "parser.y"
2360 { (yyval
.elseif
) = (yyvsp
[(1) - (1)].elseif
); }
2365 /* Line 1806 of yacc.c */
2366 #line 264 "parser.y"
2367 { (yyvsp
[(1) - (2)].elseif
)->next
= (yyvsp
[(2) - (2)].elseif
); (yyval
.elseif
) = (yyvsp
[(1) - (2)].elseif
); }
2372 /* Line 1806 of yacc.c */
2373 #line 268 "parser.y"
2374 { (yyval
.elseif
) = new_elseif_decl(ctx
, (yyvsp
[(2) - (5)].expression
), (yyvsp
[(5) - (5)].statement
)); }
2379 /* Line 1806 of yacc.c */
2380 #line 271 "parser.y"
2381 { (yyval
.statement
) = NULL
; }
2386 /* Line 1806 of yacc.c */
2387 #line 272 "parser.y"
2388 { (yyval
.statement
) = (yyvsp
[(3) - (3)].statement
); }
2393 /* Line 1806 of yacc.c */
2394 #line 275 "parser.y"
2395 { (yyval
.case_clausule
) = NULL
; }
2400 /* Line 1806 of yacc.c */
2401 #line 276 "parser.y"
2402 { (yyval
.case_clausule
) = new_case_clausule(ctx
, NULL
, (yyvsp
[(4) - (4)].statement
), NULL
); }
2407 /* Line 1806 of yacc.c */
2408 #line 278 "parser.y"
2409 { (yyval
.case_clausule
) = new_case_clausule(ctx
, (yyvsp
[(2) - (5)].expression
), (yyvsp
[(4) - (5)].statement
), (yyvsp
[(5) - (5)].case_clausule
)); }
2414 /* Line 1806 of yacc.c */
2415 #line 281 "parser.y"
2416 { (yyval
.expression
) = NULL
; }
2421 /* Line 1806 of yacc.c */
2422 #line 282 "parser.y"
2423 { (yyval
.expression
) = (yyvsp
[(2) - (3)].expression
); }
2428 /* Line 1806 of yacc.c */
2429 #line 285 "parser.y"
2430 { (yyval
.expression
) = NULL
; }
2435 /* Line 1806 of yacc.c */
2436 #line 286 "parser.y"
2437 { (yyval
.expression
) = (yyvsp
[(1) - (1)].expression
); }
2442 /* Line 1806 of yacc.c */
2443 #line 293 "parser.y"
2444 { (yyval
.expression
) = (yyvsp
[(1) - (1)].expression
); }
2449 /* Line 1806 of yacc.c */
2450 #line 294 "parser.y"
2451 { (yyvsp
[(1) - (3)].expression
)->next
= (yyvsp
[(3) - (3)].expression
); (yyval
.expression
) = (yyvsp
[(1) - (3)].expression
); }
2456 /* Line 1806 of yacc.c */
2457 #line 297 "parser.y"
2458 { (yyval
.expression
) = (yyvsp
[(1) - (1)].expression
); }
2463 /* Line 1806 of yacc.c */
2464 #line 298 "parser.y"
2465 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_IMP
, (yyvsp
[(1) - (3)].expression
), (yyvsp
[(3) - (3)].expression
)); CHECK_ERROR
; }
2470 /* Line 1806 of yacc.c */
2471 #line 301 "parser.y"
2472 { (yyval
.expression
) = (yyvsp
[(1) - (1)].expression
); }
2477 /* Line 1806 of yacc.c */
2478 #line 302 "parser.y"
2479 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_EQV
, (yyvsp
[(1) - (3)].expression
), (yyvsp
[(3) - (3)].expression
)); CHECK_ERROR
; }
2484 /* Line 1806 of yacc.c */
2485 #line 305 "parser.y"
2486 { (yyval
.expression
) = (yyvsp
[(1) - (1)].expression
); }
2491 /* Line 1806 of yacc.c */
2492 #line 306 "parser.y"
2493 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_XOR
, (yyvsp
[(1) - (3)].expression
), (yyvsp
[(3) - (3)].expression
)); CHECK_ERROR
; }
2498 /* Line 1806 of yacc.c */
2499 #line 309 "parser.y"
2500 { (yyval
.expression
) = (yyvsp
[(1) - (1)].expression
); }
2505 /* Line 1806 of yacc.c */
2506 #line 310 "parser.y"
2507 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_OR
, (yyvsp
[(1) - (3)].expression
), (yyvsp
[(3) - (3)].expression
)); CHECK_ERROR
; }
2512 /* Line 1806 of yacc.c */
2513 #line 313 "parser.y"
2514 { (yyval
.expression
) = (yyvsp
[(1) - (1)].expression
); }
2519 /* Line 1806 of yacc.c */
2520 #line 314 "parser.y"
2521 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_AND
, (yyvsp
[(1) - (3)].expression
), (yyvsp
[(3) - (3)].expression
)); CHECK_ERROR
; }
2526 /* Line 1806 of yacc.c */
2527 #line 317 "parser.y"
2528 { (yyval
.expression
) = (yyvsp
[(1) - (1)].expression
); }
2533 /* Line 1806 of yacc.c */
2534 #line 318 "parser.y"
2535 { (yyval
.expression
) = new_unary_expression(ctx
, EXPR_NOT
, (yyvsp
[(2) - (2)].expression
)); CHECK_ERROR
; }
2540 /* Line 1806 of yacc.c */
2541 #line 321 "parser.y"
2542 { (yyval
.expression
) = (yyvsp
[(1) - (1)].expression
); }
2547 /* Line 1806 of yacc.c */
2548 #line 322 "parser.y"
2549 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_EQUAL
, (yyvsp
[(1) - (3)].expression
), (yyvsp
[(3) - (3)].expression
)); CHECK_ERROR
; }
2554 /* Line 1806 of yacc.c */
2555 #line 323 "parser.y"
2556 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_NEQUAL
, (yyvsp
[(1) - (3)].expression
), (yyvsp
[(3) - (3)].expression
)); CHECK_ERROR
; }
2561 /* Line 1806 of yacc.c */
2562 #line 324 "parser.y"
2563 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_GT
, (yyvsp
[(1) - (3)].expression
), (yyvsp
[(3) - (3)].expression
)); CHECK_ERROR
; }
2568 /* Line 1806 of yacc.c */
2569 #line 325 "parser.y"
2570 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_LT
, (yyvsp
[(1) - (3)].expression
), (yyvsp
[(3) - (3)].expression
)); CHECK_ERROR
; }
2575 /* Line 1806 of yacc.c */
2576 #line 326 "parser.y"
2577 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_GTEQ
, (yyvsp
[(1) - (3)].expression
), (yyvsp
[(3) - (3)].expression
)); CHECK_ERROR
; }
2582 /* Line 1806 of yacc.c */
2583 #line 327 "parser.y"
2584 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_LTEQ
, (yyvsp
[(1) - (3)].expression
), (yyvsp
[(3) - (3)].expression
)); CHECK_ERROR
; }
2589 /* Line 1806 of yacc.c */
2590 #line 328 "parser.y"
2591 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_IS
, (yyvsp
[(1) - (3)].expression
), (yyvsp
[(3) - (3)].expression
)); CHECK_ERROR
; }
2596 /* Line 1806 of yacc.c */
2597 #line 331 "parser.y"
2598 { (yyval
.expression
) = (yyvsp
[(1) - (1)].expression
); }
2603 /* Line 1806 of yacc.c */
2604 #line 332 "parser.y"
2605 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_CONCAT
, (yyvsp
[(1) - (3)].expression
), (yyvsp
[(3) - (3)].expression
)); CHECK_ERROR
; }
2610 /* Line 1806 of yacc.c */
2611 #line 335 "parser.y"
2612 { (yyval
.expression
) = (yyvsp
[(1) - (1)].expression
); }
2617 /* Line 1806 of yacc.c */
2618 #line 336 "parser.y"
2619 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_ADD
, (yyvsp
[(1) - (3)].expression
), (yyvsp
[(3) - (3)].expression
)); CHECK_ERROR
; }
2624 /* Line 1806 of yacc.c */
2625 #line 337 "parser.y"
2626 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_SUB
, (yyvsp
[(1) - (3)].expression
), (yyvsp
[(3) - (3)].expression
)); CHECK_ERROR
; }
2631 /* Line 1806 of yacc.c */
2632 #line 340 "parser.y"
2633 { (yyval
.expression
) = (yyvsp
[(1) - (1)].expression
); }
2638 /* Line 1806 of yacc.c */
2639 #line 341 "parser.y"
2640 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_MOD
, (yyvsp
[(1) - (3)].expression
), (yyvsp
[(3) - (3)].expression
)); CHECK_ERROR
; }
2645 /* Line 1806 of yacc.c */
2646 #line 344 "parser.y"
2647 { (yyval
.expression
) = (yyvsp
[(1) - (1)].expression
); }
2652 /* Line 1806 of yacc.c */
2653 #line 346 "parser.y"
2654 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_IDIV
, (yyvsp
[(1) - (3)].expression
), (yyvsp
[(3) - (3)].expression
)); CHECK_ERROR
; }
2659 /* Line 1806 of yacc.c */
2660 #line 349 "parser.y"
2661 { (yyval
.expression
) = (yyvsp
[(1) - (1)].expression
); }
2666 /* Line 1806 of yacc.c */
2667 #line 351 "parser.y"
2668 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_MUL
, (yyvsp
[(1) - (3)].expression
), (yyvsp
[(3) - (3)].expression
)); CHECK_ERROR
; }
2673 /* Line 1806 of yacc.c */
2674 #line 353 "parser.y"
2675 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_DIV
, (yyvsp
[(1) - (3)].expression
), (yyvsp
[(3) - (3)].expression
)); CHECK_ERROR
; }
2680 /* Line 1806 of yacc.c */
2681 #line 356 "parser.y"
2682 { (yyval
.expression
) = (yyvsp
[(1) - (1)].expression
); }
2687 /* Line 1806 of yacc.c */
2688 #line 357 "parser.y"
2689 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_EXP
, (yyvsp
[(1) - (3)].expression
), (yyvsp
[(3) - (3)].expression
)); CHECK_ERROR
; }
2694 /* Line 1806 of yacc.c */
2695 #line 360 "parser.y"
2696 { (yyval
.expression
) = (yyvsp
[(1) - (1)].expression
); }
2701 /* Line 1806 of yacc.c */
2702 #line 361 "parser.y"
2703 { (yyval
.expression
) = (yyvsp
[(1) - (1)].expression
); }
2708 /* Line 1806 of yacc.c */
2709 #line 362 "parser.y"
2710 { (yyval
.expression
) = new_new_expression(ctx
, (yyvsp
[(2) - (2)].string
)); CHECK_ERROR
; }
2715 /* Line 1806 of yacc.c */
2716 #line 363 "parser.y"
2717 { (yyval
.expression
) = new_unary_expression(ctx
, EXPR_NEG
, (yyvsp
[(2) - (2)].expression
)); CHECK_ERROR
; }
2722 /* Line 1806 of yacc.c */
2723 #line 366 "parser.y"
2724 { (yyval
.expression
) = (yyvsp
[(1) - (1)].expression
); }
2729 /* Line 1806 of yacc.c */
2730 #line 367 "parser.y"
2731 { (yyvsp
[(1) - (2)].member
)->args
= (yyvsp
[(2) - (2)].expression
); (yyval
.expression
) = &(yyvsp
[(1) - (2)].member
)->expr
; }
2736 /* Line 1806 of yacc.c */
2737 #line 370 "parser.y"
2738 { (yyval
.expression
) = new_bool_expression(ctx
, VARIANT_TRUE
); CHECK_ERROR
; }
2743 /* Line 1806 of yacc.c */
2744 #line 371 "parser.y"
2745 { (yyval
.expression
) = new_bool_expression(ctx
, VARIANT_FALSE
); CHECK_ERROR
; }
2750 /* Line 1806 of yacc.c */
2751 #line 372 "parser.y"
2752 { (yyval
.expression
) = new_string_expression(ctx
, (yyvsp
[(1) - (1)].string
)); CHECK_ERROR
; }
2757 /* Line 1806 of yacc.c */
2758 #line 373 "parser.y"
2759 { (yyval
.expression
) = (yyvsp
[(1) - (1)].expression
); }
2764 /* Line 1806 of yacc.c */
2765 #line 374 "parser.y"
2766 { (yyval
.expression
) = new_expression(ctx
, EXPR_EMPTY
, 0); CHECK_ERROR
; }
2771 /* Line 1806 of yacc.c */
2772 #line 375 "parser.y"
2773 { (yyval
.expression
) = new_expression(ctx
, EXPR_NULL
, 0); CHECK_ERROR
; }
2778 /* Line 1806 of yacc.c */
2779 #line 376 "parser.y"
2780 { (yyval
.expression
) = new_expression(ctx
, EXPR_NOTHING
, 0); CHECK_ERROR
; }
2785 /* Line 1806 of yacc.c */
2786 #line 379 "parser.y"
2787 { (yyval
.expression
) = new_long_expression(ctx
, EXPR_USHORT
, (yyvsp
[(1) - (1)].lng
)); CHECK_ERROR
; }
2792 /* Line 1806 of yacc.c */
2793 #line 380 "parser.y"
2794 { (yyval
.expression
) = new_long_expression(ctx
, EXPR_USHORT
, 0); CHECK_ERROR
; }
2799 /* Line 1806 of yacc.c */
2800 #line 381 "parser.y"
2801 { (yyval
.expression
) = new_long_expression(ctx
, EXPR_ULONG
, (yyvsp
[(1) - (1)].lng
)); CHECK_ERROR
; }
2806 /* Line 1806 of yacc.c */
2807 #line 382 "parser.y"
2808 { (yyval
.expression
) = new_double_expression(ctx
, (yyvsp
[(1) - (1)].dbl
)); CHECK_ERROR
; }
2813 /* Line 1806 of yacc.c */
2814 #line 385 "parser.y"
2815 { (yyval
.uint
) = (yyvsp
[(1) - (1)].lng
); }
2820 /* Line 1806 of yacc.c */
2821 #line 386 "parser.y"
2822 { (yyval
.uint
) = 0; }
2827 /* Line 1806 of yacc.c */
2828 #line 387 "parser.y"
2829 { (yyval
.uint
) = (yyvsp
[(1) - (1)].lng
); }
2834 /* Line 1806 of yacc.c */
2835 #line 390 "parser.y"
2836 { (yyval
.expression
) = new_unary_expression(ctx
, EXPR_BRACKETS
, (yyvsp
[(2) - (3)].expression
)); }
2841 /* Line 1806 of yacc.c */
2842 #line 391 "parser.y"
2843 { (yyval
.expression
) = new_expression(ctx
, EXPR_ME
, 0); CHECK_ERROR
; }
2848 /* Line 1806 of yacc.c */
2849 #line 394 "parser.y"
2850 { (yyvsp
[(4) - (7)].class_decl
)->name
= (yyvsp
[(2) - (7)].string
); (yyval
.class_decl
) = (yyvsp
[(4) - (7)].class_decl
); }
2855 /* Line 1806 of yacc.c */
2856 #line 397 "parser.y"
2857 { (yyval
.class_decl
) = new_class_decl(ctx
); }
2862 /* Line 1806 of yacc.c */
2863 #line 398 "parser.y"
2864 { (yyval
.class_decl
) = add_class_function(ctx
, (yyvsp
[(3) - (3)].class_decl
), (yyvsp
[(1) - (3)].func_decl
)); CHECK_ERROR
; }
2869 /* Line 1806 of yacc.c */
2870 #line 400 "parser.y"
2871 { dim_decl_t
*dim_decl
= new_dim_decl(ctx
, (yyvsp
[(2) - (4)].string
), FALSE
, NULL
); CHECK_ERROR
;
2872 (yyval
.class_decl
) = add_dim_prop(ctx
, (yyvsp
[(4) - (4)].class_decl
), dim_decl
, (yyvsp
[(1) - (4)].uint
)); CHECK_ERROR
; }
2877 /* Line 1806 of yacc.c */
2878 #line 402 "parser.y"
2879 { (yyval
.class_decl
) = add_dim_prop(ctx
, (yyvsp
[(4) - (4)].class_decl
), (yyvsp
[(2) - (4)].dim_decl
), 0); CHECK_ERROR
; }
2884 /* Line 1806 of yacc.c */
2885 #line 403 "parser.y"
2886 { (yyval
.class_decl
) = add_class_function(ctx
, (yyvsp
[(3) - (3)].class_decl
), (yyvsp
[(1) - (3)].func_decl
)); CHECK_ERROR
; }
2891 /* Line 1806 of yacc.c */
2892 #line 407 "parser.y"
2893 { (yyval
.func_decl
) = new_function_decl(ctx
, (yyvsp
[(4) - (9)].string
), FUNC_PROPGET
, (yyvsp
[(1) - (9)].uint
), NULL
, (yyvsp
[(7) - (9)].statement
)); CHECK_ERROR
; }
2898 /* Line 1806 of yacc.c */
2899 #line 409 "parser.y"
2900 { (yyval
.func_decl
) = new_function_decl(ctx
, (yyvsp
[(4) - (11)].string
), FUNC_PROPLET
, (yyvsp
[(1) - (11)].uint
), (yyvsp
[(6) - (11)].arg_decl
), (yyvsp
[(9) - (11)].statement
)); CHECK_ERROR
; }
2905 /* Line 1806 of yacc.c */
2906 #line 411 "parser.y"
2907 { (yyval
.func_decl
) = new_function_decl(ctx
, (yyvsp
[(4) - (11)].string
), FUNC_PROPSET
, (yyvsp
[(1) - (11)].uint
), (yyvsp
[(6) - (11)].arg_decl
), (yyvsp
[(9) - (11)].statement
)); CHECK_ERROR
; }
2912 /* Line 1806 of yacc.c */
2913 #line 415 "parser.y"
2914 { (yyval
.func_decl
) = new_function_decl(ctx
, (yyvsp
[(3) - (8)].string
), FUNC_SUB
, (yyvsp
[(1) - (8)].uint
), (yyvsp
[(4) - (8)].arg_decl
), (yyvsp
[(6) - (8)].statement
)); CHECK_ERROR
; }
2919 /* Line 1806 of yacc.c */
2920 #line 417 "parser.y"
2921 { (yyval
.func_decl
) = new_function_decl(ctx
, (yyvsp
[(3) - (8)].string
), FUNC_FUNCTION
, (yyvsp
[(1) - (8)].uint
), (yyvsp
[(4) - (8)].arg_decl
), (yyvsp
[(6) - (8)].statement
)); CHECK_ERROR
; }
2926 /* Line 1806 of yacc.c */
2927 #line 420 "parser.y"
2928 { (yyval
.uint
) = 0; }
2933 /* Line 1806 of yacc.c */
2934 #line 421 "parser.y"
2935 { (yyval
.uint
) = (yyvsp
[(1) - (1)].uint
); }
2940 /* Line 1806 of yacc.c */
2941 #line 424 "parser.y"
2942 { (yyval
.uint
) = STORAGE_IS_DEFAULT
; }
2947 /* Line 1806 of yacc.c */
2948 #line 425 "parser.y"
2949 { (yyval
.uint
) = 0; }
2954 /* Line 1806 of yacc.c */
2955 #line 426 "parser.y"
2956 { (yyval
.uint
) = STORAGE_IS_PRIVATE
; }
2961 /* Line 1806 of yacc.c */
2962 #line 429 "parser.y"
2963 { (yyval
.arg_decl
) = NULL
; }
2968 /* Line 1806 of yacc.c */
2969 #line 430 "parser.y"
2970 { (yyval
.arg_decl
) = (yyvsp
[(2) - (3)].arg_decl
); }
2975 /* Line 1806 of yacc.c */
2976 #line 433 "parser.y"
2977 { (yyval
.arg_decl
) = (yyvsp
[(1) - (1)].arg_decl
); }
2982 /* Line 1806 of yacc.c */
2983 #line 434 "parser.y"
2984 { (yyvsp
[(1) - (3)].arg_decl
)->next
= (yyvsp
[(3) - (3)].arg_decl
); (yyval
.arg_decl
) = (yyvsp
[(1) - (3)].arg_decl
); }
2989 /* Line 1806 of yacc.c */
2990 #line 437 "parser.y"
2991 { (yyval
.arg_decl
) = new_argument_decl(ctx
, (yyvsp
[(1) - (2)].string
), TRUE
); }
2996 /* Line 1806 of yacc.c */
2997 #line 438 "parser.y"
2998 { (yyval
.arg_decl
) = new_argument_decl(ctx
, (yyvsp
[(2) - (3)].string
), TRUE
); }
3003 /* Line 1806 of yacc.c */
3004 #line 439 "parser.y"
3005 { (yyval
.arg_decl
) = new_argument_decl(ctx
, (yyvsp
[(2) - (3)].string
), FALSE
); }
3010 /* Line 1806 of yacc.c */
3011 #line 443 "parser.y"
3012 { (yyval
.string
) = (yyvsp
[(1) - (1)].string
); }
3017 /* Line 1806 of yacc.c */
3018 #line 444 "parser.y"
3019 { (yyval
.string
) = propertyW
; }
3024 /* Line 1806 of yacc.c */
3025 #line 3032 "parser.tab.c"
3028 /* User semantic actions sometimes alter yychar, and that requires
3029 that yytoken be updated with the new translation. We take the
3030 approach of translating immediately before every use of yytoken.
3031 One alternative is translating here after every semantic action,
3032 but that translation would be missed if the semantic action invokes
3033 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
3034 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
3035 incorrect destructor might then be invoked immediately. In the
3036 case of YYERROR or YYBACKUP, subsequent parser actions might lead
3037 to an incorrect destructor call or verbose syntax error message
3038 before the lookahead is translated. */
3039 YY_SYMBOL_PRINT ("-> $$ =", yyr1
[yyn
], &yyval
, &yyloc
);
3043 YY_STACK_PRINT (yyss
, yyssp
);
3047 /* Now `shift' the result of the reduction. Determine what state
3048 that goes to, based on the state we popped back to and the rule
3049 number reduced by. */
3053 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
3054 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
3055 yystate
= yytable
[yystate
];
3057 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
3062 /*------------------------------------.
3063 | yyerrlab -- here on detecting error |
3064 `------------------------------------*/
3066 /* Make sure we have latest lookahead translation. See comments at
3067 user semantic actions for why this is necessary. */
3068 yytoken
= yychar
== YYEMPTY
? YYEMPTY
: YYTRANSLATE (yychar
);
3070 /* If not already recovering from an error, report this error. */
3074 #if ! YYERROR_VERBOSE
3075 yyerror (ctx
, YY_("syntax error"));
3077 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
3080 char const *yymsgp
= YY_("syntax error");
3081 int yysyntax_error_status
;
3082 yysyntax_error_status
= YYSYNTAX_ERROR
;
3083 if (yysyntax_error_status
== 0)
3085 else if (yysyntax_error_status
== 1)
3087 if (yymsg
!= yymsgbuf
)
3088 YYSTACK_FREE (yymsg
);
3089 yymsg
= (char *) YYSTACK_ALLOC (yymsg_alloc
);
3093 yymsg_alloc
= sizeof yymsgbuf
;
3094 yysyntax_error_status
= 2;
3098 yysyntax_error_status
= YYSYNTAX_ERROR
;
3102 yyerror (ctx
, yymsgp
);
3103 if (yysyntax_error_status
== 2)
3104 goto yyexhaustedlab
;
3106 # undef YYSYNTAX_ERROR
3112 if (yyerrstatus
== 3)
3114 /* If just tried and failed to reuse lookahead token after an
3115 error, discard it. */
3117 if (yychar
<= YYEOF
)
3119 /* Return failure if at end of input. */
3120 if (yychar
== YYEOF
)
3125 yydestruct ("Error: discarding",
3126 yytoken
, &yylval
, ctx
);
3131 /* Else will try to reuse lookahead token after shifting the error
3136 /*---------------------------------------------------.
3137 | yyerrorlab -- error raised explicitly by YYERROR. |
3138 `---------------------------------------------------*/
3141 /* Pacify compilers like GCC when the user code never invokes
3142 YYERROR and the label yyerrorlab therefore never appears in user
3144 if (/*CONSTCOND*/ 0)
3147 /* Do not reclaim the symbols of the rule which action triggered
3151 YY_STACK_PRINT (yyss
, yyssp
);
3156 /*-------------------------------------------------------------.
3157 | yyerrlab1 -- common code for both syntax error and YYERROR. |
3158 `-------------------------------------------------------------*/
3160 yyerrstatus
= 3; /* Each real token shifted decrements this. */
3164 yyn
= yypact
[yystate
];
3165 if (!yypact_value_is_default (yyn
))
3168 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
3176 /* Pop the current state because it cannot handle the error token. */
3181 yydestruct ("Error: popping",
3182 yystos
[yystate
], yyvsp
, ctx
);
3185 YY_STACK_PRINT (yyss
, yyssp
);
3191 /* Shift the error token. */
3192 YY_SYMBOL_PRINT ("Shifting", yystos
[yyn
], yyvsp
, yylsp
);
3198 /*-------------------------------------.
3199 | yyacceptlab -- YYACCEPT comes here. |
3200 `-------------------------------------*/
3205 /*-----------------------------------.
3206 | yyabortlab -- YYABORT comes here. |
3207 `-----------------------------------*/
3212 #if !defined(yyoverflow) || YYERROR_VERBOSE
3213 /*-------------------------------------------------.
3214 | yyexhaustedlab -- memory exhaustion comes here. |
3215 `-------------------------------------------------*/
3217 yyerror (ctx
, YY_("memory exhausted"));
3223 if (yychar
!= YYEMPTY
)
3225 /* Make sure we have latest lookahead translation. See comments at
3226 user semantic actions for why this is necessary. */
3227 yytoken
= YYTRANSLATE (yychar
);
3228 yydestruct ("Cleanup: discarding lookahead",
3229 yytoken
, &yylval
, ctx
);
3231 /* Do not reclaim the symbols of the rule which action triggered
3232 this YYABORT or YYACCEPT. */
3234 YY_STACK_PRINT (yyss
, yyssp
);
3235 while (yyssp
!= yyss
)
3237 yydestruct ("Cleanup: popping",
3238 yystos
[*yyssp
], yyvsp
, ctx
);
3243 YYSTACK_FREE (yyss
);
3246 if (yymsg
!= yymsgbuf
)
3247 YYSTACK_FREE (yymsg
);
3249 /* Make sure YYID is used. */
3250 return YYID (yyresult
);
3255 /* Line 2067 of yacc.c */
3256 #line 451 "parser.y"
3259 static int parser_error(parser_ctx_t
*ctx
, const char *str
)
3264 static void source_add_statement(parser_ctx_t
*ctx
, statement_t
*stat
)
3270 ctx
->stats_tail
->next
= stat
;
3271 ctx
->stats_tail
= stat
;
3273 ctx
->stats
= ctx
->stats_tail
= stat
;
3277 static void source_add_class(parser_ctx_t
*ctx
, class_decl_t
*class_decl
)
3279 class_decl
->next
= ctx
->class_decls
;
3280 ctx
->class_decls
= class_decl
;
3283 static void parse_complete(parser_ctx_t
*ctx
, BOOL option_explicit
)
3285 ctx
->parse_complete
= TRUE
;
3286 ctx
->option_explicit
= option_explicit
;
3289 static void *new_expression(parser_ctx_t
*ctx
, expression_type_t type
, size_t size
)
3293 expr
= parser_alloc(ctx
, size
? size
: sizeof(*expr
));
3302 static expression_t
*new_bool_expression(parser_ctx_t
*ctx
, VARIANT_BOOL value
)
3304 bool_expression_t
*expr
;
3306 expr
= new_expression(ctx
, EXPR_BOOL
, sizeof(*expr
));
3310 expr
->value
= value
;
3314 static expression_t
*new_string_expression(parser_ctx_t
*ctx
, const WCHAR
*value
)
3316 string_expression_t
*expr
;
3318 expr
= new_expression(ctx
, EXPR_STRING
, sizeof(*expr
));
3322 expr
->value
= value
;
3326 static expression_t
*new_long_expression(parser_ctx_t
*ctx
, expression_type_t type
, LONG value
)
3328 int_expression_t
*expr
;
3330 expr
= new_expression(ctx
, type
, sizeof(*expr
));
3334 expr
->value
= value
;
3338 static expression_t
*new_double_expression(parser_ctx_t
*ctx
, double value
)
3340 double_expression_t
*expr
;
3342 expr
= new_expression(ctx
, EXPR_DOUBLE
, sizeof(*expr
));
3346 expr
->value
= value
;
3350 static expression_t
*new_unary_expression(parser_ctx_t
*ctx
, expression_type_t type
, expression_t
*subexpr
)
3352 unary_expression_t
*expr
;
3354 expr
= new_expression(ctx
, type
, sizeof(*expr
));
3358 expr
->subexpr
= subexpr
;
3362 static expression_t
*new_binary_expression(parser_ctx_t
*ctx
, expression_type_t type
, expression_t
*left
, expression_t
*right
)
3364 binary_expression_t
*expr
;
3366 expr
= new_expression(ctx
, type
, sizeof(*expr
));
3371 expr
->right
= right
;
3375 static member_expression_t
*new_member_expression(parser_ctx_t
*ctx
, expression_t
*obj_expr
, const WCHAR
*identifier
)
3377 member_expression_t
*expr
;
3379 expr
= new_expression(ctx
, EXPR_MEMBER
, sizeof(*expr
));
3383 expr
->obj_expr
= obj_expr
;
3384 expr
->identifier
= identifier
;
3389 static expression_t
*new_new_expression(parser_ctx_t
*ctx
, const WCHAR
*identifier
)
3391 string_expression_t
*expr
;
3393 expr
= new_expression(ctx
, EXPR_NEW
, sizeof(*expr
));
3397 expr
->value
= identifier
;
3401 static void *new_statement(parser_ctx_t
*ctx
, statement_type_t type
, size_t size
)
3405 stat
= parser_alloc(ctx
, size
? size
: sizeof(*stat
));
3414 static statement_t
*new_call_statement(parser_ctx_t
*ctx
, BOOL is_strict
, member_expression_t
*expr
)
3416 call_statement_t
*stat
;
3418 stat
= new_statement(ctx
, STAT_CALL
, sizeof(*stat
));
3423 stat
->is_strict
= is_strict
;
3427 static statement_t
*new_assign_statement(parser_ctx_t
*ctx
, member_expression_t
*left
, expression_t
*right
)
3429 assign_statement_t
*stat
;
3431 stat
= new_statement(ctx
, STAT_ASSIGN
, sizeof(*stat
));
3435 stat
->member_expr
= left
;
3436 stat
->value_expr
= right
;
3440 static statement_t
*new_set_statement(parser_ctx_t
*ctx
, member_expression_t
*left
, expression_t
*right
)
3442 assign_statement_t
*stat
;
3444 stat
= new_statement(ctx
, STAT_SET
, sizeof(*stat
));
3448 stat
->member_expr
= left
;
3449 stat
->value_expr
= right
;
3453 static dim_decl_t
*new_dim_decl(parser_ctx_t
*ctx
, const WCHAR
*name
, BOOL is_array
, dim_list_t
*dims
)
3457 decl
= parser_alloc(ctx
, sizeof(*decl
));
3462 decl
->is_array
= is_array
;
3468 static dim_list_t
*new_dim(parser_ctx_t
*ctx
, unsigned val
, dim_list_t
*next
)
3472 ret
= parser_alloc(ctx
, sizeof(*ret
));
3481 static statement_t
*new_dim_statement(parser_ctx_t
*ctx
, dim_decl_t
*decls
)
3483 dim_statement_t
*stat
;
3485 stat
= new_statement(ctx
, STAT_DIM
, sizeof(*stat
));
3489 stat
->dim_decls
= decls
;
3493 static elseif_decl_t
*new_elseif_decl(parser_ctx_t
*ctx
, expression_t
*expr
, statement_t
*stat
)
3495 elseif_decl_t
*decl
;
3497 decl
= parser_alloc(ctx
, sizeof(*decl
));
3507 static statement_t
*new_while_statement(parser_ctx_t
*ctx
, statement_type_t type
, expression_t
*expr
, statement_t
*body
)
3509 while_statement_t
*stat
;
3511 stat
= new_statement(ctx
, type
, sizeof(*stat
));
3520 static statement_t
*new_forto_statement(parser_ctx_t
*ctx
, const WCHAR
*identifier
, expression_t
*from_expr
,
3521 expression_t
*to_expr
, expression_t
*step_expr
, statement_t
*body
)
3523 forto_statement_t
*stat
;
3525 stat
= new_statement(ctx
, STAT_FORTO
, sizeof(*stat
));
3529 stat
->identifier
= identifier
;
3530 stat
->from_expr
= from_expr
;
3531 stat
->to_expr
= to_expr
;
3532 stat
->step_expr
= step_expr
;
3537 static statement_t
*new_foreach_statement(parser_ctx_t
*ctx
, const WCHAR
*identifier
, expression_t
*group_expr
,
3540 foreach_statement_t
*stat
;
3542 stat
= new_statement(ctx
, STAT_FOREACH
, sizeof(*stat
));
3546 stat
->identifier
= identifier
;
3547 stat
->group_expr
= group_expr
;
3552 static statement_t
*new_if_statement(parser_ctx_t
*ctx
, expression_t
*expr
, statement_t
*if_stat
, elseif_decl_t
*elseif_decl
,
3553 statement_t
*else_stat
)
3555 if_statement_t
*stat
;
3557 stat
= new_statement(ctx
, STAT_IF
, sizeof(*stat
));
3562 stat
->if_stat
= if_stat
;
3563 stat
->elseifs
= elseif_decl
;
3564 stat
->else_stat
= else_stat
;
3568 static statement_t
*new_select_statement(parser_ctx_t
*ctx
, expression_t
*expr
, case_clausule_t
*case_clausules
)
3570 select_statement_t
*stat
;
3572 stat
= new_statement(ctx
, STAT_SELECT
, sizeof(*stat
));
3577 stat
->case_clausules
= case_clausules
;
3581 static case_clausule_t
*new_case_clausule(parser_ctx_t
*ctx
, expression_t
*expr
, statement_t
*stat
, case_clausule_t
*next
)
3583 case_clausule_t
*ret
;
3585 ret
= parser_alloc(ctx
, sizeof(*ret
));
3595 static statement_t
*new_onerror_statement(parser_ctx_t
*ctx
, BOOL resume_next
)
3597 onerror_statement_t
*stat
;
3599 stat
= new_statement(ctx
, STAT_ONERROR
, sizeof(*stat
));
3603 stat
->resume_next
= resume_next
;
3607 static arg_decl_t
*new_argument_decl(parser_ctx_t
*ctx
, const WCHAR
*name
, BOOL by_ref
)
3609 arg_decl_t
*arg_decl
;
3611 arg_decl
= parser_alloc(ctx
, sizeof(*arg_decl
));
3615 arg_decl
->name
= name
;
3616 arg_decl
->by_ref
= by_ref
;
3617 arg_decl
->next
= NULL
;
3621 static function_decl_t
*new_function_decl(parser_ctx_t
*ctx
, const WCHAR
*name
, function_type_t type
,
3622 unsigned storage_flags
, arg_decl_t
*arg_decl
, statement_t
*body
)
3624 function_decl_t
*decl
;
3626 if(storage_flags
& STORAGE_IS_DEFAULT
) {
3627 if(type
== FUNC_PROPGET
) {
3630 FIXME("Invalid default property\n");
3636 decl
= parser_alloc(ctx
, sizeof(*decl
));
3642 decl
->is_public
= !(storage_flags
& STORAGE_IS_PRIVATE
);
3643 decl
->args
= arg_decl
;
3646 decl
->next_prop_func
= NULL
;
3650 static statement_t
*new_function_statement(parser_ctx_t
*ctx
, function_decl_t
*decl
)
3652 function_statement_t
*stat
;
3654 stat
= new_statement(ctx
, STAT_FUNC
, sizeof(*stat
));
3658 stat
->func_decl
= decl
;
3662 static class_decl_t
*new_class_decl(parser_ctx_t
*ctx
)
3664 class_decl_t
*class_decl
;
3666 class_decl
= parser_alloc(ctx
, sizeof(*class_decl
));
3670 class_decl
->funcs
= NULL
;
3671 class_decl
->props
= NULL
;
3672 class_decl
->next
= NULL
;
3676 static class_decl_t
*add_class_function(parser_ctx_t
*ctx
, class_decl_t
*class_decl
, function_decl_t
*decl
)
3678 function_decl_t
*iter
;
3680 for(iter
= class_decl
->funcs
; iter
; iter
= iter
->next
) {
3681 if(!strcmpiW(iter
->name
, decl
->name
)) {
3682 if(decl
->type
== FUNC_SUB
|| decl
->type
== FUNC_FUNCTION
) {
3683 FIXME("Redefinition of %s::%s\n", debugstr_w(class_decl
->name
), debugstr_w(decl
->name
));
3689 if(iter
->type
== decl
->type
) {
3690 FIXME("Redefinition of %s::%s\n", debugstr_w(class_decl
->name
), debugstr_w(decl
->name
));
3694 if(!iter
->next_prop_func
)
3696 iter
= iter
->next_prop_func
;
3699 iter
->next_prop_func
= decl
;
3704 decl
->next
= class_decl
->funcs
;
3705 class_decl
->funcs
= decl
;
3709 static class_decl_t
*add_dim_prop(parser_ctx_t
*ctx
, class_decl_t
*class_decl
, dim_decl_t
*dim_decl
, unsigned storage_flags
)
3711 if(storage_flags
& STORAGE_IS_DEFAULT
) {
3712 FIXME("variant prop van't be default value\n");
3717 dim_decl
->is_public
= !(storage_flags
& STORAGE_IS_PRIVATE
);
3718 dim_decl
->next
= class_decl
->props
;
3719 class_decl
->props
= dim_decl
;
3723 static const_decl_t
*new_const_decl(parser_ctx_t
*ctx
, const WCHAR
*name
, expression_t
*expr
)
3727 decl
= parser_alloc(ctx
, sizeof(*decl
));
3732 decl
->value_expr
= expr
;
3737 static statement_t
*new_const_statement(parser_ctx_t
*ctx
, const_decl_t
*decls
)
3739 const_statement_t
*stat
;
3741 stat
= new_statement(ctx
, STAT_CONST
, sizeof(*stat
));
3745 stat
->decls
= decls
;
3749 static statement_t
*link_statements(statement_t
*head
, statement_t
*tail
)
3753 for(iter
= head
; iter
->next
; iter
= iter
->next
);
3759 void *parser_alloc(parser_ctx_t
*ctx
, size_t size
)
3763 ret
= heap_pool_alloc(&ctx
->heap
, size
);
3765 ctx
->hres
= E_OUTOFMEMORY
;
3769 HRESULT
parse_script(parser_ctx_t
*ctx
, const WCHAR
*code
, const WCHAR
*delimiter
)
3771 const WCHAR html_delimiterW
[] = {'<','/','s','c','r','i','p','t','>',0};
3773 ctx
->code
= ctx
->ptr
= code
;
3774 ctx
->end
= ctx
->code
+ strlenW(ctx
->code
);
3776 heap_pool_init(&ctx
->heap
);
3778 ctx
->parse_complete
= FALSE
;
3781 ctx
->last_token
= tNL
;
3783 ctx
->stats
= ctx
->stats_tail
= NULL
;
3784 ctx
->class_decls
= NULL
;
3785 ctx
->option_explicit
= FALSE
;
3786 ctx
->is_html
= delimiter
&& !strcmpiW(delimiter
, html_delimiterW
);
3790 if(FAILED(ctx
->hres
))
3792 if(!ctx
->parse_complete
) {
3793 FIXME("parser failed around %s\n", debugstr_w(ctx
->code
+20 > ctx
->ptr
? ctx
->code
: ctx
->ptr
-20));
3800 void parser_release(parser_ctx_t
*ctx
)
3802 heap_pool_free(&ctx
->heap
);