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
154 extern int parser_debug
;
165 tEMPTYBRACKETS
= 261,
234 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
235 typedef union YYSTYPE YYSTYPE
;
238 #line 88 "parser.y" /* yacc.c:355 */
241 statement_t
*statement
;
242 expression_t
*expression
;
243 member_expression_t
*member
;
244 elseif_decl_t
*elseif
;
245 dim_decl_t
*dim_decl
;
246 dim_list_t
*dim_list
;
247 function_decl_t
*func_decl
;
248 arg_decl_t
*arg_decl
;
249 class_decl_t
*class_decl
;
250 const_decl_t
*const_decl
;
251 case_clausule_t
*case_clausule
;
257 #line 263 "parser.tab.c" /* yacc.c:355 */
259 # define YYSTYPE_IS_TRIVIAL 1
260 # define YYSTYPE_IS_DECLARED 1
265 int parser_parse (parser_ctx_t
*ctx
);
269 /* Copy the second part of user declarations. */
271 #line 277 "parser.tab.c" /* yacc.c:358 */
278 typedef YYTYPE_UINT8 yytype_uint8
;
280 typedef unsigned char yytype_uint8
;
284 typedef YYTYPE_INT8 yytype_int8
;
286 typedef signed char yytype_int8
;
290 typedef YYTYPE_UINT16 yytype_uint16
;
292 typedef unsigned short int yytype_uint16
;
296 typedef YYTYPE_INT16 yytype_int16
;
298 typedef short int yytype_int16
;
302 # ifdef __SIZE_TYPE__
303 # define YYSIZE_T __SIZE_TYPE__
304 # elif defined size_t
305 # define YYSIZE_T size_t
306 # elif ! defined YYSIZE_T
307 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
308 # define YYSIZE_T size_t
310 # define YYSIZE_T unsigned int
314 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
317 # if defined YYENABLE_NLS && YYENABLE_NLS
319 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
320 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
324 # define YY_(Msgid) Msgid
329 # if (defined __GNUC__ \
330 && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
331 || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
332 # define YY_ATTRIBUTE(Spec) __attribute__(Spec)
334 # define YY_ATTRIBUTE(Spec) /* empty */
338 #ifndef YY_ATTRIBUTE_PURE
339 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
342 #ifndef YY_ATTRIBUTE_UNUSED
343 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
346 #if !defined _Noreturn \
347 && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
348 # if defined _MSC_VER && 1200 <= _MSC_VER
349 # define _Noreturn __declspec (noreturn)
351 # define _Noreturn YY_ATTRIBUTE ((__noreturn__))
355 /* Suppress unused-variable warnings by "using" E. */
356 #if ! defined lint || defined __GNUC__
357 # define YYUSE(E) ((void) (E))
359 # define YYUSE(E) /* empty */
362 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
363 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
364 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
365 _Pragma ("GCC diagnostic push") \
366 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
367 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
368 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
369 _Pragma ("GCC diagnostic pop")
371 # define YY_INITIAL_VALUE(Value) Value
373 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
374 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
375 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
377 #ifndef YY_INITIAL_VALUE
378 # define YY_INITIAL_VALUE(Value) /* Nothing. */
382 #if ! defined yyoverflow || YYERROR_VERBOSE
384 /* The parser invokes alloca or malloc; define the necessary symbols. */
386 # ifdef YYSTACK_USE_ALLOCA
387 # if YYSTACK_USE_ALLOCA
389 # define YYSTACK_ALLOC __builtin_alloca
390 # elif defined __BUILTIN_VA_ARG_INCR
391 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
393 # define YYSTACK_ALLOC __alloca
394 # elif defined _MSC_VER
395 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
396 # define alloca _alloca
398 # define YYSTACK_ALLOC alloca
399 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
400 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
401 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
402 # ifndef EXIT_SUCCESS
403 # define EXIT_SUCCESS 0
410 # ifdef YYSTACK_ALLOC
411 /* Pacify GCC's 'empty if-body' warning. */
412 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
413 # ifndef YYSTACK_ALLOC_MAXIMUM
414 /* The OS might guarantee only one guard page at the bottom of the stack,
415 and a page size can be as small as 4096 bytes. So we cannot safely
416 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
417 to allow for a few compiler-allocated temporary stack slots. */
418 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
421 # define YYSTACK_ALLOC YYMALLOC
422 # define YYSTACK_FREE YYFREE
423 # ifndef YYSTACK_ALLOC_MAXIMUM
424 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
426 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
427 && ! ((defined YYMALLOC || defined malloc) \
428 && (defined YYFREE || defined free)))
429 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
430 # ifndef EXIT_SUCCESS
431 # define EXIT_SUCCESS 0
435 # define YYMALLOC malloc
436 # if ! defined malloc && ! defined EXIT_SUCCESS
437 void *malloc (YYSIZE_T
); /* INFRINGES ON USER NAME SPACE */
442 # if ! defined free && ! defined EXIT_SUCCESS
443 void free (void *); /* INFRINGES ON USER NAME SPACE */
447 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
450 #if (! defined yyoverflow \
451 && (! defined __cplusplus \
452 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
454 /* A type that is properly aligned for any stack member. */
457 yytype_int16 yyss_alloc
;
461 /* The size of the maximum gap between one aligned stack and the next. */
462 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
464 /* The size of an array large to enough to hold all stacks, each with
466 # define YYSTACK_BYTES(N) \
467 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
468 + YYSTACK_GAP_MAXIMUM)
470 # define YYCOPY_NEEDED 1
472 /* Relocate STACK from its old location to the new one. The
473 local variables YYSIZE and YYSTACKSIZE give the old and new number of
474 elements in the stack, and YYPTR gives the new location of the
475 stack. Advance YYPTR to a properly aligned location for the next
477 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
480 YYSIZE_T yynewbytes; \
481 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
482 Stack = &yyptr->Stack_alloc; \
483 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
484 yyptr += yynewbytes / sizeof (*yyptr); \
490 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
491 /* Copy COUNT objects from SRC to DST. The source and destination do
494 # if defined __GNUC__ && 1 < __GNUC__
495 # define YYCOPY(Dst, Src, Count) \
496 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
498 # define YYCOPY(Dst, Src, Count) \
502 for (yyi = 0; yyi < (Count); yyi++) \
503 (Dst)[yyi] = (Src)[yyi]; \
508 #endif /* !YYCOPY_NEEDED */
510 /* YYFINAL -- State number of the termination state. */
512 /* YYLAST -- Last index in YYTABLE. */
515 /* YYNTOKENS -- Number of terminals. */
517 /* YYNNTS -- Number of nonterminals. */
519 /* YYNRULES -- Number of rules. */
521 /* YYNSTATES -- Number of states. */
522 #define YYNSTATES 335
524 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
525 by yylex, with out-of-bounds checking. */
527 #define YYMAXUTOK 325
529 #define YYTRANSLATE(YYX) \
530 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
532 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
533 as returned by yylex, without out-of-bounds checking. */
534 static const yytype_uint8 yytranslate
[] =
536 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
537 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
538 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
539 2, 2, 2, 2, 2, 2, 2, 2, 81, 2,
540 76, 77, 84, 82, 75, 78, 74, 85, 73, 2,
541 2, 2, 2, 2, 2, 2, 2, 2, 71, 2,
542 80, 72, 79, 2, 2, 2, 2, 2, 2, 2,
543 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
544 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
545 2, 2, 83, 2, 86, 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, 2, 2, 2, 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, 1, 2, 3, 4,
562 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
563 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
564 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
565 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
566 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
567 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
568 65, 66, 67, 68, 69, 70
572 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
573 static const yytype_uint16 yyrline
[] =
575 0, 147, 147, 150, 151, 153, 155, 156, 159, 160,
576 163, 164, 167, 170, 171, 172, 173, 174, 177, 178,
577 179, 181, 182, 183, 185, 188, 191, 192, 193, 194,
578 195, 196, 197, 198, 200, 201, 202, 203, 204, 206,
579 208, 212, 213, 216, 217, 220, 221, 222, 225, 226,
580 229, 230, 233, 236, 237, 240, 241, 244, 245, 248,
581 250, 251, 254, 256, 259, 260, 263, 264, 267, 271,
582 272, 275, 276, 277, 281, 282, 285, 286, 288, 290,
583 293, 294, 297, 298, 301, 302, 305, 306, 309, 310,
584 313, 314, 317, 318, 321, 322, 323, 324, 325, 326,
585 327, 328, 331, 332, 335, 336, 337, 340, 341, 344,
586 345, 349, 350, 352, 356, 357, 360, 361, 362, 363,
587 366, 367, 370, 371, 372, 373, 374, 375, 376, 379,
588 380, 381, 382, 385, 386, 387, 390, 391, 394, 397,
589 398, 400, 402, 403, 406, 408, 410, 414, 416, 420,
590 421, 424, 425, 426, 429, 430, 433, 434, 437, 438,
591 439, 443, 444, 448, 449
595 #if YYDEBUG || YYERROR_VERBOSE || 0
596 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
597 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
598 static const char *const yytname
[] =
600 "$end", "error", "$undefined", "tEOF", "tNL", "tREM", "tEMPTYBRACKETS",
601 "tTRUE", "tFALSE", "tNOT", "tAND", "tOR", "tXOR", "tEQV", "tIMP", "tNEQ",
602 "tIS", "tLTEQ", "tGTEQ", "tMOD", "tCALL", "tDIM", "tSUB", "tFUNCTION",
603 "tPROPERTY", "tGET", "tLET", "tCONST", "tIF", "tELSE", "tELSEIF", "tEND",
604 "tTHEN", "tEXIT", "tWHILE", "tWEND", "tDO", "tLOOP", "tUNTIL", "tFOR",
605 "tTO", "tSTEP", "tEACH", "tIN", "tSELECT", "tCASE", "tBYREF", "tBYVAL",
606 "tOPTION", "tEXPLICIT", "tSTOP", "tNOTHING", "tEMPTY", "tNULL", "tCLASS",
607 "tSET", "tNEW", "tPUBLIC", "tPRIVATE", "tDEFAULT", "tME", "tERROR",
608 "tNEXT", "tON", "tRESUME", "tGOTO", "tIdentifier", "tString", "tLong",
609 "tShort", "tDouble", "':'", "'='", "'0'", "'.'", "','", "'('", "')'",
610 "'-'", "'>'", "'<'", "'&'", "'+'", "'\\\\'", "'*'", "'/'", "'^'",
611 "$accept", "Program", "OptionExplicit_opt", "SourceElements",
612 "StatementsNl_opt", "StatementsNl", "StatementNl", "Statement",
613 "SimpleStatement", "MemberExpression", "DimDeclList", "DimDecl",
614 "DimList", "ConstDeclList", "ConstDecl", "ConstExpression", "DoType",
615 "Step_opt", "IfStatement", "EndIf_opt", "ElseIfs_opt", "ElseIfs",
616 "ElseIf", "Else_opt", "CaseClausules", "Arguments_opt",
617 "ArgumentList_opt", "EmptyBrackets_opt", "ExpressionList", "Expression",
618 "EqvExpression", "XorExpression", "OrExpression", "AndExpression",
619 "NotExpression", "EqualityExpression", "ConcatExpression",
620 "AdditiveExpression", "ModExpression", "IntdivExpression",
621 "MultiplicativeExpression", "ExpExpression", "UnaryExpression",
622 "CallExpression", "LiteralExpression", "NumericLiteralExpression",
623 "IntegerValue", "PrimaryExpression", "ClassDeclaration", "ClassBody",
624 "PropertyDecl", "FunctionDecl", "Storage_opt", "Storage",
625 "ArgumentsDecl_opt", "ArgumentDeclList", "ArgumentDecl", "Identifier",
631 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
632 (internal) symbol number NUM (which must be that of a token). */
633 static const yytype_uint16 yytoknum
[] =
635 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
636 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
637 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
638 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
639 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
640 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
641 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
642 325, 58, 61, 48, 46, 44, 40, 41, 45, 62,
643 60, 38, 43, 92, 42, 47, 94
647 #define YYPACT_NINF -158
649 #define yypact_value_is_default(Yystate) \
650 (!!((Yystate) == (-158)))
652 #define YYTABLE_NINF -150
654 #define yytable_value_is_error(Yytable_value) \
657 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
659 static const yytype_int16 yypact
[] =
661 -28, -18, 43, -158, 56, -158, 307, -158, -158, 6,
662 -2, -158, -2, 468, 184, 468, 20, 33, 32, -158,
663 -2, 6, 26, -158, -158, 50, -158, 557, 468, -158,
664 116, 51, 388, -158, 62, -158, -158, -158, 130, -158,
665 -158, 8, -158, 63, 10, -158, 93, 104, -158, -158,
666 468, -158, -158, -158, -2, -158, -158, -158, -158, -158,
667 498, 8, 24, 166, 171, 177, 189, -158, 29, 113,
668 53, 182, 122, 102, 129, -158, 62, -158, -158, -158,
669 -158, -158, -158, -158, 47, 598, -158, -158, 468, -2,
670 145, 468, 214, 8, -158, 127, -158, 11, -158, 557,
671 -158, 468, 152, -158, -5, -158, 19, -2, -2, -2,
672 468, 163, -158, -2, -158, 112, -2, 97, -158, -158,
673 -158, -158, 468, 348, 468, 468, 468, 468, 498, 498,
674 498, 498, 498, 498, 498, 498, 498, 498, 498, 498,
675 498, 498, 498, 651, 201, -158, 557, 48, 200, 468,
676 36, 120, 173, 185, 175, -158, -158, 169, 35, 468,
677 468, -158, 13, 13, -158, -158, -158, -158, 176, 179,
678 -158, 45, -158, -158, 166, 557, 221, 171, 177, 189,
679 -158, 113, 113, 113, 113, 113, 113, 113, 53, 182,
680 182, 122, 102, 129, 129, -158, 217, 121, -158, 598,
681 468, 25, -158, -158, 211, -2, 228, 256, 257, 150,
682 196, 468, -158, -158, -158, 249, -158, -11, -158, 260,
683 261, -158, 112, -158, 237, 786, -158, 468, 233, 59,
684 468, 418, 240, 268, 219, 120, 120, 135, 270, 249,
685 -2, -2, 198, 202, 277, 692, 692, -158, 468, 247,
686 -158, 237, 253, 249, -158, 733, 12, 7, 7, 242,
687 120, 283, -158, -158, 224, 225, 226, 120, 277, 277,
688 -158, -11, -158, 263, 265, 27, 293, 271, -158, 273,
689 -158, 243, 468, 295, 786, 557, -158, -158, -158, 13,
690 231, 236, -158, -158, -158, -158, 282, 286, 310, 692,
691 287, -158, -158, 249, 733, -158, 211, 312, -11, -11,
692 -158, -158, 557, -158, -158, 255, -158, 692, 241, 252,
693 -158, -158, 288, 320, 326, 308, 692, 692, -158, 302,
694 305, 314, 315, -158, -158
697 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
698 Performed when YYTABLE does not specify something else to do. Zero
699 means the default is an error. */
700 static const yytype_uint8 yydefact
[] =
702 3, 0, 0, 5, 0, 1, 149, 4, 2, 0,
703 0, 162, 0, 0, 0, 0, 0, 0, 0, 34,
704 0, 0, 152, 153, 137, 0, 161, 13, 0, 6,
705 0, 15, 78, 22, 0, 120, 7, 27, 0, 150,
706 41, 78, 21, 43, 45, 37, 50, 0, 122, 123,
707 0, 128, 126, 127, 0, 124, 131, 129, 132, 130,
708 0, 78, 0, 82, 84, 86, 88, 90, 92, 94,
709 102, 104, 107, 109, 111, 114, 117, 116, 125, 32,
710 30, 31, 28, 29, 0, 149, 55, 56, 0, 0,
711 0, 0, 0, 78, 151, 0, 14, 0, 12, 17,
712 79, 0, 121, 18, 76, 77, 80, 0, 0, 0,
713 0, 19, 74, 0, 47, 0, 0, 0, 93, 118,
714 119, 121, 0, 149, 0, 0, 0, 0, 0, 0,
715 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
716 0, 0, 0, 149, 0, 9, 10, 0, 0, 0,
717 0, 149, 121, 0, 0, 136, 16, 0, 0, 0,
718 0, 42, 78, 78, 44, 135, 133, 134, 0, 48,
719 51, 0, 52, 53, 83, 8, 60, 85, 87, 89,
720 91, 96, 101, 100, 99, 95, 97, 98, 103, 106,
721 105, 108, 110, 112, 113, 115, 0, 26, 11, 149,
722 0, 0, 163, 164, 71, 0, 0, 0, 0, 0,
723 150, 0, 35, 36, 75, 20, 81, 0, 154, 0,
724 0, 46, 0, 54, 64, 149, 23, 0, 0, 0,
725 0, 0, 0, 0, 0, 149, 149, 0, 0, 33,
726 0, 0, 0, 156, 78, 149, 149, 49, 0, 69,
727 65, 66, 62, 25, 24, 149, 57, 0, 0, 0,
728 149, 0, 143, 140, 0, 0, 0, 149, 78, 78,
729 155, 0, 158, 0, 0, 0, 0, 0, 67, 0,
730 61, 0, 0, 0, 149, 8, 40, 142, 138, 78,
731 0, 0, 141, 159, 160, 157, 0, 0, 0, 149,
732 0, 63, 39, 58, 149, 72, 71, 0, 0, 0,
733 147, 148, 8, 70, 59, 0, 73, 149, 0, 0,
734 68, 38, 0, 0, 0, 0, 149, 149, 144, 0,
738 /* YYPGOTO[NTERM-NUM]. */
739 static const yytype_int16 yypgoto
[] =
741 -158, -158, -158, -158, -101, -137, 336, -23, -158, -6,
742 232, 139, 125, 234, -158, -158, 151, -158, -158, -158,
743 -158, 98, -158, -158, 49, -13, -158, 0, -31, 55,
744 238, 229, 246, 230, -40, -158, 99, 223, 60, 216,
745 220, 69, -52, -4, 262, 192, -158, -158, -158, -78,
746 -158, -144, -139, -133, -157, 95, -96, 17, -22
749 /* YYDEFGOTO[NTERM-NUM]. */
750 static const yytype_int16 yydefgoto
[] =
752 -1, 2, 3, 6, 144, 145, 146, 30, 31, 61,
753 42, 43, 168, 45, 46, 172, 88, 283, 33, 280,
754 249, 250, 251, 277, 232, 102, 103, 112, 157, 106,
755 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
756 73, 74, 75, 76, 77, 78, 169, 35, 36, 206,
757 207, 37, 38, 39, 219, 242, 243, 40, 204
760 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
761 positive, shift that token. If negative, reduce the rule whose
762 number is the opposite. If YYTABLE_NINF, syntax error. */
763 static const yytype_int16 yytable
[] =
765 32, 105, 34, 41, 96, 34, 220, 208, 120, 198,
766 118, 202, 209, 11, 100, 93, 114, 34, 210, 100,
767 1, 32, 11, 34, 85, 122, 122, 44, 111, 47,
768 11, 4, 104, 122, 90, 240, 241, 92, 122, 122,
769 202, 122, 196, 5, 128, 129, 130, 131, 121, 122,
770 122, 143, 199, 282, 86, 26, 123, 11, 87, 298,
771 7, 122, 122, 255, 26, 230, 24, -74, 62, -74,
772 84, 119, 26, 122, 224, 89, 156, 91, 203, 32,
773 152, 34, 28, 97, 110, 94, 115, 180, 155, 217,
774 195, 208, 208, 32, 160, 34, 209, 209, 228, 26,
775 176, 132, 210, 210, 48, 49, 148, 203, 133, 134,
776 160, 95, 155, 56, 57, 58, 208, 32, 59, 34,
777 98, 209, 99, 208, 161, 162, 163, 210, 209, 216,
778 44, 136, 307, 47, 210, 137, 107, 32, 113, 34,
779 32, 205, 34, 147, 273, 274, 150, 305, 51, 52,
780 53, -139, 108, 109, 281, 86, 158, 262, 263, 87,
781 264, 265, 218, 218, 55, 56, 57, 58, 116, 32,
782 59, 34, 108, 109, 237, 171, 117, 22, 23, 124,
783 165, 166, 287, 125, 306, 167, 140, 141, 126, 292,
784 266, 153, 154, 32, 135, 34, 189, 190, 313, 127,
785 258, 138, 252, 315, 201, 139, 79, 80, 81, 193,
786 194, 320, 318, 319, 215, 142, 322, 149, 151, 32,
787 82, 34, 44, 83, 159, 329, 330, 181, 182, 183,
788 184, 185, 186, 187, 244, 284, 285, -121, 197, 32,
789 32, 34, 34, 200, 272, 211, 214, 212, 213, 32,
790 225, 34, 226, 221, 222, 229, 231, 268, 269, 234,
791 235, 236, 238, 122, 245, 246, 239, 248, 293, 294,
792 254, 259, 260, 261, 267, 270, 276, 271, 32, 32,
793 34, 34, 253, 100, 279, 256, 286, 288, 244, 218,
794 289, 290, 291, 32, 296, 34, 297, 299, 32, 304,
795 34, 301, 300, 275, 310, 302, 32, 308, 34, 311,
796 8, 32, 309, 34, 312, 314, 317, 321, 323, 325,
797 32, 32, 34, 34, 326, 244, 244, 9, 10, 324,
798 327, 11, 328, 331, 12, 13, 332, 303, 333, 334,
799 14, 15, 29, 16, 233, 164, 17, 247, 227, 278,
800 170, 18, 175, 177, 191, 316, 179, 19, 188, 192,
801 174, 20, 21, 223, 22, 23, 295, 24, 9, 10,
802 25, 178, 11, 26, 0, 12, 13, 0, 27, 173,
803 0, 14, 15, 28, 16, 0, 0, 17, 0, 0,
804 0, 0, 18, 0, 100, 48, 49, 50, 19, 0,
805 0, 0, 0, 21, 0, 22, 23, 0, 24, 0,
806 0, 25, 11, 0, 26, 0, 0, 0, 0, 27,
807 0, 0, 0, 0, 28, 48, 49, 50, 0, 0,
808 0, 0, 0, 0, 0, 0, 0, 0, 0, 51,
809 52, 53, 11, 0, 54, 0, 0, 257, 24, 0,
810 0, 0, 0, 0, 26, 55, 56, 57, 58, 0,
811 0, 59, 0, 0, 101, 0, 60, 0, 0, 51,
812 52, 53, 0, 0, 54, 48, 49, 50, 24, 0,
813 0, 0, 0, 0, 26, 55, 56, 57, 58, 0,
814 0, 59, 11, 0, 28, 0, 60, 0, 0, 0,
815 0, 0, 0, 0, 0, 48, 49, 0, 0, 0,
816 0, 0, 0, 0, 0, 0, 0, 0, 0, 51,
817 52, 53, 11, 0, 54, 0, 0, 0, 24, 0,
818 0, 0, 0, 0, 26, 55, 56, 57, 58, 0,
819 0, 59, 0, 0, 28, 0, 60, 0, 0, 51,
820 52, 53, 0, 0, 54, 0, 0, 0, 24, 0,
821 0, 0, 0, 0, 26, 55, 56, 57, 58, 0,
822 0, 59, 0, 0, 28, 0, 60, 9, 10, -149,
823 -149, 11, 0, 0, 12, 13, 0, 0, 0, 0,
824 14, 15, 0, 16, 0, 0, 17, 0, 0, 0,
825 0, 18, 0, 0, 0, 0, 0, 19, 0, 0,
826 0, 0, 21, 0, 22, 23, 0, 24, 9, 10,
827 25, 0, 11, 26, 0, 12, 13, 0, 27, 0,
828 0, 14, 15, 28, 16, -8, 0, 17, 0, 0,
829 0, 0, 18, 0, 0, 0, 0, 0, 19, 0,
830 0, 0, 0, 21, 0, 22, 23, 0, 24, 0,
831 0, 25, 0, 0, 26, 0, 0, 0, 0, 27,
832 0, 9, 10, 0, 28, 11, 0, 0, 12, 13,
833 0, 0, 0, 0, 14, 15, -8, 16, 0, 0,
834 17, 0, 0, 0, 0, 18, 0, 0, 0, 0,
835 0, 19, 0, 0, 0, 0, 21, 0, 22, 23,
836 0, 24, 9, 10, 25, 0, 11, 26, 0, 12,
837 13, 0, 27, -8, 0, 14, 15, 28, 16, 0,
838 0, 17, 0, 0, 0, 0, 18, 0, 0, 0,
839 0, 0, 19, 0, 0, 0, 0, 21, 0, 22,
840 23, 0, 24, 9, 10, 25, 0, 11, 26, 0,
841 12, 13, 0, 27, 0, 0, 14, 15, 28, 16,
842 0, 0, 17, 0, 0, 0, 0, 18, 0, 0,
843 0, 0, 0, 19, 0, 0, 0, 0, 21, 0,
844 22, 23, 0, 24, 0, -8, 25, 0, 0, 26,
845 0, 0, 0, 0, 27, 0, 9, 10, 0, 28,
846 11, 0, 0, 12, 13, 0, 0, 0, 0, 14,
847 15, 0, 16, 0, 0, 17, 0, 0, 0, 0,
848 18, 0, 0, 0, 0, 0, 19, 0, 0, 0,
849 0, 21, 0, 22, 23, 0, 24, 0, 0, 25,
850 0, 0, 26, 0, 0, 0, 0, 27, 0, 0,
854 static const yytype_int16 yycheck
[] =
856 6, 32, 6, 9, 27, 9, 163, 151, 60, 146,
857 50, 4, 151, 24, 6, 21, 6, 21, 151, 6,
858 48, 27, 24, 27, 4, 14, 14, 10, 41, 12,
859 24, 49, 32, 14, 17, 46, 47, 20, 14, 14,
860 4, 14, 143, 0, 15, 16, 17, 18, 61, 14,
861 14, 4, 4, 41, 34, 66, 32, 24, 38, 32,
862 4, 14, 14, 4, 66, 40, 60, 72, 13, 74,
863 15, 54, 66, 14, 175, 42, 99, 45, 71, 85,
864 93, 85, 76, 28, 76, 59, 76, 127, 77, 76,
865 142, 235, 236, 99, 75, 99, 235, 236, 199, 66,
866 123, 72, 235, 236, 7, 8, 89, 71, 79, 80,
867 75, 61, 77, 68, 69, 70, 260, 123, 73, 123,
868 4, 260, 71, 267, 107, 108, 109, 260, 267, 160,
869 113, 78, 289, 116, 267, 82, 74, 143, 75, 143,
870 146, 21, 146, 88, 245, 246, 91, 284, 51, 52,
871 53, 31, 22, 23, 255, 34, 101, 235, 236, 38,
872 25, 26, 162, 163, 67, 68, 69, 70, 75, 175,
873 73, 175, 22, 23, 24, 78, 72, 57, 58, 13,
874 68, 69, 260, 12, 285, 73, 84, 85, 11, 267,
875 55, 64, 65, 199, 81, 199, 136, 137, 299, 10,
876 231, 19, 225, 304, 149, 83, 22, 23, 24, 140,
877 141, 312, 308, 309, 159, 86, 317, 72, 4, 225,
878 36, 225, 205, 39, 72, 326, 327, 128, 129, 130,
879 131, 132, 133, 134, 217, 257, 258, 74, 37, 245,
880 246, 245, 246, 43, 244, 72, 77, 62, 73, 255,
881 29, 255, 35, 77, 75, 200, 45, 240, 241, 31,
882 4, 4, 66, 14, 4, 4, 211, 30, 268, 269,
883 37, 31, 4, 54, 4, 77, 29, 75, 284, 285,
884 284, 285, 227, 6, 31, 230, 44, 4, 271, 289,
885 66, 66, 66, 299, 31, 299, 31, 4, 304, 4,
886 304, 28, 31, 248, 22, 62, 312, 76, 312, 23,
887 3, 317, 76, 317, 4, 28, 4, 62, 77, 31,
888 326, 327, 326, 327, 4, 308, 309, 20, 21, 77,
889 4, 24, 24, 31, 27, 28, 31, 282, 24, 24,
890 33, 34, 6, 36, 205, 113, 39, 222, 197, 251,
891 116, 44, 4, 124, 138, 306, 126, 50, 135, 139,
892 122, 54, 55, 171, 57, 58, 271, 60, 20, 21,
893 63, 125, 24, 66, -1, 27, 28, -1, 71, 117,
894 -1, 33, 34, 76, 36, -1, -1, 39, -1, -1,
895 -1, -1, 44, -1, 6, 7, 8, 9, 50, -1,
896 -1, -1, -1, 55, -1, 57, 58, -1, 60, -1,
897 -1, 63, 24, -1, 66, -1, -1, -1, -1, 71,
898 -1, -1, -1, -1, 76, 7, 8, 9, -1, -1,
899 -1, -1, -1, -1, -1, -1, -1, -1, -1, 51,
900 52, 53, 24, -1, 56, -1, -1, 29, 60, -1,
901 -1, -1, -1, -1, 66, 67, 68, 69, 70, -1,
902 -1, 73, -1, -1, 76, -1, 78, -1, -1, 51,
903 52, 53, -1, -1, 56, 7, 8, 9, 60, -1,
904 -1, -1, -1, -1, 66, 67, 68, 69, 70, -1,
905 -1, 73, 24, -1, 76, -1, 78, -1, -1, -1,
906 -1, -1, -1, -1, -1, 7, 8, -1, -1, -1,
907 -1, -1, -1, -1, -1, -1, -1, -1, -1, 51,
908 52, 53, 24, -1, 56, -1, -1, -1, 60, -1,
909 -1, -1, -1, -1, 66, 67, 68, 69, 70, -1,
910 -1, 73, -1, -1, 76, -1, 78, -1, -1, 51,
911 52, 53, -1, -1, 56, -1, -1, -1, 60, -1,
912 -1, -1, -1, -1, 66, 67, 68, 69, 70, -1,
913 -1, 73, -1, -1, 76, -1, 78, 20, 21, 22,
914 23, 24, -1, -1, 27, 28, -1, -1, -1, -1,
915 33, 34, -1, 36, -1, -1, 39, -1, -1, -1,
916 -1, 44, -1, -1, -1, -1, -1, 50, -1, -1,
917 -1, -1, 55, -1, 57, 58, -1, 60, 20, 21,
918 63, -1, 24, 66, -1, 27, 28, -1, 71, -1,
919 -1, 33, 34, 76, 36, 37, -1, 39, -1, -1,
920 -1, -1, 44, -1, -1, -1, -1, -1, 50, -1,
921 -1, -1, -1, 55, -1, 57, 58, -1, 60, -1,
922 -1, 63, -1, -1, 66, -1, -1, -1, -1, 71,
923 -1, 20, 21, -1, 76, 24, -1, -1, 27, 28,
924 -1, -1, -1, -1, 33, 34, 35, 36, -1, -1,
925 39, -1, -1, -1, -1, 44, -1, -1, -1, -1,
926 -1, 50, -1, -1, -1, -1, 55, -1, 57, 58,
927 -1, 60, 20, 21, 63, -1, 24, 66, -1, 27,
928 28, -1, 71, 31, -1, 33, 34, 76, 36, -1,
929 -1, 39, -1, -1, -1, -1, 44, -1, -1, -1,
930 -1, -1, 50, -1, -1, -1, -1, 55, -1, 57,
931 58, -1, 60, 20, 21, 63, -1, 24, 66, -1,
932 27, 28, -1, 71, -1, -1, 33, 34, 76, 36,
933 -1, -1, 39, -1, -1, -1, -1, 44, -1, -1,
934 -1, -1, -1, 50, -1, -1, -1, -1, 55, -1,
935 57, 58, -1, 60, -1, 62, 63, -1, -1, 66,
936 -1, -1, -1, -1, 71, -1, 20, 21, -1, 76,
937 24, -1, -1, 27, 28, -1, -1, -1, -1, 33,
938 34, -1, 36, -1, -1, 39, -1, -1, -1, -1,
939 44, -1, -1, -1, -1, -1, 50, -1, -1, -1,
940 -1, 55, -1, 57, 58, -1, 60, -1, -1, 63,
941 -1, -1, 66, -1, -1, -1, -1, 71, -1, -1,
945 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
946 symbol of state STATE-NUM. */
947 static const yytype_uint8 yystos
[] =
949 0, 48, 88, 89, 49, 0, 90, 4, 3, 20,
950 21, 24, 27, 28, 33, 34, 36, 39, 44, 50,
951 54, 55, 57, 58, 60, 63, 66, 71, 76, 93,
952 94, 95, 96, 105, 130, 134, 135, 138, 139, 140,
953 144, 96, 97, 98, 144, 100, 101, 144, 7, 8,
954 9, 51, 52, 53, 56, 67, 68, 69, 70, 73,
955 78, 96, 116, 117, 118, 119, 120, 121, 122, 123,
956 124, 125, 126, 127, 128, 129, 130, 131, 132, 22,
957 23, 24, 36, 39, 116, 4, 34, 38, 103, 42,
958 144, 45, 144, 96, 59, 61, 94, 116, 4, 71,
959 6, 76, 112, 113, 114, 115, 116, 74, 22, 23,
960 76, 112, 114, 75, 6, 76, 75, 72, 121, 144,
961 129, 112, 14, 32, 13, 12, 11, 10, 15, 16,
962 17, 18, 72, 79, 80, 81, 78, 82, 19, 83,
963 84, 85, 86, 4, 91, 92, 93, 116, 144, 72,
964 116, 4, 112, 64, 65, 77, 94, 115, 116, 72,
965 75, 144, 144, 144, 97, 68, 69, 73, 99, 133,
966 100, 78, 102, 131, 117, 4, 94, 118, 119, 120,
967 121, 123, 123, 123, 123, 123, 123, 123, 124, 125,
968 125, 126, 127, 128, 128, 129, 91, 37, 92, 4,
969 43, 116, 4, 71, 145, 21, 136, 137, 138, 139,
970 140, 72, 62, 73, 77, 116, 115, 76, 114, 141,
971 141, 77, 75, 132, 91, 29, 35, 103, 91, 116,
972 40, 45, 111, 98, 31, 4, 4, 24, 66, 116,
973 46, 47, 142, 143, 144, 4, 4, 99, 30, 107,
974 108, 109, 94, 116, 37, 4, 116, 29, 115, 31,
975 4, 54, 136, 136, 25, 26, 55, 4, 144, 144,
976 77, 75, 114, 91, 91, 116, 29, 110, 108, 31,
977 106, 91, 41, 104, 145, 145, 44, 136, 4, 66,
978 66, 66, 136, 114, 114, 142, 31, 31, 32, 4,
979 31, 28, 62, 116, 4, 92, 91, 141, 76, 76,
980 22, 23, 4, 91, 28, 91, 111, 4, 143, 143,
981 91, 62, 91, 77, 77, 31, 4, 4, 24, 91,
985 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
986 static const yytype_uint8 yyr1
[] =
988 0, 87, 88, 89, 89, 90, 90, 90, 91, 91,
989 92, 92, 93, 94, 94, 94, 94, 94, 95, 95,
990 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
991 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
992 95, 96, 96, 97, 97, 98, 98, 98, 99, 99,
993 100, 100, 101, 102, 102, 103, 103, 104, 104, 105,
994 105, 105, 106, 106, 107, 107, 108, 108, 109, 110,
995 110, 111, 111, 111, 112, 112, 113, 113, 114, 114,
996 115, 115, 116, 116, 117, 117, 118, 118, 119, 119,
997 120, 120, 121, 121, 122, 122, 122, 122, 122, 122,
998 122, 122, 123, 123, 124, 124, 124, 125, 125, 126,
999 126, 127, 127, 127, 128, 128, 129, 129, 129, 129,
1000 130, 130, 131, 131, 131, 131, 131, 131, 131, 132,
1001 132, 132, 132, 133, 133, 133, 134, 134, 135, 136,
1002 136, 136, 136, 136, 137, 137, 137, 138, 138, 139,
1003 139, 140, 140, 140, 141, 141, 142, 142, 143, 143,
1004 143, 144, 144, 145, 145
1007 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
1008 static const yytype_uint8 yyr2
[] =
1010 0, 2, 3, 0, 3, 0, 2, 2, 0, 1,
1011 1, 2, 2, 1, 2, 1, 3, 2, 2, 3,
1012 4, 2, 1, 5, 6, 6, 4, 1, 2, 2,
1013 2, 2, 2, 5, 1, 4, 4, 2, 10, 8,
1014 7, 1, 3, 1, 3, 1, 4, 2, 1, 3,
1015 1, 3, 3, 1, 2, 1, 1, 0, 2, 9,
1016 4, 7, 0, 2, 0, 1, 1, 2, 5, 0,
1017 3, 0, 4, 5, 1, 3, 1, 1, 0, 1,
1018 1, 3, 1, 3, 1, 3, 1, 3, 1, 3,
1019 1, 3, 1, 2, 1, 3, 3, 3, 3, 3,
1020 3, 3, 1, 3, 1, 3, 3, 1, 3, 1,
1021 3, 1, 3, 3, 1, 3, 1, 1, 2, 2,
1022 1, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1023 1, 1, 1, 1, 1, 1, 3, 1, 7, 0,
1024 3, 4, 4, 3, 9, 11, 11, 8, 8, 0,
1025 1, 2, 1, 1, 1, 3, 1, 3, 2, 3,
1030 #define yyerrok (yyerrstatus = 0)
1031 #define yyclearin (yychar = YYEMPTY)
1032 #define YYEMPTY (-2)
1035 #define YYACCEPT goto yyacceptlab
1036 #define YYABORT goto yyabortlab
1037 #define YYERROR goto yyerrorlab
1040 #define YYRECOVERING() (!!yyerrstatus)
1042 #define YYBACKUP(Token, Value) \
1044 if (yychar == YYEMPTY) \
1048 YYPOPSTACK (yylen); \
1054 yyerror (ctx, YY_("syntax error: cannot back up")); \
1059 /* Error token number */
1061 #define YYERRCODE 256
1065 /* Enable debugging if requested. */
1069 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1070 # define YYFPRINTF fprintf
1073 # define YYDPRINTF(Args) \
1079 /* This macro is provided for backward compatibility. */
1080 #ifndef YY_LOCATION_PRINT
1081 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1085 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1089 YYFPRINTF (stderr, "%s ", Title); \
1090 yy_symbol_print (stderr, \
1091 Type, Value, ctx); \
1092 YYFPRINTF (stderr, "\n"); \
1097 /*----------------------------------------.
1098 | Print this symbol's value on YYOUTPUT. |
1099 `----------------------------------------*/
1102 yy_symbol_value_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
, parser_ctx_t
*ctx
)
1104 FILE *yyo
= yyoutput
;
1110 if (yytype
< YYNTOKENS
)
1111 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
1117 /*--------------------------------.
1118 | Print this symbol on YYOUTPUT. |
1119 `--------------------------------*/
1122 yy_symbol_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
, parser_ctx_t
*ctx
)
1124 YYFPRINTF (yyoutput
, "%s %s (",
1125 yytype
< YYNTOKENS
? "token" : "nterm", yytname
[yytype
]);
1127 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
, ctx
);
1128 YYFPRINTF (yyoutput
, ")");
1131 /*------------------------------------------------------------------.
1132 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1134 `------------------------------------------------------------------*/
1137 yy_stack_print (yytype_int16
*yybottom
, yytype_int16
*yytop
)
1139 YYFPRINTF (stderr
, "Stack now");
1140 for (; yybottom
<= yytop
; yybottom
++)
1142 int yybot
= *yybottom
;
1143 YYFPRINTF (stderr
, " %d", yybot
);
1145 YYFPRINTF (stderr
, "\n");
1148 # define YY_STACK_PRINT(Bottom, Top) \
1151 yy_stack_print ((Bottom), (Top)); \
1155 /*------------------------------------------------.
1156 | Report that the YYRULE is going to be reduced. |
1157 `------------------------------------------------*/
1160 yy_reduce_print (yytype_int16
*yyssp
, YYSTYPE
*yyvsp
, int yyrule
, parser_ctx_t
*ctx
)
1162 unsigned long int yylno
= yyrline
[yyrule
];
1163 int yynrhs
= yyr2
[yyrule
];
1165 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %lu):\n",
1167 /* The symbols being reduced. */
1168 for (yyi
= 0; yyi
< yynrhs
; yyi
++)
1170 YYFPRINTF (stderr
, " $%d = ", yyi
+ 1);
1171 yy_symbol_print (stderr
,
1172 yystos
[yyssp
[yyi
+ 1 - yynrhs
]],
1173 &(yyvsp
[(yyi
+ 1) - (yynrhs
)])
1175 YYFPRINTF (stderr
, "\n");
1179 # define YY_REDUCE_PRINT(Rule) \
1182 yy_reduce_print (yyssp, yyvsp, Rule, ctx); \
1185 /* Nonzero means print parse trace. It is left uninitialized so that
1186 multiple parsers can coexist. */
1188 #else /* !YYDEBUG */
1189 # define YYDPRINTF(Args)
1190 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1191 # define YY_STACK_PRINT(Bottom, Top)
1192 # define YY_REDUCE_PRINT(Rule)
1193 #endif /* !YYDEBUG */
1196 /* YYINITDEPTH -- initial size of the parser's stacks. */
1198 # define YYINITDEPTH 200
1201 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1202 if the built-in stack extension method is used).
1204 Do not make this value too large; the results are undefined if
1205 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1206 evaluated with infinite-precision integer arithmetic. */
1209 # define YYMAXDEPTH 10000
1216 # if defined __GLIBC__ && defined _STRING_H
1217 # define yystrlen strlen
1219 /* Return the length of YYSTR. */
1221 yystrlen (const char *yystr
)
1224 for (yylen
= 0; yystr
[yylen
]; yylen
++)
1232 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1233 # define yystpcpy stpcpy
1235 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1238 yystpcpy (char *yydest
, const char *yysrc
)
1241 const char *yys
= yysrc
;
1243 while ((*yyd
++ = *yys
++) != '\0')
1252 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1253 quotes and backslashes, so that it's suitable for yyerror. The
1254 heuristic is that double-quoting is unnecessary unless the string
1255 contains an apostrophe, a comma, or backslash (other than
1256 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1257 null, do not copy; instead, return the length of what the result
1260 yytnamerr (char *yyres
, const char *yystr
)
1265 char const *yyp
= yystr
;
1272 goto do_not_strip_quotes
;
1276 goto do_not_strip_quotes
;
1289 do_not_strip_quotes
: ;
1293 return yystrlen (yystr
);
1295 return yystpcpy (yyres
, yystr
) - yyres
;
1299 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1300 about the unexpected token YYTOKEN for the state stack whose top is
1303 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1304 not large enough to hold the message. In that case, also set
1305 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1306 required number of bytes is too large to store. */
1308 yysyntax_error (YYSIZE_T
*yymsg_alloc
, char **yymsg
,
1309 yytype_int16
*yyssp
, int yytoken
)
1311 YYSIZE_T yysize0
= yytnamerr (YY_NULLPTR
, yytname
[yytoken
]);
1312 YYSIZE_T yysize
= yysize0
;
1313 enum { YYERROR_VERBOSE_ARGS_MAXIMUM
= 5 };
1314 /* Internationalized format string. */
1315 const char *yyformat
= YY_NULLPTR
;
1316 /* Arguments of yyformat. */
1317 char const *yyarg
[YYERROR_VERBOSE_ARGS_MAXIMUM
];
1318 /* Number of reported tokens (one for the "unexpected", one per
1322 /* There are many possibilities here to consider:
1323 - If this state is a consistent state with a default action, then
1324 the only way this function was invoked is if the default action
1325 is an error action. In that case, don't check for expected
1326 tokens because there are none.
1327 - The only way there can be no lookahead present (in yychar) is if
1328 this state is a consistent state with a default action. Thus,
1329 detecting the absence of a lookahead is sufficient to determine
1330 that there is no unexpected or expected token to report. In that
1331 case, just report a simple "syntax error".
1332 - Don't assume there isn't a lookahead just because this state is a
1333 consistent state with a default action. There might have been a
1334 previous inconsistent state, consistent state with a non-default
1335 action, or user semantic action that manipulated yychar.
1336 - Of course, the expected token list depends on states to have
1337 correct lookahead information, and it depends on the parser not
1338 to perform extra reductions after fetching a lookahead from the
1339 scanner and before detecting a syntax error. Thus, state merging
1340 (from LALR or IELR) and default reductions corrupt the expected
1341 token list. However, the list is correct for canonical LR with
1342 one exception: it will still contain any token that will not be
1343 accepted due to an error action in a later state.
1345 if (yytoken
!= YYEMPTY
)
1347 int yyn
= yypact
[*yyssp
];
1348 yyarg
[yycount
++] = yytname
[yytoken
];
1349 if (!yypact_value_is_default (yyn
))
1351 /* Start YYX at -YYN if negative to avoid negative indexes in
1352 YYCHECK. In other words, skip the first -YYN actions for
1353 this state because they are default actions. */
1354 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
1355 /* Stay within bounds of both yycheck and yytname. */
1356 int yychecklim
= YYLAST
- yyn
+ 1;
1357 int yyxend
= yychecklim
< YYNTOKENS
? yychecklim
: YYNTOKENS
;
1360 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
1361 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
1362 && !yytable_value_is_error (yytable
[yyx
+ yyn
]))
1364 if (yycount
== YYERROR_VERBOSE_ARGS_MAXIMUM
)
1370 yyarg
[yycount
++] = yytname
[yyx
];
1372 YYSIZE_T yysize1
= yysize
+ yytnamerr (YY_NULLPTR
, yytname
[yyx
]);
1373 if (! (yysize
<= yysize1
1374 && yysize1
<= YYSTACK_ALLOC_MAXIMUM
))
1384 # define YYCASE_(N, S) \
1388 YYCASE_(0, YY_("syntax error"));
1389 YYCASE_(1, YY_("syntax error, unexpected %s"));
1390 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1391 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1392 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1393 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1398 YYSIZE_T yysize1
= yysize
+ yystrlen (yyformat
);
1399 if (! (yysize
<= yysize1
&& yysize1
<= YYSTACK_ALLOC_MAXIMUM
))
1404 if (*yymsg_alloc
< yysize
)
1406 *yymsg_alloc
= 2 * yysize
;
1407 if (! (yysize
<= *yymsg_alloc
1408 && *yymsg_alloc
<= YYSTACK_ALLOC_MAXIMUM
))
1409 *yymsg_alloc
= YYSTACK_ALLOC_MAXIMUM
;
1413 /* Avoid sprintf, as that infringes on the user's name space.
1414 Don't have undefined behavior even if the translation
1415 produced a string with the wrong number of "%s"s. */
1419 while ((*yyp
= *yyformat
) != '\0')
1420 if (*yyp
== '%' && yyformat
[1] == 's' && yyi
< yycount
)
1422 yyp
+= yytnamerr (yyp
, yyarg
[yyi
++]);
1433 #endif /* YYERROR_VERBOSE */
1435 /*-----------------------------------------------.
1436 | Release the memory associated to this symbol. |
1437 `-----------------------------------------------*/
1440 yydestruct (const char *yymsg
, int yytype
, YYSTYPE
*yyvaluep
, parser_ctx_t
*ctx
)
1446 YY_SYMBOL_PRINT (yymsg
, yytype
, yyvaluep
, yylocationp
);
1448 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1450 YY_IGNORE_MAYBE_UNINITIALIZED_END
1461 yyparse (parser_ctx_t
*ctx
)
1463 /* The lookahead symbol. */
1467 /* The semantic value of the lookahead symbol. */
1468 /* Default value used for initialization, for pacifying older GCCs
1469 or non-GCC compilers. */
1470 YY_INITIAL_VALUE (static YYSTYPE yyval_default
;)
1471 YYSTYPE yylval
YY_INITIAL_VALUE (= yyval_default
);
1473 /* Number of syntax errors so far. */
1477 /* Number of tokens to shift before error messages enabled. */
1480 /* The stacks and their tools:
1481 'yyss': related to states.
1482 'yyvs': related to semantic values.
1484 Refer to the stacks through separate pointers, to allow yyoverflow
1485 to reallocate them elsewhere. */
1487 /* The state stack. */
1488 yytype_int16 yyssa
[YYINITDEPTH
];
1490 yytype_int16
*yyssp
;
1492 /* The semantic value stack. */
1493 YYSTYPE yyvsa
[YYINITDEPTH
];
1497 YYSIZE_T yystacksize
;
1501 /* Lookahead token as an internal (translated) token number. */
1503 /* The variables used to return semantic value and location from the
1508 /* Buffer for error messages, and its allocated size. */
1510 char *yymsg
= yymsgbuf
;
1511 YYSIZE_T yymsg_alloc
= sizeof yymsgbuf
;
1514 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1516 /* The number of symbols on the RHS of the reduced rule.
1517 Keep to zero when no symbol should be popped. */
1520 yyssp
= yyss
= yyssa
;
1521 yyvsp
= yyvs
= yyvsa
;
1522 yystacksize
= YYINITDEPTH
;
1524 YYDPRINTF ((stderr
, "Starting parse\n"));
1529 yychar
= YYEMPTY
; /* Cause a token to be read. */
1532 /*------------------------------------------------------------.
1533 | yynewstate -- Push a new state, which is found in yystate. |
1534 `------------------------------------------------------------*/
1536 /* In all cases, when you get here, the value and location stacks
1537 have just been pushed. So pushing a state here evens the stacks. */
1543 if (yyss
+ yystacksize
- 1 <= yyssp
)
1545 /* Get the current used size of the three stacks, in elements. */
1546 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1550 /* Give user a chance to reallocate the stack. Use copies of
1551 these so that the &'s don't force the real ones into
1553 YYSTYPE
*yyvs1
= yyvs
;
1554 yytype_int16
*yyss1
= yyss
;
1556 /* Each stack pointer address is followed by the size of the
1557 data in use in that stack, in bytes. This used to be a
1558 conditional around just the two extra args, but that might
1559 be undefined if yyoverflow is a macro. */
1560 yyoverflow (YY_("memory exhausted"),
1561 &yyss1
, yysize
* sizeof (*yyssp
),
1562 &yyvs1
, yysize
* sizeof (*yyvsp
),
1568 #else /* no yyoverflow */
1569 # ifndef YYSTACK_RELOCATE
1570 goto yyexhaustedlab
;
1572 /* Extend the stack our own way. */
1573 if (YYMAXDEPTH
<= yystacksize
)
1574 goto yyexhaustedlab
;
1576 if (YYMAXDEPTH
< yystacksize
)
1577 yystacksize
= YYMAXDEPTH
;
1580 yytype_int16
*yyss1
= yyss
;
1581 union yyalloc
*yyptr
=
1582 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1584 goto yyexhaustedlab
;
1585 YYSTACK_RELOCATE (yyss_alloc
, yyss
);
1586 YYSTACK_RELOCATE (yyvs_alloc
, yyvs
);
1587 # undef YYSTACK_RELOCATE
1589 YYSTACK_FREE (yyss1
);
1592 #endif /* no yyoverflow */
1594 yyssp
= yyss
+ yysize
- 1;
1595 yyvsp
= yyvs
+ yysize
- 1;
1597 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1598 (unsigned long int) yystacksize
));
1600 if (yyss
+ yystacksize
- 1 <= yyssp
)
1604 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1606 if (yystate
== YYFINAL
)
1616 /* Do appropriate processing given the current state. Read a
1617 lookahead token if we need one and don't already have one. */
1619 /* First try to decide what to do without reference to lookahead token. */
1620 yyn
= yypact
[yystate
];
1621 if (yypact_value_is_default (yyn
))
1624 /* Not known => get a lookahead token if don't already have one. */
1626 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1627 if (yychar
== YYEMPTY
)
1629 YYDPRINTF ((stderr
, "Reading a token: "));
1630 yychar
= yylex (&yylval
, ctx
);
1633 if (yychar
<= YYEOF
)
1635 yychar
= yytoken
= YYEOF
;
1636 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1640 yytoken
= YYTRANSLATE (yychar
);
1641 YY_SYMBOL_PRINT ("Next token is", yytoken
, &yylval
, &yylloc
);
1644 /* If the proper action on seeing token YYTOKEN is to reduce or to
1645 detect an error, take that action. */
1647 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1652 if (yytable_value_is_error (yyn
))
1658 /* Count tokens shifted since error; after three, turn off error
1663 /* Shift the lookahead token. */
1664 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
1666 /* Discard the shifted token. */
1670 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1672 YY_IGNORE_MAYBE_UNINITIALIZED_END
1677 /*-----------------------------------------------------------.
1678 | yydefault -- do the default action for the current state. |
1679 `-----------------------------------------------------------*/
1681 yyn
= yydefact
[yystate
];
1687 /*-----------------------------.
1688 | yyreduce -- Do a reduction. |
1689 `-----------------------------*/
1691 /* yyn is the number of a rule to reduce with. */
1694 /* If YYLEN is nonzero, implement the default value of the action:
1697 Otherwise, the following line sets YYVAL to garbage.
1698 This behavior is undocumented and Bison
1699 users should not rely upon it. Assigning to YYVAL
1700 unconditionally makes the parser a bit smaller, and it avoids a
1701 GCC warning that YYVAL may be used uninitialized. */
1702 yyval
= yyvsp
[1-yylen
];
1705 YY_REDUCE_PRINT (yyn
);
1709 #line 147 "parser.y" /* yacc.c:1646 */
1710 { parse_complete(ctx
, (yyvsp
[-2].boolean
)); }
1711 #line 1717 "parser.tab.c" /* yacc.c:1646 */
1715 #line 150 "parser.y" /* yacc.c:1646 */
1716 { (yyval
.boolean
) = FALSE
; }
1717 #line 1723 "parser.tab.c" /* yacc.c:1646 */
1721 #line 151 "parser.y" /* yacc.c:1646 */
1722 { (yyval
.boolean
) = TRUE
; }
1723 #line 1729 "parser.tab.c" /* yacc.c:1646 */
1727 #line 155 "parser.y" /* yacc.c:1646 */
1728 { source_add_statement(ctx
, (yyvsp
[0].statement
)); }
1729 #line 1735 "parser.tab.c" /* yacc.c:1646 */
1733 #line 156 "parser.y" /* yacc.c:1646 */
1734 { source_add_class(ctx
, (yyvsp
[0].class_decl
)); }
1735 #line 1741 "parser.tab.c" /* yacc.c:1646 */
1739 #line 159 "parser.y" /* yacc.c:1646 */
1740 { (yyval
.statement
) = NULL
; }
1741 #line 1747 "parser.tab.c" /* yacc.c:1646 */
1745 #line 160 "parser.y" /* yacc.c:1646 */
1746 { (yyval
.statement
) = (yyvsp
[0].statement
); }
1747 #line 1753 "parser.tab.c" /* yacc.c:1646 */
1751 #line 163 "parser.y" /* yacc.c:1646 */
1752 { (yyval
.statement
) = (yyvsp
[0].statement
); }
1753 #line 1759 "parser.tab.c" /* yacc.c:1646 */
1757 #line 164 "parser.y" /* yacc.c:1646 */
1758 { (yyval
.statement
) = link_statements((yyvsp
[-1].statement
), (yyvsp
[0].statement
)); }
1759 #line 1765 "parser.tab.c" /* yacc.c:1646 */
1763 #line 167 "parser.y" /* yacc.c:1646 */
1764 { (yyval
.statement
) = (yyvsp
[-1].statement
); }
1765 #line 1771 "parser.tab.c" /* yacc.c:1646 */
1769 #line 170 "parser.y" /* yacc.c:1646 */
1770 { (yyval
.statement
) = NULL
; }
1771 #line 1777 "parser.tab.c" /* yacc.c:1646 */
1775 #line 171 "parser.y" /* yacc.c:1646 */
1776 { (yyval
.statement
) = (yyvsp
[0].statement
); }
1777 #line 1783 "parser.tab.c" /* yacc.c:1646 */
1781 #line 172 "parser.y" /* yacc.c:1646 */
1782 { (yyval
.statement
) = (yyvsp
[0].statement
); }
1783 #line 1789 "parser.tab.c" /* yacc.c:1646 */
1787 #line 173 "parser.y" /* yacc.c:1646 */
1788 { (yyvsp
[-2].statement
)->next
= (yyvsp
[0].statement
); (yyval
.statement
) = (yyvsp
[-2].statement
); }
1789 #line 1795 "parser.tab.c" /* yacc.c:1646 */
1793 #line 174 "parser.y" /* yacc.c:1646 */
1794 { (yyval
.statement
) = (yyvsp
[-1].statement
); }
1795 #line 1801 "parser.tab.c" /* yacc.c:1646 */
1799 #line 177 "parser.y" /* yacc.c:1646 */
1800 { (yyvsp
[-1].member
)->args
= (yyvsp
[0].expression
); (yyval
.statement
) = new_call_statement(ctx
, FALSE
, (yyvsp
[-1].member
)); CHECK_ERROR
; }
1801 #line 1807 "parser.tab.c" /* yacc.c:1646 */
1805 #line 178 "parser.y" /* yacc.c:1646 */
1806 { (yyvsp
[-1].member
)->args
= (yyvsp
[0].expression
); (yyval
.statement
) = new_call_statement(ctx
, TRUE
, (yyvsp
[-1].member
)); CHECK_ERROR
; }
1807 #line 1813 "parser.tab.c" /* yacc.c:1646 */
1811 #line 180 "parser.y" /* yacc.c:1646 */
1812 { (yyvsp
[-3].member
)->args
= (yyvsp
[-2].expression
); (yyval
.statement
) = new_assign_statement(ctx
, (yyvsp
[-3].member
), (yyvsp
[0].expression
)); CHECK_ERROR
; }
1813 #line 1819 "parser.tab.c" /* yacc.c:1646 */
1817 #line 181 "parser.y" /* yacc.c:1646 */
1818 { (yyval
.statement
) = new_dim_statement(ctx
, (yyvsp
[0].dim_decl
)); CHECK_ERROR
; }
1819 #line 1825 "parser.tab.c" /* yacc.c:1646 */
1823 #line 182 "parser.y" /* yacc.c:1646 */
1824 { (yyval
.statement
) = (yyvsp
[0].statement
); }
1825 #line 1831 "parser.tab.c" /* yacc.c:1646 */
1829 #line 184 "parser.y" /* yacc.c:1646 */
1830 { (yyval
.statement
) = new_while_statement(ctx
, STAT_WHILE
, (yyvsp
[-3].expression
), (yyvsp
[-1].statement
)); CHECK_ERROR
; }
1831 #line 1837 "parser.tab.c" /* yacc.c:1646 */
1835 #line 186 "parser.y" /* yacc.c:1646 */
1836 { (yyval
.statement
) = new_while_statement(ctx
, (yyvsp
[-4].boolean
) ? STAT_WHILELOOP
: STAT_UNTIL
, (yyvsp
[-3].expression
), (yyvsp
[-1].statement
));
1838 #line 1844 "parser.tab.c" /* yacc.c:1646 */
1842 #line 189 "parser.y" /* yacc.c:1646 */
1843 { (yyval
.statement
) = new_while_statement(ctx
, (yyvsp
[-1].boolean
) ? STAT_DOWHILE
: STAT_DOUNTIL
, (yyvsp
[0].expression
), (yyvsp
[-3].statement
));
1845 #line 1851 "parser.tab.c" /* yacc.c:1646 */
1849 #line 191 "parser.y" /* yacc.c:1646 */
1850 { (yyval
.statement
) = new_while_statement(ctx
, STAT_DOWHILE
, NULL
, (yyvsp
[-1].statement
)); CHECK_ERROR
; }
1851 #line 1857 "parser.tab.c" /* yacc.c:1646 */
1855 #line 192 "parser.y" /* yacc.c:1646 */
1856 { (yyval
.statement
) = new_function_statement(ctx
, (yyvsp
[0].func_decl
)); CHECK_ERROR
; }
1857 #line 1863 "parser.tab.c" /* yacc.c:1646 */
1861 #line 193 "parser.y" /* yacc.c:1646 */
1862 { (yyval
.statement
) = new_statement(ctx
, STAT_EXITDO
, 0); CHECK_ERROR
; }
1863 #line 1869 "parser.tab.c" /* yacc.c:1646 */
1867 #line 194 "parser.y" /* yacc.c:1646 */
1868 { (yyval
.statement
) = new_statement(ctx
, STAT_EXITFOR
, 0); CHECK_ERROR
; }
1869 #line 1875 "parser.tab.c" /* yacc.c:1646 */
1873 #line 195 "parser.y" /* yacc.c:1646 */
1874 { (yyval
.statement
) = new_statement(ctx
, STAT_EXITFUNC
, 0); CHECK_ERROR
; }
1875 #line 1881 "parser.tab.c" /* yacc.c:1646 */
1879 #line 196 "parser.y" /* yacc.c:1646 */
1880 { (yyval
.statement
) = new_statement(ctx
, STAT_EXITPROP
, 0); CHECK_ERROR
; }
1881 #line 1887 "parser.tab.c" /* yacc.c:1646 */
1885 #line 197 "parser.y" /* yacc.c:1646 */
1886 { (yyval
.statement
) = new_statement(ctx
, STAT_EXITSUB
, 0); CHECK_ERROR
; }
1887 #line 1893 "parser.tab.c" /* yacc.c:1646 */
1891 #line 199 "parser.y" /* yacc.c:1646 */
1892 { (yyvsp
[-3].member
)->args
= (yyvsp
[-2].expression
); (yyval
.statement
) = new_set_statement(ctx
, (yyvsp
[-3].member
), (yyvsp
[0].expression
)); CHECK_ERROR
; }
1893 #line 1899 "parser.tab.c" /* yacc.c:1646 */
1897 #line 200 "parser.y" /* yacc.c:1646 */
1898 { (yyval
.statement
) = new_statement(ctx
, STAT_STOP
, 0); CHECK_ERROR
; }
1899 #line 1905 "parser.tab.c" /* yacc.c:1646 */
1903 #line 201 "parser.y" /* yacc.c:1646 */
1904 { (yyval
.statement
) = new_onerror_statement(ctx
, TRUE
); CHECK_ERROR
; }
1905 #line 1911 "parser.tab.c" /* yacc.c:1646 */
1909 #line 202 "parser.y" /* yacc.c:1646 */
1910 { (yyval
.statement
) = new_onerror_statement(ctx
, FALSE
); CHECK_ERROR
; }
1911 #line 1917 "parser.tab.c" /* yacc.c:1646 */
1915 #line 203 "parser.y" /* yacc.c:1646 */
1916 { (yyval
.statement
) = new_const_statement(ctx
, (yyvsp
[0].const_decl
)); CHECK_ERROR
; }
1917 #line 1923 "parser.tab.c" /* yacc.c:1646 */
1921 #line 205 "parser.y" /* yacc.c:1646 */
1922 { (yyval
.statement
) = new_forto_statement(ctx
, (yyvsp
[-8].string
), (yyvsp
[-6].expression
), (yyvsp
[-4].expression
), (yyvsp
[-3].expression
), (yyvsp
[-1].statement
)); CHECK_ERROR
; }
1923 #line 1929 "parser.tab.c" /* yacc.c:1646 */
1927 #line 207 "parser.y" /* yacc.c:1646 */
1928 { (yyval
.statement
) = new_foreach_statement(ctx
, (yyvsp
[-5].string
), (yyvsp
[-3].expression
), (yyvsp
[-1].statement
)); }
1929 #line 1935 "parser.tab.c" /* yacc.c:1646 */
1933 #line 209 "parser.y" /* yacc.c:1646 */
1934 { (yyval
.statement
) = new_select_statement(ctx
, (yyvsp
[-4].expression
), (yyvsp
[-2].case_clausule
)); }
1935 #line 1941 "parser.tab.c" /* yacc.c:1646 */
1939 #line 212 "parser.y" /* yacc.c:1646 */
1940 { (yyval
.member
) = new_member_expression(ctx
, NULL
, (yyvsp
[0].string
)); CHECK_ERROR
; }
1941 #line 1947 "parser.tab.c" /* yacc.c:1646 */
1945 #line 213 "parser.y" /* yacc.c:1646 */
1946 { (yyval
.member
) = new_member_expression(ctx
, (yyvsp
[-2].expression
), (yyvsp
[0].string
)); CHECK_ERROR
; }
1947 #line 1953 "parser.tab.c" /* yacc.c:1646 */
1951 #line 216 "parser.y" /* yacc.c:1646 */
1952 { (yyval
.dim_decl
) = (yyvsp
[0].dim_decl
); }
1953 #line 1959 "parser.tab.c" /* yacc.c:1646 */
1957 #line 217 "parser.y" /* yacc.c:1646 */
1958 { (yyvsp
[-2].dim_decl
)->next
= (yyvsp
[0].dim_decl
); (yyval
.dim_decl
) = (yyvsp
[-2].dim_decl
); }
1959 #line 1965 "parser.tab.c" /* yacc.c:1646 */
1963 #line 220 "parser.y" /* yacc.c:1646 */
1964 { (yyval
.dim_decl
) = new_dim_decl(ctx
, (yyvsp
[0].string
), FALSE
, NULL
); CHECK_ERROR
; }
1965 #line 1971 "parser.tab.c" /* yacc.c:1646 */
1969 #line 221 "parser.y" /* yacc.c:1646 */
1970 { (yyval
.dim_decl
) = new_dim_decl(ctx
, (yyvsp
[-3].string
), TRUE
, (yyvsp
[-1].dim_list
)); CHECK_ERROR
; }
1971 #line 1977 "parser.tab.c" /* yacc.c:1646 */
1975 #line 222 "parser.y" /* yacc.c:1646 */
1976 { (yyval
.dim_decl
) = new_dim_decl(ctx
, (yyvsp
[-1].string
), TRUE
, NULL
); CHECK_ERROR
; }
1977 #line 1983 "parser.tab.c" /* yacc.c:1646 */
1981 #line 225 "parser.y" /* yacc.c:1646 */
1982 { (yyval
.dim_list
) = new_dim(ctx
, (yyvsp
[0].uint
), NULL
); }
1983 #line 1989 "parser.tab.c" /* yacc.c:1646 */
1987 #line 226 "parser.y" /* yacc.c:1646 */
1988 { (yyval
.dim_list
) = new_dim(ctx
, (yyvsp
[-2].uint
), (yyvsp
[0].dim_list
)); }
1989 #line 1995 "parser.tab.c" /* yacc.c:1646 */
1993 #line 229 "parser.y" /* yacc.c:1646 */
1994 { (yyval
.const_decl
) = (yyvsp
[0].const_decl
); }
1995 #line 2001 "parser.tab.c" /* yacc.c:1646 */
1999 #line 230 "parser.y" /* yacc.c:1646 */
2000 { (yyvsp
[-2].const_decl
)->next
= (yyvsp
[0].const_decl
); (yyval
.const_decl
) = (yyvsp
[-2].const_decl
); }
2001 #line 2007 "parser.tab.c" /* yacc.c:1646 */
2005 #line 233 "parser.y" /* yacc.c:1646 */
2006 { (yyval
.const_decl
) = new_const_decl(ctx
, (yyvsp
[-2].string
), (yyvsp
[0].expression
)); CHECK_ERROR
; }
2007 #line 2013 "parser.tab.c" /* yacc.c:1646 */
2011 #line 236 "parser.y" /* yacc.c:1646 */
2012 { (yyval
.expression
) = (yyvsp
[0].expression
); }
2013 #line 2019 "parser.tab.c" /* yacc.c:1646 */
2017 #line 237 "parser.y" /* yacc.c:1646 */
2018 { (yyval
.expression
) = new_unary_expression(ctx
, EXPR_NEG
, (yyvsp
[0].expression
)); CHECK_ERROR
; }
2019 #line 2025 "parser.tab.c" /* yacc.c:1646 */
2023 #line 240 "parser.y" /* yacc.c:1646 */
2024 { (yyval
.boolean
) = TRUE
; }
2025 #line 2031 "parser.tab.c" /* yacc.c:1646 */
2029 #line 241 "parser.y" /* yacc.c:1646 */
2030 { (yyval
.boolean
) = FALSE
; }
2031 #line 2037 "parser.tab.c" /* yacc.c:1646 */
2035 #line 244 "parser.y" /* yacc.c:1646 */
2036 { (yyval
.expression
) = NULL
;}
2037 #line 2043 "parser.tab.c" /* yacc.c:1646 */
2041 #line 245 "parser.y" /* yacc.c:1646 */
2042 { (yyval
.expression
) = (yyvsp
[0].expression
); }
2043 #line 2049 "parser.tab.c" /* yacc.c:1646 */
2047 #line 249 "parser.y" /* yacc.c:1646 */
2048 { (yyval
.statement
) = new_if_statement(ctx
, (yyvsp
[-7].expression
), (yyvsp
[-4].statement
), (yyvsp
[-3].elseif
), (yyvsp
[-2].statement
)); CHECK_ERROR
; }
2049 #line 2055 "parser.tab.c" /* yacc.c:1646 */
2053 #line 250 "parser.y" /* yacc.c:1646 */
2054 { (yyval
.statement
) = new_if_statement(ctx
, (yyvsp
[-2].expression
), (yyvsp
[0].statement
), NULL
, NULL
); CHECK_ERROR
; }
2055 #line 2061 "parser.tab.c" /* yacc.c:1646 */
2059 #line 252 "parser.y" /* yacc.c:1646 */
2060 { (yyval
.statement
) = new_if_statement(ctx
, (yyvsp
[-5].expression
), (yyvsp
[-3].statement
), NULL
, (yyvsp
[-1].statement
)); CHECK_ERROR
; }
2061 #line 2067 "parser.tab.c" /* yacc.c:1646 */
2065 #line 259 "parser.y" /* yacc.c:1646 */
2066 { (yyval
.elseif
) = NULL
; }
2067 #line 2073 "parser.tab.c" /* yacc.c:1646 */
2071 #line 260 "parser.y" /* yacc.c:1646 */
2072 { (yyval
.elseif
) = (yyvsp
[0].elseif
); }
2073 #line 2079 "parser.tab.c" /* yacc.c:1646 */
2077 #line 263 "parser.y" /* yacc.c:1646 */
2078 { (yyval
.elseif
) = (yyvsp
[0].elseif
); }
2079 #line 2085 "parser.tab.c" /* yacc.c:1646 */
2083 #line 264 "parser.y" /* yacc.c:1646 */
2084 { (yyvsp
[-1].elseif
)->next
= (yyvsp
[0].elseif
); (yyval
.elseif
) = (yyvsp
[-1].elseif
); }
2085 #line 2091 "parser.tab.c" /* yacc.c:1646 */
2089 #line 268 "parser.y" /* yacc.c:1646 */
2090 { (yyval
.elseif
) = new_elseif_decl(ctx
, (yyvsp
[-3].expression
), (yyvsp
[0].statement
)); }
2091 #line 2097 "parser.tab.c" /* yacc.c:1646 */
2095 #line 271 "parser.y" /* yacc.c:1646 */
2096 { (yyval
.statement
) = NULL
; }
2097 #line 2103 "parser.tab.c" /* yacc.c:1646 */
2101 #line 272 "parser.y" /* yacc.c:1646 */
2102 { (yyval
.statement
) = (yyvsp
[0].statement
); }
2103 #line 2109 "parser.tab.c" /* yacc.c:1646 */
2107 #line 275 "parser.y" /* yacc.c:1646 */
2108 { (yyval
.case_clausule
) = NULL
; }
2109 #line 2115 "parser.tab.c" /* yacc.c:1646 */
2113 #line 276 "parser.y" /* yacc.c:1646 */
2114 { (yyval
.case_clausule
) = new_case_clausule(ctx
, NULL
, (yyvsp
[0].statement
), NULL
); }
2115 #line 2121 "parser.tab.c" /* yacc.c:1646 */
2119 #line 278 "parser.y" /* yacc.c:1646 */
2120 { (yyval
.case_clausule
) = new_case_clausule(ctx
, (yyvsp
[-3].expression
), (yyvsp
[-1].statement
), (yyvsp
[0].case_clausule
)); }
2121 #line 2127 "parser.tab.c" /* yacc.c:1646 */
2125 #line 281 "parser.y" /* yacc.c:1646 */
2126 { (yyval
.expression
) = NULL
; }
2127 #line 2133 "parser.tab.c" /* yacc.c:1646 */
2131 #line 282 "parser.y" /* yacc.c:1646 */
2132 { (yyval
.expression
) = (yyvsp
[-1].expression
); }
2133 #line 2139 "parser.tab.c" /* yacc.c:1646 */
2137 #line 285 "parser.y" /* yacc.c:1646 */
2138 { (yyval
.expression
) = NULL
; }
2139 #line 2145 "parser.tab.c" /* yacc.c:1646 */
2143 #line 286 "parser.y" /* yacc.c:1646 */
2144 { (yyval
.expression
) = (yyvsp
[0].expression
); }
2145 #line 2151 "parser.tab.c" /* yacc.c:1646 */
2149 #line 293 "parser.y" /* yacc.c:1646 */
2150 { (yyval
.expression
) = (yyvsp
[0].expression
); }
2151 #line 2157 "parser.tab.c" /* yacc.c:1646 */
2155 #line 294 "parser.y" /* yacc.c:1646 */
2156 { (yyvsp
[-2].expression
)->next
= (yyvsp
[0].expression
); (yyval
.expression
) = (yyvsp
[-2].expression
); }
2157 #line 2163 "parser.tab.c" /* yacc.c:1646 */
2161 #line 297 "parser.y" /* yacc.c:1646 */
2162 { (yyval
.expression
) = (yyvsp
[0].expression
); }
2163 #line 2169 "parser.tab.c" /* yacc.c:1646 */
2167 #line 298 "parser.y" /* yacc.c:1646 */
2168 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_IMP
, (yyvsp
[-2].expression
), (yyvsp
[0].expression
)); CHECK_ERROR
; }
2169 #line 2175 "parser.tab.c" /* yacc.c:1646 */
2173 #line 301 "parser.y" /* yacc.c:1646 */
2174 { (yyval
.expression
) = (yyvsp
[0].expression
); }
2175 #line 2181 "parser.tab.c" /* yacc.c:1646 */
2179 #line 302 "parser.y" /* yacc.c:1646 */
2180 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_EQV
, (yyvsp
[-2].expression
), (yyvsp
[0].expression
)); CHECK_ERROR
; }
2181 #line 2187 "parser.tab.c" /* yacc.c:1646 */
2185 #line 305 "parser.y" /* yacc.c:1646 */
2186 { (yyval
.expression
) = (yyvsp
[0].expression
); }
2187 #line 2193 "parser.tab.c" /* yacc.c:1646 */
2191 #line 306 "parser.y" /* yacc.c:1646 */
2192 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_XOR
, (yyvsp
[-2].expression
), (yyvsp
[0].expression
)); CHECK_ERROR
; }
2193 #line 2199 "parser.tab.c" /* yacc.c:1646 */
2197 #line 309 "parser.y" /* yacc.c:1646 */
2198 { (yyval
.expression
) = (yyvsp
[0].expression
); }
2199 #line 2205 "parser.tab.c" /* yacc.c:1646 */
2203 #line 310 "parser.y" /* yacc.c:1646 */
2204 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_OR
, (yyvsp
[-2].expression
), (yyvsp
[0].expression
)); CHECK_ERROR
; }
2205 #line 2211 "parser.tab.c" /* yacc.c:1646 */
2209 #line 313 "parser.y" /* yacc.c:1646 */
2210 { (yyval
.expression
) = (yyvsp
[0].expression
); }
2211 #line 2217 "parser.tab.c" /* yacc.c:1646 */
2215 #line 314 "parser.y" /* yacc.c:1646 */
2216 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_AND
, (yyvsp
[-2].expression
), (yyvsp
[0].expression
)); CHECK_ERROR
; }
2217 #line 2223 "parser.tab.c" /* yacc.c:1646 */
2221 #line 317 "parser.y" /* yacc.c:1646 */
2222 { (yyval
.expression
) = (yyvsp
[0].expression
); }
2223 #line 2229 "parser.tab.c" /* yacc.c:1646 */
2227 #line 318 "parser.y" /* yacc.c:1646 */
2228 { (yyval
.expression
) = new_unary_expression(ctx
, EXPR_NOT
, (yyvsp
[0].expression
)); CHECK_ERROR
; }
2229 #line 2235 "parser.tab.c" /* yacc.c:1646 */
2233 #line 321 "parser.y" /* yacc.c:1646 */
2234 { (yyval
.expression
) = (yyvsp
[0].expression
); }
2235 #line 2241 "parser.tab.c" /* yacc.c:1646 */
2239 #line 322 "parser.y" /* yacc.c:1646 */
2240 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_EQUAL
, (yyvsp
[-2].expression
), (yyvsp
[0].expression
)); CHECK_ERROR
; }
2241 #line 2247 "parser.tab.c" /* yacc.c:1646 */
2245 #line 323 "parser.y" /* yacc.c:1646 */
2246 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_NEQUAL
, (yyvsp
[-2].expression
), (yyvsp
[0].expression
)); CHECK_ERROR
; }
2247 #line 2253 "parser.tab.c" /* yacc.c:1646 */
2251 #line 324 "parser.y" /* yacc.c:1646 */
2252 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_GT
, (yyvsp
[-2].expression
), (yyvsp
[0].expression
)); CHECK_ERROR
; }
2253 #line 2259 "parser.tab.c" /* yacc.c:1646 */
2257 #line 325 "parser.y" /* yacc.c:1646 */
2258 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_LT
, (yyvsp
[-2].expression
), (yyvsp
[0].expression
)); CHECK_ERROR
; }
2259 #line 2265 "parser.tab.c" /* yacc.c:1646 */
2263 #line 326 "parser.y" /* yacc.c:1646 */
2264 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_GTEQ
, (yyvsp
[-2].expression
), (yyvsp
[0].expression
)); CHECK_ERROR
; }
2265 #line 2271 "parser.tab.c" /* yacc.c:1646 */
2269 #line 327 "parser.y" /* yacc.c:1646 */
2270 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_LTEQ
, (yyvsp
[-2].expression
), (yyvsp
[0].expression
)); CHECK_ERROR
; }
2271 #line 2277 "parser.tab.c" /* yacc.c:1646 */
2275 #line 328 "parser.y" /* yacc.c:1646 */
2276 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_IS
, (yyvsp
[-2].expression
), (yyvsp
[0].expression
)); CHECK_ERROR
; }
2277 #line 2283 "parser.tab.c" /* yacc.c:1646 */
2281 #line 331 "parser.y" /* yacc.c:1646 */
2282 { (yyval
.expression
) = (yyvsp
[0].expression
); }
2283 #line 2289 "parser.tab.c" /* yacc.c:1646 */
2287 #line 332 "parser.y" /* yacc.c:1646 */
2288 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_CONCAT
, (yyvsp
[-2].expression
), (yyvsp
[0].expression
)); CHECK_ERROR
; }
2289 #line 2295 "parser.tab.c" /* yacc.c:1646 */
2293 #line 335 "parser.y" /* yacc.c:1646 */
2294 { (yyval
.expression
) = (yyvsp
[0].expression
); }
2295 #line 2301 "parser.tab.c" /* yacc.c:1646 */
2299 #line 336 "parser.y" /* yacc.c:1646 */
2300 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_ADD
, (yyvsp
[-2].expression
), (yyvsp
[0].expression
)); CHECK_ERROR
; }
2301 #line 2307 "parser.tab.c" /* yacc.c:1646 */
2305 #line 337 "parser.y" /* yacc.c:1646 */
2306 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_SUB
, (yyvsp
[-2].expression
), (yyvsp
[0].expression
)); CHECK_ERROR
; }
2307 #line 2313 "parser.tab.c" /* yacc.c:1646 */
2311 #line 340 "parser.y" /* yacc.c:1646 */
2312 { (yyval
.expression
) = (yyvsp
[0].expression
); }
2313 #line 2319 "parser.tab.c" /* yacc.c:1646 */
2317 #line 341 "parser.y" /* yacc.c:1646 */
2318 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_MOD
, (yyvsp
[-2].expression
), (yyvsp
[0].expression
)); CHECK_ERROR
; }
2319 #line 2325 "parser.tab.c" /* yacc.c:1646 */
2323 #line 344 "parser.y" /* yacc.c:1646 */
2324 { (yyval
.expression
) = (yyvsp
[0].expression
); }
2325 #line 2331 "parser.tab.c" /* yacc.c:1646 */
2329 #line 346 "parser.y" /* yacc.c:1646 */
2330 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_IDIV
, (yyvsp
[-2].expression
), (yyvsp
[0].expression
)); CHECK_ERROR
; }
2331 #line 2337 "parser.tab.c" /* yacc.c:1646 */
2335 #line 349 "parser.y" /* yacc.c:1646 */
2336 { (yyval
.expression
) = (yyvsp
[0].expression
); }
2337 #line 2343 "parser.tab.c" /* yacc.c:1646 */
2341 #line 351 "parser.y" /* yacc.c:1646 */
2342 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_MUL
, (yyvsp
[-2].expression
), (yyvsp
[0].expression
)); CHECK_ERROR
; }
2343 #line 2349 "parser.tab.c" /* yacc.c:1646 */
2347 #line 353 "parser.y" /* yacc.c:1646 */
2348 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_DIV
, (yyvsp
[-2].expression
), (yyvsp
[0].expression
)); CHECK_ERROR
; }
2349 #line 2355 "parser.tab.c" /* yacc.c:1646 */
2353 #line 356 "parser.y" /* yacc.c:1646 */
2354 { (yyval
.expression
) = (yyvsp
[0].expression
); }
2355 #line 2361 "parser.tab.c" /* yacc.c:1646 */
2359 #line 357 "parser.y" /* yacc.c:1646 */
2360 { (yyval
.expression
) = new_binary_expression(ctx
, EXPR_EXP
, (yyvsp
[-2].expression
), (yyvsp
[0].expression
)); CHECK_ERROR
; }
2361 #line 2367 "parser.tab.c" /* yacc.c:1646 */
2365 #line 360 "parser.y" /* yacc.c:1646 */
2366 { (yyval
.expression
) = (yyvsp
[0].expression
); }
2367 #line 2373 "parser.tab.c" /* yacc.c:1646 */
2371 #line 361 "parser.y" /* yacc.c:1646 */
2372 { (yyval
.expression
) = (yyvsp
[0].expression
); }
2373 #line 2379 "parser.tab.c" /* yacc.c:1646 */
2377 #line 362 "parser.y" /* yacc.c:1646 */
2378 { (yyval
.expression
) = new_new_expression(ctx
, (yyvsp
[0].string
)); CHECK_ERROR
; }
2379 #line 2385 "parser.tab.c" /* yacc.c:1646 */
2383 #line 363 "parser.y" /* yacc.c:1646 */
2384 { (yyval
.expression
) = new_unary_expression(ctx
, EXPR_NEG
, (yyvsp
[0].expression
)); CHECK_ERROR
; }
2385 #line 2391 "parser.tab.c" /* yacc.c:1646 */
2389 #line 366 "parser.y" /* yacc.c:1646 */
2390 { (yyval
.expression
) = (yyvsp
[0].expression
); }
2391 #line 2397 "parser.tab.c" /* yacc.c:1646 */
2395 #line 367 "parser.y" /* yacc.c:1646 */
2396 { (yyvsp
[-1].member
)->args
= (yyvsp
[0].expression
); (yyval
.expression
) = &(yyvsp
[-1].member
)->expr
; }
2397 #line 2403 "parser.tab.c" /* yacc.c:1646 */
2401 #line 370 "parser.y" /* yacc.c:1646 */
2402 { (yyval
.expression
) = new_bool_expression(ctx
, VARIANT_TRUE
); CHECK_ERROR
; }
2403 #line 2409 "parser.tab.c" /* yacc.c:1646 */
2407 #line 371 "parser.y" /* yacc.c:1646 */
2408 { (yyval
.expression
) = new_bool_expression(ctx
, VARIANT_FALSE
); CHECK_ERROR
; }
2409 #line 2415 "parser.tab.c" /* yacc.c:1646 */
2413 #line 372 "parser.y" /* yacc.c:1646 */
2414 { (yyval
.expression
) = new_string_expression(ctx
, (yyvsp
[0].string
)); CHECK_ERROR
; }
2415 #line 2421 "parser.tab.c" /* yacc.c:1646 */
2419 #line 373 "parser.y" /* yacc.c:1646 */
2420 { (yyval
.expression
) = (yyvsp
[0].expression
); }
2421 #line 2427 "parser.tab.c" /* yacc.c:1646 */
2425 #line 374 "parser.y" /* yacc.c:1646 */
2426 { (yyval
.expression
) = new_expression(ctx
, EXPR_EMPTY
, 0); CHECK_ERROR
; }
2427 #line 2433 "parser.tab.c" /* yacc.c:1646 */
2431 #line 375 "parser.y" /* yacc.c:1646 */
2432 { (yyval
.expression
) = new_expression(ctx
, EXPR_NULL
, 0); CHECK_ERROR
; }
2433 #line 2439 "parser.tab.c" /* yacc.c:1646 */
2437 #line 376 "parser.y" /* yacc.c:1646 */
2438 { (yyval
.expression
) = new_expression(ctx
, EXPR_NOTHING
, 0); CHECK_ERROR
; }
2439 #line 2445 "parser.tab.c" /* yacc.c:1646 */
2443 #line 379 "parser.y" /* yacc.c:1646 */
2444 { (yyval
.expression
) = new_long_expression(ctx
, EXPR_USHORT
, (yyvsp
[0].lng
)); CHECK_ERROR
; }
2445 #line 2451 "parser.tab.c" /* yacc.c:1646 */
2449 #line 380 "parser.y" /* yacc.c:1646 */
2450 { (yyval
.expression
) = new_long_expression(ctx
, EXPR_USHORT
, 0); CHECK_ERROR
; }
2451 #line 2457 "parser.tab.c" /* yacc.c:1646 */
2455 #line 381 "parser.y" /* yacc.c:1646 */
2456 { (yyval
.expression
) = new_long_expression(ctx
, EXPR_ULONG
, (yyvsp
[0].lng
)); CHECK_ERROR
; }
2457 #line 2463 "parser.tab.c" /* yacc.c:1646 */
2461 #line 382 "parser.y" /* yacc.c:1646 */
2462 { (yyval
.expression
) = new_double_expression(ctx
, (yyvsp
[0].dbl
)); CHECK_ERROR
; }
2463 #line 2469 "parser.tab.c" /* yacc.c:1646 */
2467 #line 385 "parser.y" /* yacc.c:1646 */
2468 { (yyval
.uint
) = (yyvsp
[0].lng
); }
2469 #line 2475 "parser.tab.c" /* yacc.c:1646 */
2473 #line 386 "parser.y" /* yacc.c:1646 */
2474 { (yyval
.uint
) = 0; }
2475 #line 2481 "parser.tab.c" /* yacc.c:1646 */
2479 #line 387 "parser.y" /* yacc.c:1646 */
2480 { (yyval
.uint
) = (yyvsp
[0].lng
); }
2481 #line 2487 "parser.tab.c" /* yacc.c:1646 */
2485 #line 390 "parser.y" /* yacc.c:1646 */
2486 { (yyval
.expression
) = new_unary_expression(ctx
, EXPR_BRACKETS
, (yyvsp
[-1].expression
)); }
2487 #line 2493 "parser.tab.c" /* yacc.c:1646 */
2491 #line 391 "parser.y" /* yacc.c:1646 */
2492 { (yyval
.expression
) = new_expression(ctx
, EXPR_ME
, 0); CHECK_ERROR
; }
2493 #line 2499 "parser.tab.c" /* yacc.c:1646 */
2497 #line 394 "parser.y" /* yacc.c:1646 */
2498 { (yyvsp
[-3].class_decl
)->name
= (yyvsp
[-5].string
); (yyval
.class_decl
) = (yyvsp
[-3].class_decl
); }
2499 #line 2505 "parser.tab.c" /* yacc.c:1646 */
2503 #line 397 "parser.y" /* yacc.c:1646 */
2504 { (yyval
.class_decl
) = new_class_decl(ctx
); }
2505 #line 2511 "parser.tab.c" /* yacc.c:1646 */
2509 #line 398 "parser.y" /* yacc.c:1646 */
2510 { (yyval
.class_decl
) = add_class_function(ctx
, (yyvsp
[0].class_decl
), (yyvsp
[-2].func_decl
)); CHECK_ERROR
; }
2511 #line 2517 "parser.tab.c" /* yacc.c:1646 */
2515 #line 400 "parser.y" /* yacc.c:1646 */
2516 { dim_decl_t
*dim_decl
= new_dim_decl(ctx
, (yyvsp
[-2].string
), FALSE
, NULL
); CHECK_ERROR
;
2517 (yyval
.class_decl
) = add_dim_prop(ctx
, (yyvsp
[0].class_decl
), dim_decl
, (yyvsp
[-3].uint
)); CHECK_ERROR
; }
2518 #line 2524 "parser.tab.c" /* yacc.c:1646 */
2522 #line 402 "parser.y" /* yacc.c:1646 */
2523 { (yyval
.class_decl
) = add_dim_prop(ctx
, (yyvsp
[0].class_decl
), (yyvsp
[-2].dim_decl
), 0); CHECK_ERROR
; }
2524 #line 2530 "parser.tab.c" /* yacc.c:1646 */
2528 #line 403 "parser.y" /* yacc.c:1646 */
2529 { (yyval
.class_decl
) = add_class_function(ctx
, (yyvsp
[0].class_decl
), (yyvsp
[-2].func_decl
)); CHECK_ERROR
; }
2530 #line 2536 "parser.tab.c" /* yacc.c:1646 */
2534 #line 407 "parser.y" /* yacc.c:1646 */
2535 { (yyval
.func_decl
) = new_function_decl(ctx
, (yyvsp
[-5].string
), FUNC_PROPGET
, (yyvsp
[-8].uint
), (yyvsp
[-4].arg_decl
), (yyvsp
[-2].statement
)); CHECK_ERROR
; }
2536 #line 2542 "parser.tab.c" /* yacc.c:1646 */
2540 #line 409 "parser.y" /* yacc.c:1646 */
2541 { (yyval
.func_decl
) = new_function_decl(ctx
, (yyvsp
[-7].string
), FUNC_PROPLET
, (yyvsp
[-10].uint
), (yyvsp
[-5].arg_decl
), (yyvsp
[-2].statement
)); CHECK_ERROR
; }
2542 #line 2548 "parser.tab.c" /* yacc.c:1646 */
2546 #line 411 "parser.y" /* yacc.c:1646 */
2547 { (yyval
.func_decl
) = new_function_decl(ctx
, (yyvsp
[-7].string
), FUNC_PROPSET
, (yyvsp
[-10].uint
), (yyvsp
[-5].arg_decl
), (yyvsp
[-2].statement
)); CHECK_ERROR
; }
2548 #line 2554 "parser.tab.c" /* yacc.c:1646 */
2552 #line 415 "parser.y" /* yacc.c:1646 */
2553 { (yyval
.func_decl
) = new_function_decl(ctx
, (yyvsp
[-5].string
), FUNC_SUB
, (yyvsp
[-7].uint
), (yyvsp
[-4].arg_decl
), (yyvsp
[-2].statement
)); CHECK_ERROR
; }
2554 #line 2560 "parser.tab.c" /* yacc.c:1646 */
2558 #line 417 "parser.y" /* yacc.c:1646 */
2559 { (yyval
.func_decl
) = new_function_decl(ctx
, (yyvsp
[-5].string
), FUNC_FUNCTION
, (yyvsp
[-7].uint
), (yyvsp
[-4].arg_decl
), (yyvsp
[-2].statement
)); CHECK_ERROR
; }
2560 #line 2566 "parser.tab.c" /* yacc.c:1646 */
2564 #line 420 "parser.y" /* yacc.c:1646 */
2565 { (yyval
.uint
) = 0; }
2566 #line 2572 "parser.tab.c" /* yacc.c:1646 */
2570 #line 421 "parser.y" /* yacc.c:1646 */
2571 { (yyval
.uint
) = (yyvsp
[0].uint
); }
2572 #line 2578 "parser.tab.c" /* yacc.c:1646 */
2576 #line 424 "parser.y" /* yacc.c:1646 */
2577 { (yyval
.uint
) = STORAGE_IS_DEFAULT
; }
2578 #line 2584 "parser.tab.c" /* yacc.c:1646 */
2582 #line 425 "parser.y" /* yacc.c:1646 */
2583 { (yyval
.uint
) = 0; }
2584 #line 2590 "parser.tab.c" /* yacc.c:1646 */
2588 #line 426 "parser.y" /* yacc.c:1646 */
2589 { (yyval
.uint
) = STORAGE_IS_PRIVATE
; }
2590 #line 2596 "parser.tab.c" /* yacc.c:1646 */
2594 #line 429 "parser.y" /* yacc.c:1646 */
2595 { (yyval
.arg_decl
) = NULL
; }
2596 #line 2602 "parser.tab.c" /* yacc.c:1646 */
2600 #line 430 "parser.y" /* yacc.c:1646 */
2601 { (yyval
.arg_decl
) = (yyvsp
[-1].arg_decl
); }
2602 #line 2608 "parser.tab.c" /* yacc.c:1646 */
2606 #line 433 "parser.y" /* yacc.c:1646 */
2607 { (yyval
.arg_decl
) = (yyvsp
[0].arg_decl
); }
2608 #line 2614 "parser.tab.c" /* yacc.c:1646 */
2612 #line 434 "parser.y" /* yacc.c:1646 */
2613 { (yyvsp
[-2].arg_decl
)->next
= (yyvsp
[0].arg_decl
); (yyval
.arg_decl
) = (yyvsp
[-2].arg_decl
); }
2614 #line 2620 "parser.tab.c" /* yacc.c:1646 */
2618 #line 437 "parser.y" /* yacc.c:1646 */
2619 { (yyval
.arg_decl
) = new_argument_decl(ctx
, (yyvsp
[-1].string
), TRUE
); }
2620 #line 2626 "parser.tab.c" /* yacc.c:1646 */
2624 #line 438 "parser.y" /* yacc.c:1646 */
2625 { (yyval
.arg_decl
) = new_argument_decl(ctx
, (yyvsp
[-1].string
), TRUE
); }
2626 #line 2632 "parser.tab.c" /* yacc.c:1646 */
2630 #line 439 "parser.y" /* yacc.c:1646 */
2631 { (yyval
.arg_decl
) = new_argument_decl(ctx
, (yyvsp
[-1].string
), FALSE
); }
2632 #line 2638 "parser.tab.c" /* yacc.c:1646 */
2636 #line 443 "parser.y" /* yacc.c:1646 */
2637 { (yyval
.string
) = (yyvsp
[0].string
); }
2638 #line 2644 "parser.tab.c" /* yacc.c:1646 */
2642 #line 444 "parser.y" /* yacc.c:1646 */
2643 { (yyval
.string
) = propertyW
; }
2644 #line 2650 "parser.tab.c" /* yacc.c:1646 */
2648 #line 2654 "parser.tab.c" /* yacc.c:1646 */
2651 /* User semantic actions sometimes alter yychar, and that requires
2652 that yytoken be updated with the new translation. We take the
2653 approach of translating immediately before every use of yytoken.
2654 One alternative is translating here after every semantic action,
2655 but that translation would be missed if the semantic action invokes
2656 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2657 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2658 incorrect destructor might then be invoked immediately. In the
2659 case of YYERROR or YYBACKUP, subsequent parser actions might lead
2660 to an incorrect destructor call or verbose syntax error message
2661 before the lookahead is translated. */
2662 YY_SYMBOL_PRINT ("-> $$ =", yyr1
[yyn
], &yyval
, &yyloc
);
2666 YY_STACK_PRINT (yyss
, yyssp
);
2670 /* Now 'shift' the result of the reduction. Determine what state
2671 that goes to, based on the state we popped back to and the rule
2672 number reduced by. */
2676 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
2677 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
2678 yystate
= yytable
[yystate
];
2680 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
2685 /*--------------------------------------.
2686 | yyerrlab -- here on detecting error. |
2687 `--------------------------------------*/
2689 /* Make sure we have latest lookahead translation. See comments at
2690 user semantic actions for why this is necessary. */
2691 yytoken
= yychar
== YYEMPTY
? YYEMPTY
: YYTRANSLATE (yychar
);
2693 /* If not already recovering from an error, report this error. */
2697 #if ! YYERROR_VERBOSE
2698 yyerror (ctx
, YY_("syntax error"));
2700 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2703 char const *yymsgp
= YY_("syntax error");
2704 int yysyntax_error_status
;
2705 yysyntax_error_status
= YYSYNTAX_ERROR
;
2706 if (yysyntax_error_status
== 0)
2708 else if (yysyntax_error_status
== 1)
2710 if (yymsg
!= yymsgbuf
)
2711 YYSTACK_FREE (yymsg
);
2712 yymsg
= (char *) YYSTACK_ALLOC (yymsg_alloc
);
2716 yymsg_alloc
= sizeof yymsgbuf
;
2717 yysyntax_error_status
= 2;
2721 yysyntax_error_status
= YYSYNTAX_ERROR
;
2725 yyerror (ctx
, yymsgp
);
2726 if (yysyntax_error_status
== 2)
2727 goto yyexhaustedlab
;
2729 # undef YYSYNTAX_ERROR
2735 if (yyerrstatus
== 3)
2737 /* If just tried and failed to reuse lookahead token after an
2738 error, discard it. */
2740 if (yychar
<= YYEOF
)
2742 /* Return failure if at end of input. */
2743 if (yychar
== YYEOF
)
2748 yydestruct ("Error: discarding",
2749 yytoken
, &yylval
, ctx
);
2754 /* Else will try to reuse lookahead token after shifting the error
2759 /*---------------------------------------------------.
2760 | yyerrorlab -- error raised explicitly by YYERROR. |
2761 `---------------------------------------------------*/
2764 /* Pacify compilers like GCC when the user code never invokes
2765 YYERROR and the label yyerrorlab therefore never appears in user
2767 if (/*CONSTCOND*/ 0)
2770 /* Do not reclaim the symbols of the rule whose action triggered
2774 YY_STACK_PRINT (yyss
, yyssp
);
2779 /*-------------------------------------------------------------.
2780 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2781 `-------------------------------------------------------------*/
2783 yyerrstatus
= 3; /* Each real token shifted decrements this. */
2787 yyn
= yypact
[yystate
];
2788 if (!yypact_value_is_default (yyn
))
2791 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
2799 /* Pop the current state because it cannot handle the error token. */
2804 yydestruct ("Error: popping",
2805 yystos
[yystate
], yyvsp
, ctx
);
2808 YY_STACK_PRINT (yyss
, yyssp
);
2811 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2813 YY_IGNORE_MAYBE_UNINITIALIZED_END
2816 /* Shift the error token. */
2817 YY_SYMBOL_PRINT ("Shifting", yystos
[yyn
], yyvsp
, yylsp
);
2823 /*-------------------------------------.
2824 | yyacceptlab -- YYACCEPT comes here. |
2825 `-------------------------------------*/
2830 /*-----------------------------------.
2831 | yyabortlab -- YYABORT comes here. |
2832 `-----------------------------------*/
2837 #if !defined yyoverflow || YYERROR_VERBOSE
2838 /*-------------------------------------------------.
2839 | yyexhaustedlab -- memory exhaustion comes here. |
2840 `-------------------------------------------------*/
2842 yyerror (ctx
, YY_("memory exhausted"));
2848 if (yychar
!= YYEMPTY
)
2850 /* Make sure we have latest lookahead translation. See comments at
2851 user semantic actions for why this is necessary. */
2852 yytoken
= YYTRANSLATE (yychar
);
2853 yydestruct ("Cleanup: discarding lookahead",
2854 yytoken
, &yylval
, ctx
);
2856 /* Do not reclaim the symbols of the rule whose action triggered
2857 this YYABORT or YYACCEPT. */
2859 YY_STACK_PRINT (yyss
, yyssp
);
2860 while (yyssp
!= yyss
)
2862 yydestruct ("Cleanup: popping",
2863 yystos
[*yyssp
], yyvsp
, ctx
);
2868 YYSTACK_FREE (yyss
);
2871 if (yymsg
!= yymsgbuf
)
2872 YYSTACK_FREE (yymsg
);
2876 #line 451 "parser.y" /* yacc.c:1906 */
2879 static int parser_error(parser_ctx_t
*ctx
, const char *str
)
2884 static void source_add_statement(parser_ctx_t
*ctx
, statement_t
*stat
)
2890 ctx
->stats_tail
->next
= stat
;
2891 ctx
->stats_tail
= stat
;
2893 ctx
->stats
= ctx
->stats_tail
= stat
;
2897 static void source_add_class(parser_ctx_t
*ctx
, class_decl_t
*class_decl
)
2899 class_decl
->next
= ctx
->class_decls
;
2900 ctx
->class_decls
= class_decl
;
2903 static void parse_complete(parser_ctx_t
*ctx
, BOOL option_explicit
)
2905 ctx
->parse_complete
= TRUE
;
2906 ctx
->option_explicit
= option_explicit
;
2909 static void *new_expression(parser_ctx_t
*ctx
, expression_type_t type
, size_t size
)
2913 expr
= parser_alloc(ctx
, size
? size
: sizeof(*expr
));
2922 static expression_t
*new_bool_expression(parser_ctx_t
*ctx
, VARIANT_BOOL value
)
2924 bool_expression_t
*expr
;
2926 expr
= new_expression(ctx
, EXPR_BOOL
, sizeof(*expr
));
2930 expr
->value
= value
;
2934 static expression_t
*new_string_expression(parser_ctx_t
*ctx
, const WCHAR
*value
)
2936 string_expression_t
*expr
;
2938 expr
= new_expression(ctx
, EXPR_STRING
, sizeof(*expr
));
2942 expr
->value
= value
;
2946 static expression_t
*new_long_expression(parser_ctx_t
*ctx
, expression_type_t type
, LONG value
)
2948 int_expression_t
*expr
;
2950 expr
= new_expression(ctx
, type
, sizeof(*expr
));
2954 expr
->value
= value
;
2958 static expression_t
*new_double_expression(parser_ctx_t
*ctx
, double value
)
2960 double_expression_t
*expr
;
2962 expr
= new_expression(ctx
, EXPR_DOUBLE
, sizeof(*expr
));
2966 expr
->value
= value
;
2970 static expression_t
*new_unary_expression(parser_ctx_t
*ctx
, expression_type_t type
, expression_t
*subexpr
)
2972 unary_expression_t
*expr
;
2974 expr
= new_expression(ctx
, type
, sizeof(*expr
));
2978 expr
->subexpr
= subexpr
;
2982 static expression_t
*new_binary_expression(parser_ctx_t
*ctx
, expression_type_t type
, expression_t
*left
, expression_t
*right
)
2984 binary_expression_t
*expr
;
2986 expr
= new_expression(ctx
, type
, sizeof(*expr
));
2991 expr
->right
= right
;
2995 static member_expression_t
*new_member_expression(parser_ctx_t
*ctx
, expression_t
*obj_expr
, const WCHAR
*identifier
)
2997 member_expression_t
*expr
;
2999 expr
= new_expression(ctx
, EXPR_MEMBER
, sizeof(*expr
));
3003 expr
->obj_expr
= obj_expr
;
3004 expr
->identifier
= identifier
;
3009 static expression_t
*new_new_expression(parser_ctx_t
*ctx
, const WCHAR
*identifier
)
3011 string_expression_t
*expr
;
3013 expr
= new_expression(ctx
, EXPR_NEW
, sizeof(*expr
));
3017 expr
->value
= identifier
;
3021 static void *new_statement(parser_ctx_t
*ctx
, statement_type_t type
, size_t size
)
3025 stat
= parser_alloc(ctx
, size
? size
: sizeof(*stat
));
3034 static statement_t
*new_call_statement(parser_ctx_t
*ctx
, BOOL is_strict
, member_expression_t
*expr
)
3036 call_statement_t
*stat
;
3038 stat
= new_statement(ctx
, STAT_CALL
, sizeof(*stat
));
3043 stat
->is_strict
= is_strict
;
3047 static statement_t
*new_assign_statement(parser_ctx_t
*ctx
, member_expression_t
*left
, expression_t
*right
)
3049 assign_statement_t
*stat
;
3051 stat
= new_statement(ctx
, STAT_ASSIGN
, sizeof(*stat
));
3055 stat
->member_expr
= left
;
3056 stat
->value_expr
= right
;
3060 static statement_t
*new_set_statement(parser_ctx_t
*ctx
, member_expression_t
*left
, expression_t
*right
)
3062 assign_statement_t
*stat
;
3064 stat
= new_statement(ctx
, STAT_SET
, sizeof(*stat
));
3068 stat
->member_expr
= left
;
3069 stat
->value_expr
= right
;
3073 static dim_decl_t
*new_dim_decl(parser_ctx_t
*ctx
, const WCHAR
*name
, BOOL is_array
, dim_list_t
*dims
)
3077 decl
= parser_alloc(ctx
, sizeof(*decl
));
3082 decl
->is_array
= is_array
;
3088 static dim_list_t
*new_dim(parser_ctx_t
*ctx
, unsigned val
, dim_list_t
*next
)
3092 ret
= parser_alloc(ctx
, sizeof(*ret
));
3101 static statement_t
*new_dim_statement(parser_ctx_t
*ctx
, dim_decl_t
*decls
)
3103 dim_statement_t
*stat
;
3105 stat
= new_statement(ctx
, STAT_DIM
, sizeof(*stat
));
3109 stat
->dim_decls
= decls
;
3113 static elseif_decl_t
*new_elseif_decl(parser_ctx_t
*ctx
, expression_t
*expr
, statement_t
*stat
)
3115 elseif_decl_t
*decl
;
3117 decl
= parser_alloc(ctx
, sizeof(*decl
));
3127 static statement_t
*new_while_statement(parser_ctx_t
*ctx
, statement_type_t type
, expression_t
*expr
, statement_t
*body
)
3129 while_statement_t
*stat
;
3131 stat
= new_statement(ctx
, type
, sizeof(*stat
));
3140 static statement_t
*new_forto_statement(parser_ctx_t
*ctx
, const WCHAR
*identifier
, expression_t
*from_expr
,
3141 expression_t
*to_expr
, expression_t
*step_expr
, statement_t
*body
)
3143 forto_statement_t
*stat
;
3145 stat
= new_statement(ctx
, STAT_FORTO
, sizeof(*stat
));
3149 stat
->identifier
= identifier
;
3150 stat
->from_expr
= from_expr
;
3151 stat
->to_expr
= to_expr
;
3152 stat
->step_expr
= step_expr
;
3157 static statement_t
*new_foreach_statement(parser_ctx_t
*ctx
, const WCHAR
*identifier
, expression_t
*group_expr
,
3160 foreach_statement_t
*stat
;
3162 stat
= new_statement(ctx
, STAT_FOREACH
, sizeof(*stat
));
3166 stat
->identifier
= identifier
;
3167 stat
->group_expr
= group_expr
;
3172 static statement_t
*new_if_statement(parser_ctx_t
*ctx
, expression_t
*expr
, statement_t
*if_stat
, elseif_decl_t
*elseif_decl
,
3173 statement_t
*else_stat
)
3175 if_statement_t
*stat
;
3177 stat
= new_statement(ctx
, STAT_IF
, sizeof(*stat
));
3182 stat
->if_stat
= if_stat
;
3183 stat
->elseifs
= elseif_decl
;
3184 stat
->else_stat
= else_stat
;
3188 static statement_t
*new_select_statement(parser_ctx_t
*ctx
, expression_t
*expr
, case_clausule_t
*case_clausules
)
3190 select_statement_t
*stat
;
3192 stat
= new_statement(ctx
, STAT_SELECT
, sizeof(*stat
));
3197 stat
->case_clausules
= case_clausules
;
3201 static case_clausule_t
*new_case_clausule(parser_ctx_t
*ctx
, expression_t
*expr
, statement_t
*stat
, case_clausule_t
*next
)
3203 case_clausule_t
*ret
;
3205 ret
= parser_alloc(ctx
, sizeof(*ret
));
3215 static statement_t
*new_onerror_statement(parser_ctx_t
*ctx
, BOOL resume_next
)
3217 onerror_statement_t
*stat
;
3219 stat
= new_statement(ctx
, STAT_ONERROR
, sizeof(*stat
));
3223 stat
->resume_next
= resume_next
;
3227 static arg_decl_t
*new_argument_decl(parser_ctx_t
*ctx
, const WCHAR
*name
, BOOL by_ref
)
3229 arg_decl_t
*arg_decl
;
3231 arg_decl
= parser_alloc(ctx
, sizeof(*arg_decl
));
3235 arg_decl
->name
= name
;
3236 arg_decl
->by_ref
= by_ref
;
3237 arg_decl
->next
= NULL
;
3241 static function_decl_t
*new_function_decl(parser_ctx_t
*ctx
, const WCHAR
*name
, function_type_t type
,
3242 unsigned storage_flags
, arg_decl_t
*arg_decl
, statement_t
*body
)
3244 function_decl_t
*decl
;
3246 if(storage_flags
& STORAGE_IS_DEFAULT
) {
3247 if(type
== FUNC_PROPGET
) {
3250 FIXME("Invalid default property\n");
3256 decl
= parser_alloc(ctx
, sizeof(*decl
));
3262 decl
->is_public
= !(storage_flags
& STORAGE_IS_PRIVATE
);
3263 decl
->args
= arg_decl
;
3266 decl
->next_prop_func
= NULL
;
3270 static statement_t
*new_function_statement(parser_ctx_t
*ctx
, function_decl_t
*decl
)
3272 function_statement_t
*stat
;
3274 stat
= new_statement(ctx
, STAT_FUNC
, sizeof(*stat
));
3278 stat
->func_decl
= decl
;
3282 static class_decl_t
*new_class_decl(parser_ctx_t
*ctx
)
3284 class_decl_t
*class_decl
;
3286 class_decl
= parser_alloc(ctx
, sizeof(*class_decl
));
3290 class_decl
->funcs
= NULL
;
3291 class_decl
->props
= NULL
;
3292 class_decl
->next
= NULL
;
3296 static class_decl_t
*add_class_function(parser_ctx_t
*ctx
, class_decl_t
*class_decl
, function_decl_t
*decl
)
3298 function_decl_t
*iter
;
3300 for(iter
= class_decl
->funcs
; iter
; iter
= iter
->next
) {
3301 if(!strcmpiW(iter
->name
, decl
->name
)) {
3302 if(decl
->type
== FUNC_SUB
|| decl
->type
== FUNC_FUNCTION
) {
3303 FIXME("Redefinition of %s::%s\n", debugstr_w(class_decl
->name
), debugstr_w(decl
->name
));
3309 if(iter
->type
== decl
->type
) {
3310 FIXME("Redefinition of %s::%s\n", debugstr_w(class_decl
->name
), debugstr_w(decl
->name
));
3314 if(!iter
->next_prop_func
)
3316 iter
= iter
->next_prop_func
;
3319 iter
->next_prop_func
= decl
;
3324 decl
->next
= class_decl
->funcs
;
3325 class_decl
->funcs
= decl
;
3329 static class_decl_t
*add_dim_prop(parser_ctx_t
*ctx
, class_decl_t
*class_decl
, dim_decl_t
*dim_decl
, unsigned storage_flags
)
3331 if(storage_flags
& STORAGE_IS_DEFAULT
) {
3332 FIXME("variant prop van't be default value\n");
3337 dim_decl
->is_public
= !(storage_flags
& STORAGE_IS_PRIVATE
);
3338 dim_decl
->next
= class_decl
->props
;
3339 class_decl
->props
= dim_decl
;
3343 static const_decl_t
*new_const_decl(parser_ctx_t
*ctx
, const WCHAR
*name
, expression_t
*expr
)
3347 decl
= parser_alloc(ctx
, sizeof(*decl
));
3352 decl
->value_expr
= expr
;
3357 static statement_t
*new_const_statement(parser_ctx_t
*ctx
, const_decl_t
*decls
)
3359 const_statement_t
*stat
;
3361 stat
= new_statement(ctx
, STAT_CONST
, sizeof(*stat
));
3365 stat
->decls
= decls
;
3369 static statement_t
*link_statements(statement_t
*head
, statement_t
*tail
)
3373 for(iter
= head
; iter
->next
; iter
= iter
->next
);
3379 void *parser_alloc(parser_ctx_t
*ctx
, size_t size
)
3383 ret
= heap_pool_alloc(&ctx
->heap
, size
);
3385 ctx
->hres
= E_OUTOFMEMORY
;
3389 HRESULT
parse_script(parser_ctx_t
*ctx
, const WCHAR
*code
, const WCHAR
*delimiter
)
3391 const WCHAR html_delimiterW
[] = {'<','/','s','c','r','i','p','t','>',0};
3393 ctx
->code
= ctx
->ptr
= code
;
3394 ctx
->end
= ctx
->code
+ strlenW(ctx
->code
);
3396 heap_pool_init(&ctx
->heap
);
3398 ctx
->parse_complete
= FALSE
;
3401 ctx
->last_token
= tNL
;
3403 ctx
->stats
= ctx
->stats_tail
= NULL
;
3404 ctx
->class_decls
= NULL
;
3405 ctx
->option_explicit
= FALSE
;
3406 ctx
->is_html
= delimiter
&& !strcmpiW(delimiter
, html_delimiterW
);
3410 if(FAILED(ctx
->hres
))
3412 if(!ctx
->parse_complete
) {
3413 FIXME("parser failed around %s\n", debugstr_w(ctx
->code
+20 > ctx
->ptr
? ctx
->code
: ctx
->ptr
-20));
3420 void parser_release(parser_ctx_t
*ctx
)
3422 heap_pool_free(&ctx
->heap
);