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