1 /* A Bison parser, made by GNU Bison 3.0.2. */
3 /* Bison implementation for Yacc-like parsers in C
5 Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 /* As a special exception, you may create a larger work that contains
21 part or all of the Bison parser skeleton and distribute that work
22 under terms of your choice, so long as that work isn't itself a
23 parser generator using the skeleton or a modified version thereof
24 as a parser skeleton. Alternatively, if you modify or redistribute
25 the parser skeleton itself, you may (at your option) remove this
26 special exception, which will cause the skeleton and the resulting
27 Bison output files to be licensed under the GNU General Public
28 License without this special exception.
30 This special exception was added by the Free Software Foundation in
31 version 2.2 of Bison. */
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34 simplifying the original so-called "semantic" parser. */
36 /* All symbols defined below should begin with yy or YY, to avoid
37 infringing on user name space. This should be done even for local
38 variables, as they might otherwise be expanded by user macros.
39 There are some unavoidable exceptions within include files to
40 define necessary library symbols; they are noted "INFRINGES ON
41 USER NAME SPACE" below. */
43 /* Identify Bison output. */
47 #define YYBISON_VERSION "3.0.2"
50 #define YYSKELETON_NAME "yacc.c"
62 /* Substitute the variable and function names. */
63 #define yyparse parser_parse
64 #define yylex parser_lex
65 #define yyerror parser_error
66 #define yydebug parser_debug
67 #define yynerrs parser_nerrs
70 /* Copy the first part of user declarations. */
71 #line 19 "parser.y" /* yacc.c:339 */
76 static int parser_error(parser_ctx_t
*,const char*);
78 static void parse_complete(parser_ctx_t
*,BOOL
);
80 static void source_add_statement(parser_ctx_t
*,statement_t
*);
81 static void source_add_class(parser_ctx_t
*,class_decl_t
*);
83 static void *new_expression(parser_ctx_t
*,expression_type_t
,size_t);
84 static expression_t
*new_bool_expression(parser_ctx_t
*,VARIANT_BOOL
);
85 static expression_t
*new_string_expression(parser_ctx_t
*,const WCHAR
*);
86 static expression_t
*new_long_expression(parser_ctx_t
*,expression_type_t
,LONG
);
87 static expression_t
*new_double_expression(parser_ctx_t
*,double);
88 static expression_t
*new_unary_expression(parser_ctx_t
*,expression_type_t
,expression_t
*);
89 static expression_t
*new_binary_expression(parser_ctx_t
*,expression_type_t
,expression_t
*,expression_t
*);
90 static expression_t
*new_new_expression(parser_ctx_t
*,const WCHAR
*);
92 static member_expression_t
*new_member_expression(parser_ctx_t
*,expression_t
*,const WCHAR
*);
94 static void *new_statement(parser_ctx_t
*,statement_type_t
,size_t);
95 static statement_t
*new_call_statement(parser_ctx_t
*,BOOL
,member_expression_t
*);
96 static statement_t
*new_assign_statement(parser_ctx_t
*,member_expression_t
*,expression_t
*);
97 static statement_t
*new_set_statement(parser_ctx_t
*,member_expression_t
*,expression_t
*);
98 static statement_t
*new_dim_statement(parser_ctx_t
*,dim_decl_t
*);
99 static statement_t
*new_while_statement(parser_ctx_t
*,statement_type_t
,expression_t
*,statement_t
*);
100 static statement_t
*new_forto_statement(parser_ctx_t
*,const WCHAR
*,expression_t
*,expression_t
*,expression_t
*,statement_t
*);
101 static statement_t
*new_foreach_statement(parser_ctx_t
*,const WCHAR
*,expression_t
*,statement_t
*);
102 static statement_t
*new_if_statement(parser_ctx_t
*,expression_t
*,statement_t
*,elseif_decl_t
*,statement_t
*);
103 static statement_t
*new_function_statement(parser_ctx_t
*,function_decl_t
*);
104 static statement_t
*new_onerror_statement(parser_ctx_t
*,BOOL
);
105 static statement_t
*new_const_statement(parser_ctx_t
*,const_decl_t
*);
106 static statement_t
*new_select_statement(parser_ctx_t
*,expression_t
*,case_clausule_t
*);
108 static dim_decl_t
*new_dim_decl(parser_ctx_t
*,const WCHAR
*,BOOL
,dim_list_t
*);
109 static dim_list_t
*new_dim(parser_ctx_t
*,unsigned,dim_list_t
*);
110 static elseif_decl_t
*new_elseif_decl(parser_ctx_t
*,expression_t
*,statement_t
*);
111 static function_decl_t
*new_function_decl(parser_ctx_t
*,const WCHAR
*,function_type_t
,unsigned,arg_decl_t
*,statement_t
*);
112 static arg_decl_t
*new_argument_decl(parser_ctx_t
*,const WCHAR
*,BOOL
);
113 static const_decl_t
*new_const_decl(parser_ctx_t
*,const WCHAR
*,expression_t
*);
114 static case_clausule_t
*new_case_clausule(parser_ctx_t
*,expression_t
*,statement_t
*,case_clausule_t
*);
116 static class_decl_t
*new_class_decl(parser_ctx_t
*);
117 static class_decl_t
*add_class_function(parser_ctx_t
*,class_decl_t
*,function_decl_t
*);
118 static class_decl_t
*add_dim_prop(parser_ctx_t
*,class_decl_t
*,dim_decl_t
*,unsigned);
120 static statement_t
*link_statements(statement_t
*,statement_t
*);
122 static const WCHAR propertyW
[] = {'p','r','o','p','e','r','t','y',0};
124 #define STORAGE_IS_PRIVATE 1
125 #define STORAGE_IS_DEFAULT 2
127 #define CHECK_ERROR if(((parser_ctx_t*)ctx)->hres != S_OK) YYABORT
130 #line 136 "parser.tab.c" /* yacc.c:339 */
133 # if defined __cplusplus && 201103L <= __cplusplus
134 # define YY_NULLPTR nullptr
136 # define YY_NULLPTR 0
140 /* Enabling verbose error messages. */
141 #ifdef YYERROR_VERBOSE
142 # undef YYERROR_VERBOSE
143 # define YYERROR_VERBOSE 1
145 # define YYERROR_VERBOSE 0
148 /* In a future release of Bison, this section will be replaced
149 by #include "parser.tab.h". */
150 #ifndef YY_PARSER_PARSER_TAB_H_INCLUDED
151 # define YY_PARSER_PARSER_TAB_H_INCLUDED
157 extern int parser_debug
;
168 tEMPTYBRACKETS
= 261,
237 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
238 typedef union YYSTYPE YYSTYPE
;
241 #line 88 "parser.y" /* yacc.c:355 */
244 statement_t
*statement
;
245 expression_t
*expression
;
246 member_expression_t
*member
;
247 elseif_decl_t
*elseif
;
248 dim_decl_t
*dim_decl
;
249 dim_list_t
*dim_list
;
250 function_decl_t
*func_decl
;
251 arg_decl_t
*arg_decl
;
252 class_decl_t
*class_decl
;
253 const_decl_t
*const_decl
;
254 case_clausule_t
*case_clausule
;
260 #line 266 "parser.tab.c" /* yacc.c:355 */
262 # define YYSTYPE_IS_TRIVIAL 1
263 # define YYSTYPE_IS_DECLARED 1
268 int parser_parse (parser_ctx_t
*ctx
);
270 #endif /* !YY_PARSER_PARSER_TAB_H_INCLUDED */
272 /* Copy the second part of user declarations. */
274 #line 280 "parser.tab.c" /* yacc.c:358 */
281 typedef YYTYPE_UINT8 yytype_uint8
;
283 typedef unsigned char yytype_uint8
;
287 typedef YYTYPE_INT8 yytype_int8
;
289 typedef signed char yytype_int8
;
293 typedef YYTYPE_UINT16 yytype_uint16
;
295 typedef unsigned short int yytype_uint16
;
299 typedef YYTYPE_INT16 yytype_int16
;
301 typedef short int yytype_int16
;
305 # ifdef __SIZE_TYPE__
306 # define YYSIZE_T __SIZE_TYPE__
307 # elif defined size_t
308 # define YYSIZE_T size_t
309 # elif ! defined YYSIZE_T
310 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
311 # define YYSIZE_T size_t
313 # define YYSIZE_T unsigned int
317 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
320 # if defined YYENABLE_NLS && YYENABLE_NLS
322 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
323 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
327 # define YY_(Msgid) Msgid
332 # if (defined __GNUC__ \
333 && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
334 || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
335 # define YY_ATTRIBUTE(Spec) __attribute__(Spec)
337 # define YY_ATTRIBUTE(Spec) /* empty */
341 #ifndef YY_ATTRIBUTE_PURE
342 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
345 #ifndef YY_ATTRIBUTE_UNUSED
346 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
349 #if !defined _Noreturn \
350 && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
351 # if defined _MSC_VER && 1200 <= _MSC_VER
352 # define _Noreturn __declspec (noreturn)
354 # define _Noreturn YY_ATTRIBUTE ((__noreturn__))
358 /* Suppress unused-variable warnings by "using" E. */
359 #if ! defined lint || defined __GNUC__
360 # define YYUSE(E) ((void) (E))
362 # define YYUSE(E) /* empty */
365 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
366 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
367 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
368 _Pragma ("GCC diagnostic push") \
369 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
370 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
371 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
372 _Pragma ("GCC diagnostic pop")
374 # define YY_INITIAL_VALUE(Value) Value
376 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
377 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
378 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
380 #ifndef YY_INITIAL_VALUE
381 # define YY_INITIAL_VALUE(Value) /* Nothing. */
385 #if ! defined yyoverflow || YYERROR_VERBOSE
387 /* The parser invokes alloca or malloc; define the necessary symbols. */
389 # ifdef YYSTACK_USE_ALLOCA
390 # if YYSTACK_USE_ALLOCA
392 # define YYSTACK_ALLOC __builtin_alloca
393 # elif defined __BUILTIN_VA_ARG_INCR
394 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
396 # define YYSTACK_ALLOC __alloca
397 # elif defined _MSC_VER
398 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
399 # define alloca _alloca
401 # define YYSTACK_ALLOC alloca
402 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
403 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
404 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
405 # ifndef EXIT_SUCCESS
406 # define EXIT_SUCCESS 0
413 # ifdef YYSTACK_ALLOC
414 /* Pacify GCC's 'empty if-body' warning. */
415 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
416 # ifndef YYSTACK_ALLOC_MAXIMUM
417 /* The OS might guarantee only one guard page at the bottom of the stack,
418 and a page size can be as small as 4096 bytes. So we cannot safely
419 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
420 to allow for a few compiler-allocated temporary stack slots. */
421 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
424 # define YYSTACK_ALLOC YYMALLOC
425 # define YYSTACK_FREE YYFREE
426 # ifndef YYSTACK_ALLOC_MAXIMUM
427 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
429 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
430 && ! ((defined YYMALLOC || defined malloc) \
431 && (defined YYFREE || defined free)))
432 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
433 # ifndef EXIT_SUCCESS
434 # define EXIT_SUCCESS 0
438 # define YYMALLOC malloc
439 # if ! defined malloc && ! defined EXIT_SUCCESS
440 void *malloc (YYSIZE_T
); /* INFRINGES ON USER NAME SPACE */
445 # if ! defined free && ! defined EXIT_SUCCESS
446 void free (void *); /* INFRINGES ON USER NAME SPACE */
450 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
453 #if (! defined yyoverflow \
454 && (! defined __cplusplus \
455 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
457 /* A type that is properly aligned for any stack member. */
460 yytype_int16 yyss_alloc
;
464 /* The size of the maximum gap between one aligned stack and the next. */
465 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
467 /* The size of an array large to enough to hold all stacks, each with
469 # define YYSTACK_BYTES(N) \
470 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
471 + YYSTACK_GAP_MAXIMUM)
473 # define YYCOPY_NEEDED 1
475 /* Relocate STACK from its old location to the new one. The
476 local variables YYSIZE and YYSTACKSIZE give the old and new number of
477 elements in the stack, and YYPTR gives the new location of the
478 stack. Advance YYPTR to a properly aligned location for the next
480 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
483 YYSIZE_T yynewbytes; \
484 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
485 Stack = &yyptr->Stack_alloc; \
486 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
487 yyptr += yynewbytes / sizeof (*yyptr); \
493 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
494 /* Copy COUNT objects from SRC to DST. The source and destination do
497 # if defined __GNUC__ && 1 < __GNUC__
498 # define YYCOPY(Dst, Src, Count) \
499 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
501 # define YYCOPY(Dst, Src, Count) \
505 for (yyi = 0; yyi < (Count); yyi++) \
506 (Dst)[yyi] = (Src)[yyi]; \
511 #endif /* !YYCOPY_NEEDED */
513 /* YYFINAL -- State number of the termination state. */
515 /* YYLAST -- Last index in YYTABLE. */
518 /* YYNTOKENS -- Number of terminals. */
520 /* YYNNTS -- Number of nonterminals. */
522 /* YYNRULES -- Number of rules. */
524 /* YYNSTATES -- Number of states. */
525 #define YYNSTATES 341
527 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
528 by yylex, with out-of-bounds checking. */
530 #define YYMAXUTOK 325
532 #define YYTRANSLATE(YYX) \
533 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
535 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
536 as returned by yylex, without out-of-bounds checking. */
537 static const yytype_uint8 yytranslate
[] =
539 0, 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, 2, 2, 2, 2,
542 2, 2, 2, 2, 2, 2, 2, 2, 81, 2,
543 76, 77, 84, 82, 75, 78, 74, 85, 73, 2,
544 2, 2, 2, 2, 2, 2, 2, 2, 71, 2,
545 80, 72, 79, 2, 2, 2, 2, 2, 2, 2,
546 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
547 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
548 2, 2, 83, 2, 86, 2, 2, 2, 2, 2,
549 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
550 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
551 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
552 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
553 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
554 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
555 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
556 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
557 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
558 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
559 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
560 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
561 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
562 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
563 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
564 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
565 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
566 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
567 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
568 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
569 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
570 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
571 65, 66, 67, 68, 69, 70
575 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
576 static const yytype_uint16 yyrline
[] =
578 0, 147, 147, 150, 151, 153, 155, 156, 159, 160,
579 163, 164, 167, 170, 171, 172, 173, 174, 177, 178,
580 179, 181, 182, 183, 185, 188, 191, 192, 193, 194,
581 195, 196, 197, 198, 200, 201, 202, 203, 204, 206,
582 208, 212, 213, 216, 217, 220, 221, 222, 225, 226,
583 229, 230, 233, 236, 237, 240, 241, 244, 245, 248,
584 250, 251, 254, 256, 259, 260, 263, 264, 267, 271,
585 272, 275, 276, 277, 281, 282, 285, 286, 289, 290,
586 291, 293, 295, 298, 299, 302, 303, 306, 307, 310,
587 311, 314, 315, 318, 319, 322, 323, 326, 327, 328,
588 329, 330, 331, 332, 333, 336, 337, 340, 341, 342,
589 345, 346, 349, 350, 354, 355, 357, 361, 362, 365,
590 366, 367, 368, 371, 372, 375, 376, 377, 378, 379,
591 380, 381, 384, 385, 386, 387, 390, 391, 392, 395,
592 396, 399, 402, 403, 405, 407, 408, 411, 413, 415,
593 419, 421, 425, 426, 429, 430, 431, 434, 435, 438,
594 439, 442, 443, 444, 448, 449, 453, 454
598 #if YYDEBUG || YYERROR_VERBOSE || 0
599 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
600 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
601 static const char *const yytname
[] =
603 "$end", "error", "$undefined", "tEOF", "tNL", "tREM", "tEMPTYBRACKETS",
604 "tTRUE", "tFALSE", "tNOT", "tAND", "tOR", "tXOR", "tEQV", "tIMP", "tNEQ",
605 "tIS", "tLTEQ", "tGTEQ", "tMOD", "tCALL", "tDIM", "tSUB", "tFUNCTION",
606 "tPROPERTY", "tGET", "tLET", "tCONST", "tIF", "tELSE", "tELSEIF", "tEND",
607 "tTHEN", "tEXIT", "tWHILE", "tWEND", "tDO", "tLOOP", "tUNTIL", "tFOR",
608 "tTO", "tSTEP", "tEACH", "tIN", "tSELECT", "tCASE", "tBYREF", "tBYVAL",
609 "tOPTION", "tEXPLICIT", "tSTOP", "tNOTHING", "tEMPTY", "tNULL", "tCLASS",
610 "tSET", "tNEW", "tPUBLIC", "tPRIVATE", "tDEFAULT", "tME", "tERROR",
611 "tNEXT", "tON", "tRESUME", "tGOTO", "tIdentifier", "tString", "tLong",
612 "tShort", "tDouble", "':'", "'='", "'0'", "'.'", "','", "'('", "')'",
613 "'-'", "'>'", "'<'", "'&'", "'+'", "'\\\\'", "'*'", "'/'", "'^'",
614 "$accept", "Program", "OptionExplicit_opt", "SourceElements",
615 "StatementsNl_opt", "StatementsNl", "StatementNl", "Statement",
616 "SimpleStatement", "MemberExpression", "DimDeclList", "DimDecl",
617 "DimList", "ConstDeclList", "ConstDecl", "ConstExpression", "DoType",
618 "Step_opt", "IfStatement", "EndIf_opt", "ElseIfs_opt", "ElseIfs",
619 "ElseIf", "Else_opt", "CaseClausules", "Arguments_opt",
620 "ArgumentList_opt", "ArgumentList", "EmptyBrackets_opt",
621 "ExpressionList", "Expression", "EqvExpression", "XorExpression",
622 "OrExpression", "AndExpression", "NotExpression", "EqualityExpression",
623 "ConcatExpression", "AdditiveExpression", "ModExpression",
624 "IntdivExpression", "MultiplicativeExpression", "ExpExpression",
625 "UnaryExpression", "CallExpression", "LiteralExpression",
626 "NumericLiteralExpression", "IntegerValue", "PrimaryExpression",
627 "ClassDeclaration", "ClassBody", "PropertyDecl", "FunctionDecl",
628 "Storage_opt", "Storage", "ArgumentsDecl_opt", "ArgumentDeclList",
629 "ArgumentDecl", "Identifier", "StSep", YY_NULLPTR
634 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
635 (internal) symbol number NUM (which must be that of a token). */
636 static const yytype_uint16 yytoknum
[] =
638 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
639 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
640 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
641 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
642 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
643 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
644 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
645 325, 58, 61, 48, 46, 44, 40, 41, 45, 62,
646 60, 38, 43, 92, 42, 47, 94
650 #define YYPACT_NINF -154
652 #define yypact_value_is_default(Yystate) \
653 (!!((Yystate) == (-154)))
655 #define YYTABLE_NINF -153
657 #define yytable_value_is_error(Yytable_value) \
660 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
662 static const yytype_int16 yypact
[] =
664 -13, -11, 67, -154, 78, -154, 313, -154, -154, 98,
665 -5, -154, -5, 464, 146, 464, 12, 34, 76, -154,
666 -5, 98, 96, -154, -154, 90, -154, 566, 464, -154,
667 159, 101, 182, -154, 104, -154, -154, -154, 37, -154,
668 -154, 1, -154, 100, 4, -154, 112, 131, -154, -154,
669 464, -154, -154, -154, -5, -154, -154, -154, -154, -154,
670 497, 1, 31, 171, 196, 198, 212, -154, 24, 147,
671 -60, 208, 148, -31, 143, -154, 104, -154, -154, -154,
672 -154, -154, -154, -154, 52, 607, -154, -154, 464, -5,
673 158, 464, 228, 1, -154, 65, -154, -3, -154, 566,
674 -154, 392, 392, 165, -154, -154, 130, 19, -5, -5,
675 -5, 392, 167, -154, -5, -154, 92, -5, 528, -154,
676 -154, -154, -154, 464, 354, 464, 464, 464, 464, 497,
677 497, 497, 497, 497, 497, 497, 497, 497, 497, 497,
678 497, 497, 497, 497, 660, 202, -154, 566, 105, 204,
679 464, 16, 123, 181, 201, 191, -154, -154, -154, 188,
680 22, 464, 392, -154, 7, 7, -154, -154, -154, -154,
681 192, 193, -154, 42, -154, -154, 171, 566, 85, 196,
682 198, 212, -154, 147, 147, 147, 147, 147, 147, 147,
683 -60, 208, 208, 148, -31, 143, 143, -154, 236, 13,
684 -154, 607, 464, 29, -154, -154, 227, -5, 242, 270,
685 271, 176, 210, 464, -154, -154, -154, 263, -154, 2,
686 -154, 274, 275, -154, 92, -154, 250, 795, 253, -154,
687 -154, 464, 245, 109, 464, 425, 258, 286, 239, 123,
688 123, 107, 291, 263, -5, -5, 219, 222, 292, 701,
689 701, -154, 464, 273, -154, 250, 269, -154, 263, -154,
690 742, 14, 21, 21, 30, 260, 123, 302, -154, -154,
691 241, 244, 247, 123, 292, 292, -154, 2, -154, 277,
692 280, 43, 311, 287, -154, -154, 259, 464, 316, 795,
693 566, 464, -154, -154, -154, 7, 246, 248, -154, -154,
694 -154, -154, 301, 307, 321, 701, 308, -154, 263, 742,
695 -154, 227, -154, 331, 2, 2, -154, -154, 566, -154,
696 -154, 276, -154, 701, 262, 265, -154, -154, 312, 341,
697 346, 327, 701, 701, -154, 322, 323, 332, 335, -154,
701 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
702 Performed when YYTABLE does not specify something else to do. Zero
703 means the default is an error. */
704 static const yytype_uint8 yydefact
[] =
706 3, 0, 0, 5, 0, 1, 152, 4, 2, 0,
707 0, 165, 0, 0, 0, 0, 0, 0, 0, 34,
708 0, 0, 155, 156, 140, 0, 164, 13, 0, 6,
709 0, 15, 81, 22, 0, 123, 7, 27, 0, 153,
710 41, 81, 21, 43, 45, 37, 50, 0, 125, 126,
711 0, 131, 129, 130, 0, 127, 134, 132, 135, 133,
712 0, 81, 0, 85, 87, 89, 91, 93, 95, 97,
713 105, 107, 110, 112, 114, 117, 120, 119, 128, 32,
714 30, 31, 28, 29, 0, 152, 55, 56, 0, 0,
715 0, 0, 0, 81, 154, 0, 14, 0, 12, 17,
716 82, 0, 0, 124, 18, 77, 76, 78, 0, 0,
717 0, 0, 19, 74, 0, 47, 0, 0, 0, 96,
718 121, 122, 124, 0, 152, 0, 0, 0, 0, 0,
719 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
720 0, 0, 0, 0, 152, 0, 9, 10, 0, 0,
721 0, 0, 152, 124, 0, 0, 139, 16, 80, 0,
722 0, 0, 0, 42, 81, 81, 44, 138, 136, 137,
723 0, 48, 51, 0, 52, 53, 86, 8, 62, 88,
724 90, 92, 94, 99, 104, 103, 102, 98, 100, 101,
725 106, 109, 108, 111, 113, 115, 116, 118, 0, 26,
726 11, 152, 0, 0, 166, 167, 71, 0, 0, 0,
727 0, 0, 153, 0, 35, 36, 75, 20, 79, 0,
728 157, 0, 0, 46, 0, 54, 64, 152, 0, 60,
729 23, 0, 0, 0, 0, 0, 0, 0, 0, 152,
730 152, 0, 0, 33, 0, 0, 0, 159, 81, 152,
731 152, 49, 0, 69, 65, 66, 62, 63, 25, 24,
732 152, 57, 0, 0, 83, 0, 152, 0, 146, 143,
733 0, 0, 0, 152, 81, 81, 158, 0, 161, 0,
734 0, 0, 0, 0, 67, 61, 0, 0, 0, 152,
735 8, 0, 40, 145, 141, 81, 0, 0, 144, 162,
736 163, 160, 0, 0, 0, 152, 0, 39, 58, 152,
737 72, 71, 84, 0, 0, 0, 150, 151, 8, 70,
738 59, 0, 73, 152, 0, 0, 68, 38, 0, 0,
739 0, 0, 152, 152, 147, 0, 0, 0, 0, 148,
743 /* YYPGOTO[NTERM-NUM]. */
744 static const yytype_int16 yypgoto
[] =
746 -154, -154, -154, -154, -113, -143, 349, -26, -154, -6,
747 251, 153, 137, 249, -154, -154, 163, -154, -154, 108,
748 -154, 114, -154, -154, 61, -9, -154, -23, -8, 86,
749 57, 257, 261, 266, 256, -42, -154, 82, 255, -30,
750 264, 254, 25, -54, -4, 267, 223, -154, -154, -154,
751 -149, -154, -138, -90, -87, -153, 118, -121, 17, -37
754 /* YYDEFGOTO[NTERM-NUM]. */
755 static const yytype_int16 yydefgoto
[] =
757 -1, 2, 3, 6, 145, 146, 147, 30, 31, 61,
758 42, 43, 170, 45, 46, 174, 88, 288, 33, 229,
759 253, 254, 255, 283, 236, 103, 104, 159, 113, 263,
760 107, 63, 64, 65, 66, 67, 68, 69, 70, 71,
761 72, 73, 74, 75, 76, 77, 78, 171, 35, 36,
762 208, 209, 37, 38, 39, 221, 246, 247, 40, 206
765 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
766 positive, shift that token. If negative, reduce the rule whose
767 number is the opposite. If YYTABLE_NINF, syntax error. */
768 static const yytype_int16 yytable
[] =
770 32, 96, 34, 41, 200, 34, 121, 100, 119, 105,
771 115, 123, 222, 100, 210, 93, 85, 34, 137, 11,
772 204, 32, 138, 34, 106, 204, 11, 44, 123, 47,
773 123, 198, 112, 123, 90, 1, 123, 92, 4, 129,
774 130, 131, 132, 123, 123, 123, 86, 86, 244, 245,
775 87, 87, 122, 141, 142, 287, 144, 123, 11, 109,
776 110, 26, 211, 124, 226, 212, 123, 5, 26, 234,
777 62, 120, 84, 157, 156, 304, 89, 111, 158, 32,
778 116, 34, 7, 219, 153, 97, 182, 205, 232, 197,
779 268, 269, 205, 32, 162, 34, 133, 162, 178, 156,
780 26, 210, 210, 134, 135, 291, 149, 191, 192, 201,
781 56, 57, 58, 260, 227, 59, 228, 293, 32, 123,
782 34, 91, 11, 123, 298, 163, 164, 165, 210, 154,
783 155, 44, 270, 271, 47, 210, 279, 280, 32, 218,
784 34, 32, 313, 34, 207, 148, 310, 286, 151, 211,
785 211, 95, 212, 212, -142, 94, 220, 220, 24, 160,
786 167, 168, 272, 98, 26, 169, 195, 196, 79, 80,
787 81, 32, 99, 34, 28, 114, 211, 311, 108, 212,
788 22, 23, 82, 211, 125, 83, 212, 117, 100, 48,
789 49, 50, 319, 324, 325, 32, 321, 34, 109, 110,
790 241, 256, -74, 118, -74, 326, 11, 203, 126, 127,
791 328, 183, 184, 185, 186, 187, 188, 189, 217, 335,
792 336, 32, 128, 34, 44, 289, 290, 139, 136, 143,
793 150, 140, 152, 51, 52, 53, 248, 161, 54, 199,
794 278, -124, 24, 32, 32, 34, 34, 202, 26, 55,
795 56, 57, 58, 213, 32, 59, 34, 101, 102, 233,
796 60, 274, 275, 214, 215, 216, 299, 300, 224, 223,
797 243, 230, 235, 238, 239, 240, 242, 123, 249, 250,
798 252, 257, 259, 32, 32, 34, 34, 220, 258, 265,
799 266, 261, 264, 267, 248, 273, 276, 277, 100, 32,
800 228, 34, 282, 32, 292, 34, 294, 295, 302, 281,
801 296, 303, 32, 297, 34, 305, 8, 32, 306, 34,
802 309, 307, 314, 316, 315, 318, 32, 32, 34, 34,
803 317, 248, 248, 9, 10, 323, 320, 11, 327, 329,
804 12, 13, 330, 331, 308, 332, 14, 15, 264, 16,
805 333, 334, 17, 337, 338, 29, 339, 18, 177, 340,
806 237, 251, 231, 19, 285, 166, 172, 20, 21, 284,
807 22, 23, 322, 24, 9, 10, 25, 312, 11, 26,
808 176, 12, 13, 181, 27, 175, 179, 14, 15, 28,
809 16, 190, 180, 17, 194, 301, 225, 0, 18, 48,
810 49, 50, 0, 193, 19, 0, 0, 0, 0, 21,
811 0, 22, 23, 0, 24, 0, 11, 25, 0, 0,
812 26, 0, 0, 0, 0, 27, 0, 0, 0, 0,
813 28, 0, 48, 49, 50, 0, 0, 0, 0, 0,
814 0, 0, 0, 51, 52, 53, 0, 0, 54, 11,
815 0, 0, 24, 0, 262, 0, 0, 0, 26, 55,
816 56, 57, 58, 0, 0, 59, 0, 101, 28, 0,
817 60, 48, 49, 50, 0, 0, 51, 52, 53, 0,
818 0, 54, 0, 0, 0, 24, 0, 0, 11, 0,
819 0, 26, 55, 56, 57, 58, 0, 0, 59, 0,
820 0, 28, 0, 60, 48, 49, 0, 0, 0, 0,
821 0, 0, 0, 0, 0, 51, 52, 53, 0, 0,
822 54, 11, 0, 0, 24, 0, 0, 0, 0, 0,
823 26, 55, 56, 57, 58, 48, 49, 59, 0, 0,
824 28, 0, 60, 0, 0, 0, 0, 0, 51, 52,
825 53, 0, 0, 54, 0, 0, 0, 24, 0, 0,
826 0, 0, 0, 26, 55, 56, 57, 58, 0, 0,
827 59, 0, 0, 28, 0, 60, 0, 0, 0, 51,
828 52, 53, 0, 0, 0, 0, 9, 10, -152, -152,
829 11, 0, 0, 12, 13, 55, 56, 57, 58, 14,
830 15, 59, 16, 0, 0, 17, 173, 0, 0, 0,
831 18, 0, 0, 0, 0, 0, 19, 0, 0, 0,
832 0, 21, 0, 22, 23, 0, 24, 9, 10, 25,
833 0, 11, 26, 0, 12, 13, 0, 27, 0, 0,
834 14, 15, 28, 16, -8, 0, 17, 0, 0, 0,
835 0, 18, 0, 0, 0, 0, 0, 19, 0, 0,
836 0, 0, 21, 0, 22, 23, 0, 24, 0, 0,
837 25, 0, 0, 26, 0, 0, 0, 0, 27, 0,
838 9, 10, 0, 28, 11, 0, 0, 12, 13, 0,
839 0, 0, 0, 14, 15, -8, 16, 0, 0, 17,
840 0, 0, 0, 0, 18, 0, 0, 0, 0, 0,
841 19, 0, 0, 0, 0, 21, 0, 22, 23, 0,
842 24, 9, 10, 25, 0, 11, 26, 0, 12, 13,
843 0, 27, -8, 0, 14, 15, 28, 16, 0, 0,
844 17, 0, 0, 0, 0, 18, 0, 0, 0, 0,
845 0, 19, 0, 0, 0, 0, 21, 0, 22, 23,
846 0, 24, 9, 10, 25, 0, 11, 26, 0, 12,
847 13, 0, 27, 0, 0, 14, 15, 28, 16, 0,
848 0, 17, 0, 0, 0, 0, 18, 0, 0, 0,
849 0, 0, 19, 0, 0, 0, 0, 21, 0, 22,
850 23, 0, 24, 0, -8, 25, 0, 0, 26, 0,
851 0, 0, 0, 27, 0, 9, 10, 0, 28, 11,
852 0, 0, 12, 13, 0, 0, 0, 0, 14, 15,
853 0, 16, 0, 0, 17, 0, 0, 0, 0, 18,
854 0, 0, 0, 0, 0, 19, 0, 0, 0, 0,
855 21, 0, 22, 23, 0, 24, 0, 0, 25, 0,
856 0, 26, 0, 0, 0, 0, 27, 0, 0, 0,
860 static const yytype_int16 yycheck
[] =
862 6, 27, 6, 9, 147, 9, 60, 6, 50, 32,
863 6, 14, 165, 6, 152, 21, 4, 21, 78, 24,
864 4, 27, 82, 27, 32, 4, 24, 10, 14, 12,
865 14, 144, 41, 14, 17, 48, 14, 20, 49, 15,
866 16, 17, 18, 14, 14, 14, 34, 34, 46, 47,
867 38, 38, 61, 84, 85, 41, 4, 14, 24, 22,
868 23, 66, 152, 32, 177, 152, 14, 0, 66, 40,
869 13, 54, 15, 99, 77, 32, 42, 76, 101, 85,
870 76, 85, 4, 76, 93, 28, 128, 71, 201, 143,
871 239, 240, 71, 99, 75, 99, 72, 75, 124, 77,
872 66, 239, 240, 79, 80, 75, 89, 137, 138, 4,
873 68, 69, 70, 4, 29, 73, 31, 266, 124, 14,
874 124, 45, 24, 14, 273, 108, 109, 110, 266, 64,
875 65, 114, 25, 26, 117, 273, 249, 250, 144, 162,
876 144, 147, 295, 147, 21, 88, 289, 260, 91, 239,
877 240, 61, 239, 240, 31, 59, 164, 165, 60, 102,
878 68, 69, 55, 4, 66, 73, 141, 142, 22, 23,
879 24, 177, 71, 177, 76, 75, 266, 290, 74, 266,
880 57, 58, 36, 273, 13, 39, 273, 75, 6, 7,
881 8, 9, 305, 314, 315, 201, 309, 201, 22, 23,
882 24, 227, 72, 72, 74, 318, 24, 150, 12, 11,
883 323, 129, 130, 131, 132, 133, 134, 135, 161, 332,
884 333, 227, 10, 227, 207, 262, 263, 19, 81, 86,
885 72, 83, 4, 51, 52, 53, 219, 72, 56, 37,
886 248, 74, 60, 249, 250, 249, 250, 43, 66, 67,
887 68, 69, 70, 72, 260, 73, 260, 75, 76, 202,
888 78, 244, 245, 62, 73, 77, 274, 275, 75, 77,
889 213, 35, 45, 31, 4, 4, 66, 14, 4, 4,
890 30, 28, 37, 289, 290, 289, 290, 295, 231, 31,
891 4, 234, 235, 54, 277, 4, 77, 75, 6, 305,
892 31, 305, 29, 309, 44, 309, 4, 66, 31, 252,
893 66, 31, 318, 66, 318, 4, 3, 323, 31, 323,
894 4, 62, 76, 22, 76, 4, 332, 333, 332, 333,
895 23, 314, 315, 20, 21, 4, 28, 24, 62, 77,
896 27, 28, 77, 31, 287, 4, 33, 34, 291, 36,
897 4, 24, 39, 31, 31, 6, 24, 44, 4, 24,
898 207, 224, 199, 50, 256, 114, 117, 54, 55, 255,
899 57, 58, 311, 60, 20, 21, 63, 291, 24, 66,
900 123, 27, 28, 127, 71, 118, 125, 33, 34, 76,
901 36, 136, 126, 39, 140, 277, 173, -1, 44, 7,
902 8, 9, -1, 139, 50, -1, -1, -1, -1, 55,
903 -1, 57, 58, -1, 60, -1, 24, 63, -1, -1,
904 66, -1, -1, -1, -1, 71, -1, -1, -1, -1,
905 76, -1, 7, 8, 9, -1, -1, -1, -1, -1,
906 -1, -1, -1, 51, 52, 53, -1, -1, 56, 24,
907 -1, -1, 60, -1, 29, -1, -1, -1, 66, 67,
908 68, 69, 70, -1, -1, 73, -1, 75, 76, -1,
909 78, 7, 8, 9, -1, -1, 51, 52, 53, -1,
910 -1, 56, -1, -1, -1, 60, -1, -1, 24, -1,
911 -1, 66, 67, 68, 69, 70, -1, -1, 73, -1,
912 -1, 76, -1, 78, 7, 8, -1, -1, -1, -1,
913 -1, -1, -1, -1, -1, 51, 52, 53, -1, -1,
914 56, 24, -1, -1, 60, -1, -1, -1, -1, -1,
915 66, 67, 68, 69, 70, 7, 8, 73, -1, -1,
916 76, -1, 78, -1, -1, -1, -1, -1, 51, 52,
917 53, -1, -1, 56, -1, -1, -1, 60, -1, -1,
918 -1, -1, -1, 66, 67, 68, 69, 70, -1, -1,
919 73, -1, -1, 76, -1, 78, -1, -1, -1, 51,
920 52, 53, -1, -1, -1, -1, 20, 21, 22, 23,
921 24, -1, -1, 27, 28, 67, 68, 69, 70, 33,
922 34, 73, 36, -1, -1, 39, 78, -1, -1, -1,
923 44, -1, -1, -1, -1, -1, 50, -1, -1, -1,
924 -1, 55, -1, 57, 58, -1, 60, 20, 21, 63,
925 -1, 24, 66, -1, 27, 28, -1, 71, -1, -1,
926 33, 34, 76, 36, 37, -1, 39, -1, -1, -1,
927 -1, 44, -1, -1, -1, -1, -1, 50, -1, -1,
928 -1, -1, 55, -1, 57, 58, -1, 60, -1, -1,
929 63, -1, -1, 66, -1, -1, -1, -1, 71, -1,
930 20, 21, -1, 76, 24, -1, -1, 27, 28, -1,
931 -1, -1, -1, 33, 34, 35, 36, -1, -1, 39,
932 -1, -1, -1, -1, 44, -1, -1, -1, -1, -1,
933 50, -1, -1, -1, -1, 55, -1, 57, 58, -1,
934 60, 20, 21, 63, -1, 24, 66, -1, 27, 28,
935 -1, 71, 31, -1, 33, 34, 76, 36, -1, -1,
936 39, -1, -1, -1, -1, 44, -1, -1, -1, -1,
937 -1, 50, -1, -1, -1, -1, 55, -1, 57, 58,
938 -1, 60, 20, 21, 63, -1, 24, 66, -1, 27,
939 28, -1, 71, -1, -1, 33, 34, 76, 36, -1,
940 -1, 39, -1, -1, -1, -1, 44, -1, -1, -1,
941 -1, -1, 50, -1, -1, -1, -1, 55, -1, 57,
942 58, -1, 60, -1, 62, 63, -1, -1, 66, -1,
943 -1, -1, -1, 71, -1, 20, 21, -1, 76, 24,
944 -1, -1, 27, 28, -1, -1, -1, -1, 33, 34,
945 -1, 36, -1, -1, 39, -1, -1, -1, -1, 44,
946 -1, -1, -1, -1, -1, 50, -1, -1, -1, -1,
947 55, -1, 57, 58, -1, 60, -1, -1, 63, -1,
948 -1, 66, -1, -1, -1, -1, 71, -1, -1, -1,
952 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
953 symbol of state STATE-NUM. */
954 static const yytype_uint8 yystos
[] =
956 0, 48, 88, 89, 49, 0, 90, 4, 3, 20,
957 21, 24, 27, 28, 33, 34, 36, 39, 44, 50,
958 54, 55, 57, 58, 60, 63, 66, 71, 76, 93,
959 94, 95, 96, 105, 131, 135, 136, 139, 140, 141,
960 145, 96, 97, 98, 145, 100, 101, 145, 7, 8,
961 9, 51, 52, 53, 56, 67, 68, 69, 70, 73,
962 78, 96, 117, 118, 119, 120, 121, 122, 123, 124,
963 125, 126, 127, 128, 129, 130, 131, 132, 133, 22,
964 23, 24, 36, 39, 117, 4, 34, 38, 103, 42,
965 145, 45, 145, 96, 59, 61, 94, 117, 4, 71,
966 6, 75, 76, 112, 113, 114, 115, 117, 74, 22,
967 23, 76, 112, 115, 75, 6, 76, 75, 72, 122,
968 145, 130, 112, 14, 32, 13, 12, 11, 10, 15,
969 16, 17, 18, 72, 79, 80, 81, 78, 82, 19,
970 83, 84, 85, 86, 4, 91, 92, 93, 117, 145,
971 72, 117, 4, 112, 64, 65, 77, 94, 114, 114,
972 117, 72, 75, 145, 145, 145, 97, 68, 69, 73,
973 99, 134, 100, 78, 102, 132, 118, 4, 94, 119,
974 120, 121, 122, 124, 124, 124, 124, 124, 124, 124,
975 125, 126, 126, 127, 128, 129, 129, 130, 91, 37,
976 92, 4, 43, 117, 4, 71, 146, 21, 137, 138,
977 139, 140, 141, 72, 62, 73, 77, 117, 114, 76,
978 115, 142, 142, 77, 75, 133, 91, 29, 31, 106,
979 35, 103, 91, 117, 40, 45, 111, 98, 31, 4,
980 4, 24, 66, 117, 46, 47, 143, 144, 145, 4,
981 4, 99, 30, 107, 108, 109, 94, 28, 117, 37,
982 4, 117, 29, 116, 117, 31, 4, 54, 137, 137,
983 25, 26, 55, 4, 145, 145, 77, 75, 115, 91,
984 91, 117, 29, 110, 108, 106, 91, 41, 104, 146,
985 146, 75, 44, 137, 4, 66, 66, 66, 137, 115,
986 115, 143, 31, 31, 32, 4, 31, 62, 117, 4,
987 92, 91, 116, 142, 76, 76, 22, 23, 4, 91,
988 28, 91, 111, 4, 144, 144, 91, 62, 91, 77,
989 77, 31, 4, 4, 24, 91, 91, 31, 31, 24,
993 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
994 static const yytype_uint8 yyr1
[] =
996 0, 87, 88, 89, 89, 90, 90, 90, 91, 91,
997 92, 92, 93, 94, 94, 94, 94, 94, 95, 95,
998 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
999 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
1000 95, 96, 96, 97, 97, 98, 98, 98, 99, 99,
1001 100, 100, 101, 102, 102, 103, 103, 104, 104, 105,
1002 105, 105, 106, 106, 107, 107, 108, 108, 109, 110,
1003 110, 111, 111, 111, 112, 112, 113, 113, 114, 114,
1004 114, 115, 115, 116, 116, 117, 117, 118, 118, 119,
1005 119, 120, 120, 121, 121, 122, 122, 123, 123, 123,
1006 123, 123, 123, 123, 123, 124, 124, 125, 125, 125,
1007 126, 126, 127, 127, 128, 128, 128, 129, 129, 130,
1008 130, 130, 130, 131, 131, 132, 132, 132, 132, 132,
1009 132, 132, 133, 133, 133, 133, 134, 134, 134, 135,
1010 135, 136, 137, 137, 137, 137, 137, 138, 138, 138,
1011 139, 139, 140, 140, 141, 141, 141, 142, 142, 143,
1012 143, 144, 144, 144, 145, 145, 146, 146
1015 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
1016 static const yytype_uint8 yyr2
[] =
1018 0, 2, 3, 0, 3, 0, 2, 2, 0, 1,
1019 1, 2, 2, 1, 2, 1, 3, 2, 2, 3,
1020 4, 2, 1, 5, 6, 6, 4, 1, 2, 2,
1021 2, 2, 2, 5, 1, 4, 4, 2, 10, 8,
1022 7, 1, 3, 1, 3, 1, 4, 2, 1, 3,
1023 1, 3, 3, 1, 2, 1, 1, 0, 2, 9,
1024 5, 7, 0, 2, 0, 1, 1, 2, 5, 0,
1025 3, 0, 4, 5, 1, 3, 1, 1, 1, 3,
1026 2, 0, 1, 1, 3, 1, 3, 1, 3, 1,
1027 3, 1, 3, 1, 3, 1, 2, 1, 3, 3,
1028 3, 3, 3, 3, 3, 1, 3, 1, 3, 3,
1029 1, 3, 1, 3, 1, 3, 3, 1, 3, 1,
1030 1, 2, 2, 1, 2, 1, 1, 1, 1, 1,
1031 1, 1, 1, 1, 1, 1, 1, 1, 1, 3,
1032 1, 7, 0, 3, 4, 4, 3, 9, 11, 11,
1033 8, 8, 0, 1, 2, 1, 1, 1, 3, 1,
1034 3, 2, 3, 3, 1, 1, 1, 1
1038 #define yyerrok (yyerrstatus = 0)
1039 #define yyclearin (yychar = YYEMPTY)
1040 #define YYEMPTY (-2)
1043 #define YYACCEPT goto yyacceptlab
1044 #define YYABORT goto yyabortlab
1045 #define YYERROR goto yyerrorlab
1048 #define YYRECOVERING() (!!yyerrstatus)
1050 #define YYBACKUP(Token, Value) \
1052 if (yychar == YYEMPTY) \
1056 YYPOPSTACK (yylen); \
1062 yyerror (ctx, YY_("syntax error: cannot back up")); \
1067 /* Error token number */
1069 #define YYERRCODE 256
1073 /* Enable debugging if requested. */
1077 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1078 # define YYFPRINTF fprintf
1081 # define YYDPRINTF(Args) \
1087 /* This macro is provided for backward compatibility. */
1088 #ifndef YY_LOCATION_PRINT
1089 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1093 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1097 YYFPRINTF (stderr, "%s ", Title); \
1098 yy_symbol_print (stderr, \
1099 Type, Value, ctx); \
1100 YYFPRINTF (stderr, "\n"); \
1105 /*----------------------------------------.
1106 | Print this symbol's value on YYOUTPUT. |
1107 `----------------------------------------*/
1110 yy_symbol_value_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
, parser_ctx_t
*ctx
)
1112 FILE *yyo
= yyoutput
;
1118 if (yytype
< YYNTOKENS
)
1119 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
1125 /*--------------------------------.
1126 | Print this symbol on YYOUTPUT. |
1127 `--------------------------------*/
1130 yy_symbol_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
, parser_ctx_t
*ctx
)
1132 YYFPRINTF (yyoutput
, "%s %s (",
1133 yytype
< YYNTOKENS
? "token" : "nterm", yytname
[yytype
]);
1135 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
, ctx
);
1136 YYFPRINTF (yyoutput
, ")");
1139 /*------------------------------------------------------------------.
1140 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1142 `------------------------------------------------------------------*/
1145 yy_stack_print (yytype_int16
*yybottom
, yytype_int16
*yytop
)
1147 YYFPRINTF (stderr
, "Stack now");
1148 for (; yybottom
<= yytop
; yybottom
++)
1150 int yybot
= *yybottom
;
1151 YYFPRINTF (stderr
, " %d", yybot
);
1153 YYFPRINTF (stderr
, "\n");
1156 # define YY_STACK_PRINT(Bottom, Top) \
1159 yy_stack_print ((Bottom), (Top)); \
1163 /*------------------------------------------------.
1164 | Report that the YYRULE is going to be reduced. |
1165 `------------------------------------------------*/
1168 yy_reduce_print (yytype_int16
*yyssp
, YYSTYPE
*yyvsp
, int yyrule
, parser_ctx_t
*ctx
)
1170 unsigned long int yylno
= yyrline
[yyrule
];
1171 int yynrhs
= yyr2
[yyrule
];
1173 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %lu):\n",
1175 /* The symbols being reduced. */
1176 for (yyi
= 0; yyi
< yynrhs
; yyi
++)
1178 YYFPRINTF (stderr
, " $%d = ", yyi
+ 1);
1179 yy_symbol_print (stderr
,
1180 yystos
[yyssp
[yyi
+ 1 - yynrhs
]],
1181 &(yyvsp
[(yyi
+ 1) - (yynrhs
)])
1183 YYFPRINTF (stderr
, "\n");
1187 # define YY_REDUCE_PRINT(Rule) \
1190 yy_reduce_print (yyssp, yyvsp, Rule, ctx); \
1193 /* Nonzero means print parse trace. It is left uninitialized so that
1194 multiple parsers can coexist. */
1196 #else /* !YYDEBUG */
1197 # define YYDPRINTF(Args)
1198 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1199 # define YY_STACK_PRINT(Bottom, Top)
1200 # define YY_REDUCE_PRINT(Rule)
1201 #endif /* !YYDEBUG */
1204 /* YYINITDEPTH -- initial size of the parser's stacks. */
1206 # define YYINITDEPTH 200
1209 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1210 if the built-in stack extension method is used).
1212 Do not make this value too large; the results are undefined if
1213 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1214 evaluated with infinite-precision integer arithmetic. */
1217 # define YYMAXDEPTH 10000
1224 # if defined __GLIBC__ && defined _STRING_H
1225 # define yystrlen strlen
1227 /* Return the length of YYSTR. */
1229 yystrlen (const char *yystr
)
1232 for (yylen
= 0; yystr
[yylen
]; yylen
++)
1240 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1241 # define yystpcpy stpcpy
1243 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1246 yystpcpy (char *yydest
, const char *yysrc
)
1249 const char *yys
= yysrc
;
1251 while ((*yyd
++ = *yys
++) != '\0')
1260 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1261 quotes and backslashes, so that it's suitable for yyerror. The
1262 heuristic is that double-quoting is unnecessary unless the string
1263 contains an apostrophe, a comma, or backslash (other than
1264 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1265 null, do not copy; instead, return the length of what the result
1268 yytnamerr (char *yyres
, const char *yystr
)
1273 char const *yyp
= yystr
;
1280 goto do_not_strip_quotes
;
1284 goto do_not_strip_quotes
;
1297 do_not_strip_quotes
: ;
1301 return yystrlen (yystr
);
1303 return yystpcpy (yyres
, yystr
) - yyres
;
1307 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1308 about the unexpected token YYTOKEN for the state stack whose top is
1311 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1312 not large enough to hold the message. In that case, also set
1313 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1314 required number of bytes is too large to store. */
1316 yysyntax_error (YYSIZE_T
*yymsg_alloc
, char **yymsg
,
1317 yytype_int16
*yyssp
, int yytoken
)
1319 YYSIZE_T yysize0
= yytnamerr (YY_NULLPTR
, yytname
[yytoken
]);
1320 YYSIZE_T yysize
= yysize0
;
1321 enum { YYERROR_VERBOSE_ARGS_MAXIMUM
= 5 };
1322 /* Internationalized format string. */
1323 const char *yyformat
= YY_NULLPTR
;
1324 /* Arguments of yyformat. */
1325 char const *yyarg
[YYERROR_VERBOSE_ARGS_MAXIMUM
];
1326 /* Number of reported tokens (one for the "unexpected", one per
1330 /* There are many possibilities here to consider:
1331 - If this state is a consistent state with a default action, then
1332 the only way this function was invoked is if the default action
1333 is an error action. In that case, don't check for expected
1334 tokens because there are none.
1335 - The only way there can be no lookahead present (in yychar) is if
1336 this state is a consistent state with a default action. Thus,
1337 detecting the absence of a lookahead is sufficient to determine
1338 that there is no unexpected or expected token to report. In that
1339 case, just report a simple "syntax error".
1340 - Don't assume there isn't a lookahead just because this state is a
1341 consistent state with a default action. There might have been a
1342 previous inconsistent state, consistent state with a non-default
1343 action, or user semantic action that manipulated yychar.
1344 - Of course, the expected token list depends on states to have
1345 correct lookahead information, and it depends on the parser not
1346 to perform extra reductions after fetching a lookahead from the
1347 scanner and before detecting a syntax error. Thus, state merging
1348 (from LALR or IELR) and default reductions corrupt the expected
1349 token list. However, the list is correct for canonical LR with
1350 one exception: it will still contain any token that will not be
1351 accepted due to an error action in a later state.
1353 if (yytoken
!= YYEMPTY
)
1355 int yyn
= yypact
[*yyssp
];
1356 yyarg
[yycount
++] = yytname
[yytoken
];
1357 if (!yypact_value_is_default (yyn
))
1359 /* Start YYX at -YYN if negative to avoid negative indexes in
1360 YYCHECK. In other words, skip the first -YYN actions for
1361 this state because they are default actions. */
1362 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
1363 /* Stay within bounds of both yycheck and yytname. */
1364 int yychecklim
= YYLAST
- yyn
+ 1;
1365 int yyxend
= yychecklim
< YYNTOKENS
? yychecklim
: YYNTOKENS
;
1368 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
1369 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
1370 && !yytable_value_is_error (yytable
[yyx
+ yyn
]))
1372 if (yycount
== YYERROR_VERBOSE_ARGS_MAXIMUM
)
1378 yyarg
[yycount
++] = yytname
[yyx
];
1380 YYSIZE_T yysize1
= yysize
+ yytnamerr (YY_NULLPTR
, yytname
[yyx
]);
1381 if (! (yysize
<= yysize1
1382 && yysize1
<= YYSTACK_ALLOC_MAXIMUM
))
1392 # define YYCASE_(N, S) \
1396 YYCASE_(0, YY_("syntax error"));
1397 YYCASE_(1, YY_("syntax error, unexpected %s"));
1398 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1399 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1400 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1401 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1406 YYSIZE_T yysize1
= yysize
+ yystrlen (yyformat
);
1407 if (! (yysize
<= yysize1
&& yysize1
<= YYSTACK_ALLOC_MAXIMUM
))
1412 if (*yymsg_alloc
< yysize
)
1414 *yymsg_alloc
= 2 * yysize
;
1415 if (! (yysize
<= *yymsg_alloc
1416 && *yymsg_alloc
<= YYSTACK_ALLOC_MAXIMUM
))
1417 *yymsg_alloc
= YYSTACK_ALLOC_MAXIMUM
;
1421 /* Avoid sprintf, as that infringes on the user's name space.
1422 Don't have undefined behavior even if the translation
1423 produced a string with the wrong number of "%s"s. */
1427 while ((*yyp
= *yyformat
) != '\0')
1428 if (*yyp
== '%' && yyformat
[1] == 's' && yyi
< yycount
)
1430 yyp
+= yytnamerr (yyp
, yyarg
[yyi
++]);
1441 #endif /* YYERROR_VERBOSE */
1443 /*-----------------------------------------------.
1444 | Release the memory associated to this symbol. |
1445 `-----------------------------------------------*/
1448 yydestruct (const char *yymsg
, int yytype
, YYSTYPE
*yyvaluep
, parser_ctx_t
*ctx
)
1454 YY_SYMBOL_PRINT (yymsg
, yytype
, yyvaluep
, yylocationp
);
1456 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1458 YY_IGNORE_MAYBE_UNINITIALIZED_END
1469 yyparse (parser_ctx_t
*ctx
)
1471 /* The lookahead symbol. */
1475 /* The semantic value of the lookahead symbol. */
1476 /* Default value used for initialization, for pacifying older GCCs
1477 or non-GCC compilers. */
1478 YY_INITIAL_VALUE (static YYSTYPE yyval_default
;)
1479 YYSTYPE yylval
YY_INITIAL_VALUE (= yyval_default
);
1481 /* Number of syntax errors so far. */
1485 /* Number of tokens to shift before error messages enabled. */
1488 /* The stacks and their tools:
1489 'yyss': related to states.
1490 'yyvs': related to semantic values.
1492 Refer to the stacks through separate pointers, to allow yyoverflow
1493 to reallocate them elsewhere. */
1495 /* The state stack. */
1496 yytype_int16 yyssa
[YYINITDEPTH
];
1498 yytype_int16
*yyssp
;
1500 /* The semantic value stack. */
1501 YYSTYPE yyvsa
[YYINITDEPTH
];
1505 YYSIZE_T yystacksize
;
1509 /* Lookahead token as an internal (translated) token number. */
1511 /* The variables used to return semantic value and location from the
1516 /* Buffer for error messages, and its allocated size. */
1518 char *yymsg
= yymsgbuf
;
1519 YYSIZE_T yymsg_alloc
= sizeof yymsgbuf
;
1522 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1524 /* The number of symbols on the RHS of the reduced rule.
1525 Keep to zero when no symbol should be popped. */
1528 yyssp
= yyss
= yyssa
;
1529 yyvsp
= yyvs
= yyvsa
;
1530 yystacksize
= YYINITDEPTH
;
1532 YYDPRINTF ((stderr
, "Starting parse\n"));
1537 yychar
= YYEMPTY
; /* Cause a token to be read. */
1540 /*------------------------------------------------------------.
1541 | yynewstate -- Push a new state, which is found in yystate. |
1542 `------------------------------------------------------------*/
1544 /* In all cases, when you get here, the value and location stacks
1545 have just been pushed. So pushing a state here evens the stacks. */
1551 if (yyss
+ yystacksize
- 1 <= yyssp
)
1553 /* Get the current used size of the three stacks, in elements. */
1554 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1558 /* Give user a chance to reallocate the stack. Use copies of
1559 these so that the &'s don't force the real ones into
1561 YYSTYPE
*yyvs1
= yyvs
;
1562 yytype_int16
*yyss1
= yyss
;
1564 /* Each stack pointer address is followed by the size of the
1565 data in use in that stack, in bytes. This used to be a
1566 conditional around just the two extra args, but that might
1567 be undefined if yyoverflow is a macro. */
1568 yyoverflow (YY_("memory exhausted"),
1569 &yyss1
, yysize
* sizeof (*yyssp
),
1570 &yyvs1
, yysize
* sizeof (*yyvsp
),
1576 #else /* no yyoverflow */
1577 # ifndef YYSTACK_RELOCATE
1578 goto yyexhaustedlab
;
1580 /* Extend the stack our own way. */
1581 if (YYMAXDEPTH
<= yystacksize
)
1582 goto yyexhaustedlab
;
1584 if (YYMAXDEPTH
< yystacksize
)
1585 yystacksize
= YYMAXDEPTH
;
1588 yytype_int16
*yyss1
= yyss
;
1589 union yyalloc
*yyptr
=
1590 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1592 goto yyexhaustedlab
;
1593 YYSTACK_RELOCATE (yyss_alloc
, yyss
);
1594 YYSTACK_RELOCATE (yyvs_alloc
, yyvs
);
1595 # undef YYSTACK_RELOCATE
1597 YYSTACK_FREE (yyss1
);
1600 #endif /* no yyoverflow */
1602 yyssp
= yyss
+ yysize
- 1;
1603 yyvsp
= yyvs
+ yysize
- 1;
1605 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1606 (unsigned long int) yystacksize
));
1608 if (yyss
+ yystacksize
- 1 <= yyssp
)
1612 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1614 if (yystate
== YYFINAL
)
1624 /* Do appropriate processing given the current state. Read a
1625 lookahead token if we need one and don't already have one. */
1627 /* First try to decide what to do without reference to lookahead token. */
1628 yyn
= yypact
[yystate
];
1629 if (yypact_value_is_default (yyn
))
1632 /* Not known => get a lookahead token if don't already have one. */
1634 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1635 if (yychar
== YYEMPTY
)
1637 YYDPRINTF ((stderr
, "Reading a token: "));
1638 yychar
= yylex (&yylval
, ctx
);
1641 if (yychar
<= YYEOF
)
1643 yychar
= yytoken
= YYEOF
;
1644 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1648 yytoken
= YYTRANSLATE (yychar
);
1649 YY_SYMBOL_PRINT ("Next token is", yytoken
, &yylval
, &yylloc
);
1652 /* If the proper action on seeing token YYTOKEN is to reduce or to
1653 detect an error, take that action. */
1655 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1660 if (yytable_value_is_error (yyn
))
1666 /* Count tokens shifted since error; after three, turn off error
1671 /* Shift the lookahead token. */
1672 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
1674 /* Discard the shifted token. */
1678 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1680 YY_IGNORE_MAYBE_UNINITIALIZED_END
1685 /*-----------------------------------------------------------.
1686 | yydefault -- do the default action for the current state. |
1687 `-----------------------------------------------------------*/
1689 yyn
= yydefact
[yystate
];
1695 /*-----------------------------.
1696 | yyreduce -- Do a reduction. |
1697 `-----------------------------*/
1699 /* yyn is the number of a rule to reduce with. */
1702 /* If YYLEN is nonzero, implement the default value of the action:
1705 Otherwise, the following line sets YYVAL to garbage.
1706 This behavior is undocumented and Bison
1707 users should not rely upon it. Assigning to YYVAL
1708 unconditionally makes the parser a bit smaller, and it avoids a
1709 GCC warning that YYVAL may be used uninitialized. */
1710 yyval
= yyvsp
[1-yylen
];
1713 YY_REDUCE_PRINT (yyn
);
1717 #line 147 "parser.y" /* yacc.c:1646 */
1718 { parse_complete(ctx
, (yyvsp
[-2].boolean
)); }
1719 #line 1725 "parser.tab.c" /* yacc.c:1646 */
1723 #line 150 "parser.y" /* yacc.c:1646 */
1724 { (yyval
.boolean
) = FALSE
; }
1725 #line 1731 "parser.tab.c" /* yacc.c:1646 */
1729 #line 151 "parser.y" /* yacc.c:1646 */
1730 { (yyval
.boolean
) = TRUE
; }
1731 #line 1737 "parser.tab.c" /* yacc.c:1646 */
1735 #line 155 "parser.y" /* yacc.c:1646 */
1736 { source_add_statement(ctx
, (yyvsp
[0].statement
)); }
1737 #line 1743 "parser.tab.c" /* yacc.c:1646 */
1741 #line 156 "parser.y" /* yacc.c:1646 */
1742 { source_add_class(ctx
, (yyvsp
[0].class_decl
)); }
1743 #line 1749 "parser.tab.c" /* yacc.c:1646 */
1747 #line 159 "parser.y" /* yacc.c:1646 */
1748 { (yyval
.statement
) = NULL
; }
1749 #line 1755 "parser.tab.c" /* yacc.c:1646 */
1753 #line 160 "parser.y" /* yacc.c:1646 */
1754 { (yyval
.statement
) = (yyvsp
[0].statement
); }
1755 #line 1761 "parser.tab.c" /* yacc.c:1646 */
1759 #line 163 "parser.y" /* yacc.c:1646 */
1760 { (yyval
.statement
) = (yyvsp
[0].statement
); }
1761 #line 1767 "parser.tab.c" /* yacc.c:1646 */
1765 #line 164 "parser.y" /* yacc.c:1646 */
1766 { (yyval
.statement
) = link_statements((yyvsp
[-1].statement
), (yyvsp
[0].statement
)); }
1767 #line 1773 "parser.tab.c" /* yacc.c:1646 */
1771 #line 167 "parser.y" /* yacc.c:1646 */
1772 { (yyval
.statement
) = (yyvsp
[-1].statement
); }
1773 #line 1779 "parser.tab.c" /* yacc.c:1646 */
1777 #line 170 "parser.y" /* yacc.c:1646 */
1778 { (yyval
.statement
) = NULL
; }
1779 #line 1785 "parser.tab.c" /* yacc.c:1646 */
1783 #line 171 "parser.y" /* yacc.c:1646 */
1784 { (yyval
.statement
) = (yyvsp
[0].statement
); }
1785 #line 1791 "parser.tab.c" /* yacc.c:1646 */
1789 #line 172 "parser.y" /* yacc.c:1646 */
1790 { (yyval
.statement
) = (yyvsp
[0].statement
); }
1791 #line 1797 "parser.tab.c" /* yacc.c:1646 */
1795 #line 173 "parser.y" /* yacc.c:1646 */
1796 { (yyvsp
[-2].statement
)->next
= (yyvsp
[0].statement
); (yyval
.statement
) = (yyvsp
[-2].statement
); }
1797 #line 1803 "parser.tab.c" /* yacc.c:1646 */
1801 #line 174 "parser.y" /* yacc.c:1646 */
1802 { (yyval
.statement
) = (yyvsp
[-1].statement
); }
1803 #line 1809 "parser.tab.c" /* yacc.c:1646 */
1807 #line 177 "parser.y" /* yacc.c:1646 */
1808 { (yyvsp
[-1].member
)->args
= (yyvsp
[0].expression
); (yyval
.statement
) = new_call_statement(ctx
, FALSE
, (yyvsp
[-1].member
)); CHECK_ERROR
; }
1809 #line 1815 "parser.tab.c" /* yacc.c:1646 */
1813 #line 178 "parser.y" /* yacc.c:1646 */
1814 { (yyvsp
[-1].member
)->args
= (yyvsp
[0].expression
); (yyval
.statement
) = new_call_statement(ctx
, TRUE
, (yyvsp
[-1].member
)); CHECK_ERROR
; }
1815 #line 1821 "parser.tab.c" /* yacc.c:1646 */
1819 #line 180 "parser.y" /* yacc.c:1646 */
1820 { (yyvsp
[-3].member
)->args
= (yyvsp
[-2].expression
); (yyval
.statement
) = new_assign_statement(ctx
, (yyvsp
[-3].member
), (yyvsp
[0].expression
)); CHECK_ERROR
; }
1821 #line 1827 "parser.tab.c" /* yacc.c:1646 */
1825 #line 181 "parser.y" /* yacc.c:1646 */
1826 { (yyval
.statement
) = new_dim_statement(ctx
, (yyvsp
[0].dim_decl
)); CHECK_ERROR
; }
1827 #line 1833 "parser.tab.c" /* yacc.c:1646 */
1831 #line 182 "parser.y" /* yacc.c:1646 */
1832 { (yyval
.statement
) = (yyvsp
[0].statement
); }
1833 #line 1839 "parser.tab.c" /* yacc.c:1646 */
1837 #line 184 "parser.y" /* yacc.c:1646 */
1838 { (yyval
.statement
) = new_while_statement(ctx
, STAT_WHILE
, (yyvsp
[-3].expression
), (yyvsp
[-1].statement
)); CHECK_ERROR
; }
1839 #line 1845 "parser.tab.c" /* yacc.c:1646 */
1843 #line 186 "parser.y" /* yacc.c:1646 */
1844 { (yyval
.statement
) = new_while_statement(ctx
, (yyvsp
[-4].boolean
) ? STAT_WHILELOOP
: STAT_UNTIL
, (yyvsp
[-3].expression
), (yyvsp
[-1].statement
));
1846 #line 1852 "parser.tab.c" /* yacc.c:1646 */
1850 #line 189 "parser.y" /* yacc.c:1646 */
1851 { (yyval
.statement
) = new_while_statement(ctx
, (yyvsp
[-1].boolean
) ? STAT_DOWHILE
: STAT_DOUNTIL
, (yyvsp
[0].expression
), (yyvsp
[-3].statement
));
1853 #line 1859 "parser.tab.c" /* yacc.c:1646 */
1857 #line 191 "parser.y" /* yacc.c:1646 */
1858 { (yyval
.statement
) = new_while_statement(ctx
, STAT_DOWHILE
, NULL
, (yyvsp
[-1].statement
)); CHECK_ERROR
; }
1859 #line 1865 "parser.tab.c" /* yacc.c:1646 */
1863 #line 192 "parser.y" /* yacc.c:1646 */
1864 { (yyval
.statement
) = new_function_statement(ctx
, (yyvsp
[0].func_decl
)); CHECK_ERROR
; }
1865 #line 1871 "parser.tab.c" /* yacc.c:1646 */
1869 #line 193 "parser.y" /* yacc.c:1646 */
1870 { (yyval
.statement
) = new_statement(ctx
, STAT_EXITDO
, 0); CHECK_ERROR
; }
1871 #line 1877 "parser.tab.c" /* yacc.c:1646 */
1875 #line 194 "parser.y" /* yacc.c:1646 */
1876 { (yyval
.statement
) = new_statement(ctx
, STAT_EXITFOR
, 0); CHECK_ERROR
; }
1877 #line 1883 "parser.tab.c" /* yacc.c:1646 */
1881 #line 195 "parser.y" /* yacc.c:1646 */
1882 { (yyval
.statement
) = new_statement(ctx
, STAT_EXITFUNC
, 0); CHECK_ERROR
; }
1883 #line 1889 "parser.tab.c" /* yacc.c:1646 */
1887 #line 196 "parser.y" /* yacc.c:1646 */
1888 { (yyval
.statement
) = new_statement(ctx
, STAT_EXITPROP
, 0); CHECK_ERROR
; }
1889 #line 1895 "parser.tab.c" /* yacc.c:1646 */
1893 #line 197 "parser.y" /* yacc.c:1646 */
1894 { (yyval
.statement
) = new_statement(ctx
, STAT_EXITSUB
, 0); CHECK_ERROR
; }
1895 #line 1901 "parser.tab.c" /* yacc.c:1646 */
1899 #line 199 "parser.y" /* yacc.c:1646 */
1900 { (yyvsp
[-3].member
)->args
= (yyvsp
[-2].expression
); (yyval
.statement
) = new_set_statement(ctx
, (yyvsp
[-3].member
), (yyvsp
[0].expression
)); CHECK_ERROR
; }
1901 #line 1907 "parser.tab.c" /* yacc.c:1646 */
1905 #line 200 "parser.y" /* yacc.c:1646 */
1906 { (yyval
.statement
) = new_statement(ctx
, STAT_STOP
, 0); CHECK_ERROR
; }
1907 #line 1913 "parser.tab.c" /* yacc.c:1646 */
1911 #line 201 "parser.y" /* yacc.c:1646 */
1912 { (yyval
.statement
) = new_onerror_statement(ctx
, TRUE
); CHECK_ERROR
; }
1913 #line 1919 "parser.tab.c" /* yacc.c:1646 */
1917 #line 202 "parser.y" /* yacc.c:1646 */
1918 { (yyval
.statement
) = new_onerror_statement(ctx
, FALSE
); CHECK_ERROR
; }
1919 #line 1925 "parser.tab.c" /* yacc.c:1646 */
1923 #line 203 "parser.y" /* yacc.c:1646 */
1924 { (yyval
.statement
) = new_const_statement(ctx
, (yyvsp
[0].const_decl
)); CHECK_ERROR
; }
1925 #line 1931 "parser.tab.c" /* yacc.c:1646 */
1929 #line 205 "parser.y" /* yacc.c:1646 */
1930 { (yyval
.statement
) = new_forto_statement(ctx
, (yyvsp
[-8].string
), (yyvsp
[-6].expression
), (yyvsp
[-4].expression
), (yyvsp
[-3].expression
), (yyvsp
[-1].statement
)); CHECK_ERROR
; }
1931 #line 1937 "parser.tab.c" /* yacc.c:1646 */
1935 #line 207 "parser.y" /* yacc.c:1646 */
1936 { (yyval
.statement
) = new_foreach_statement(ctx
, (yyvsp
[-5].string
), (yyvsp
[-3].expression
), (yyvsp
[-1].statement
)); }
1937 #line 1943 "parser.tab.c" /* yacc.c:1646 */
1941 #line 209 "parser.y" /* yacc.c:1646 */
1942 { (yyval
.statement
) = new_select_statement(ctx
, (yyvsp
[-4].expression
), (yyvsp
[-2].case_clausule
)); }
1943 #line 1949 "parser.tab.c" /* yacc.c:1646 */
1947 #line 212 "parser.y" /* yacc.c:1646 */
1948 { (yyval
.member
) = new_member_expression(ctx
, NULL
, (yyvsp
[0].string
)); CHECK_ERROR
; }
1949 #line 1955 "parser.tab.c" /* yacc.c:1646 */
1953 #line 213 "parser.y" /* yacc.c:1646 */
1954 { (yyval
.member
) = new_member_expression(ctx
, (yyvsp
[-2].expression
), (yyvsp
[0].string
)); CHECK_ERROR
; }
1955 #line 1961 "parser.tab.c" /* yacc.c:1646 */
1959 #line 216 "parser.y" /* yacc.c:1646 */
1960 { (yyval
.dim_decl
) = (yyvsp
[0].dim_decl
); }
1961 #line 1967 "parser.tab.c" /* yacc.c:1646 */
1965 #line 217 "parser.y" /* yacc.c:1646 */
1966 { (yyvsp
[-2].dim_decl
)->next
= (yyvsp
[0].dim_decl
); (yyval
.dim_decl
) = (yyvsp
[-2].dim_decl
); }
1967 #line 1973 "parser.tab.c" /* yacc.c:1646 */
1971 #line 220 "parser.y" /* yacc.c:1646 */
1972 { (yyval
.dim_decl
) = new_dim_decl(ctx
, (yyvsp
[0].string
), FALSE
, NULL
); CHECK_ERROR
; }
1973 #line 1979 "parser.tab.c" /* yacc.c:1646 */
1977 #line 221 "parser.y" /* yacc.c:1646 */
1978 { (yyval
.dim_decl
) = new_dim_decl(ctx
, (yyvsp
[-3].string
), TRUE
, (yyvsp
[-1].dim_list
)); CHECK_ERROR
; }
1979 #line 1985 "parser.tab.c" /* yacc.c:1646 */
1983 #line 222 "parser.y" /* yacc.c:1646 */
1984 { (yyval
.dim_decl
) = new_dim_decl(ctx
, (yyvsp
[-1].string
), TRUE
, NULL
); CHECK_ERROR
; }
1985 #line 1991 "parser.tab.c" /* yacc.c:1646 */
1989 #line 225 "parser.y" /* yacc.c:1646 */
1990 { (yyval
.dim_list
) = new_dim(ctx
, (yyvsp
[0].uint
), NULL
); }
1991 #line 1997 "parser.tab.c" /* yacc.c:1646 */
1995 #line 226 "parser.y" /* yacc.c:1646 */
1996 { (yyval
.dim_list
) = new_dim(ctx
, (yyvsp
[-2].uint
), (yyvsp
[0].dim_list
)); }
1997 #line 2003 "parser.tab.c" /* yacc.c:1646 */
2001 #line 229 "parser.y" /* yacc.c:1646 */
2002 { (yyval
.const_decl
) = (yyvsp
[0].const_decl
); }
2003 #line 2009 "parser.tab.c" /* yacc.c:1646 */
2007 #line 230 "parser.y" /* yacc.c:1646 */
2008 { (yyvsp
[-2].const_decl
)->next
= (yyvsp
[0].const_decl
); (yyval
.const_decl
) = (yyvsp
[-2].const_decl
); }
2009 #line 2015 "parser.tab.c" /* yacc.c:1646 */
2013 #line 233 "parser.y" /* yacc.c:1646 */
2014 { (yyval
.const_decl
) = new_const_decl(ctx
, (yyvsp
[-2].string
), (yyvsp
[0].expression
)); CHECK_ERROR
; }
2015 #line 2021 "parser.tab.c" /* yacc.c:1646 */
2019 #line 236 "parser.y" /* yacc.c:1646 */
2020 { (yyval
.expression
) = (yyvsp
[0].expression
); }
2021 #line 2027 "parser.tab.c" /* yacc.c:1646 */
2025 #line 237 "parser.y" /* yacc.c:1646 */
2026 { (yyval
.expression
) = new_unary_expression(ctx
, EXPR_NEG
, (yyvsp
[0].expression
)); CHECK_ERROR
; }
2027 #line 2033 "parser.tab.c" /* yacc.c:1646 */
2031 #line 240 "parser.y" /* yacc.c:1646 */
2032 { (yyval
.boolean
) = TRUE
; }
2033 #line 2039 "parser.tab.c" /* yacc.c:1646 */
2037 #line 241 "parser.y" /* yacc.c:1646 */
2038 { (yyval
.boolean
) = FALSE
; }
2039 #line 2045 "parser.tab.c" /* yacc.c:1646 */
2043 #line 244 "parser.y" /* yacc.c:1646 */
2044 { (yyval
.expression
) = NULL
;}
2045 #line 2051 "parser.tab.c" /* yacc.c:1646 */
2049 #line 245 "parser.y" /* yacc.c:1646 */
2050 { (yyval
.expression
) = (yyvsp
[0].expression
); }
2051 #line 2057 "parser.tab.c" /* yacc.c:1646 */
2055 #line 249 "parser.y" /* yacc.c:1646 */
2056 { (yyval
.statement
) = new_if_statement(ctx
, (yyvsp
[-7].expression
), (yyvsp
[-4].statement
), (yyvsp
[-3].elseif
), (yyvsp
[-2].statement
)); CHECK_ERROR
; }
2057 #line 2063 "parser.tab.c" /* yacc.c:1646 */
2061 #line 250 "parser.y" /* yacc.c:1646 */
2062 { (yyval
.statement
) = new_if_statement(ctx
, (yyvsp
[-3].expression
), (yyvsp
[-1].statement
), NULL
, NULL
); CHECK_ERROR
; }
2063 #line 2069 "parser.tab.c" /* yacc.c:1646 */
2067 #line 252 "parser.y" /* yacc.c:1646 */
2068 { (yyval
.statement
) = new_if_statement(ctx
, (yyvsp
[-5].expression
), (yyvsp
[-3].statement
), NULL
, (yyvsp
[-1].statement
)); CHECK_ERROR
; }
2069 #line 2075 "parser.tab.c" /* yacc.c:1646 */
2073 #line 259 "parser.y" /* yacc.c:1646 */
2074 { (yyval
.elseif
) = NULL
; }
2075 #line 2081 "parser.tab.c" /* yacc.c:1646 */
2079 #line 260 "parser.y" /* yacc.c:1646 */
2080 { (yyval
.elseif
) = (yyvsp
[0].elseif
); }
2081 #line 2087 "parser.tab.c" /* yacc.c:1646 */
2085 #line 263 "parser.y" /* yacc.c:1646 */
2086 { (yyval
.elseif
) = (yyvsp
[0].elseif
); }
2087 #line 2093 "parser.tab.c" /* yacc.c:1646 */
2091 #line 264 "parser.y" /* yacc.c:1646 */
2092 { (yyvsp
[-1].elseif
)->next
= (yyvsp
[0].elseif
); (yyval
.elseif
) = (yyvsp
[-1].elseif
); }
2093 #line 2099 "parser.tab.c" /* yacc.c:1646 */
2097 #line 268 "parser.y" /* yacc.c:1646 */
2098 { (yyval
.elseif
) = new_elseif_decl(ctx
, (yyvsp
[-3].expression
), (yyvsp
[0].statement
)); }
2099 #line 2105 "parser.tab.c" /* yacc.c:1646 */
2103 #line 271 "parser.y" /* yacc.c:1646 */
2104 { (yyval
.statement
) = NULL
; }
2105 #line 2111 "parser.tab.c" /* yacc.c:1646 */
2109 #line 272 "parser.y" /* yacc.c:1646 */
2110 { (yyval
.statement
) = (yyvsp
[0].statement
); }
2111 #line 2117 "parser.tab.c" /* yacc.c:1646 */
2115 #line 275 "parser.y" /* yacc.c:1646 */
2116 { (yyval
.case_clausule
) = NULL
; }
2117 #line 2123 "parser.tab.c" /* yacc.c:1646 */
2121 #line 276 "parser.y" /* yacc.c:1646 */
2122 { (yyval
.case_clausule
) = new_case_clausule(ctx
, NULL
, (yyvsp
[0].statement
), NULL
); }
2123 #line 2129 "parser.tab.c" /* yacc.c:1646 */
2127 #line 278 "parser.y" /* yacc.c:1646 */
2128 { (yyval
.case_clausule
) = new_case_clausule(ctx
, (yyvsp
[-3].expression
), (yyvsp
[-1].statement
), (yyvsp
[0].case_clausule
)); }
2129 #line 2135 "parser.tab.c" /* yacc.c:1646 */
2133 #line 281 "parser.y" /* yacc.c:1646 */
2134 { (yyval
.expression
) = NULL
; }
2135 #line 2141 "parser.tab.c" /* yacc.c:1646 */
2139 #line 282 "parser.y" /* yacc.c:1646 */
2140 { (yyval
.expression
) = (yyvsp
[-1].expression
); }
2141 #line 2147 "parser.tab.c" /* yacc.c:1646 */
2145 #line 285 "parser.y" /* yacc.c:1646 */
2146 { (yyval
.expression
) = NULL
; }
2147 #line 2153 "parser.tab.c" /* yacc.c:1646 */
2151 #line 286 "parser.y" /* yacc.c:1646 */
2152 { (yyval
.expression
) = (yyvsp
[0].expression
); }
2153 #line 2159 "parser.tab.c" /* yacc.c:1646 */
2157 #line 289 "parser.y" /* yacc.c:1646 */
2158 { (yyval
.expression
) = (yyvsp
[0].expression
); }
2159 #line 2165 "parser.tab.c" /* yacc.c:1646 */
2163 #line 290 "parser.y" /* yacc.c:1646 */
2164 { (yyvsp
[-2].expression
)->next
= (yyvsp
[0].expression
); (yyval
.expression
) = (yyvsp
[-2].expression
); }
2165 #line 2171 "parser.tab.c" /* yacc.c:1646 */
2169 #line 291 "parser.y" /* yacc.c:1646 */
2170 { (yyval
.expression
) = new_expression(ctx
, EXPR_NOARG
, 0); CHECK_ERROR
; (yyval
.expression
)->next
= (yyvsp
[0].expression
); }
2171 #line 2177 "parser.tab.c" /* yacc.c:1646 */
2175 #line 298 "parser.y" /* yacc.c:1646 */
2176 { (yyval
.expression
) = (yyvsp
[0].expression
); }
2177 #line 2183 "parser.tab.c" /* yacc.c:1646 */
2181 #line 299 "parser.y" /* yacc.c:1646 */
2182 { (yyvsp
[-2].expression
)->next
= (yyvsp
[0].expression
); (yyval
.expression
) = (yyvsp
[-2].expression
); }
2183 #line 2189 "parser.tab.c" /* yacc.c:1646 */
2187 #line 302 "parser.y" /* yacc.c:1646 */
2188 { (yyval
.expression
) = (yyvsp
[0].expression
); }
2189 #line 2195 "parser.tab.c" /* yacc.c:1646 */
2193 #line 303 "parser.y" /* yacc.c:1646 */
2194 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_IMP
, (yyvsp
[-2].expression
), (yyvsp
[0].expression
)); CHECK_ERROR
; }
2195 #line 2201 "parser.tab.c" /* yacc.c:1646 */
2199 #line 306 "parser.y" /* yacc.c:1646 */
2200 { (yyval
.expression
) = (yyvsp
[0].expression
); }
2201 #line 2207 "parser.tab.c" /* yacc.c:1646 */
2205 #line 307 "parser.y" /* yacc.c:1646 */
2206 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_EQV
, (yyvsp
[-2].expression
), (yyvsp
[0].expression
)); CHECK_ERROR
; }
2207 #line 2213 "parser.tab.c" /* yacc.c:1646 */
2211 #line 310 "parser.y" /* yacc.c:1646 */
2212 { (yyval
.expression
) = (yyvsp
[0].expression
); }
2213 #line 2219 "parser.tab.c" /* yacc.c:1646 */
2217 #line 311 "parser.y" /* yacc.c:1646 */
2218 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_XOR
, (yyvsp
[-2].expression
), (yyvsp
[0].expression
)); CHECK_ERROR
; }
2219 #line 2225 "parser.tab.c" /* yacc.c:1646 */
2223 #line 314 "parser.y" /* yacc.c:1646 */
2224 { (yyval
.expression
) = (yyvsp
[0].expression
); }
2225 #line 2231 "parser.tab.c" /* yacc.c:1646 */
2229 #line 315 "parser.y" /* yacc.c:1646 */
2230 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_OR
, (yyvsp
[-2].expression
), (yyvsp
[0].expression
)); CHECK_ERROR
; }
2231 #line 2237 "parser.tab.c" /* yacc.c:1646 */
2235 #line 318 "parser.y" /* yacc.c:1646 */
2236 { (yyval
.expression
) = (yyvsp
[0].expression
); }
2237 #line 2243 "parser.tab.c" /* yacc.c:1646 */
2241 #line 319 "parser.y" /* yacc.c:1646 */
2242 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_AND
, (yyvsp
[-2].expression
), (yyvsp
[0].expression
)); CHECK_ERROR
; }
2243 #line 2249 "parser.tab.c" /* yacc.c:1646 */
2247 #line 322 "parser.y" /* yacc.c:1646 */
2248 { (yyval
.expression
) = (yyvsp
[0].expression
); }
2249 #line 2255 "parser.tab.c" /* yacc.c:1646 */
2253 #line 323 "parser.y" /* yacc.c:1646 */
2254 { (yyval
.expression
) = new_unary_expression(ctx
, EXPR_NOT
, (yyvsp
[0].expression
)); CHECK_ERROR
; }
2255 #line 2261 "parser.tab.c" /* yacc.c:1646 */
2259 #line 326 "parser.y" /* yacc.c:1646 */
2260 { (yyval
.expression
) = (yyvsp
[0].expression
); }
2261 #line 2267 "parser.tab.c" /* yacc.c:1646 */
2265 #line 327 "parser.y" /* yacc.c:1646 */
2266 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_EQUAL
, (yyvsp
[-2].expression
), (yyvsp
[0].expression
)); CHECK_ERROR
; }
2267 #line 2273 "parser.tab.c" /* yacc.c:1646 */
2271 #line 328 "parser.y" /* yacc.c:1646 */
2272 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_NEQUAL
, (yyvsp
[-2].expression
), (yyvsp
[0].expression
)); CHECK_ERROR
; }
2273 #line 2279 "parser.tab.c" /* yacc.c:1646 */
2277 #line 329 "parser.y" /* yacc.c:1646 */
2278 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_GT
, (yyvsp
[-2].expression
), (yyvsp
[0].expression
)); CHECK_ERROR
; }
2279 #line 2285 "parser.tab.c" /* yacc.c:1646 */
2283 #line 330 "parser.y" /* yacc.c:1646 */
2284 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_LT
, (yyvsp
[-2].expression
), (yyvsp
[0].expression
)); CHECK_ERROR
; }
2285 #line 2291 "parser.tab.c" /* yacc.c:1646 */
2289 #line 331 "parser.y" /* yacc.c:1646 */
2290 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_GTEQ
, (yyvsp
[-2].expression
), (yyvsp
[0].expression
)); CHECK_ERROR
; }
2291 #line 2297 "parser.tab.c" /* yacc.c:1646 */
2295 #line 332 "parser.y" /* yacc.c:1646 */
2296 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_LTEQ
, (yyvsp
[-2].expression
), (yyvsp
[0].expression
)); CHECK_ERROR
; }
2297 #line 2303 "parser.tab.c" /* yacc.c:1646 */
2301 #line 333 "parser.y" /* yacc.c:1646 */
2302 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_IS
, (yyvsp
[-2].expression
), (yyvsp
[0].expression
)); CHECK_ERROR
; }
2303 #line 2309 "parser.tab.c" /* yacc.c:1646 */
2307 #line 336 "parser.y" /* yacc.c:1646 */
2308 { (yyval
.expression
) = (yyvsp
[0].expression
); }
2309 #line 2315 "parser.tab.c" /* yacc.c:1646 */
2313 #line 337 "parser.y" /* yacc.c:1646 */
2314 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_CONCAT
, (yyvsp
[-2].expression
), (yyvsp
[0].expression
)); CHECK_ERROR
; }
2315 #line 2321 "parser.tab.c" /* yacc.c:1646 */
2319 #line 340 "parser.y" /* yacc.c:1646 */
2320 { (yyval
.expression
) = (yyvsp
[0].expression
); }
2321 #line 2327 "parser.tab.c" /* yacc.c:1646 */
2325 #line 341 "parser.y" /* yacc.c:1646 */
2326 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_ADD
, (yyvsp
[-2].expression
), (yyvsp
[0].expression
)); CHECK_ERROR
; }
2327 #line 2333 "parser.tab.c" /* yacc.c:1646 */
2331 #line 342 "parser.y" /* yacc.c:1646 */
2332 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_SUB
, (yyvsp
[-2].expression
), (yyvsp
[0].expression
)); CHECK_ERROR
; }
2333 #line 2339 "parser.tab.c" /* yacc.c:1646 */
2337 #line 345 "parser.y" /* yacc.c:1646 */
2338 { (yyval
.expression
) = (yyvsp
[0].expression
); }
2339 #line 2345 "parser.tab.c" /* yacc.c:1646 */
2343 #line 346 "parser.y" /* yacc.c:1646 */
2344 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_MOD
, (yyvsp
[-2].expression
), (yyvsp
[0].expression
)); CHECK_ERROR
; }
2345 #line 2351 "parser.tab.c" /* yacc.c:1646 */
2349 #line 349 "parser.y" /* yacc.c:1646 */
2350 { (yyval
.expression
) = (yyvsp
[0].expression
); }
2351 #line 2357 "parser.tab.c" /* yacc.c:1646 */
2355 #line 351 "parser.y" /* yacc.c:1646 */
2356 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_IDIV
, (yyvsp
[-2].expression
), (yyvsp
[0].expression
)); CHECK_ERROR
; }
2357 #line 2363 "parser.tab.c" /* yacc.c:1646 */
2361 #line 354 "parser.y" /* yacc.c:1646 */
2362 { (yyval
.expression
) = (yyvsp
[0].expression
); }
2363 #line 2369 "parser.tab.c" /* yacc.c:1646 */
2367 #line 356 "parser.y" /* yacc.c:1646 */
2368 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_MUL
, (yyvsp
[-2].expression
), (yyvsp
[0].expression
)); CHECK_ERROR
; }
2369 #line 2375 "parser.tab.c" /* yacc.c:1646 */
2373 #line 358 "parser.y" /* yacc.c:1646 */
2374 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_DIV
, (yyvsp
[-2].expression
), (yyvsp
[0].expression
)); CHECK_ERROR
; }
2375 #line 2381 "parser.tab.c" /* yacc.c:1646 */
2379 #line 361 "parser.y" /* yacc.c:1646 */
2380 { (yyval
.expression
) = (yyvsp
[0].expression
); }
2381 #line 2387 "parser.tab.c" /* yacc.c:1646 */
2385 #line 362 "parser.y" /* yacc.c:1646 */
2386 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_EXP
, (yyvsp
[-2].expression
), (yyvsp
[0].expression
)); CHECK_ERROR
; }
2387 #line 2393 "parser.tab.c" /* yacc.c:1646 */
2391 #line 365 "parser.y" /* yacc.c:1646 */
2392 { (yyval
.expression
) = (yyvsp
[0].expression
); }
2393 #line 2399 "parser.tab.c" /* yacc.c:1646 */
2397 #line 366 "parser.y" /* yacc.c:1646 */
2398 { (yyval
.expression
) = (yyvsp
[0].expression
); }
2399 #line 2405 "parser.tab.c" /* yacc.c:1646 */
2403 #line 367 "parser.y" /* yacc.c:1646 */
2404 { (yyval
.expression
) = new_new_expression(ctx
, (yyvsp
[0].string
)); CHECK_ERROR
; }
2405 #line 2411 "parser.tab.c" /* yacc.c:1646 */
2409 #line 368 "parser.y" /* yacc.c:1646 */
2410 { (yyval
.expression
) = new_unary_expression(ctx
, EXPR_NEG
, (yyvsp
[0].expression
)); CHECK_ERROR
; }
2411 #line 2417 "parser.tab.c" /* yacc.c:1646 */
2415 #line 371 "parser.y" /* yacc.c:1646 */
2416 { (yyval
.expression
) = (yyvsp
[0].expression
); }
2417 #line 2423 "parser.tab.c" /* yacc.c:1646 */
2421 #line 372 "parser.y" /* yacc.c:1646 */
2422 { (yyvsp
[-1].member
)->args
= (yyvsp
[0].expression
); (yyval
.expression
) = &(yyvsp
[-1].member
)->expr
; }
2423 #line 2429 "parser.tab.c" /* yacc.c:1646 */
2427 #line 375 "parser.y" /* yacc.c:1646 */
2428 { (yyval
.expression
) = new_bool_expression(ctx
, VARIANT_TRUE
); CHECK_ERROR
; }
2429 #line 2435 "parser.tab.c" /* yacc.c:1646 */
2433 #line 376 "parser.y" /* yacc.c:1646 */
2434 { (yyval
.expression
) = new_bool_expression(ctx
, VARIANT_FALSE
); CHECK_ERROR
; }
2435 #line 2441 "parser.tab.c" /* yacc.c:1646 */
2439 #line 377 "parser.y" /* yacc.c:1646 */
2440 { (yyval
.expression
) = new_string_expression(ctx
, (yyvsp
[0].string
)); CHECK_ERROR
; }
2441 #line 2447 "parser.tab.c" /* yacc.c:1646 */
2445 #line 378 "parser.y" /* yacc.c:1646 */
2446 { (yyval
.expression
) = (yyvsp
[0].expression
); }
2447 #line 2453 "parser.tab.c" /* yacc.c:1646 */
2451 #line 379 "parser.y" /* yacc.c:1646 */
2452 { (yyval
.expression
) = new_expression(ctx
, EXPR_EMPTY
, 0); CHECK_ERROR
; }
2453 #line 2459 "parser.tab.c" /* yacc.c:1646 */
2457 #line 380 "parser.y" /* yacc.c:1646 */
2458 { (yyval
.expression
) = new_expression(ctx
, EXPR_NULL
, 0); CHECK_ERROR
; }
2459 #line 2465 "parser.tab.c" /* yacc.c:1646 */
2463 #line 381 "parser.y" /* yacc.c:1646 */
2464 { (yyval
.expression
) = new_expression(ctx
, EXPR_NOTHING
, 0); CHECK_ERROR
; }
2465 #line 2471 "parser.tab.c" /* yacc.c:1646 */
2469 #line 384 "parser.y" /* yacc.c:1646 */
2470 { (yyval
.expression
) = new_long_expression(ctx
, EXPR_USHORT
, (yyvsp
[0].lng
)); CHECK_ERROR
; }
2471 #line 2477 "parser.tab.c" /* yacc.c:1646 */
2475 #line 385 "parser.y" /* yacc.c:1646 */
2476 { (yyval
.expression
) = new_long_expression(ctx
, EXPR_USHORT
, 0); CHECK_ERROR
; }
2477 #line 2483 "parser.tab.c" /* yacc.c:1646 */
2481 #line 386 "parser.y" /* yacc.c:1646 */
2482 { (yyval
.expression
) = new_long_expression(ctx
, EXPR_ULONG
, (yyvsp
[0].lng
)); CHECK_ERROR
; }
2483 #line 2489 "parser.tab.c" /* yacc.c:1646 */
2487 #line 387 "parser.y" /* yacc.c:1646 */
2488 { (yyval
.expression
) = new_double_expression(ctx
, (yyvsp
[0].dbl
)); CHECK_ERROR
; }
2489 #line 2495 "parser.tab.c" /* yacc.c:1646 */
2493 #line 390 "parser.y" /* yacc.c:1646 */
2494 { (yyval
.uint
) = (yyvsp
[0].lng
); }
2495 #line 2501 "parser.tab.c" /* yacc.c:1646 */
2499 #line 391 "parser.y" /* yacc.c:1646 */
2500 { (yyval
.uint
) = 0; }
2501 #line 2507 "parser.tab.c" /* yacc.c:1646 */
2505 #line 392 "parser.y" /* yacc.c:1646 */
2506 { (yyval
.uint
) = (yyvsp
[0].lng
); }
2507 #line 2513 "parser.tab.c" /* yacc.c:1646 */
2511 #line 395 "parser.y" /* yacc.c:1646 */
2512 { (yyval
.expression
) = new_unary_expression(ctx
, EXPR_BRACKETS
, (yyvsp
[-1].expression
)); }
2513 #line 2519 "parser.tab.c" /* yacc.c:1646 */
2517 #line 396 "parser.y" /* yacc.c:1646 */
2518 { (yyval
.expression
) = new_expression(ctx
, EXPR_ME
, 0); CHECK_ERROR
; }
2519 #line 2525 "parser.tab.c" /* yacc.c:1646 */
2523 #line 399 "parser.y" /* yacc.c:1646 */
2524 { (yyvsp
[-3].class_decl
)->name
= (yyvsp
[-5].string
); (yyval
.class_decl
) = (yyvsp
[-3].class_decl
); }
2525 #line 2531 "parser.tab.c" /* yacc.c:1646 */
2529 #line 402 "parser.y" /* yacc.c:1646 */
2530 { (yyval
.class_decl
) = new_class_decl(ctx
); }
2531 #line 2537 "parser.tab.c" /* yacc.c:1646 */
2535 #line 403 "parser.y" /* yacc.c:1646 */
2536 { (yyval
.class_decl
) = add_class_function(ctx
, (yyvsp
[0].class_decl
), (yyvsp
[-2].func_decl
)); CHECK_ERROR
; }
2537 #line 2543 "parser.tab.c" /* yacc.c:1646 */
2541 #line 405 "parser.y" /* yacc.c:1646 */
2542 { dim_decl_t
*dim_decl
= new_dim_decl(ctx
, (yyvsp
[-2].string
), FALSE
, NULL
); CHECK_ERROR
;
2543 (yyval
.class_decl
) = add_dim_prop(ctx
, (yyvsp
[0].class_decl
), dim_decl
, (yyvsp
[-3].uint
)); CHECK_ERROR
; }
2544 #line 2550 "parser.tab.c" /* yacc.c:1646 */
2548 #line 407 "parser.y" /* yacc.c:1646 */
2549 { (yyval
.class_decl
) = add_dim_prop(ctx
, (yyvsp
[0].class_decl
), (yyvsp
[-2].dim_decl
), 0); CHECK_ERROR
; }
2550 #line 2556 "parser.tab.c" /* yacc.c:1646 */
2554 #line 408 "parser.y" /* yacc.c:1646 */
2555 { (yyval
.class_decl
) = add_class_function(ctx
, (yyvsp
[0].class_decl
), (yyvsp
[-2].func_decl
)); CHECK_ERROR
; }
2556 #line 2562 "parser.tab.c" /* yacc.c:1646 */
2560 #line 412 "parser.y" /* yacc.c:1646 */
2561 { (yyval
.func_decl
) = new_function_decl(ctx
, (yyvsp
[-5].string
), FUNC_PROPGET
, (yyvsp
[-8].uint
), (yyvsp
[-4].arg_decl
), (yyvsp
[-2].statement
)); CHECK_ERROR
; }
2562 #line 2568 "parser.tab.c" /* yacc.c:1646 */
2566 #line 414 "parser.y" /* yacc.c:1646 */
2567 { (yyval
.func_decl
) = new_function_decl(ctx
, (yyvsp
[-7].string
), FUNC_PROPLET
, (yyvsp
[-10].uint
), (yyvsp
[-5].arg_decl
), (yyvsp
[-2].statement
)); CHECK_ERROR
; }
2568 #line 2574 "parser.tab.c" /* yacc.c:1646 */
2572 #line 416 "parser.y" /* yacc.c:1646 */
2573 { (yyval
.func_decl
) = new_function_decl(ctx
, (yyvsp
[-7].string
), FUNC_PROPSET
, (yyvsp
[-10].uint
), (yyvsp
[-5].arg_decl
), (yyvsp
[-2].statement
)); CHECK_ERROR
; }
2574 #line 2580 "parser.tab.c" /* yacc.c:1646 */
2578 #line 420 "parser.y" /* yacc.c:1646 */
2579 { (yyval
.func_decl
) = new_function_decl(ctx
, (yyvsp
[-5].string
), FUNC_SUB
, (yyvsp
[-7].uint
), (yyvsp
[-4].arg_decl
), (yyvsp
[-2].statement
)); CHECK_ERROR
; }
2580 #line 2586 "parser.tab.c" /* yacc.c:1646 */
2584 #line 422 "parser.y" /* yacc.c:1646 */
2585 { (yyval
.func_decl
) = new_function_decl(ctx
, (yyvsp
[-5].string
), FUNC_FUNCTION
, (yyvsp
[-7].uint
), (yyvsp
[-4].arg_decl
), (yyvsp
[-2].statement
)); CHECK_ERROR
; }
2586 #line 2592 "parser.tab.c" /* yacc.c:1646 */
2590 #line 425 "parser.y" /* yacc.c:1646 */
2591 { (yyval
.uint
) = 0; }
2592 #line 2598 "parser.tab.c" /* yacc.c:1646 */
2596 #line 426 "parser.y" /* yacc.c:1646 */
2597 { (yyval
.uint
) = (yyvsp
[0].uint
); }
2598 #line 2604 "parser.tab.c" /* yacc.c:1646 */
2602 #line 429 "parser.y" /* yacc.c:1646 */
2603 { (yyval
.uint
) = STORAGE_IS_DEFAULT
; }
2604 #line 2610 "parser.tab.c" /* yacc.c:1646 */
2608 #line 430 "parser.y" /* yacc.c:1646 */
2609 { (yyval
.uint
) = 0; }
2610 #line 2616 "parser.tab.c" /* yacc.c:1646 */
2614 #line 431 "parser.y" /* yacc.c:1646 */
2615 { (yyval
.uint
) = STORAGE_IS_PRIVATE
; }
2616 #line 2622 "parser.tab.c" /* yacc.c:1646 */
2620 #line 434 "parser.y" /* yacc.c:1646 */
2621 { (yyval
.arg_decl
) = NULL
; }
2622 #line 2628 "parser.tab.c" /* yacc.c:1646 */
2626 #line 435 "parser.y" /* yacc.c:1646 */
2627 { (yyval
.arg_decl
) = (yyvsp
[-1].arg_decl
); }
2628 #line 2634 "parser.tab.c" /* yacc.c:1646 */
2632 #line 438 "parser.y" /* yacc.c:1646 */
2633 { (yyval
.arg_decl
) = (yyvsp
[0].arg_decl
); }
2634 #line 2640 "parser.tab.c" /* yacc.c:1646 */
2638 #line 439 "parser.y" /* yacc.c:1646 */
2639 { (yyvsp
[-2].arg_decl
)->next
= (yyvsp
[0].arg_decl
); (yyval
.arg_decl
) = (yyvsp
[-2].arg_decl
); }
2640 #line 2646 "parser.tab.c" /* yacc.c:1646 */
2644 #line 442 "parser.y" /* yacc.c:1646 */
2645 { (yyval
.arg_decl
) = new_argument_decl(ctx
, (yyvsp
[-1].string
), TRUE
); }
2646 #line 2652 "parser.tab.c" /* yacc.c:1646 */
2650 #line 443 "parser.y" /* yacc.c:1646 */
2651 { (yyval
.arg_decl
) = new_argument_decl(ctx
, (yyvsp
[-1].string
), TRUE
); }
2652 #line 2658 "parser.tab.c" /* yacc.c:1646 */
2656 #line 444 "parser.y" /* yacc.c:1646 */
2657 { (yyval
.arg_decl
) = new_argument_decl(ctx
, (yyvsp
[-1].string
), FALSE
); }
2658 #line 2664 "parser.tab.c" /* yacc.c:1646 */
2662 #line 448 "parser.y" /* yacc.c:1646 */
2663 { (yyval
.string
) = (yyvsp
[0].string
); }
2664 #line 2670 "parser.tab.c" /* yacc.c:1646 */
2668 #line 449 "parser.y" /* yacc.c:1646 */
2669 { (yyval
.string
) = propertyW
; }
2670 #line 2676 "parser.tab.c" /* yacc.c:1646 */
2674 #line 2680 "parser.tab.c" /* yacc.c:1646 */
2677 /* User semantic actions sometimes alter yychar, and that requires
2678 that yytoken be updated with the new translation. We take the
2679 approach of translating immediately before every use of yytoken.
2680 One alternative is translating here after every semantic action,
2681 but that translation would be missed if the semantic action invokes
2682 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2683 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2684 incorrect destructor might then be invoked immediately. In the
2685 case of YYERROR or YYBACKUP, subsequent parser actions might lead
2686 to an incorrect destructor call or verbose syntax error message
2687 before the lookahead is translated. */
2688 YY_SYMBOL_PRINT ("-> $$ =", yyr1
[yyn
], &yyval
, &yyloc
);
2692 YY_STACK_PRINT (yyss
, yyssp
);
2696 /* Now 'shift' the result of the reduction. Determine what state
2697 that goes to, based on the state we popped back to and the rule
2698 number reduced by. */
2702 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
2703 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
2704 yystate
= yytable
[yystate
];
2706 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
2711 /*--------------------------------------.
2712 | yyerrlab -- here on detecting error. |
2713 `--------------------------------------*/
2715 /* Make sure we have latest lookahead translation. See comments at
2716 user semantic actions for why this is necessary. */
2717 yytoken
= yychar
== YYEMPTY
? YYEMPTY
: YYTRANSLATE (yychar
);
2719 /* If not already recovering from an error, report this error. */
2723 #if ! YYERROR_VERBOSE
2724 yyerror (ctx
, YY_("syntax error"));
2726 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2729 char const *yymsgp
= YY_("syntax error");
2730 int yysyntax_error_status
;
2731 yysyntax_error_status
= YYSYNTAX_ERROR
;
2732 if (yysyntax_error_status
== 0)
2734 else if (yysyntax_error_status
== 1)
2736 if (yymsg
!= yymsgbuf
)
2737 YYSTACK_FREE (yymsg
);
2738 yymsg
= (char *) YYSTACK_ALLOC (yymsg_alloc
);
2742 yymsg_alloc
= sizeof yymsgbuf
;
2743 yysyntax_error_status
= 2;
2747 yysyntax_error_status
= YYSYNTAX_ERROR
;
2751 yyerror (ctx
, yymsgp
);
2752 if (yysyntax_error_status
== 2)
2753 goto yyexhaustedlab
;
2755 # undef YYSYNTAX_ERROR
2761 if (yyerrstatus
== 3)
2763 /* If just tried and failed to reuse lookahead token after an
2764 error, discard it. */
2766 if (yychar
<= YYEOF
)
2768 /* Return failure if at end of input. */
2769 if (yychar
== YYEOF
)
2774 yydestruct ("Error: discarding",
2775 yytoken
, &yylval
, ctx
);
2780 /* Else will try to reuse lookahead token after shifting the error
2785 /*---------------------------------------------------.
2786 | yyerrorlab -- error raised explicitly by YYERROR. |
2787 `---------------------------------------------------*/
2790 /* Pacify compilers like GCC when the user code never invokes
2791 YYERROR and the label yyerrorlab therefore never appears in user
2793 if (/*CONSTCOND*/ 0)
2796 /* Do not reclaim the symbols of the rule whose action triggered
2800 YY_STACK_PRINT (yyss
, yyssp
);
2805 /*-------------------------------------------------------------.
2806 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2807 `-------------------------------------------------------------*/
2809 yyerrstatus
= 3; /* Each real token shifted decrements this. */
2813 yyn
= yypact
[yystate
];
2814 if (!yypact_value_is_default (yyn
))
2817 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
2825 /* Pop the current state because it cannot handle the error token. */
2830 yydestruct ("Error: popping",
2831 yystos
[yystate
], yyvsp
, ctx
);
2834 YY_STACK_PRINT (yyss
, yyssp
);
2837 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2839 YY_IGNORE_MAYBE_UNINITIALIZED_END
2842 /* Shift the error token. */
2843 YY_SYMBOL_PRINT ("Shifting", yystos
[yyn
], yyvsp
, yylsp
);
2849 /*-------------------------------------.
2850 | yyacceptlab -- YYACCEPT comes here. |
2851 `-------------------------------------*/
2856 /*-----------------------------------.
2857 | yyabortlab -- YYABORT comes here. |
2858 `-----------------------------------*/
2863 #if !defined yyoverflow || YYERROR_VERBOSE
2864 /*-------------------------------------------------.
2865 | yyexhaustedlab -- memory exhaustion comes here. |
2866 `-------------------------------------------------*/
2868 yyerror (ctx
, YY_("memory exhausted"));
2874 if (yychar
!= YYEMPTY
)
2876 /* Make sure we have latest lookahead translation. See comments at
2877 user semantic actions for why this is necessary. */
2878 yytoken
= YYTRANSLATE (yychar
);
2879 yydestruct ("Cleanup: discarding lookahead",
2880 yytoken
, &yylval
, ctx
);
2882 /* Do not reclaim the symbols of the rule whose action triggered
2883 this YYABORT or YYACCEPT. */
2885 YY_STACK_PRINT (yyss
, yyssp
);
2886 while (yyssp
!= yyss
)
2888 yydestruct ("Cleanup: popping",
2889 yystos
[*yyssp
], yyvsp
, ctx
);
2894 YYSTACK_FREE (yyss
);
2897 if (yymsg
!= yymsgbuf
)
2898 YYSTACK_FREE (yymsg
);
2902 #line 456 "parser.y" /* yacc.c:1906 */
2905 static int parser_error(parser_ctx_t
*ctx
, const char *str
)
2910 static void source_add_statement(parser_ctx_t
*ctx
, statement_t
*stat
)
2916 ctx
->stats_tail
->next
= stat
;
2917 ctx
->stats_tail
= stat
;
2919 ctx
->stats
= ctx
->stats_tail
= stat
;
2923 static void source_add_class(parser_ctx_t
*ctx
, class_decl_t
*class_decl
)
2925 class_decl
->next
= ctx
->class_decls
;
2926 ctx
->class_decls
= class_decl
;
2929 static void parse_complete(parser_ctx_t
*ctx
, BOOL option_explicit
)
2931 ctx
->parse_complete
= TRUE
;
2932 ctx
->option_explicit
= option_explicit
;
2935 static void *new_expression(parser_ctx_t
*ctx
, expression_type_t type
, size_t size
)
2939 expr
= parser_alloc(ctx
, size
? size
: sizeof(*expr
));
2948 static expression_t
*new_bool_expression(parser_ctx_t
*ctx
, VARIANT_BOOL value
)
2950 bool_expression_t
*expr
;
2952 expr
= new_expression(ctx
, EXPR_BOOL
, sizeof(*expr
));
2956 expr
->value
= value
;
2960 static expression_t
*new_string_expression(parser_ctx_t
*ctx
, const WCHAR
*value
)
2962 string_expression_t
*expr
;
2964 expr
= new_expression(ctx
, EXPR_STRING
, sizeof(*expr
));
2968 expr
->value
= value
;
2972 static expression_t
*new_long_expression(parser_ctx_t
*ctx
, expression_type_t type
, LONG value
)
2974 int_expression_t
*expr
;
2976 expr
= new_expression(ctx
, type
, sizeof(*expr
));
2980 expr
->value
= value
;
2984 static expression_t
*new_double_expression(parser_ctx_t
*ctx
, double value
)
2986 double_expression_t
*expr
;
2988 expr
= new_expression(ctx
, EXPR_DOUBLE
, sizeof(*expr
));
2992 expr
->value
= value
;
2996 static expression_t
*new_unary_expression(parser_ctx_t
*ctx
, expression_type_t type
, expression_t
*subexpr
)
2998 unary_expression_t
*expr
;
3000 expr
= new_expression(ctx
, type
, sizeof(*expr
));
3004 expr
->subexpr
= subexpr
;
3008 static expression_t
*new_binary_expression(parser_ctx_t
*ctx
, expression_type_t type
, expression_t
*left
, expression_t
*right
)
3010 binary_expression_t
*expr
;
3012 expr
= new_expression(ctx
, type
, sizeof(*expr
));
3017 expr
->right
= right
;
3021 static member_expression_t
*new_member_expression(parser_ctx_t
*ctx
, expression_t
*obj_expr
, const WCHAR
*identifier
)
3023 member_expression_t
*expr
;
3025 expr
= new_expression(ctx
, EXPR_MEMBER
, sizeof(*expr
));
3029 expr
->obj_expr
= obj_expr
;
3030 expr
->identifier
= identifier
;
3035 static expression_t
*new_new_expression(parser_ctx_t
*ctx
, const WCHAR
*identifier
)
3037 string_expression_t
*expr
;
3039 expr
= new_expression(ctx
, EXPR_NEW
, sizeof(*expr
));
3043 expr
->value
= identifier
;
3047 static void *new_statement(parser_ctx_t
*ctx
, statement_type_t type
, size_t size
)
3051 stat
= parser_alloc(ctx
, size
? size
: sizeof(*stat
));
3060 static statement_t
*new_call_statement(parser_ctx_t
*ctx
, BOOL is_strict
, member_expression_t
*expr
)
3062 call_statement_t
*stat
;
3064 stat
= new_statement(ctx
, STAT_CALL
, sizeof(*stat
));
3069 stat
->is_strict
= is_strict
;
3073 static statement_t
*new_assign_statement(parser_ctx_t
*ctx
, member_expression_t
*left
, expression_t
*right
)
3075 assign_statement_t
*stat
;
3077 stat
= new_statement(ctx
, STAT_ASSIGN
, sizeof(*stat
));
3081 stat
->member_expr
= left
;
3082 stat
->value_expr
= right
;
3086 static statement_t
*new_set_statement(parser_ctx_t
*ctx
, member_expression_t
*left
, expression_t
*right
)
3088 assign_statement_t
*stat
;
3090 stat
= new_statement(ctx
, STAT_SET
, sizeof(*stat
));
3094 stat
->member_expr
= left
;
3095 stat
->value_expr
= right
;
3099 static dim_decl_t
*new_dim_decl(parser_ctx_t
*ctx
, const WCHAR
*name
, BOOL is_array
, dim_list_t
*dims
)
3103 decl
= parser_alloc(ctx
, sizeof(*decl
));
3108 decl
->is_array
= is_array
;
3114 static dim_list_t
*new_dim(parser_ctx_t
*ctx
, unsigned val
, dim_list_t
*next
)
3118 ret
= parser_alloc(ctx
, sizeof(*ret
));
3127 static statement_t
*new_dim_statement(parser_ctx_t
*ctx
, dim_decl_t
*decls
)
3129 dim_statement_t
*stat
;
3131 stat
= new_statement(ctx
, STAT_DIM
, sizeof(*stat
));
3135 stat
->dim_decls
= decls
;
3139 static elseif_decl_t
*new_elseif_decl(parser_ctx_t
*ctx
, expression_t
*expr
, statement_t
*stat
)
3141 elseif_decl_t
*decl
;
3143 decl
= parser_alloc(ctx
, sizeof(*decl
));
3153 static statement_t
*new_while_statement(parser_ctx_t
*ctx
, statement_type_t type
, expression_t
*expr
, statement_t
*body
)
3155 while_statement_t
*stat
;
3157 stat
= new_statement(ctx
, type
, sizeof(*stat
));
3166 static statement_t
*new_forto_statement(parser_ctx_t
*ctx
, const WCHAR
*identifier
, expression_t
*from_expr
,
3167 expression_t
*to_expr
, expression_t
*step_expr
, statement_t
*body
)
3169 forto_statement_t
*stat
;
3171 stat
= new_statement(ctx
, STAT_FORTO
, sizeof(*stat
));
3175 stat
->identifier
= identifier
;
3176 stat
->from_expr
= from_expr
;
3177 stat
->to_expr
= to_expr
;
3178 stat
->step_expr
= step_expr
;
3183 static statement_t
*new_foreach_statement(parser_ctx_t
*ctx
, const WCHAR
*identifier
, expression_t
*group_expr
,
3186 foreach_statement_t
*stat
;
3188 stat
= new_statement(ctx
, STAT_FOREACH
, sizeof(*stat
));
3192 stat
->identifier
= identifier
;
3193 stat
->group_expr
= group_expr
;
3198 static statement_t
*new_if_statement(parser_ctx_t
*ctx
, expression_t
*expr
, statement_t
*if_stat
, elseif_decl_t
*elseif_decl
,
3199 statement_t
*else_stat
)
3201 if_statement_t
*stat
;
3203 stat
= new_statement(ctx
, STAT_IF
, sizeof(*stat
));
3208 stat
->if_stat
= if_stat
;
3209 stat
->elseifs
= elseif_decl
;
3210 stat
->else_stat
= else_stat
;
3214 static statement_t
*new_select_statement(parser_ctx_t
*ctx
, expression_t
*expr
, case_clausule_t
*case_clausules
)
3216 select_statement_t
*stat
;
3218 stat
= new_statement(ctx
, STAT_SELECT
, sizeof(*stat
));
3223 stat
->case_clausules
= case_clausules
;
3227 static case_clausule_t
*new_case_clausule(parser_ctx_t
*ctx
, expression_t
*expr
, statement_t
*stat
, case_clausule_t
*next
)
3229 case_clausule_t
*ret
;
3231 ret
= parser_alloc(ctx
, sizeof(*ret
));
3241 static statement_t
*new_onerror_statement(parser_ctx_t
*ctx
, BOOL resume_next
)
3243 onerror_statement_t
*stat
;
3245 stat
= new_statement(ctx
, STAT_ONERROR
, sizeof(*stat
));
3249 stat
->resume_next
= resume_next
;
3253 static arg_decl_t
*new_argument_decl(parser_ctx_t
*ctx
, const WCHAR
*name
, BOOL by_ref
)
3255 arg_decl_t
*arg_decl
;
3257 arg_decl
= parser_alloc(ctx
, sizeof(*arg_decl
));
3261 arg_decl
->name
= name
;
3262 arg_decl
->by_ref
= by_ref
;
3263 arg_decl
->next
= NULL
;
3267 static function_decl_t
*new_function_decl(parser_ctx_t
*ctx
, const WCHAR
*name
, function_type_t type
,
3268 unsigned storage_flags
, arg_decl_t
*arg_decl
, statement_t
*body
)
3270 function_decl_t
*decl
;
3272 if(storage_flags
& STORAGE_IS_DEFAULT
) {
3273 if(type
== FUNC_PROPGET
) {
3276 FIXME("Invalid default property\n");
3282 decl
= parser_alloc(ctx
, sizeof(*decl
));
3288 decl
->is_public
= !(storage_flags
& STORAGE_IS_PRIVATE
);
3289 decl
->args
= arg_decl
;
3292 decl
->next_prop_func
= NULL
;
3296 static statement_t
*new_function_statement(parser_ctx_t
*ctx
, function_decl_t
*decl
)
3298 function_statement_t
*stat
;
3300 stat
= new_statement(ctx
, STAT_FUNC
, sizeof(*stat
));
3304 stat
->func_decl
= decl
;
3308 static class_decl_t
*new_class_decl(parser_ctx_t
*ctx
)
3310 class_decl_t
*class_decl
;
3312 class_decl
= parser_alloc(ctx
, sizeof(*class_decl
));
3316 class_decl
->funcs
= NULL
;
3317 class_decl
->props
= NULL
;
3318 class_decl
->next
= NULL
;
3322 static class_decl_t
*add_class_function(parser_ctx_t
*ctx
, class_decl_t
*class_decl
, function_decl_t
*decl
)
3324 function_decl_t
*iter
;
3326 for(iter
= class_decl
->funcs
; iter
; iter
= iter
->next
) {
3327 if(!strcmpiW(iter
->name
, decl
->name
)) {
3328 if(decl
->type
== FUNC_SUB
|| decl
->type
== FUNC_FUNCTION
) {
3329 FIXME("Redefinition of %s::%s\n", debugstr_w(class_decl
->name
), debugstr_w(decl
->name
));
3335 if(iter
->type
== decl
->type
) {
3336 FIXME("Redefinition of %s::%s\n", debugstr_w(class_decl
->name
), debugstr_w(decl
->name
));
3340 if(!iter
->next_prop_func
)
3342 iter
= iter
->next_prop_func
;
3345 iter
->next_prop_func
= decl
;
3350 decl
->next
= class_decl
->funcs
;
3351 class_decl
->funcs
= decl
;
3355 static class_decl_t
*add_dim_prop(parser_ctx_t
*ctx
, class_decl_t
*class_decl
, dim_decl_t
*dim_decl
, unsigned storage_flags
)
3357 if(storage_flags
& STORAGE_IS_DEFAULT
) {
3358 FIXME("variant prop van't be default value\n");
3363 dim_decl
->is_public
= !(storage_flags
& STORAGE_IS_PRIVATE
);
3364 dim_decl
->next
= class_decl
->props
;
3365 class_decl
->props
= dim_decl
;
3369 static const_decl_t
*new_const_decl(parser_ctx_t
*ctx
, const WCHAR
*name
, expression_t
*expr
)
3373 decl
= parser_alloc(ctx
, sizeof(*decl
));
3378 decl
->value_expr
= expr
;
3383 static statement_t
*new_const_statement(parser_ctx_t
*ctx
, const_decl_t
*decls
)
3385 const_statement_t
*stat
;
3387 stat
= new_statement(ctx
, STAT_CONST
, sizeof(*stat
));
3391 stat
->decls
= decls
;
3395 static statement_t
*link_statements(statement_t
*head
, statement_t
*tail
)
3399 for(iter
= head
; iter
->next
; iter
= iter
->next
);
3405 void *parser_alloc(parser_ctx_t
*ctx
, size_t size
)
3409 ret
= heap_pool_alloc(&ctx
->heap
, size
);
3411 ctx
->hres
= E_OUTOFMEMORY
;
3415 HRESULT
parse_script(parser_ctx_t
*ctx
, const WCHAR
*code
, const WCHAR
*delimiter
)
3417 const WCHAR html_delimiterW
[] = {'<','/','s','c','r','i','p','t','>',0};
3419 ctx
->code
= ctx
->ptr
= code
;
3420 ctx
->end
= ctx
->code
+ strlenW(ctx
->code
);
3422 heap_pool_init(&ctx
->heap
);
3424 ctx
->parse_complete
= FALSE
;
3427 ctx
->last_token
= tNL
;
3429 ctx
->stats
= ctx
->stats_tail
= NULL
;
3430 ctx
->class_decls
= NULL
;
3431 ctx
->option_explicit
= FALSE
;
3432 ctx
->is_html
= delimiter
&& !strcmpiW(delimiter
, html_delimiterW
);
3436 if(FAILED(ctx
->hres
))
3438 if(!ctx
->parse_complete
) {
3439 FIXME("parser failed around %s\n", debugstr_w(ctx
->code
+20 > ctx
->ptr
? ctx
->code
: ctx
->ptr
-20));
3446 void parser_release(parser_ctx_t
*ctx
)
3448 heap_pool_free(&ctx
->heap
);