* Sync up to trunk head (r64716).
[reactos.git] / dll / win32 / vbscript / parser.tab.c
1 /* A Bison parser, made by GNU Bison 3.0.2. */
2
3 /* Bison implementation for Yacc-like parsers in C
4
5 Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
6
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.
11
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.
16
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/>. */
19
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.
29
30 This special exception was added by the Free Software Foundation in
31 version 2.2 of Bison. */
32
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34 simplifying the original so-called "semantic" parser. */
35
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. */
42
43 /* Identify Bison output. */
44 #define YYBISON 1
45
46 /* Bison version. */
47 #define YYBISON_VERSION "3.0.2"
48
49 /* Skeleton name. */
50 #define YYSKELETON_NAME "yacc.c"
51
52 /* Pure parsers. */
53 #define YYPURE 1
54
55 /* Push parsers. */
56 #define YYPUSH 0
57
58 /* Pull parsers. */
59 #define YYPULL 1
60
61
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
68
69
70 /* Copy the first part of user declarations. */
71 #line 19 "parser.y" /* yacc.c:339 */
72
73
74 #include "vbscript.h"
75
76 static int parser_error(parser_ctx_t *,const char*);
77
78 static void parse_complete(parser_ctx_t*,BOOL);
79
80 static void source_add_statement(parser_ctx_t*,statement_t*);
81 static void source_add_class(parser_ctx_t*,class_decl_t*);
82
83 static void *new_expression(parser_ctx_t*,expression_type_t,size_t);
84 static expression_t *new_bool_expression(parser_ctx_t*,VARIANT_BOOL);
85 static expression_t *new_string_expression(parser_ctx_t*,const WCHAR*);
86 static expression_t *new_long_expression(parser_ctx_t*,expression_type_t,LONG);
87 static expression_t *new_double_expression(parser_ctx_t*,double);
88 static expression_t *new_unary_expression(parser_ctx_t*,expression_type_t,expression_t*);
89 static expression_t *new_binary_expression(parser_ctx_t*,expression_type_t,expression_t*,expression_t*);
90 static expression_t *new_new_expression(parser_ctx_t*,const WCHAR*);
91
92 static member_expression_t *new_member_expression(parser_ctx_t*,expression_t*,const WCHAR*);
93
94 static void *new_statement(parser_ctx_t*,statement_type_t,size_t);
95 static statement_t *new_call_statement(parser_ctx_t*,BOOL,member_expression_t*);
96 static statement_t *new_assign_statement(parser_ctx_t*,member_expression_t*,expression_t*);
97 static statement_t *new_set_statement(parser_ctx_t*,member_expression_t*,expression_t*);
98 static statement_t *new_dim_statement(parser_ctx_t*,dim_decl_t*);
99 static statement_t *new_while_statement(parser_ctx_t*,statement_type_t,expression_t*,statement_t*);
100 static statement_t *new_forto_statement(parser_ctx_t*,const WCHAR*,expression_t*,expression_t*,expression_t*,statement_t*);
101 static statement_t *new_foreach_statement(parser_ctx_t*,const WCHAR*,expression_t*,statement_t*);
102 static statement_t *new_if_statement(parser_ctx_t*,expression_t*,statement_t*,elseif_decl_t*,statement_t*);
103 static statement_t *new_function_statement(parser_ctx_t*,function_decl_t*);
104 static statement_t *new_onerror_statement(parser_ctx_t*,BOOL);
105 static statement_t *new_const_statement(parser_ctx_t*,const_decl_t*);
106 static statement_t *new_select_statement(parser_ctx_t*,expression_t*,case_clausule_t*);
107
108 static dim_decl_t *new_dim_decl(parser_ctx_t*,const WCHAR*,BOOL,dim_list_t*);
109 static dim_list_t *new_dim(parser_ctx_t*,unsigned,dim_list_t*);
110 static elseif_decl_t *new_elseif_decl(parser_ctx_t*,expression_t*,statement_t*);
111 static function_decl_t *new_function_decl(parser_ctx_t*,const WCHAR*,function_type_t,unsigned,arg_decl_t*,statement_t*);
112 static arg_decl_t *new_argument_decl(parser_ctx_t*,const WCHAR*,BOOL);
113 static const_decl_t *new_const_decl(parser_ctx_t*,const WCHAR*,expression_t*);
114 static case_clausule_t *new_case_clausule(parser_ctx_t*,expression_t*,statement_t*,case_clausule_t*);
115
116 static class_decl_t *new_class_decl(parser_ctx_t*);
117 static class_decl_t *add_class_function(parser_ctx_t*,class_decl_t*,function_decl_t*);
118 static class_decl_t *add_dim_prop(parser_ctx_t*,class_decl_t*,dim_decl_t*,unsigned);
119
120 static statement_t *link_statements(statement_t*,statement_t*);
121
122 static const WCHAR propertyW[] = {'p','r','o','p','e','r','t','y',0};
123
124 #define STORAGE_IS_PRIVATE 1
125 #define STORAGE_IS_DEFAULT 2
126
127 #define CHECK_ERROR if(((parser_ctx_t*)ctx)->hres != S_OK) YYABORT
128
129
130 #line 136 "parser.tab.c" /* yacc.c:339 */
131
132 # ifndef YY_NULLPTR
133 # if defined __cplusplus && 201103L <= __cplusplus
134 # define YY_NULLPTR nullptr
135 # else
136 # define YY_NULLPTR 0
137 # endif
138 # endif
139
140 /* Enabling verbose error messages. */
141 #ifdef YYERROR_VERBOSE
142 # undef YYERROR_VERBOSE
143 # define YYERROR_VERBOSE 1
144 #else
145 # define YYERROR_VERBOSE 0
146 #endif
147
148
149 /* Debug traces. */
150 #ifndef YYDEBUG
151 # define YYDEBUG 0
152 #endif
153 #if YYDEBUG
154 extern int parser_debug;
155 #endif
156
157 /* Token type. */
158 #ifndef YYTOKENTYPE
159 # define YYTOKENTYPE
160 enum yytokentype
161 {
162 tEOF = 258,
163 tNL = 259,
164 tREM = 260,
165 tEMPTYBRACKETS = 261,
166 tTRUE = 262,
167 tFALSE = 263,
168 tNOT = 264,
169 tAND = 265,
170 tOR = 266,
171 tXOR = 267,
172 tEQV = 268,
173 tIMP = 269,
174 tNEQ = 270,
175 tIS = 271,
176 tLTEQ = 272,
177 tGTEQ = 273,
178 tMOD = 274,
179 tCALL = 275,
180 tDIM = 276,
181 tSUB = 277,
182 tFUNCTION = 278,
183 tPROPERTY = 279,
184 tGET = 280,
185 tLET = 281,
186 tCONST = 282,
187 tIF = 283,
188 tELSE = 284,
189 tELSEIF = 285,
190 tEND = 286,
191 tTHEN = 287,
192 tEXIT = 288,
193 tWHILE = 289,
194 tWEND = 290,
195 tDO = 291,
196 tLOOP = 292,
197 tUNTIL = 293,
198 tFOR = 294,
199 tTO = 295,
200 tSTEP = 296,
201 tEACH = 297,
202 tIN = 298,
203 tSELECT = 299,
204 tCASE = 300,
205 tBYREF = 301,
206 tBYVAL = 302,
207 tOPTION = 303,
208 tEXPLICIT = 304,
209 tSTOP = 305,
210 tNOTHING = 306,
211 tEMPTY = 307,
212 tNULL = 308,
213 tCLASS = 309,
214 tSET = 310,
215 tNEW = 311,
216 tPUBLIC = 312,
217 tPRIVATE = 313,
218 tDEFAULT = 314,
219 tME = 315,
220 tERROR = 316,
221 tNEXT = 317,
222 tON = 318,
223 tRESUME = 319,
224 tGOTO = 320,
225 tIdentifier = 321,
226 tString = 322,
227 tLong = 323,
228 tShort = 324,
229 tDouble = 325
230 };
231 #endif
232
233 /* Value type. */
234 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
235 typedef union YYSTYPE YYSTYPE;
236 union YYSTYPE
237 {
238 #line 88 "parser.y" /* yacc.c:355 */
239
240 const WCHAR *string;
241 statement_t *statement;
242 expression_t *expression;
243 member_expression_t *member;
244 elseif_decl_t *elseif;
245 dim_decl_t *dim_decl;
246 dim_list_t *dim_list;
247 function_decl_t *func_decl;
248 arg_decl_t *arg_decl;
249 class_decl_t *class_decl;
250 const_decl_t *const_decl;
251 case_clausule_t *case_clausule;
252 unsigned uint;
253 LONG lng;
254 BOOL boolean;
255 double dbl;
256
257 #line 263 "parser.tab.c" /* yacc.c:355 */
258 };
259 # define YYSTYPE_IS_TRIVIAL 1
260 # define YYSTYPE_IS_DECLARED 1
261 #endif
262
263
264
265 int parser_parse (parser_ctx_t *ctx);
266
267
268
269 /* Copy the second part of user declarations. */
270
271 #line 277 "parser.tab.c" /* yacc.c:358 */
272
273 #ifdef short
274 # undef short
275 #endif
276
277 #ifdef YYTYPE_UINT8
278 typedef YYTYPE_UINT8 yytype_uint8;
279 #else
280 typedef unsigned char yytype_uint8;
281 #endif
282
283 #ifdef YYTYPE_INT8
284 typedef YYTYPE_INT8 yytype_int8;
285 #else
286 typedef signed char yytype_int8;
287 #endif
288
289 #ifdef YYTYPE_UINT16
290 typedef YYTYPE_UINT16 yytype_uint16;
291 #else
292 typedef unsigned short int yytype_uint16;
293 #endif
294
295 #ifdef YYTYPE_INT16
296 typedef YYTYPE_INT16 yytype_int16;
297 #else
298 typedef short int yytype_int16;
299 #endif
300
301 #ifndef YYSIZE_T
302 # ifdef __SIZE_TYPE__
303 # define YYSIZE_T __SIZE_TYPE__
304 # elif defined size_t
305 # define YYSIZE_T size_t
306 # elif ! defined YYSIZE_T
307 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
308 # define YYSIZE_T size_t
309 # else
310 # define YYSIZE_T unsigned int
311 # endif
312 #endif
313
314 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
315
316 #ifndef YY_
317 # if defined YYENABLE_NLS && YYENABLE_NLS
318 # if ENABLE_NLS
319 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
320 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
321 # endif
322 # endif
323 # ifndef YY_
324 # define YY_(Msgid) Msgid
325 # endif
326 #endif
327
328 #ifndef YY_ATTRIBUTE
329 # if (defined __GNUC__ \
330 && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
331 || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
332 # define YY_ATTRIBUTE(Spec) __attribute__(Spec)
333 # else
334 # define YY_ATTRIBUTE(Spec) /* empty */
335 # endif
336 #endif
337
338 #ifndef YY_ATTRIBUTE_PURE
339 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
340 #endif
341
342 #ifndef YY_ATTRIBUTE_UNUSED
343 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
344 #endif
345
346 #if !defined _Noreturn \
347 && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
348 # if defined _MSC_VER && 1200 <= _MSC_VER
349 # define _Noreturn __declspec (noreturn)
350 # else
351 # define _Noreturn YY_ATTRIBUTE ((__noreturn__))
352 # endif
353 #endif
354
355 /* Suppress unused-variable warnings by "using" E. */
356 #if ! defined lint || defined __GNUC__
357 # define YYUSE(E) ((void) (E))
358 #else
359 # define YYUSE(E) /* empty */
360 #endif
361
362 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
363 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
364 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
365 _Pragma ("GCC diagnostic push") \
366 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
367 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
368 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
369 _Pragma ("GCC diagnostic pop")
370 #else
371 # define YY_INITIAL_VALUE(Value) Value
372 #endif
373 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
374 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
375 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
376 #endif
377 #ifndef YY_INITIAL_VALUE
378 # define YY_INITIAL_VALUE(Value) /* Nothing. */
379 #endif
380
381
382 #if ! defined yyoverflow || YYERROR_VERBOSE
383
384 /* The parser invokes alloca or malloc; define the necessary symbols. */
385
386 # ifdef YYSTACK_USE_ALLOCA
387 # if YYSTACK_USE_ALLOCA
388 # ifdef __GNUC__
389 # define YYSTACK_ALLOC __builtin_alloca
390 # elif defined __BUILTIN_VA_ARG_INCR
391 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
392 # elif defined _AIX
393 # define YYSTACK_ALLOC __alloca
394 # elif defined _MSC_VER
395 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
396 # define alloca _alloca
397 # else
398 # define YYSTACK_ALLOC alloca
399 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
400 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
401 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
402 # ifndef EXIT_SUCCESS
403 # define EXIT_SUCCESS 0
404 # endif
405 # endif
406 # endif
407 # endif
408 # endif
409
410 # ifdef YYSTACK_ALLOC
411 /* Pacify GCC's 'empty if-body' warning. */
412 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
413 # ifndef YYSTACK_ALLOC_MAXIMUM
414 /* The OS might guarantee only one guard page at the bottom of the stack,
415 and a page size can be as small as 4096 bytes. So we cannot safely
416 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
417 to allow for a few compiler-allocated temporary stack slots. */
418 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
419 # endif
420 # else
421 # define YYSTACK_ALLOC YYMALLOC
422 # define YYSTACK_FREE YYFREE
423 # ifndef YYSTACK_ALLOC_MAXIMUM
424 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
425 # endif
426 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
427 && ! ((defined YYMALLOC || defined malloc) \
428 && (defined YYFREE || defined free)))
429 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
430 # ifndef EXIT_SUCCESS
431 # define EXIT_SUCCESS 0
432 # endif
433 # endif
434 # ifndef YYMALLOC
435 # define YYMALLOC malloc
436 # if ! defined malloc && ! defined EXIT_SUCCESS
437 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
438 # endif
439 # endif
440 # ifndef YYFREE
441 # define YYFREE free
442 # if ! defined free && ! defined EXIT_SUCCESS
443 void free (void *); /* INFRINGES ON USER NAME SPACE */
444 # endif
445 # endif
446 # endif
447 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
448
449
450 #if (! defined yyoverflow \
451 && (! defined __cplusplus \
452 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
453
454 /* A type that is properly aligned for any stack member. */
455 union yyalloc
456 {
457 yytype_int16 yyss_alloc;
458 YYSTYPE yyvs_alloc;
459 };
460
461 /* The size of the maximum gap between one aligned stack and the next. */
462 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
463
464 /* The size of an array large to enough to hold all stacks, each with
465 N elements. */
466 # define YYSTACK_BYTES(N) \
467 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
468 + YYSTACK_GAP_MAXIMUM)
469
470 # define YYCOPY_NEEDED 1
471
472 /* Relocate STACK from its old location to the new one. The
473 local variables YYSIZE and YYSTACKSIZE give the old and new number of
474 elements in the stack, and YYPTR gives the new location of the
475 stack. Advance YYPTR to a properly aligned location for the next
476 stack. */
477 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
478 do \
479 { \
480 YYSIZE_T yynewbytes; \
481 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
482 Stack = &yyptr->Stack_alloc; \
483 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
484 yyptr += yynewbytes / sizeof (*yyptr); \
485 } \
486 while (0)
487
488 #endif
489
490 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
491 /* Copy COUNT objects from SRC to DST. The source and destination do
492 not overlap. */
493 # ifndef YYCOPY
494 # if defined __GNUC__ && 1 < __GNUC__
495 # define YYCOPY(Dst, Src, Count) \
496 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
497 # else
498 # define YYCOPY(Dst, Src, Count) \
499 do \
500 { \
501 YYSIZE_T yyi; \
502 for (yyi = 0; yyi < (Count); yyi++) \
503 (Dst)[yyi] = (Src)[yyi]; \
504 } \
505 while (0)
506 # endif
507 # endif
508 #endif /* !YYCOPY_NEEDED */
509
510 /* YYFINAL -- State number of the termination state. */
511 #define YYFINAL 5
512 /* YYLAST -- Last index in YYTABLE. */
513 #define YYLAST 862
514
515 /* YYNTOKENS -- Number of terminals. */
516 #define YYNTOKENS 87
517 /* YYNNTS -- Number of nonterminals. */
518 #define YYNNTS 59
519 /* YYNRULES -- Number of rules. */
520 #define YYNRULES 164
521 /* YYNSTATES -- Number of states. */
522 #define YYNSTATES 335
523
524 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
525 by yylex, with out-of-bounds checking. */
526 #define YYUNDEFTOK 2
527 #define YYMAXUTOK 325
528
529 #define YYTRANSLATE(YYX) \
530 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
531
532 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
533 as returned by yylex, without out-of-bounds checking. */
534 static const yytype_uint8 yytranslate[] =
535 {
536 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
537 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
538 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
539 2, 2, 2, 2, 2, 2, 2, 2, 81, 2,
540 76, 77, 84, 82, 75, 78, 74, 85, 73, 2,
541 2, 2, 2, 2, 2, 2, 2, 2, 71, 2,
542 80, 72, 79, 2, 2, 2, 2, 2, 2, 2,
543 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
544 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
545 2, 2, 83, 2, 86, 2, 2, 2, 2, 2,
546 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
547 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
548 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
549 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
550 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
551 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
552 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
553 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
554 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
555 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
556 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
557 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
558 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
559 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
560 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
561 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
562 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
563 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
564 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
565 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
566 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
567 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
568 65, 66, 67, 68, 69, 70
569 };
570
571 #if YYDEBUG
572 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
573 static const yytype_uint16 yyrline[] =
574 {
575 0, 147, 147, 150, 151, 153, 155, 156, 159, 160,
576 163, 164, 167, 170, 171, 172, 173, 174, 177, 178,
577 179, 181, 182, 183, 185, 188, 191, 192, 193, 194,
578 195, 196, 197, 198, 200, 201, 202, 203, 204, 206,
579 208, 212, 213, 216, 217, 220, 221, 222, 225, 226,
580 229, 230, 233, 236, 237, 240, 241, 244, 245, 248,
581 250, 251, 254, 256, 259, 260, 263, 264, 267, 271,
582 272, 275, 276, 277, 281, 282, 285, 286, 288, 290,
583 293, 294, 297, 298, 301, 302, 305, 306, 309, 310,
584 313, 314, 317, 318, 321, 322, 323, 324, 325, 326,
585 327, 328, 331, 332, 335, 336, 337, 340, 341, 344,
586 345, 349, 350, 352, 356, 357, 360, 361, 362, 363,
587 366, 367, 370, 371, 372, 373, 374, 375, 376, 379,
588 380, 381, 382, 385, 386, 387, 390, 391, 394, 397,
589 398, 400, 402, 403, 406, 408, 410, 414, 416, 420,
590 421, 424, 425, 426, 429, 430, 433, 434, 437, 438,
591 439, 443, 444, 448, 449
592 };
593 #endif
594
595 #if YYDEBUG || YYERROR_VERBOSE || 0
596 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
597 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
598 static const char *const yytname[] =
599 {
600 "$end", "error", "$undefined", "tEOF", "tNL", "tREM", "tEMPTYBRACKETS",
601 "tTRUE", "tFALSE", "tNOT", "tAND", "tOR", "tXOR", "tEQV", "tIMP", "tNEQ",
602 "tIS", "tLTEQ", "tGTEQ", "tMOD", "tCALL", "tDIM", "tSUB", "tFUNCTION",
603 "tPROPERTY", "tGET", "tLET", "tCONST", "tIF", "tELSE", "tELSEIF", "tEND",
604 "tTHEN", "tEXIT", "tWHILE", "tWEND", "tDO", "tLOOP", "tUNTIL", "tFOR",
605 "tTO", "tSTEP", "tEACH", "tIN", "tSELECT", "tCASE", "tBYREF", "tBYVAL",
606 "tOPTION", "tEXPLICIT", "tSTOP", "tNOTHING", "tEMPTY", "tNULL", "tCLASS",
607 "tSET", "tNEW", "tPUBLIC", "tPRIVATE", "tDEFAULT", "tME", "tERROR",
608 "tNEXT", "tON", "tRESUME", "tGOTO", "tIdentifier", "tString", "tLong",
609 "tShort", "tDouble", "':'", "'='", "'0'", "'.'", "','", "'('", "')'",
610 "'-'", "'>'", "'<'", "'&'", "'+'", "'\\\\'", "'*'", "'/'", "'^'",
611 "$accept", "Program", "OptionExplicit_opt", "SourceElements",
612 "StatementsNl_opt", "StatementsNl", "StatementNl", "Statement",
613 "SimpleStatement", "MemberExpression", "DimDeclList", "DimDecl",
614 "DimList", "ConstDeclList", "ConstDecl", "ConstExpression", "DoType",
615 "Step_opt", "IfStatement", "EndIf_opt", "ElseIfs_opt", "ElseIfs",
616 "ElseIf", "Else_opt", "CaseClausules", "Arguments_opt",
617 "ArgumentList_opt", "EmptyBrackets_opt", "ExpressionList", "Expression",
618 "EqvExpression", "XorExpression", "OrExpression", "AndExpression",
619 "NotExpression", "EqualityExpression", "ConcatExpression",
620 "AdditiveExpression", "ModExpression", "IntdivExpression",
621 "MultiplicativeExpression", "ExpExpression", "UnaryExpression",
622 "CallExpression", "LiteralExpression", "NumericLiteralExpression",
623 "IntegerValue", "PrimaryExpression", "ClassDeclaration", "ClassBody",
624 "PropertyDecl", "FunctionDecl", "Storage_opt", "Storage",
625 "ArgumentsDecl_opt", "ArgumentDeclList", "ArgumentDecl", "Identifier",
626 "StSep", YY_NULLPTR
627 };
628 #endif
629
630 # ifdef YYPRINT
631 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
632 (internal) symbol number NUM (which must be that of a token). */
633 static const yytype_uint16 yytoknum[] =
634 {
635 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
636 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
637 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
638 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
639 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
640 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
641 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
642 325, 58, 61, 48, 46, 44, 40, 41, 45, 62,
643 60, 38, 43, 92, 42, 47, 94
644 };
645 # endif
646
647 #define YYPACT_NINF -158
648
649 #define yypact_value_is_default(Yystate) \
650 (!!((Yystate) == (-158)))
651
652 #define YYTABLE_NINF -150
653
654 #define yytable_value_is_error(Yytable_value) \
655 0
656
657 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
658 STATE-NUM. */
659 static const yytype_int16 yypact[] =
660 {
661 -28, -18, 43, -158, 56, -158, 307, -158, -158, 6,
662 -2, -158, -2, 468, 184, 468, 20, 33, 32, -158,
663 -2, 6, 26, -158, -158, 50, -158, 557, 468, -158,
664 116, 51, 388, -158, 62, -158, -158, -158, 130, -158,
665 -158, 8, -158, 63, 10, -158, 93, 104, -158, -158,
666 468, -158, -158, -158, -2, -158, -158, -158, -158, -158,
667 498, 8, 24, 166, 171, 177, 189, -158, 29, 113,
668 53, 182, 122, 102, 129, -158, 62, -158, -158, -158,
669 -158, -158, -158, -158, 47, 598, -158, -158, 468, -2,
670 145, 468, 214, 8, -158, 127, -158, 11, -158, 557,
671 -158, 468, 152, -158, -5, -158, 19, -2, -2, -2,
672 468, 163, -158, -2, -158, 112, -2, 97, -158, -158,
673 -158, -158, 468, 348, 468, 468, 468, 468, 498, 498,
674 498, 498, 498, 498, 498, 498, 498, 498, 498, 498,
675 498, 498, 498, 651, 201, -158, 557, 48, 200, 468,
676 36, 120, 173, 185, 175, -158, -158, 169, 35, 468,
677 468, -158, 13, 13, -158, -158, -158, -158, 176, 179,
678 -158, 45, -158, -158, 166, 557, 221, 171, 177, 189,
679 -158, 113, 113, 113, 113, 113, 113, 113, 53, 182,
680 182, 122, 102, 129, 129, -158, 217, 121, -158, 598,
681 468, 25, -158, -158, 211, -2, 228, 256, 257, 150,
682 196, 468, -158, -158, -158, 249, -158, -11, -158, 260,
683 261, -158, 112, -158, 237, 786, -158, 468, 233, 59,
684 468, 418, 240, 268, 219, 120, 120, 135, 270, 249,
685 -2, -2, 198, 202, 277, 692, 692, -158, 468, 247,
686 -158, 237, 253, 249, -158, 733, 12, 7, 7, 242,
687 120, 283, -158, -158, 224, 225, 226, 120, 277, 277,
688 -158, -11, -158, 263, 265, 27, 293, 271, -158, 273,
689 -158, 243, 468, 295, 786, 557, -158, -158, -158, 13,
690 231, 236, -158, -158, -158, -158, 282, 286, 310, 692,
691 287, -158, -158, 249, 733, -158, 211, 312, -11, -11,
692 -158, -158, 557, -158, -158, 255, -158, 692, 241, 252,
693 -158, -158, 288, 320, 326, 308, 692, 692, -158, 302,
694 305, 314, 315, -158, -158
695 };
696
697 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
698 Performed when YYTABLE does not specify something else to do. Zero
699 means the default is an error. */
700 static const yytype_uint8 yydefact[] =
701 {
702 3, 0, 0, 5, 0, 1, 149, 4, 2, 0,
703 0, 162, 0, 0, 0, 0, 0, 0, 0, 34,
704 0, 0, 152, 153, 137, 0, 161, 13, 0, 6,
705 0, 15, 78, 22, 0, 120, 7, 27, 0, 150,
706 41, 78, 21, 43, 45, 37, 50, 0, 122, 123,
707 0, 128, 126, 127, 0, 124, 131, 129, 132, 130,
708 0, 78, 0, 82, 84, 86, 88, 90, 92, 94,
709 102, 104, 107, 109, 111, 114, 117, 116, 125, 32,
710 30, 31, 28, 29, 0, 149, 55, 56, 0, 0,
711 0, 0, 0, 78, 151, 0, 14, 0, 12, 17,
712 79, 0, 121, 18, 76, 77, 80, 0, 0, 0,
713 0, 19, 74, 0, 47, 0, 0, 0, 93, 118,
714 119, 121, 0, 149, 0, 0, 0, 0, 0, 0,
715 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
716 0, 0, 0, 149, 0, 9, 10, 0, 0, 0,
717 0, 149, 121, 0, 0, 136, 16, 0, 0, 0,
718 0, 42, 78, 78, 44, 135, 133, 134, 0, 48,
719 51, 0, 52, 53, 83, 8, 60, 85, 87, 89,
720 91, 96, 101, 100, 99, 95, 97, 98, 103, 106,
721 105, 108, 110, 112, 113, 115, 0, 26, 11, 149,
722 0, 0, 163, 164, 71, 0, 0, 0, 0, 0,
723 150, 0, 35, 36, 75, 20, 81, 0, 154, 0,
724 0, 46, 0, 54, 64, 149, 23, 0, 0, 0,
725 0, 0, 0, 0, 0, 149, 149, 0, 0, 33,
726 0, 0, 0, 156, 78, 149, 149, 49, 0, 69,
727 65, 66, 62, 25, 24, 149, 57, 0, 0, 0,
728 149, 0, 143, 140, 0, 0, 0, 149, 78, 78,
729 155, 0, 158, 0, 0, 0, 0, 0, 67, 0,
730 61, 0, 0, 0, 149, 8, 40, 142, 138, 78,
731 0, 0, 141, 159, 160, 157, 0, 0, 0, 149,
732 0, 63, 39, 58, 149, 72, 71, 0, 0, 0,
733 147, 148, 8, 70, 59, 0, 73, 149, 0, 0,
734 68, 38, 0, 0, 0, 0, 149, 149, 144, 0,
735 0, 0, 0, 145, 146
736 };
737
738 /* YYPGOTO[NTERM-NUM]. */
739 static const yytype_int16 yypgoto[] =
740 {
741 -158, -158, -158, -158, -101, -137, 336, -23, -158, -6,
742 232, 139, 125, 234, -158, -158, 151, -158, -158, -158,
743 -158, 98, -158, -158, 49, -13, -158, 0, -31, 55,
744 238, 229, 246, 230, -40, -158, 99, 223, 60, 216,
745 220, 69, -52, -4, 262, 192, -158, -158, -158, -78,
746 -158, -144, -139, -133, -157, 95, -96, 17, -22
747 };
748
749 /* YYDEFGOTO[NTERM-NUM]. */
750 static const yytype_int16 yydefgoto[] =
751 {
752 -1, 2, 3, 6, 144, 145, 146, 30, 31, 61,
753 42, 43, 168, 45, 46, 172, 88, 283, 33, 280,
754 249, 250, 251, 277, 232, 102, 103, 112, 157, 106,
755 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
756 73, 74, 75, 76, 77, 78, 169, 35, 36, 206,
757 207, 37, 38, 39, 219, 242, 243, 40, 204
758 };
759
760 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
761 positive, shift that token. If negative, reduce the rule whose
762 number is the opposite. If YYTABLE_NINF, syntax error. */
763 static const yytype_int16 yytable[] =
764 {
765 32, 105, 34, 41, 96, 34, 220, 208, 120, 198,
766 118, 202, 209, 11, 100, 93, 114, 34, 210, 100,
767 1, 32, 11, 34, 85, 122, 122, 44, 111, 47,
768 11, 4, 104, 122, 90, 240, 241, 92, 122, 122,
769 202, 122, 196, 5, 128, 129, 130, 131, 121, 122,
770 122, 143, 199, 282, 86, 26, 123, 11, 87, 298,
771 7, 122, 122, 255, 26, 230, 24, -74, 62, -74,
772 84, 119, 26, 122, 224, 89, 156, 91, 203, 32,
773 152, 34, 28, 97, 110, 94, 115, 180, 155, 217,
774 195, 208, 208, 32, 160, 34, 209, 209, 228, 26,
775 176, 132, 210, 210, 48, 49, 148, 203, 133, 134,
776 160, 95, 155, 56, 57, 58, 208, 32, 59, 34,
777 98, 209, 99, 208, 161, 162, 163, 210, 209, 216,
778 44, 136, 307, 47, 210, 137, 107, 32, 113, 34,
779 32, 205, 34, 147, 273, 274, 150, 305, 51, 52,
780 53, -139, 108, 109, 281, 86, 158, 262, 263, 87,
781 264, 265, 218, 218, 55, 56, 57, 58, 116, 32,
782 59, 34, 108, 109, 237, 171, 117, 22, 23, 124,
783 165, 166, 287, 125, 306, 167, 140, 141, 126, 292,
784 266, 153, 154, 32, 135, 34, 189, 190, 313, 127,
785 258, 138, 252, 315, 201, 139, 79, 80, 81, 193,
786 194, 320, 318, 319, 215, 142, 322, 149, 151, 32,
787 82, 34, 44, 83, 159, 329, 330, 181, 182, 183,
788 184, 185, 186, 187, 244, 284, 285, -121, 197, 32,
789 32, 34, 34, 200, 272, 211, 214, 212, 213, 32,
790 225, 34, 226, 221, 222, 229, 231, 268, 269, 234,
791 235, 236, 238, 122, 245, 246, 239, 248, 293, 294,
792 254, 259, 260, 261, 267, 270, 276, 271, 32, 32,
793 34, 34, 253, 100, 279, 256, 286, 288, 244, 218,
794 289, 290, 291, 32, 296, 34, 297, 299, 32, 304,
795 34, 301, 300, 275, 310, 302, 32, 308, 34, 311,
796 8, 32, 309, 34, 312, 314, 317, 321, 323, 325,
797 32, 32, 34, 34, 326, 244, 244, 9, 10, 324,
798 327, 11, 328, 331, 12, 13, 332, 303, 333, 334,
799 14, 15, 29, 16, 233, 164, 17, 247, 227, 278,
800 170, 18, 175, 177, 191, 316, 179, 19, 188, 192,
801 174, 20, 21, 223, 22, 23, 295, 24, 9, 10,
802 25, 178, 11, 26, 0, 12, 13, 0, 27, 173,
803 0, 14, 15, 28, 16, 0, 0, 17, 0, 0,
804 0, 0, 18, 0, 100, 48, 49, 50, 19, 0,
805 0, 0, 0, 21, 0, 22, 23, 0, 24, 0,
806 0, 25, 11, 0, 26, 0, 0, 0, 0, 27,
807 0, 0, 0, 0, 28, 48, 49, 50, 0, 0,
808 0, 0, 0, 0, 0, 0, 0, 0, 0, 51,
809 52, 53, 11, 0, 54, 0, 0, 257, 24, 0,
810 0, 0, 0, 0, 26, 55, 56, 57, 58, 0,
811 0, 59, 0, 0, 101, 0, 60, 0, 0, 51,
812 52, 53, 0, 0, 54, 48, 49, 50, 24, 0,
813 0, 0, 0, 0, 26, 55, 56, 57, 58, 0,
814 0, 59, 11, 0, 28, 0, 60, 0, 0, 0,
815 0, 0, 0, 0, 0, 48, 49, 0, 0, 0,
816 0, 0, 0, 0, 0, 0, 0, 0, 0, 51,
817 52, 53, 11, 0, 54, 0, 0, 0, 24, 0,
818 0, 0, 0, 0, 26, 55, 56, 57, 58, 0,
819 0, 59, 0, 0, 28, 0, 60, 0, 0, 51,
820 52, 53, 0, 0, 54, 0, 0, 0, 24, 0,
821 0, 0, 0, 0, 26, 55, 56, 57, 58, 0,
822 0, 59, 0, 0, 28, 0, 60, 9, 10, -149,
823 -149, 11, 0, 0, 12, 13, 0, 0, 0, 0,
824 14, 15, 0, 16, 0, 0, 17, 0, 0, 0,
825 0, 18, 0, 0, 0, 0, 0, 19, 0, 0,
826 0, 0, 21, 0, 22, 23, 0, 24, 9, 10,
827 25, 0, 11, 26, 0, 12, 13, 0, 27, 0,
828 0, 14, 15, 28, 16, -8, 0, 17, 0, 0,
829 0, 0, 18, 0, 0, 0, 0, 0, 19, 0,
830 0, 0, 0, 21, 0, 22, 23, 0, 24, 0,
831 0, 25, 0, 0, 26, 0, 0, 0, 0, 27,
832 0, 9, 10, 0, 28, 11, 0, 0, 12, 13,
833 0, 0, 0, 0, 14, 15, -8, 16, 0, 0,
834 17, 0, 0, 0, 0, 18, 0, 0, 0, 0,
835 0, 19, 0, 0, 0, 0, 21, 0, 22, 23,
836 0, 24, 9, 10, 25, 0, 11, 26, 0, 12,
837 13, 0, 27, -8, 0, 14, 15, 28, 16, 0,
838 0, 17, 0, 0, 0, 0, 18, 0, 0, 0,
839 0, 0, 19, 0, 0, 0, 0, 21, 0, 22,
840 23, 0, 24, 9, 10, 25, 0, 11, 26, 0,
841 12, 13, 0, 27, 0, 0, 14, 15, 28, 16,
842 0, 0, 17, 0, 0, 0, 0, 18, 0, 0,
843 0, 0, 0, 19, 0, 0, 0, 0, 21, 0,
844 22, 23, 0, 24, 0, -8, 25, 0, 0, 26,
845 0, 0, 0, 0, 27, 0, 9, 10, 0, 28,
846 11, 0, 0, 12, 13, 0, 0, 0, 0, 14,
847 15, 0, 16, 0, 0, 17, 0, 0, 0, 0,
848 18, 0, 0, 0, 0, 0, 19, 0, 0, 0,
849 0, 21, 0, 22, 23, 0, 24, 0, 0, 25,
850 0, 0, 26, 0, 0, 0, 0, 27, 0, 0,
851 0, 0, 28
852 };
853
854 static const yytype_int16 yycheck[] =
855 {
856 6, 32, 6, 9, 27, 9, 163, 151, 60, 146,
857 50, 4, 151, 24, 6, 21, 6, 21, 151, 6,
858 48, 27, 24, 27, 4, 14, 14, 10, 41, 12,
859 24, 49, 32, 14, 17, 46, 47, 20, 14, 14,
860 4, 14, 143, 0, 15, 16, 17, 18, 61, 14,
861 14, 4, 4, 41, 34, 66, 32, 24, 38, 32,
862 4, 14, 14, 4, 66, 40, 60, 72, 13, 74,
863 15, 54, 66, 14, 175, 42, 99, 45, 71, 85,
864 93, 85, 76, 28, 76, 59, 76, 127, 77, 76,
865 142, 235, 236, 99, 75, 99, 235, 236, 199, 66,
866 123, 72, 235, 236, 7, 8, 89, 71, 79, 80,
867 75, 61, 77, 68, 69, 70, 260, 123, 73, 123,
868 4, 260, 71, 267, 107, 108, 109, 260, 267, 160,
869 113, 78, 289, 116, 267, 82, 74, 143, 75, 143,
870 146, 21, 146, 88, 245, 246, 91, 284, 51, 52,
871 53, 31, 22, 23, 255, 34, 101, 235, 236, 38,
872 25, 26, 162, 163, 67, 68, 69, 70, 75, 175,
873 73, 175, 22, 23, 24, 78, 72, 57, 58, 13,
874 68, 69, 260, 12, 285, 73, 84, 85, 11, 267,
875 55, 64, 65, 199, 81, 199, 136, 137, 299, 10,
876 231, 19, 225, 304, 149, 83, 22, 23, 24, 140,
877 141, 312, 308, 309, 159, 86, 317, 72, 4, 225,
878 36, 225, 205, 39, 72, 326, 327, 128, 129, 130,
879 131, 132, 133, 134, 217, 257, 258, 74, 37, 245,
880 246, 245, 246, 43, 244, 72, 77, 62, 73, 255,
881 29, 255, 35, 77, 75, 200, 45, 240, 241, 31,
882 4, 4, 66, 14, 4, 4, 211, 30, 268, 269,
883 37, 31, 4, 54, 4, 77, 29, 75, 284, 285,
884 284, 285, 227, 6, 31, 230, 44, 4, 271, 289,
885 66, 66, 66, 299, 31, 299, 31, 4, 304, 4,
886 304, 28, 31, 248, 22, 62, 312, 76, 312, 23,
887 3, 317, 76, 317, 4, 28, 4, 62, 77, 31,
888 326, 327, 326, 327, 4, 308, 309, 20, 21, 77,
889 4, 24, 24, 31, 27, 28, 31, 282, 24, 24,
890 33, 34, 6, 36, 205, 113, 39, 222, 197, 251,
891 116, 44, 4, 124, 138, 306, 126, 50, 135, 139,
892 122, 54, 55, 171, 57, 58, 271, 60, 20, 21,
893 63, 125, 24, 66, -1, 27, 28, -1, 71, 117,
894 -1, 33, 34, 76, 36, -1, -1, 39, -1, -1,
895 -1, -1, 44, -1, 6, 7, 8, 9, 50, -1,
896 -1, -1, -1, 55, -1, 57, 58, -1, 60, -1,
897 -1, 63, 24, -1, 66, -1, -1, -1, -1, 71,
898 -1, -1, -1, -1, 76, 7, 8, 9, -1, -1,
899 -1, -1, -1, -1, -1, -1, -1, -1, -1, 51,
900 52, 53, 24, -1, 56, -1, -1, 29, 60, -1,
901 -1, -1, -1, -1, 66, 67, 68, 69, 70, -1,
902 -1, 73, -1, -1, 76, -1, 78, -1, -1, 51,
903 52, 53, -1, -1, 56, 7, 8, 9, 60, -1,
904 -1, -1, -1, -1, 66, 67, 68, 69, 70, -1,
905 -1, 73, 24, -1, 76, -1, 78, -1, -1, -1,
906 -1, -1, -1, -1, -1, 7, 8, -1, -1, -1,
907 -1, -1, -1, -1, -1, -1, -1, -1, -1, 51,
908 52, 53, 24, -1, 56, -1, -1, -1, 60, -1,
909 -1, -1, -1, -1, 66, 67, 68, 69, 70, -1,
910 -1, 73, -1, -1, 76, -1, 78, -1, -1, 51,
911 52, 53, -1, -1, 56, -1, -1, -1, 60, -1,
912 -1, -1, -1, -1, 66, 67, 68, 69, 70, -1,
913 -1, 73, -1, -1, 76, -1, 78, 20, 21, 22,
914 23, 24, -1, -1, 27, 28, -1, -1, -1, -1,
915 33, 34, -1, 36, -1, -1, 39, -1, -1, -1,
916 -1, 44, -1, -1, -1, -1, -1, 50, -1, -1,
917 -1, -1, 55, -1, 57, 58, -1, 60, 20, 21,
918 63, -1, 24, 66, -1, 27, 28, -1, 71, -1,
919 -1, 33, 34, 76, 36, 37, -1, 39, -1, -1,
920 -1, -1, 44, -1, -1, -1, -1, -1, 50, -1,
921 -1, -1, -1, 55, -1, 57, 58, -1, 60, -1,
922 -1, 63, -1, -1, 66, -1, -1, -1, -1, 71,
923 -1, 20, 21, -1, 76, 24, -1, -1, 27, 28,
924 -1, -1, -1, -1, 33, 34, 35, 36, -1, -1,
925 39, -1, -1, -1, -1, 44, -1, -1, -1, -1,
926 -1, 50, -1, -1, -1, -1, 55, -1, 57, 58,
927 -1, 60, 20, 21, 63, -1, 24, 66, -1, 27,
928 28, -1, 71, 31, -1, 33, 34, 76, 36, -1,
929 -1, 39, -1, -1, -1, -1, 44, -1, -1, -1,
930 -1, -1, 50, -1, -1, -1, -1, 55, -1, 57,
931 58, -1, 60, 20, 21, 63, -1, 24, 66, -1,
932 27, 28, -1, 71, -1, -1, 33, 34, 76, 36,
933 -1, -1, 39, -1, -1, -1, -1, 44, -1, -1,
934 -1, -1, -1, 50, -1, -1, -1, -1, 55, -1,
935 57, 58, -1, 60, -1, 62, 63, -1, -1, 66,
936 -1, -1, -1, -1, 71, -1, 20, 21, -1, 76,
937 24, -1, -1, 27, 28, -1, -1, -1, -1, 33,
938 34, -1, 36, -1, -1, 39, -1, -1, -1, -1,
939 44, -1, -1, -1, -1, -1, 50, -1, -1, -1,
940 -1, 55, -1, 57, 58, -1, 60, -1, -1, 63,
941 -1, -1, 66, -1, -1, -1, -1, 71, -1, -1,
942 -1, -1, 76
943 };
944
945 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
946 symbol of state STATE-NUM. */
947 static const yytype_uint8 yystos[] =
948 {
949 0, 48, 88, 89, 49, 0, 90, 4, 3, 20,
950 21, 24, 27, 28, 33, 34, 36, 39, 44, 50,
951 54, 55, 57, 58, 60, 63, 66, 71, 76, 93,
952 94, 95, 96, 105, 130, 134, 135, 138, 139, 140,
953 144, 96, 97, 98, 144, 100, 101, 144, 7, 8,
954 9, 51, 52, 53, 56, 67, 68, 69, 70, 73,
955 78, 96, 116, 117, 118, 119, 120, 121, 122, 123,
956 124, 125, 126, 127, 128, 129, 130, 131, 132, 22,
957 23, 24, 36, 39, 116, 4, 34, 38, 103, 42,
958 144, 45, 144, 96, 59, 61, 94, 116, 4, 71,
959 6, 76, 112, 113, 114, 115, 116, 74, 22, 23,
960 76, 112, 114, 75, 6, 76, 75, 72, 121, 144,
961 129, 112, 14, 32, 13, 12, 11, 10, 15, 16,
962 17, 18, 72, 79, 80, 81, 78, 82, 19, 83,
963 84, 85, 86, 4, 91, 92, 93, 116, 144, 72,
964 116, 4, 112, 64, 65, 77, 94, 115, 116, 72,
965 75, 144, 144, 144, 97, 68, 69, 73, 99, 133,
966 100, 78, 102, 131, 117, 4, 94, 118, 119, 120,
967 121, 123, 123, 123, 123, 123, 123, 123, 124, 125,
968 125, 126, 127, 128, 128, 129, 91, 37, 92, 4,
969 43, 116, 4, 71, 145, 21, 136, 137, 138, 139,
970 140, 72, 62, 73, 77, 116, 115, 76, 114, 141,
971 141, 77, 75, 132, 91, 29, 35, 103, 91, 116,
972 40, 45, 111, 98, 31, 4, 4, 24, 66, 116,
973 46, 47, 142, 143, 144, 4, 4, 99, 30, 107,
974 108, 109, 94, 116, 37, 4, 116, 29, 115, 31,
975 4, 54, 136, 136, 25, 26, 55, 4, 144, 144,
976 77, 75, 114, 91, 91, 116, 29, 110, 108, 31,
977 106, 91, 41, 104, 145, 145, 44, 136, 4, 66,
978 66, 66, 136, 114, 114, 142, 31, 31, 32, 4,
979 31, 28, 62, 116, 4, 92, 91, 141, 76, 76,
980 22, 23, 4, 91, 28, 91, 111, 4, 143, 143,
981 91, 62, 91, 77, 77, 31, 4, 4, 24, 91,
982 91, 31, 31, 24, 24
983 };
984
985 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
986 static const yytype_uint8 yyr1[] =
987 {
988 0, 87, 88, 89, 89, 90, 90, 90, 91, 91,
989 92, 92, 93, 94, 94, 94, 94, 94, 95, 95,
990 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
991 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
992 95, 96, 96, 97, 97, 98, 98, 98, 99, 99,
993 100, 100, 101, 102, 102, 103, 103, 104, 104, 105,
994 105, 105, 106, 106, 107, 107, 108, 108, 109, 110,
995 110, 111, 111, 111, 112, 112, 113, 113, 114, 114,
996 115, 115, 116, 116, 117, 117, 118, 118, 119, 119,
997 120, 120, 121, 121, 122, 122, 122, 122, 122, 122,
998 122, 122, 123, 123, 124, 124, 124, 125, 125, 126,
999 126, 127, 127, 127, 128, 128, 129, 129, 129, 129,
1000 130, 130, 131, 131, 131, 131, 131, 131, 131, 132,
1001 132, 132, 132, 133, 133, 133, 134, 134, 135, 136,
1002 136, 136, 136, 136, 137, 137, 137, 138, 138, 139,
1003 139, 140, 140, 140, 141, 141, 142, 142, 143, 143,
1004 143, 144, 144, 145, 145
1005 };
1006
1007 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
1008 static const yytype_uint8 yyr2[] =
1009 {
1010 0, 2, 3, 0, 3, 0, 2, 2, 0, 1,
1011 1, 2, 2, 1, 2, 1, 3, 2, 2, 3,
1012 4, 2, 1, 5, 6, 6, 4, 1, 2, 2,
1013 2, 2, 2, 5, 1, 4, 4, 2, 10, 8,
1014 7, 1, 3, 1, 3, 1, 4, 2, 1, 3,
1015 1, 3, 3, 1, 2, 1, 1, 0, 2, 9,
1016 4, 7, 0, 2, 0, 1, 1, 2, 5, 0,
1017 3, 0, 4, 5, 1, 3, 1, 1, 0, 1,
1018 1, 3, 1, 3, 1, 3, 1, 3, 1, 3,
1019 1, 3, 1, 2, 1, 3, 3, 3, 3, 3,
1020 3, 3, 1, 3, 1, 3, 3, 1, 3, 1,
1021 3, 1, 3, 3, 1, 3, 1, 1, 2, 2,
1022 1, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1023 1, 1, 1, 1, 1, 1, 3, 1, 7, 0,
1024 3, 4, 4, 3, 9, 11, 11, 8, 8, 0,
1025 1, 2, 1, 1, 1, 3, 1, 3, 2, 3,
1026 3, 1, 1, 1, 1
1027 };
1028
1029
1030 #define yyerrok (yyerrstatus = 0)
1031 #define yyclearin (yychar = YYEMPTY)
1032 #define YYEMPTY (-2)
1033 #define YYEOF 0
1034
1035 #define YYACCEPT goto yyacceptlab
1036 #define YYABORT goto yyabortlab
1037 #define YYERROR goto yyerrorlab
1038
1039
1040 #define YYRECOVERING() (!!yyerrstatus)
1041
1042 #define YYBACKUP(Token, Value) \
1043 do \
1044 if (yychar == YYEMPTY) \
1045 { \
1046 yychar = (Token); \
1047 yylval = (Value); \
1048 YYPOPSTACK (yylen); \
1049 yystate = *yyssp; \
1050 goto yybackup; \
1051 } \
1052 else \
1053 { \
1054 yyerror (ctx, YY_("syntax error: cannot back up")); \
1055 YYERROR; \
1056 } \
1057 while (0)
1058
1059 /* Error token number */
1060 #define YYTERROR 1
1061 #define YYERRCODE 256
1062
1063
1064
1065 /* Enable debugging if requested. */
1066 #if YYDEBUG
1067
1068 # ifndef YYFPRINTF
1069 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1070 # define YYFPRINTF fprintf
1071 # endif
1072
1073 # define YYDPRINTF(Args) \
1074 do { \
1075 if (yydebug) \
1076 YYFPRINTF Args; \
1077 } while (0)
1078
1079 /* This macro is provided for backward compatibility. */
1080 #ifndef YY_LOCATION_PRINT
1081 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1082 #endif
1083
1084
1085 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1086 do { \
1087 if (yydebug) \
1088 { \
1089 YYFPRINTF (stderr, "%s ", Title); \
1090 yy_symbol_print (stderr, \
1091 Type, Value, ctx); \
1092 YYFPRINTF (stderr, "\n"); \
1093 } \
1094 } while (0)
1095
1096
1097 /*----------------------------------------.
1098 | Print this symbol's value on YYOUTPUT. |
1099 `----------------------------------------*/
1100
1101 static void
1102 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, parser_ctx_t *ctx)
1103 {
1104 FILE *yyo = yyoutput;
1105 YYUSE (yyo);
1106 YYUSE (ctx);
1107 if (!yyvaluep)
1108 return;
1109 # ifdef YYPRINT
1110 if (yytype < YYNTOKENS)
1111 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1112 # endif
1113 YYUSE (yytype);
1114 }
1115
1116
1117 /*--------------------------------.
1118 | Print this symbol on YYOUTPUT. |
1119 `--------------------------------*/
1120
1121 static void
1122 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, parser_ctx_t *ctx)
1123 {
1124 YYFPRINTF (yyoutput, "%s %s (",
1125 yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
1126
1127 yy_symbol_value_print (yyoutput, yytype, yyvaluep, ctx);
1128 YYFPRINTF (yyoutput, ")");
1129 }
1130
1131 /*------------------------------------------------------------------.
1132 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1133 | TOP (included). |
1134 `------------------------------------------------------------------*/
1135
1136 static void
1137 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
1138 {
1139 YYFPRINTF (stderr, "Stack now");
1140 for (; yybottom <= yytop; yybottom++)
1141 {
1142 int yybot = *yybottom;
1143 YYFPRINTF (stderr, " %d", yybot);
1144 }
1145 YYFPRINTF (stderr, "\n");
1146 }
1147
1148 # define YY_STACK_PRINT(Bottom, Top) \
1149 do { \
1150 if (yydebug) \
1151 yy_stack_print ((Bottom), (Top)); \
1152 } while (0)
1153
1154
1155 /*------------------------------------------------.
1156 | Report that the YYRULE is going to be reduced. |
1157 `------------------------------------------------*/
1158
1159 static void
1160 yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, parser_ctx_t *ctx)
1161 {
1162 unsigned long int yylno = yyrline[yyrule];
1163 int yynrhs = yyr2[yyrule];
1164 int yyi;
1165 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1166 yyrule - 1, yylno);
1167 /* The symbols being reduced. */
1168 for (yyi = 0; yyi < yynrhs; yyi++)
1169 {
1170 YYFPRINTF (stderr, " $%d = ", yyi + 1);
1171 yy_symbol_print (stderr,
1172 yystos[yyssp[yyi + 1 - yynrhs]],
1173 &(yyvsp[(yyi + 1) - (yynrhs)])
1174 , ctx);
1175 YYFPRINTF (stderr, "\n");
1176 }
1177 }
1178
1179 # define YY_REDUCE_PRINT(Rule) \
1180 do { \
1181 if (yydebug) \
1182 yy_reduce_print (yyssp, yyvsp, Rule, ctx); \
1183 } while (0)
1184
1185 /* Nonzero means print parse trace. It is left uninitialized so that
1186 multiple parsers can coexist. */
1187 int yydebug;
1188 #else /* !YYDEBUG */
1189 # define YYDPRINTF(Args)
1190 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1191 # define YY_STACK_PRINT(Bottom, Top)
1192 # define YY_REDUCE_PRINT(Rule)
1193 #endif /* !YYDEBUG */
1194
1195
1196 /* YYINITDEPTH -- initial size of the parser's stacks. */
1197 #ifndef YYINITDEPTH
1198 # define YYINITDEPTH 200
1199 #endif
1200
1201 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1202 if the built-in stack extension method is used).
1203
1204 Do not make this value too large; the results are undefined if
1205 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1206 evaluated with infinite-precision integer arithmetic. */
1207
1208 #ifndef YYMAXDEPTH
1209 # define YYMAXDEPTH 10000
1210 #endif
1211
1212
1213 #if YYERROR_VERBOSE
1214
1215 # ifndef yystrlen
1216 # if defined __GLIBC__ && defined _STRING_H
1217 # define yystrlen strlen
1218 # else
1219 /* Return the length of YYSTR. */
1220 static YYSIZE_T
1221 yystrlen (const char *yystr)
1222 {
1223 YYSIZE_T yylen;
1224 for (yylen = 0; yystr[yylen]; yylen++)
1225 continue;
1226 return yylen;
1227 }
1228 # endif
1229 # endif
1230
1231 # ifndef yystpcpy
1232 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1233 # define yystpcpy stpcpy
1234 # else
1235 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1236 YYDEST. */
1237 static char *
1238 yystpcpy (char *yydest, const char *yysrc)
1239 {
1240 char *yyd = yydest;
1241 const char *yys = yysrc;
1242
1243 while ((*yyd++ = *yys++) != '\0')
1244 continue;
1245
1246 return yyd - 1;
1247 }
1248 # endif
1249 # endif
1250
1251 # ifndef yytnamerr
1252 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1253 quotes and backslashes, so that it's suitable for yyerror. The
1254 heuristic is that double-quoting is unnecessary unless the string
1255 contains an apostrophe, a comma, or backslash (other than
1256 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1257 null, do not copy; instead, return the length of what the result
1258 would have been. */
1259 static YYSIZE_T
1260 yytnamerr (char *yyres, const char *yystr)
1261 {
1262 if (*yystr == '"')
1263 {
1264 YYSIZE_T yyn = 0;
1265 char const *yyp = yystr;
1266
1267 for (;;)
1268 switch (*++yyp)
1269 {
1270 case '\'':
1271 case ',':
1272 goto do_not_strip_quotes;
1273
1274 case '\\':
1275 if (*++yyp != '\\')
1276 goto do_not_strip_quotes;
1277 /* Fall through. */
1278 default:
1279 if (yyres)
1280 yyres[yyn] = *yyp;
1281 yyn++;
1282 break;
1283
1284 case '"':
1285 if (yyres)
1286 yyres[yyn] = '\0';
1287 return yyn;
1288 }
1289 do_not_strip_quotes: ;
1290 }
1291
1292 if (! yyres)
1293 return yystrlen (yystr);
1294
1295 return yystpcpy (yyres, yystr) - yyres;
1296 }
1297 # endif
1298
1299 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1300 about the unexpected token YYTOKEN for the state stack whose top is
1301 YYSSP.
1302
1303 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1304 not large enough to hold the message. In that case, also set
1305 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1306 required number of bytes is too large to store. */
1307 static int
1308 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1309 yytype_int16 *yyssp, int yytoken)
1310 {
1311 YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
1312 YYSIZE_T yysize = yysize0;
1313 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1314 /* Internationalized format string. */
1315 const char *yyformat = YY_NULLPTR;
1316 /* Arguments of yyformat. */
1317 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1318 /* Number of reported tokens (one for the "unexpected", one per
1319 "expected"). */
1320 int yycount = 0;
1321
1322 /* There are many possibilities here to consider:
1323 - If this state is a consistent state with a default action, then
1324 the only way this function was invoked is if the default action
1325 is an error action. In that case, don't check for expected
1326 tokens because there are none.
1327 - The only way there can be no lookahead present (in yychar) is if
1328 this state is a consistent state with a default action. Thus,
1329 detecting the absence of a lookahead is sufficient to determine
1330 that there is no unexpected or expected token to report. In that
1331 case, just report a simple "syntax error".
1332 - Don't assume there isn't a lookahead just because this state is a
1333 consistent state with a default action. There might have been a
1334 previous inconsistent state, consistent state with a non-default
1335 action, or user semantic action that manipulated yychar.
1336 - Of course, the expected token list depends on states to have
1337 correct lookahead information, and it depends on the parser not
1338 to perform extra reductions after fetching a lookahead from the
1339 scanner and before detecting a syntax error. Thus, state merging
1340 (from LALR or IELR) and default reductions corrupt the expected
1341 token list. However, the list is correct for canonical LR with
1342 one exception: it will still contain any token that will not be
1343 accepted due to an error action in a later state.
1344 */
1345 if (yytoken != YYEMPTY)
1346 {
1347 int yyn = yypact[*yyssp];
1348 yyarg[yycount++] = yytname[yytoken];
1349 if (!yypact_value_is_default (yyn))
1350 {
1351 /* Start YYX at -YYN if negative to avoid negative indexes in
1352 YYCHECK. In other words, skip the first -YYN actions for
1353 this state because they are default actions. */
1354 int yyxbegin = yyn < 0 ? -yyn : 0;
1355 /* Stay within bounds of both yycheck and yytname. */
1356 int yychecklim = YYLAST - yyn + 1;
1357 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1358 int yyx;
1359
1360 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1361 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1362 && !yytable_value_is_error (yytable[yyx + yyn]))
1363 {
1364 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1365 {
1366 yycount = 1;
1367 yysize = yysize0;
1368 break;
1369 }
1370 yyarg[yycount++] = yytname[yyx];
1371 {
1372 YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
1373 if (! (yysize <= yysize1
1374 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1375 return 2;
1376 yysize = yysize1;
1377 }
1378 }
1379 }
1380 }
1381
1382 switch (yycount)
1383 {
1384 # define YYCASE_(N, S) \
1385 case N: \
1386 yyformat = S; \
1387 break
1388 YYCASE_(0, YY_("syntax error"));
1389 YYCASE_(1, YY_("syntax error, unexpected %s"));
1390 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1391 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1392 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1393 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1394 # undef YYCASE_
1395 }
1396
1397 {
1398 YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
1399 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1400 return 2;
1401 yysize = yysize1;
1402 }
1403
1404 if (*yymsg_alloc < yysize)
1405 {
1406 *yymsg_alloc = 2 * yysize;
1407 if (! (yysize <= *yymsg_alloc
1408 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1409 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1410 return 1;
1411 }
1412
1413 /* Avoid sprintf, as that infringes on the user's name space.
1414 Don't have undefined behavior even if the translation
1415 produced a string with the wrong number of "%s"s. */
1416 {
1417 char *yyp = *yymsg;
1418 int yyi = 0;
1419 while ((*yyp = *yyformat) != '\0')
1420 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1421 {
1422 yyp += yytnamerr (yyp, yyarg[yyi++]);
1423 yyformat += 2;
1424 }
1425 else
1426 {
1427 yyp++;
1428 yyformat++;
1429 }
1430 }
1431 return 0;
1432 }
1433 #endif /* YYERROR_VERBOSE */
1434
1435 /*-----------------------------------------------.
1436 | Release the memory associated to this symbol. |
1437 `-----------------------------------------------*/
1438
1439 static void
1440 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, parser_ctx_t *ctx)
1441 {
1442 YYUSE (yyvaluep);
1443 YYUSE (ctx);
1444 if (!yymsg)
1445 yymsg = "Deleting";
1446 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1447
1448 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1449 YYUSE (yytype);
1450 YY_IGNORE_MAYBE_UNINITIALIZED_END
1451 }
1452
1453
1454
1455
1456 /*----------.
1457 | yyparse. |
1458 `----------*/
1459
1460 int
1461 yyparse (parser_ctx_t *ctx)
1462 {
1463 /* The lookahead symbol. */
1464 int yychar;
1465
1466
1467 /* The semantic value of the lookahead symbol. */
1468 /* Default value used for initialization, for pacifying older GCCs
1469 or non-GCC compilers. */
1470 YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
1471 YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
1472
1473 /* Number of syntax errors so far. */
1474 int yynerrs;
1475
1476 int yystate;
1477 /* Number of tokens to shift before error messages enabled. */
1478 int yyerrstatus;
1479
1480 /* The stacks and their tools:
1481 'yyss': related to states.
1482 'yyvs': related to semantic values.
1483
1484 Refer to the stacks through separate pointers, to allow yyoverflow
1485 to reallocate them elsewhere. */
1486
1487 /* The state stack. */
1488 yytype_int16 yyssa[YYINITDEPTH];
1489 yytype_int16 *yyss;
1490 yytype_int16 *yyssp;
1491
1492 /* The semantic value stack. */
1493 YYSTYPE yyvsa[YYINITDEPTH];
1494 YYSTYPE *yyvs;
1495 YYSTYPE *yyvsp;
1496
1497 YYSIZE_T yystacksize;
1498
1499 int yyn;
1500 int yyresult;
1501 /* Lookahead token as an internal (translated) token number. */
1502 int yytoken = 0;
1503 /* The variables used to return semantic value and location from the
1504 action routines. */
1505 YYSTYPE yyval;
1506
1507 #if YYERROR_VERBOSE
1508 /* Buffer for error messages, and its allocated size. */
1509 char yymsgbuf[128];
1510 char *yymsg = yymsgbuf;
1511 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1512 #endif
1513
1514 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1515
1516 /* The number of symbols on the RHS of the reduced rule.
1517 Keep to zero when no symbol should be popped. */
1518 int yylen = 0;
1519
1520 yyssp = yyss = yyssa;
1521 yyvsp = yyvs = yyvsa;
1522 yystacksize = YYINITDEPTH;
1523
1524 YYDPRINTF ((stderr, "Starting parse\n"));
1525
1526 yystate = 0;
1527 yyerrstatus = 0;
1528 yynerrs = 0;
1529 yychar = YYEMPTY; /* Cause a token to be read. */
1530 goto yysetstate;
1531
1532 /*------------------------------------------------------------.
1533 | yynewstate -- Push a new state, which is found in yystate. |
1534 `------------------------------------------------------------*/
1535 yynewstate:
1536 /* In all cases, when you get here, the value and location stacks
1537 have just been pushed. So pushing a state here evens the stacks. */
1538 yyssp++;
1539
1540 yysetstate:
1541 *yyssp = yystate;
1542
1543 if (yyss + yystacksize - 1 <= yyssp)
1544 {
1545 /* Get the current used size of the three stacks, in elements. */
1546 YYSIZE_T yysize = yyssp - yyss + 1;
1547
1548 #ifdef yyoverflow
1549 {
1550 /* Give user a chance to reallocate the stack. Use copies of
1551 these so that the &'s don't force the real ones into
1552 memory. */
1553 YYSTYPE *yyvs1 = yyvs;
1554 yytype_int16 *yyss1 = yyss;
1555
1556 /* Each stack pointer address is followed by the size of the
1557 data in use in that stack, in bytes. This used to be a
1558 conditional around just the two extra args, but that might
1559 be undefined if yyoverflow is a macro. */
1560 yyoverflow (YY_("memory exhausted"),
1561 &yyss1, yysize * sizeof (*yyssp),
1562 &yyvs1, yysize * sizeof (*yyvsp),
1563 &yystacksize);
1564
1565 yyss = yyss1;
1566 yyvs = yyvs1;
1567 }
1568 #else /* no yyoverflow */
1569 # ifndef YYSTACK_RELOCATE
1570 goto yyexhaustedlab;
1571 # else
1572 /* Extend the stack our own way. */
1573 if (YYMAXDEPTH <= yystacksize)
1574 goto yyexhaustedlab;
1575 yystacksize *= 2;
1576 if (YYMAXDEPTH < yystacksize)
1577 yystacksize = YYMAXDEPTH;
1578
1579 {
1580 yytype_int16 *yyss1 = yyss;
1581 union yyalloc *yyptr =
1582 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1583 if (! yyptr)
1584 goto yyexhaustedlab;
1585 YYSTACK_RELOCATE (yyss_alloc, yyss);
1586 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1587 # undef YYSTACK_RELOCATE
1588 if (yyss1 != yyssa)
1589 YYSTACK_FREE (yyss1);
1590 }
1591 # endif
1592 #endif /* no yyoverflow */
1593
1594 yyssp = yyss + yysize - 1;
1595 yyvsp = yyvs + yysize - 1;
1596
1597 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1598 (unsigned long int) yystacksize));
1599
1600 if (yyss + yystacksize - 1 <= yyssp)
1601 YYABORT;
1602 }
1603
1604 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1605
1606 if (yystate == YYFINAL)
1607 YYACCEPT;
1608
1609 goto yybackup;
1610
1611 /*-----------.
1612 | yybackup. |
1613 `-----------*/
1614 yybackup:
1615
1616 /* Do appropriate processing given the current state. Read a
1617 lookahead token if we need one and don't already have one. */
1618
1619 /* First try to decide what to do without reference to lookahead token. */
1620 yyn = yypact[yystate];
1621 if (yypact_value_is_default (yyn))
1622 goto yydefault;
1623
1624 /* Not known => get a lookahead token if don't already have one. */
1625
1626 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1627 if (yychar == YYEMPTY)
1628 {
1629 YYDPRINTF ((stderr, "Reading a token: "));
1630 yychar = yylex (&yylval, ctx);
1631 }
1632
1633 if (yychar <= YYEOF)
1634 {
1635 yychar = yytoken = YYEOF;
1636 YYDPRINTF ((stderr, "Now at end of input.\n"));
1637 }
1638 else
1639 {
1640 yytoken = YYTRANSLATE (yychar);
1641 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1642 }
1643
1644 /* If the proper action on seeing token YYTOKEN is to reduce or to
1645 detect an error, take that action. */
1646 yyn += yytoken;
1647 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1648 goto yydefault;
1649 yyn = yytable[yyn];
1650 if (yyn <= 0)
1651 {
1652 if (yytable_value_is_error (yyn))
1653 goto yyerrlab;
1654 yyn = -yyn;
1655 goto yyreduce;
1656 }
1657
1658 /* Count tokens shifted since error; after three, turn off error
1659 status. */
1660 if (yyerrstatus)
1661 yyerrstatus--;
1662
1663 /* Shift the lookahead token. */
1664 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1665
1666 /* Discard the shifted token. */
1667 yychar = YYEMPTY;
1668
1669 yystate = yyn;
1670 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1671 *++yyvsp = yylval;
1672 YY_IGNORE_MAYBE_UNINITIALIZED_END
1673
1674 goto yynewstate;
1675
1676
1677 /*-----------------------------------------------------------.
1678 | yydefault -- do the default action for the current state. |
1679 `-----------------------------------------------------------*/
1680 yydefault:
1681 yyn = yydefact[yystate];
1682 if (yyn == 0)
1683 goto yyerrlab;
1684 goto yyreduce;
1685
1686
1687 /*-----------------------------.
1688 | yyreduce -- Do a reduction. |
1689 `-----------------------------*/
1690 yyreduce:
1691 /* yyn is the number of a rule to reduce with. */
1692 yylen = yyr2[yyn];
1693
1694 /* If YYLEN is nonzero, implement the default value of the action:
1695 '$$ = $1'.
1696
1697 Otherwise, the following line sets YYVAL to garbage.
1698 This behavior is undocumented and Bison
1699 users should not rely upon it. Assigning to YYVAL
1700 unconditionally makes the parser a bit smaller, and it avoids a
1701 GCC warning that YYVAL may be used uninitialized. */
1702 yyval = yyvsp[1-yylen];
1703
1704
1705 YY_REDUCE_PRINT (yyn);
1706 switch (yyn)
1707 {
1708 case 2:
1709 #line 147 "parser.y" /* yacc.c:1646 */
1710 { parse_complete(ctx, (yyvsp[-2].boolean)); }
1711 #line 1717 "parser.tab.c" /* yacc.c:1646 */
1712 break;
1713
1714 case 3:
1715 #line 150 "parser.y" /* yacc.c:1646 */
1716 { (yyval.boolean) = FALSE; }
1717 #line 1723 "parser.tab.c" /* yacc.c:1646 */
1718 break;
1719
1720 case 4:
1721 #line 151 "parser.y" /* yacc.c:1646 */
1722 { (yyval.boolean) = TRUE; }
1723 #line 1729 "parser.tab.c" /* yacc.c:1646 */
1724 break;
1725
1726 case 6:
1727 #line 155 "parser.y" /* yacc.c:1646 */
1728 { source_add_statement(ctx, (yyvsp[0].statement)); }
1729 #line 1735 "parser.tab.c" /* yacc.c:1646 */
1730 break;
1731
1732 case 7:
1733 #line 156 "parser.y" /* yacc.c:1646 */
1734 { source_add_class(ctx, (yyvsp[0].class_decl)); }
1735 #line 1741 "parser.tab.c" /* yacc.c:1646 */
1736 break;
1737
1738 case 8:
1739 #line 159 "parser.y" /* yacc.c:1646 */
1740 { (yyval.statement) = NULL; }
1741 #line 1747 "parser.tab.c" /* yacc.c:1646 */
1742 break;
1743
1744 case 9:
1745 #line 160 "parser.y" /* yacc.c:1646 */
1746 { (yyval.statement) = (yyvsp[0].statement); }
1747 #line 1753 "parser.tab.c" /* yacc.c:1646 */
1748 break;
1749
1750 case 10:
1751 #line 163 "parser.y" /* yacc.c:1646 */
1752 { (yyval.statement) = (yyvsp[0].statement); }
1753 #line 1759 "parser.tab.c" /* yacc.c:1646 */
1754 break;
1755
1756 case 11:
1757 #line 164 "parser.y" /* yacc.c:1646 */
1758 { (yyval.statement) = link_statements((yyvsp[-1].statement), (yyvsp[0].statement)); }
1759 #line 1765 "parser.tab.c" /* yacc.c:1646 */
1760 break;
1761
1762 case 12:
1763 #line 167 "parser.y" /* yacc.c:1646 */
1764 { (yyval.statement) = (yyvsp[-1].statement); }
1765 #line 1771 "parser.tab.c" /* yacc.c:1646 */
1766 break;
1767
1768 case 13:
1769 #line 170 "parser.y" /* yacc.c:1646 */
1770 { (yyval.statement) = NULL; }
1771 #line 1777 "parser.tab.c" /* yacc.c:1646 */
1772 break;
1773
1774 case 14:
1775 #line 171 "parser.y" /* yacc.c:1646 */
1776 { (yyval.statement) = (yyvsp[0].statement); }
1777 #line 1783 "parser.tab.c" /* yacc.c:1646 */
1778 break;
1779
1780 case 15:
1781 #line 172 "parser.y" /* yacc.c:1646 */
1782 { (yyval.statement) = (yyvsp[0].statement); }
1783 #line 1789 "parser.tab.c" /* yacc.c:1646 */
1784 break;
1785
1786 case 16:
1787 #line 173 "parser.y" /* yacc.c:1646 */
1788 { (yyvsp[-2].statement)->next = (yyvsp[0].statement); (yyval.statement) = (yyvsp[-2].statement); }
1789 #line 1795 "parser.tab.c" /* yacc.c:1646 */
1790 break;
1791
1792 case 17:
1793 #line 174 "parser.y" /* yacc.c:1646 */
1794 { (yyval.statement) = (yyvsp[-1].statement); }
1795 #line 1801 "parser.tab.c" /* yacc.c:1646 */
1796 break;
1797
1798 case 18:
1799 #line 177 "parser.y" /* yacc.c:1646 */
1800 { (yyvsp[-1].member)->args = (yyvsp[0].expression); (yyval.statement) = new_call_statement(ctx, FALSE, (yyvsp[-1].member)); CHECK_ERROR; }
1801 #line 1807 "parser.tab.c" /* yacc.c:1646 */
1802 break;
1803
1804 case 19:
1805 #line 178 "parser.y" /* yacc.c:1646 */
1806 { (yyvsp[-1].member)->args = (yyvsp[0].expression); (yyval.statement) = new_call_statement(ctx, TRUE, (yyvsp[-1].member)); CHECK_ERROR; }
1807 #line 1813 "parser.tab.c" /* yacc.c:1646 */
1808 break;
1809
1810 case 20:
1811 #line 180 "parser.y" /* yacc.c:1646 */
1812 { (yyvsp[-3].member)->args = (yyvsp[-2].expression); (yyval.statement) = new_assign_statement(ctx, (yyvsp[-3].member), (yyvsp[0].expression)); CHECK_ERROR; }
1813 #line 1819 "parser.tab.c" /* yacc.c:1646 */
1814 break;
1815
1816 case 21:
1817 #line 181 "parser.y" /* yacc.c:1646 */
1818 { (yyval.statement) = new_dim_statement(ctx, (yyvsp[0].dim_decl)); CHECK_ERROR; }
1819 #line 1825 "parser.tab.c" /* yacc.c:1646 */
1820 break;
1821
1822 case 22:
1823 #line 182 "parser.y" /* yacc.c:1646 */
1824 { (yyval.statement) = (yyvsp[0].statement); }
1825 #line 1831 "parser.tab.c" /* yacc.c:1646 */
1826 break;
1827
1828 case 23:
1829 #line 184 "parser.y" /* yacc.c:1646 */
1830 { (yyval.statement) = new_while_statement(ctx, STAT_WHILE, (yyvsp[-3].expression), (yyvsp[-1].statement)); CHECK_ERROR; }
1831 #line 1837 "parser.tab.c" /* yacc.c:1646 */
1832 break;
1833
1834 case 24:
1835 #line 186 "parser.y" /* yacc.c:1646 */
1836 { (yyval.statement) = new_while_statement(ctx, (yyvsp[-4].boolean) ? STAT_WHILELOOP : STAT_UNTIL, (yyvsp[-3].expression), (yyvsp[-1].statement));
1837 CHECK_ERROR; }
1838 #line 1844 "parser.tab.c" /* yacc.c:1646 */
1839 break;
1840
1841 case 25:
1842 #line 189 "parser.y" /* yacc.c:1646 */
1843 { (yyval.statement) = new_while_statement(ctx, (yyvsp[-1].boolean) ? STAT_DOWHILE : STAT_DOUNTIL, (yyvsp[0].expression), (yyvsp[-3].statement));
1844 CHECK_ERROR; }
1845 #line 1851 "parser.tab.c" /* yacc.c:1646 */
1846 break;
1847
1848 case 26:
1849 #line 191 "parser.y" /* yacc.c:1646 */
1850 { (yyval.statement) = new_while_statement(ctx, STAT_DOWHILE, NULL, (yyvsp[-1].statement)); CHECK_ERROR; }
1851 #line 1857 "parser.tab.c" /* yacc.c:1646 */
1852 break;
1853
1854 case 27:
1855 #line 192 "parser.y" /* yacc.c:1646 */
1856 { (yyval.statement) = new_function_statement(ctx, (yyvsp[0].func_decl)); CHECK_ERROR; }
1857 #line 1863 "parser.tab.c" /* yacc.c:1646 */
1858 break;
1859
1860 case 28:
1861 #line 193 "parser.y" /* yacc.c:1646 */
1862 { (yyval.statement) = new_statement(ctx, STAT_EXITDO, 0); CHECK_ERROR; }
1863 #line 1869 "parser.tab.c" /* yacc.c:1646 */
1864 break;
1865
1866 case 29:
1867 #line 194 "parser.y" /* yacc.c:1646 */
1868 { (yyval.statement) = new_statement(ctx, STAT_EXITFOR, 0); CHECK_ERROR; }
1869 #line 1875 "parser.tab.c" /* yacc.c:1646 */
1870 break;
1871
1872 case 30:
1873 #line 195 "parser.y" /* yacc.c:1646 */
1874 { (yyval.statement) = new_statement(ctx, STAT_EXITFUNC, 0); CHECK_ERROR; }
1875 #line 1881 "parser.tab.c" /* yacc.c:1646 */
1876 break;
1877
1878 case 31:
1879 #line 196 "parser.y" /* yacc.c:1646 */
1880 { (yyval.statement) = new_statement(ctx, STAT_EXITPROP, 0); CHECK_ERROR; }
1881 #line 1887 "parser.tab.c" /* yacc.c:1646 */
1882 break;
1883
1884 case 32:
1885 #line 197 "parser.y" /* yacc.c:1646 */
1886 { (yyval.statement) = new_statement(ctx, STAT_EXITSUB, 0); CHECK_ERROR; }
1887 #line 1893 "parser.tab.c" /* yacc.c:1646 */
1888 break;
1889
1890 case 33:
1891 #line 199 "parser.y" /* yacc.c:1646 */
1892 { (yyvsp[-3].member)->args = (yyvsp[-2].expression); (yyval.statement) = new_set_statement(ctx, (yyvsp[-3].member), (yyvsp[0].expression)); CHECK_ERROR; }
1893 #line 1899 "parser.tab.c" /* yacc.c:1646 */
1894 break;
1895
1896 case 34:
1897 #line 200 "parser.y" /* yacc.c:1646 */
1898 { (yyval.statement) = new_statement(ctx, STAT_STOP, 0); CHECK_ERROR; }
1899 #line 1905 "parser.tab.c" /* yacc.c:1646 */
1900 break;
1901
1902 case 35:
1903 #line 201 "parser.y" /* yacc.c:1646 */
1904 { (yyval.statement) = new_onerror_statement(ctx, TRUE); CHECK_ERROR; }
1905 #line 1911 "parser.tab.c" /* yacc.c:1646 */
1906 break;
1907
1908 case 36:
1909 #line 202 "parser.y" /* yacc.c:1646 */
1910 { (yyval.statement) = new_onerror_statement(ctx, FALSE); CHECK_ERROR; }
1911 #line 1917 "parser.tab.c" /* yacc.c:1646 */
1912 break;
1913
1914 case 37:
1915 #line 203 "parser.y" /* yacc.c:1646 */
1916 { (yyval.statement) = new_const_statement(ctx, (yyvsp[0].const_decl)); CHECK_ERROR; }
1917 #line 1923 "parser.tab.c" /* yacc.c:1646 */
1918 break;
1919
1920 case 38:
1921 #line 205 "parser.y" /* yacc.c:1646 */
1922 { (yyval.statement) = new_forto_statement(ctx, (yyvsp[-8].string), (yyvsp[-6].expression), (yyvsp[-4].expression), (yyvsp[-3].expression), (yyvsp[-1].statement)); CHECK_ERROR; }
1923 #line 1929 "parser.tab.c" /* yacc.c:1646 */
1924 break;
1925
1926 case 39:
1927 #line 207 "parser.y" /* yacc.c:1646 */
1928 { (yyval.statement) = new_foreach_statement(ctx, (yyvsp[-5].string), (yyvsp[-3].expression), (yyvsp[-1].statement)); }
1929 #line 1935 "parser.tab.c" /* yacc.c:1646 */
1930 break;
1931
1932 case 40:
1933 #line 209 "parser.y" /* yacc.c:1646 */
1934 { (yyval.statement) = new_select_statement(ctx, (yyvsp[-4].expression), (yyvsp[-2].case_clausule)); }
1935 #line 1941 "parser.tab.c" /* yacc.c:1646 */
1936 break;
1937
1938 case 41:
1939 #line 212 "parser.y" /* yacc.c:1646 */
1940 { (yyval.member) = new_member_expression(ctx, NULL, (yyvsp[0].string)); CHECK_ERROR; }
1941 #line 1947 "parser.tab.c" /* yacc.c:1646 */
1942 break;
1943
1944 case 42:
1945 #line 213 "parser.y" /* yacc.c:1646 */
1946 { (yyval.member) = new_member_expression(ctx, (yyvsp[-2].expression), (yyvsp[0].string)); CHECK_ERROR; }
1947 #line 1953 "parser.tab.c" /* yacc.c:1646 */
1948 break;
1949
1950 case 43:
1951 #line 216 "parser.y" /* yacc.c:1646 */
1952 { (yyval.dim_decl) = (yyvsp[0].dim_decl); }
1953 #line 1959 "parser.tab.c" /* yacc.c:1646 */
1954 break;
1955
1956 case 44:
1957 #line 217 "parser.y" /* yacc.c:1646 */
1958 { (yyvsp[-2].dim_decl)->next = (yyvsp[0].dim_decl); (yyval.dim_decl) = (yyvsp[-2].dim_decl); }
1959 #line 1965 "parser.tab.c" /* yacc.c:1646 */
1960 break;
1961
1962 case 45:
1963 #line 220 "parser.y" /* yacc.c:1646 */
1964 { (yyval.dim_decl) = new_dim_decl(ctx, (yyvsp[0].string), FALSE, NULL); CHECK_ERROR; }
1965 #line 1971 "parser.tab.c" /* yacc.c:1646 */
1966 break;
1967
1968 case 46:
1969 #line 221 "parser.y" /* yacc.c:1646 */
1970 { (yyval.dim_decl) = new_dim_decl(ctx, (yyvsp[-3].string), TRUE, (yyvsp[-1].dim_list)); CHECK_ERROR; }
1971 #line 1977 "parser.tab.c" /* yacc.c:1646 */
1972 break;
1973
1974 case 47:
1975 #line 222 "parser.y" /* yacc.c:1646 */
1976 { (yyval.dim_decl) = new_dim_decl(ctx, (yyvsp[-1].string), TRUE, NULL); CHECK_ERROR; }
1977 #line 1983 "parser.tab.c" /* yacc.c:1646 */
1978 break;
1979
1980 case 48:
1981 #line 225 "parser.y" /* yacc.c:1646 */
1982 { (yyval.dim_list) = new_dim(ctx, (yyvsp[0].uint), NULL); }
1983 #line 1989 "parser.tab.c" /* yacc.c:1646 */
1984 break;
1985
1986 case 49:
1987 #line 226 "parser.y" /* yacc.c:1646 */
1988 { (yyval.dim_list) = new_dim(ctx, (yyvsp[-2].uint), (yyvsp[0].dim_list)); }
1989 #line 1995 "parser.tab.c" /* yacc.c:1646 */
1990 break;
1991
1992 case 50:
1993 #line 229 "parser.y" /* yacc.c:1646 */
1994 { (yyval.const_decl) = (yyvsp[0].const_decl); }
1995 #line 2001 "parser.tab.c" /* yacc.c:1646 */
1996 break;
1997
1998 case 51:
1999 #line 230 "parser.y" /* yacc.c:1646 */
2000 { (yyvsp[-2].const_decl)->next = (yyvsp[0].const_decl); (yyval.const_decl) = (yyvsp[-2].const_decl); }
2001 #line 2007 "parser.tab.c" /* yacc.c:1646 */
2002 break;
2003
2004 case 52:
2005 #line 233 "parser.y" /* yacc.c:1646 */
2006 { (yyval.const_decl) = new_const_decl(ctx, (yyvsp[-2].string), (yyvsp[0].expression)); CHECK_ERROR; }
2007 #line 2013 "parser.tab.c" /* yacc.c:1646 */
2008 break;
2009
2010 case 53:
2011 #line 236 "parser.y" /* yacc.c:1646 */
2012 { (yyval.expression) = (yyvsp[0].expression); }
2013 #line 2019 "parser.tab.c" /* yacc.c:1646 */
2014 break;
2015
2016 case 54:
2017 #line 237 "parser.y" /* yacc.c:1646 */
2018 { (yyval.expression) = new_unary_expression(ctx, EXPR_NEG, (yyvsp[0].expression)); CHECK_ERROR; }
2019 #line 2025 "parser.tab.c" /* yacc.c:1646 */
2020 break;
2021
2022 case 55:
2023 #line 240 "parser.y" /* yacc.c:1646 */
2024 { (yyval.boolean) = TRUE; }
2025 #line 2031 "parser.tab.c" /* yacc.c:1646 */
2026 break;
2027
2028 case 56:
2029 #line 241 "parser.y" /* yacc.c:1646 */
2030 { (yyval.boolean) = FALSE; }
2031 #line 2037 "parser.tab.c" /* yacc.c:1646 */
2032 break;
2033
2034 case 57:
2035 #line 244 "parser.y" /* yacc.c:1646 */
2036 { (yyval.expression) = NULL;}
2037 #line 2043 "parser.tab.c" /* yacc.c:1646 */
2038 break;
2039
2040 case 58:
2041 #line 245 "parser.y" /* yacc.c:1646 */
2042 { (yyval.expression) = (yyvsp[0].expression); }
2043 #line 2049 "parser.tab.c" /* yacc.c:1646 */
2044 break;
2045
2046 case 59:
2047 #line 249 "parser.y" /* yacc.c:1646 */
2048 { (yyval.statement) = new_if_statement(ctx, (yyvsp[-7].expression), (yyvsp[-4].statement), (yyvsp[-3].elseif), (yyvsp[-2].statement)); CHECK_ERROR; }
2049 #line 2055 "parser.tab.c" /* yacc.c:1646 */
2050 break;
2051
2052 case 60:
2053 #line 250 "parser.y" /* yacc.c:1646 */
2054 { (yyval.statement) = new_if_statement(ctx, (yyvsp[-2].expression), (yyvsp[0].statement), NULL, NULL); CHECK_ERROR; }
2055 #line 2061 "parser.tab.c" /* yacc.c:1646 */
2056 break;
2057
2058 case 61:
2059 #line 252 "parser.y" /* yacc.c:1646 */
2060 { (yyval.statement) = new_if_statement(ctx, (yyvsp[-5].expression), (yyvsp[-3].statement), NULL, (yyvsp[-1].statement)); CHECK_ERROR; }
2061 #line 2067 "parser.tab.c" /* yacc.c:1646 */
2062 break;
2063
2064 case 64:
2065 #line 259 "parser.y" /* yacc.c:1646 */
2066 { (yyval.elseif) = NULL; }
2067 #line 2073 "parser.tab.c" /* yacc.c:1646 */
2068 break;
2069
2070 case 65:
2071 #line 260 "parser.y" /* yacc.c:1646 */
2072 { (yyval.elseif) = (yyvsp[0].elseif); }
2073 #line 2079 "parser.tab.c" /* yacc.c:1646 */
2074 break;
2075
2076 case 66:
2077 #line 263 "parser.y" /* yacc.c:1646 */
2078 { (yyval.elseif) = (yyvsp[0].elseif); }
2079 #line 2085 "parser.tab.c" /* yacc.c:1646 */
2080 break;
2081
2082 case 67:
2083 #line 264 "parser.y" /* yacc.c:1646 */
2084 { (yyvsp[-1].elseif)->next = (yyvsp[0].elseif); (yyval.elseif) = (yyvsp[-1].elseif); }
2085 #line 2091 "parser.tab.c" /* yacc.c:1646 */
2086 break;
2087
2088 case 68:
2089 #line 268 "parser.y" /* yacc.c:1646 */
2090 { (yyval.elseif) = new_elseif_decl(ctx, (yyvsp[-3].expression), (yyvsp[0].statement)); }
2091 #line 2097 "parser.tab.c" /* yacc.c:1646 */
2092 break;
2093
2094 case 69:
2095 #line 271 "parser.y" /* yacc.c:1646 */
2096 { (yyval.statement) = NULL; }
2097 #line 2103 "parser.tab.c" /* yacc.c:1646 */
2098 break;
2099
2100 case 70:
2101 #line 272 "parser.y" /* yacc.c:1646 */
2102 { (yyval.statement) = (yyvsp[0].statement); }
2103 #line 2109 "parser.tab.c" /* yacc.c:1646 */
2104 break;
2105
2106 case 71:
2107 #line 275 "parser.y" /* yacc.c:1646 */
2108 { (yyval.case_clausule) = NULL; }
2109 #line 2115 "parser.tab.c" /* yacc.c:1646 */
2110 break;
2111
2112 case 72:
2113 #line 276 "parser.y" /* yacc.c:1646 */
2114 { (yyval.case_clausule) = new_case_clausule(ctx, NULL, (yyvsp[0].statement), NULL); }
2115 #line 2121 "parser.tab.c" /* yacc.c:1646 */
2116 break;
2117
2118 case 73:
2119 #line 278 "parser.y" /* yacc.c:1646 */
2120 { (yyval.case_clausule) = new_case_clausule(ctx, (yyvsp[-3].expression), (yyvsp[-1].statement), (yyvsp[0].case_clausule)); }
2121 #line 2127 "parser.tab.c" /* yacc.c:1646 */
2122 break;
2123
2124 case 74:
2125 #line 281 "parser.y" /* yacc.c:1646 */
2126 { (yyval.expression) = NULL; }
2127 #line 2133 "parser.tab.c" /* yacc.c:1646 */
2128 break;
2129
2130 case 75:
2131 #line 282 "parser.y" /* yacc.c:1646 */
2132 { (yyval.expression) = (yyvsp[-1].expression); }
2133 #line 2139 "parser.tab.c" /* yacc.c:1646 */
2134 break;
2135
2136 case 76:
2137 #line 285 "parser.y" /* yacc.c:1646 */
2138 { (yyval.expression) = NULL; }
2139 #line 2145 "parser.tab.c" /* yacc.c:1646 */
2140 break;
2141
2142 case 77:
2143 #line 286 "parser.y" /* yacc.c:1646 */
2144 { (yyval.expression) = (yyvsp[0].expression); }
2145 #line 2151 "parser.tab.c" /* yacc.c:1646 */
2146 break;
2147
2148 case 80:
2149 #line 293 "parser.y" /* yacc.c:1646 */
2150 { (yyval.expression) = (yyvsp[0].expression); }
2151 #line 2157 "parser.tab.c" /* yacc.c:1646 */
2152 break;
2153
2154 case 81:
2155 #line 294 "parser.y" /* yacc.c:1646 */
2156 { (yyvsp[-2].expression)->next = (yyvsp[0].expression); (yyval.expression) = (yyvsp[-2].expression); }
2157 #line 2163 "parser.tab.c" /* yacc.c:1646 */
2158 break;
2159
2160 case 82:
2161 #line 297 "parser.y" /* yacc.c:1646 */
2162 { (yyval.expression) = (yyvsp[0].expression); }
2163 #line 2169 "parser.tab.c" /* yacc.c:1646 */
2164 break;
2165
2166 case 83:
2167 #line 298 "parser.y" /* yacc.c:1646 */
2168 { (yyval.expression) = new_binary_expression(ctx, EXPR_IMP, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; }
2169 #line 2175 "parser.tab.c" /* yacc.c:1646 */
2170 break;
2171
2172 case 84:
2173 #line 301 "parser.y" /* yacc.c:1646 */
2174 { (yyval.expression) = (yyvsp[0].expression); }
2175 #line 2181 "parser.tab.c" /* yacc.c:1646 */
2176 break;
2177
2178 case 85:
2179 #line 302 "parser.y" /* yacc.c:1646 */
2180 { (yyval.expression) = new_binary_expression(ctx, EXPR_EQV, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; }
2181 #line 2187 "parser.tab.c" /* yacc.c:1646 */
2182 break;
2183
2184 case 86:
2185 #line 305 "parser.y" /* yacc.c:1646 */
2186 { (yyval.expression) = (yyvsp[0].expression); }
2187 #line 2193 "parser.tab.c" /* yacc.c:1646 */
2188 break;
2189
2190 case 87:
2191 #line 306 "parser.y" /* yacc.c:1646 */
2192 { (yyval.expression) = new_binary_expression(ctx, EXPR_XOR, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; }
2193 #line 2199 "parser.tab.c" /* yacc.c:1646 */
2194 break;
2195
2196 case 88:
2197 #line 309 "parser.y" /* yacc.c:1646 */
2198 { (yyval.expression) = (yyvsp[0].expression); }
2199 #line 2205 "parser.tab.c" /* yacc.c:1646 */
2200 break;
2201
2202 case 89:
2203 #line 310 "parser.y" /* yacc.c:1646 */
2204 { (yyval.expression) = new_binary_expression(ctx, EXPR_OR, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; }
2205 #line 2211 "parser.tab.c" /* yacc.c:1646 */
2206 break;
2207
2208 case 90:
2209 #line 313 "parser.y" /* yacc.c:1646 */
2210 { (yyval.expression) = (yyvsp[0].expression); }
2211 #line 2217 "parser.tab.c" /* yacc.c:1646 */
2212 break;
2213
2214 case 91:
2215 #line 314 "parser.y" /* yacc.c:1646 */
2216 { (yyval.expression) = new_binary_expression(ctx, EXPR_AND, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; }
2217 #line 2223 "parser.tab.c" /* yacc.c:1646 */
2218 break;
2219
2220 case 92:
2221 #line 317 "parser.y" /* yacc.c:1646 */
2222 { (yyval.expression) = (yyvsp[0].expression); }
2223 #line 2229 "parser.tab.c" /* yacc.c:1646 */
2224 break;
2225
2226 case 93:
2227 #line 318 "parser.y" /* yacc.c:1646 */
2228 { (yyval.expression) = new_unary_expression(ctx, EXPR_NOT, (yyvsp[0].expression)); CHECK_ERROR; }
2229 #line 2235 "parser.tab.c" /* yacc.c:1646 */
2230 break;
2231
2232 case 94:
2233 #line 321 "parser.y" /* yacc.c:1646 */
2234 { (yyval.expression) = (yyvsp[0].expression); }
2235 #line 2241 "parser.tab.c" /* yacc.c:1646 */
2236 break;
2237
2238 case 95:
2239 #line 322 "parser.y" /* yacc.c:1646 */
2240 { (yyval.expression) = new_binary_expression(ctx, EXPR_EQUAL, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; }
2241 #line 2247 "parser.tab.c" /* yacc.c:1646 */
2242 break;
2243
2244 case 96:
2245 #line 323 "parser.y" /* yacc.c:1646 */
2246 { (yyval.expression) = new_binary_expression(ctx, EXPR_NEQUAL, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; }
2247 #line 2253 "parser.tab.c" /* yacc.c:1646 */
2248 break;
2249
2250 case 97:
2251 #line 324 "parser.y" /* yacc.c:1646 */
2252 { (yyval.expression) = new_binary_expression(ctx, EXPR_GT, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; }
2253 #line 2259 "parser.tab.c" /* yacc.c:1646 */
2254 break;
2255
2256 case 98:
2257 #line 325 "parser.y" /* yacc.c:1646 */
2258 { (yyval.expression) = new_binary_expression(ctx, EXPR_LT, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; }
2259 #line 2265 "parser.tab.c" /* yacc.c:1646 */
2260 break;
2261
2262 case 99:
2263 #line 326 "parser.y" /* yacc.c:1646 */
2264 { (yyval.expression) = new_binary_expression(ctx, EXPR_GTEQ, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; }
2265 #line 2271 "parser.tab.c" /* yacc.c:1646 */
2266 break;
2267
2268 case 100:
2269 #line 327 "parser.y" /* yacc.c:1646 */
2270 { (yyval.expression) = new_binary_expression(ctx, EXPR_LTEQ, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; }
2271 #line 2277 "parser.tab.c" /* yacc.c:1646 */
2272 break;
2273
2274 case 101:
2275 #line 328 "parser.y" /* yacc.c:1646 */
2276 { (yyval.expression) = new_binary_expression(ctx, EXPR_IS, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; }
2277 #line 2283 "parser.tab.c" /* yacc.c:1646 */
2278 break;
2279
2280 case 102:
2281 #line 331 "parser.y" /* yacc.c:1646 */
2282 { (yyval.expression) = (yyvsp[0].expression); }
2283 #line 2289 "parser.tab.c" /* yacc.c:1646 */
2284 break;
2285
2286 case 103:
2287 #line 332 "parser.y" /* yacc.c:1646 */
2288 { (yyval.expression) = new_binary_expression(ctx, EXPR_CONCAT, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; }
2289 #line 2295 "parser.tab.c" /* yacc.c:1646 */
2290 break;
2291
2292 case 104:
2293 #line 335 "parser.y" /* yacc.c:1646 */
2294 { (yyval.expression) = (yyvsp[0].expression); }
2295 #line 2301 "parser.tab.c" /* yacc.c:1646 */
2296 break;
2297
2298 case 105:
2299 #line 336 "parser.y" /* yacc.c:1646 */
2300 { (yyval.expression) = new_binary_expression(ctx, EXPR_ADD, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; }
2301 #line 2307 "parser.tab.c" /* yacc.c:1646 */
2302 break;
2303
2304 case 106:
2305 #line 337 "parser.y" /* yacc.c:1646 */
2306 { (yyval.expression) = new_binary_expression(ctx, EXPR_SUB, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; }
2307 #line 2313 "parser.tab.c" /* yacc.c:1646 */
2308 break;
2309
2310 case 107:
2311 #line 340 "parser.y" /* yacc.c:1646 */
2312 { (yyval.expression) = (yyvsp[0].expression); }
2313 #line 2319 "parser.tab.c" /* yacc.c:1646 */
2314 break;
2315
2316 case 108:
2317 #line 341 "parser.y" /* yacc.c:1646 */
2318 { (yyval.expression) = new_binary_expression(ctx, EXPR_MOD, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; }
2319 #line 2325 "parser.tab.c" /* yacc.c:1646 */
2320 break;
2321
2322 case 109:
2323 #line 344 "parser.y" /* yacc.c:1646 */
2324 { (yyval.expression) = (yyvsp[0].expression); }
2325 #line 2331 "parser.tab.c" /* yacc.c:1646 */
2326 break;
2327
2328 case 110:
2329 #line 346 "parser.y" /* yacc.c:1646 */
2330 { (yyval.expression) = new_binary_expression(ctx, EXPR_IDIV, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; }
2331 #line 2337 "parser.tab.c" /* yacc.c:1646 */
2332 break;
2333
2334 case 111:
2335 #line 349 "parser.y" /* yacc.c:1646 */
2336 { (yyval.expression) = (yyvsp[0].expression); }
2337 #line 2343 "parser.tab.c" /* yacc.c:1646 */
2338 break;
2339
2340 case 112:
2341 #line 351 "parser.y" /* yacc.c:1646 */
2342 { (yyval.expression) = new_binary_expression(ctx, EXPR_MUL, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; }
2343 #line 2349 "parser.tab.c" /* yacc.c:1646 */
2344 break;
2345
2346 case 113:
2347 #line 353 "parser.y" /* yacc.c:1646 */
2348 { (yyval.expression) = new_binary_expression(ctx, EXPR_DIV, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; }
2349 #line 2355 "parser.tab.c" /* yacc.c:1646 */
2350 break;
2351
2352 case 114:
2353 #line 356 "parser.y" /* yacc.c:1646 */
2354 { (yyval.expression) = (yyvsp[0].expression); }
2355 #line 2361 "parser.tab.c" /* yacc.c:1646 */
2356 break;
2357
2358 case 115:
2359 #line 357 "parser.y" /* yacc.c:1646 */
2360 { (yyval.expression) = new_binary_expression(ctx, EXPR_EXP, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; }
2361 #line 2367 "parser.tab.c" /* yacc.c:1646 */
2362 break;
2363
2364 case 116:
2365 #line 360 "parser.y" /* yacc.c:1646 */
2366 { (yyval.expression) = (yyvsp[0].expression); }
2367 #line 2373 "parser.tab.c" /* yacc.c:1646 */
2368 break;
2369
2370 case 117:
2371 #line 361 "parser.y" /* yacc.c:1646 */
2372 { (yyval.expression) = (yyvsp[0].expression); }
2373 #line 2379 "parser.tab.c" /* yacc.c:1646 */
2374 break;
2375
2376 case 118:
2377 #line 362 "parser.y" /* yacc.c:1646 */
2378 { (yyval.expression) = new_new_expression(ctx, (yyvsp[0].string)); CHECK_ERROR; }
2379 #line 2385 "parser.tab.c" /* yacc.c:1646 */
2380 break;
2381
2382 case 119:
2383 #line 363 "parser.y" /* yacc.c:1646 */
2384 { (yyval.expression) = new_unary_expression(ctx, EXPR_NEG, (yyvsp[0].expression)); CHECK_ERROR; }
2385 #line 2391 "parser.tab.c" /* yacc.c:1646 */
2386 break;
2387
2388 case 120:
2389 #line 366 "parser.y" /* yacc.c:1646 */
2390 { (yyval.expression) = (yyvsp[0].expression); }
2391 #line 2397 "parser.tab.c" /* yacc.c:1646 */
2392 break;
2393
2394 case 121:
2395 #line 367 "parser.y" /* yacc.c:1646 */
2396 { (yyvsp[-1].member)->args = (yyvsp[0].expression); (yyval.expression) = &(yyvsp[-1].member)->expr; }
2397 #line 2403 "parser.tab.c" /* yacc.c:1646 */
2398 break;
2399
2400 case 122:
2401 #line 370 "parser.y" /* yacc.c:1646 */
2402 { (yyval.expression) = new_bool_expression(ctx, VARIANT_TRUE); CHECK_ERROR; }
2403 #line 2409 "parser.tab.c" /* yacc.c:1646 */
2404 break;
2405
2406 case 123:
2407 #line 371 "parser.y" /* yacc.c:1646 */
2408 { (yyval.expression) = new_bool_expression(ctx, VARIANT_FALSE); CHECK_ERROR; }
2409 #line 2415 "parser.tab.c" /* yacc.c:1646 */
2410 break;
2411
2412 case 124:
2413 #line 372 "parser.y" /* yacc.c:1646 */
2414 { (yyval.expression) = new_string_expression(ctx, (yyvsp[0].string)); CHECK_ERROR; }
2415 #line 2421 "parser.tab.c" /* yacc.c:1646 */
2416 break;
2417
2418 case 125:
2419 #line 373 "parser.y" /* yacc.c:1646 */
2420 { (yyval.expression) = (yyvsp[0].expression); }
2421 #line 2427 "parser.tab.c" /* yacc.c:1646 */
2422 break;
2423
2424 case 126:
2425 #line 374 "parser.y" /* yacc.c:1646 */
2426 { (yyval.expression) = new_expression(ctx, EXPR_EMPTY, 0); CHECK_ERROR; }
2427 #line 2433 "parser.tab.c" /* yacc.c:1646 */
2428 break;
2429
2430 case 127:
2431 #line 375 "parser.y" /* yacc.c:1646 */
2432 { (yyval.expression) = new_expression(ctx, EXPR_NULL, 0); CHECK_ERROR; }
2433 #line 2439 "parser.tab.c" /* yacc.c:1646 */
2434 break;
2435
2436 case 128:
2437 #line 376 "parser.y" /* yacc.c:1646 */
2438 { (yyval.expression) = new_expression(ctx, EXPR_NOTHING, 0); CHECK_ERROR; }
2439 #line 2445 "parser.tab.c" /* yacc.c:1646 */
2440 break;
2441
2442 case 129:
2443 #line 379 "parser.y" /* yacc.c:1646 */
2444 { (yyval.expression) = new_long_expression(ctx, EXPR_USHORT, (yyvsp[0].lng)); CHECK_ERROR; }
2445 #line 2451 "parser.tab.c" /* yacc.c:1646 */
2446 break;
2447
2448 case 130:
2449 #line 380 "parser.y" /* yacc.c:1646 */
2450 { (yyval.expression) = new_long_expression(ctx, EXPR_USHORT, 0); CHECK_ERROR; }
2451 #line 2457 "parser.tab.c" /* yacc.c:1646 */
2452 break;
2453
2454 case 131:
2455 #line 381 "parser.y" /* yacc.c:1646 */
2456 { (yyval.expression) = new_long_expression(ctx, EXPR_ULONG, (yyvsp[0].lng)); CHECK_ERROR; }
2457 #line 2463 "parser.tab.c" /* yacc.c:1646 */
2458 break;
2459
2460 case 132:
2461 #line 382 "parser.y" /* yacc.c:1646 */
2462 { (yyval.expression) = new_double_expression(ctx, (yyvsp[0].dbl)); CHECK_ERROR; }
2463 #line 2469 "parser.tab.c" /* yacc.c:1646 */
2464 break;
2465
2466 case 133:
2467 #line 385 "parser.y" /* yacc.c:1646 */
2468 { (yyval.uint) = (yyvsp[0].lng); }
2469 #line 2475 "parser.tab.c" /* yacc.c:1646 */
2470 break;
2471
2472 case 134:
2473 #line 386 "parser.y" /* yacc.c:1646 */
2474 { (yyval.uint) = 0; }
2475 #line 2481 "parser.tab.c" /* yacc.c:1646 */
2476 break;
2477
2478 case 135:
2479 #line 387 "parser.y" /* yacc.c:1646 */
2480 { (yyval.uint) = (yyvsp[0].lng); }
2481 #line 2487 "parser.tab.c" /* yacc.c:1646 */
2482 break;
2483
2484 case 136:
2485 #line 390 "parser.y" /* yacc.c:1646 */
2486 { (yyval.expression) = new_unary_expression(ctx, EXPR_BRACKETS, (yyvsp[-1].expression)); }
2487 #line 2493 "parser.tab.c" /* yacc.c:1646 */
2488 break;
2489
2490 case 137:
2491 #line 391 "parser.y" /* yacc.c:1646 */
2492 { (yyval.expression) = new_expression(ctx, EXPR_ME, 0); CHECK_ERROR; }
2493 #line 2499 "parser.tab.c" /* yacc.c:1646 */
2494 break;
2495
2496 case 138:
2497 #line 394 "parser.y" /* yacc.c:1646 */
2498 { (yyvsp[-3].class_decl)->name = (yyvsp[-5].string); (yyval.class_decl) = (yyvsp[-3].class_decl); }
2499 #line 2505 "parser.tab.c" /* yacc.c:1646 */
2500 break;
2501
2502 case 139:
2503 #line 397 "parser.y" /* yacc.c:1646 */
2504 { (yyval.class_decl) = new_class_decl(ctx); }
2505 #line 2511 "parser.tab.c" /* yacc.c:1646 */
2506 break;
2507
2508 case 140:
2509 #line 398 "parser.y" /* yacc.c:1646 */
2510 { (yyval.class_decl) = add_class_function(ctx, (yyvsp[0].class_decl), (yyvsp[-2].func_decl)); CHECK_ERROR; }
2511 #line 2517 "parser.tab.c" /* yacc.c:1646 */
2512 break;
2513
2514 case 141:
2515 #line 400 "parser.y" /* yacc.c:1646 */
2516 { dim_decl_t *dim_decl = new_dim_decl(ctx, (yyvsp[-2].string), FALSE, NULL); CHECK_ERROR;
2517 (yyval.class_decl) = add_dim_prop(ctx, (yyvsp[0].class_decl), dim_decl, (yyvsp[-3].uint)); CHECK_ERROR; }
2518 #line 2524 "parser.tab.c" /* yacc.c:1646 */
2519 break;
2520
2521 case 142:
2522 #line 402 "parser.y" /* yacc.c:1646 */
2523 { (yyval.class_decl) = add_dim_prop(ctx, (yyvsp[0].class_decl), (yyvsp[-2].dim_decl), 0); CHECK_ERROR; }
2524 #line 2530 "parser.tab.c" /* yacc.c:1646 */
2525 break;
2526
2527 case 143:
2528 #line 403 "parser.y" /* yacc.c:1646 */
2529 { (yyval.class_decl) = add_class_function(ctx, (yyvsp[0].class_decl), (yyvsp[-2].func_decl)); CHECK_ERROR; }
2530 #line 2536 "parser.tab.c" /* yacc.c:1646 */
2531 break;
2532
2533 case 144:
2534 #line 407 "parser.y" /* yacc.c:1646 */
2535 { (yyval.func_decl) = new_function_decl(ctx, (yyvsp[-5].string), FUNC_PROPGET, (yyvsp[-8].uint), (yyvsp[-4].arg_decl), (yyvsp[-2].statement)); CHECK_ERROR; }
2536 #line 2542 "parser.tab.c" /* yacc.c:1646 */
2537 break;
2538
2539 case 145:
2540 #line 409 "parser.y" /* yacc.c:1646 */
2541 { (yyval.func_decl) = new_function_decl(ctx, (yyvsp[-7].string), FUNC_PROPLET, (yyvsp[-10].uint), (yyvsp[-5].arg_decl), (yyvsp[-2].statement)); CHECK_ERROR; }
2542 #line 2548 "parser.tab.c" /* yacc.c:1646 */
2543 break;
2544
2545 case 146:
2546 #line 411 "parser.y" /* yacc.c:1646 */
2547 { (yyval.func_decl) = new_function_decl(ctx, (yyvsp[-7].string), FUNC_PROPSET, (yyvsp[-10].uint), (yyvsp[-5].arg_decl), (yyvsp[-2].statement)); CHECK_ERROR; }
2548 #line 2554 "parser.tab.c" /* yacc.c:1646 */
2549 break;
2550
2551 case 147:
2552 #line 415 "parser.y" /* yacc.c:1646 */
2553 { (yyval.func_decl) = new_function_decl(ctx, (yyvsp[-5].string), FUNC_SUB, (yyvsp[-7].uint), (yyvsp[-4].arg_decl), (yyvsp[-2].statement)); CHECK_ERROR; }
2554 #line 2560 "parser.tab.c" /* yacc.c:1646 */
2555 break;
2556
2557 case 148:
2558 #line 417 "parser.y" /* yacc.c:1646 */
2559 { (yyval.func_decl) = new_function_decl(ctx, (yyvsp[-5].string), FUNC_FUNCTION, (yyvsp[-7].uint), (yyvsp[-4].arg_decl), (yyvsp[-2].statement)); CHECK_ERROR; }
2560 #line 2566 "parser.tab.c" /* yacc.c:1646 */
2561 break;
2562
2563 case 149:
2564 #line 420 "parser.y" /* yacc.c:1646 */
2565 { (yyval.uint) = 0; }
2566 #line 2572 "parser.tab.c" /* yacc.c:1646 */
2567 break;
2568
2569 case 150:
2570 #line 421 "parser.y" /* yacc.c:1646 */
2571 { (yyval.uint) = (yyvsp[0].uint); }
2572 #line 2578 "parser.tab.c" /* yacc.c:1646 */
2573 break;
2574
2575 case 151:
2576 #line 424 "parser.y" /* yacc.c:1646 */
2577 { (yyval.uint) = STORAGE_IS_DEFAULT; }
2578 #line 2584 "parser.tab.c" /* yacc.c:1646 */
2579 break;
2580
2581 case 152:
2582 #line 425 "parser.y" /* yacc.c:1646 */
2583 { (yyval.uint) = 0; }
2584 #line 2590 "parser.tab.c" /* yacc.c:1646 */
2585 break;
2586
2587 case 153:
2588 #line 426 "parser.y" /* yacc.c:1646 */
2589 { (yyval.uint) = STORAGE_IS_PRIVATE; }
2590 #line 2596 "parser.tab.c" /* yacc.c:1646 */
2591 break;
2592
2593 case 154:
2594 #line 429 "parser.y" /* yacc.c:1646 */
2595 { (yyval.arg_decl) = NULL; }
2596 #line 2602 "parser.tab.c" /* yacc.c:1646 */
2597 break;
2598
2599 case 155:
2600 #line 430 "parser.y" /* yacc.c:1646 */
2601 { (yyval.arg_decl) = (yyvsp[-1].arg_decl); }
2602 #line 2608 "parser.tab.c" /* yacc.c:1646 */
2603 break;
2604
2605 case 156:
2606 #line 433 "parser.y" /* yacc.c:1646 */
2607 { (yyval.arg_decl) = (yyvsp[0].arg_decl); }
2608 #line 2614 "parser.tab.c" /* yacc.c:1646 */
2609 break;
2610
2611 case 157:
2612 #line 434 "parser.y" /* yacc.c:1646 */
2613 { (yyvsp[-2].arg_decl)->next = (yyvsp[0].arg_decl); (yyval.arg_decl) = (yyvsp[-2].arg_decl); }
2614 #line 2620 "parser.tab.c" /* yacc.c:1646 */
2615 break;
2616
2617 case 158:
2618 #line 437 "parser.y" /* yacc.c:1646 */
2619 { (yyval.arg_decl) = new_argument_decl(ctx, (yyvsp[-1].string), TRUE); }
2620 #line 2626 "parser.tab.c" /* yacc.c:1646 */
2621 break;
2622
2623 case 159:
2624 #line 438 "parser.y" /* yacc.c:1646 */
2625 { (yyval.arg_decl) = new_argument_decl(ctx, (yyvsp[-1].string), TRUE); }
2626 #line 2632 "parser.tab.c" /* yacc.c:1646 */
2627 break;
2628
2629 case 160:
2630 #line 439 "parser.y" /* yacc.c:1646 */
2631 { (yyval.arg_decl) = new_argument_decl(ctx, (yyvsp[-1].string), FALSE); }
2632 #line 2638 "parser.tab.c" /* yacc.c:1646 */
2633 break;
2634
2635 case 161:
2636 #line 443 "parser.y" /* yacc.c:1646 */
2637 { (yyval.string) = (yyvsp[0].string); }
2638 #line 2644 "parser.tab.c" /* yacc.c:1646 */
2639 break;
2640
2641 case 162:
2642 #line 444 "parser.y" /* yacc.c:1646 */
2643 { (yyval.string) = propertyW; }
2644 #line 2650 "parser.tab.c" /* yacc.c:1646 */
2645 break;
2646
2647
2648 #line 2654 "parser.tab.c" /* yacc.c:1646 */
2649 default: break;
2650 }
2651 /* User semantic actions sometimes alter yychar, and that requires
2652 that yytoken be updated with the new translation. We take the
2653 approach of translating immediately before every use of yytoken.
2654 One alternative is translating here after every semantic action,
2655 but that translation would be missed if the semantic action invokes
2656 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2657 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2658 incorrect destructor might then be invoked immediately. In the
2659 case of YYERROR or YYBACKUP, subsequent parser actions might lead
2660 to an incorrect destructor call or verbose syntax error message
2661 before the lookahead is translated. */
2662 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2663
2664 YYPOPSTACK (yylen);
2665 yylen = 0;
2666 YY_STACK_PRINT (yyss, yyssp);
2667
2668 *++yyvsp = yyval;
2669
2670 /* Now 'shift' the result of the reduction. Determine what state
2671 that goes to, based on the state we popped back to and the rule
2672 number reduced by. */
2673
2674 yyn = yyr1[yyn];
2675
2676 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2677 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2678 yystate = yytable[yystate];
2679 else
2680 yystate = yydefgoto[yyn - YYNTOKENS];
2681
2682 goto yynewstate;
2683
2684
2685 /*--------------------------------------.
2686 | yyerrlab -- here on detecting error. |
2687 `--------------------------------------*/
2688 yyerrlab:
2689 /* Make sure we have latest lookahead translation. See comments at
2690 user semantic actions for why this is necessary. */
2691 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
2692
2693 /* If not already recovering from an error, report this error. */
2694 if (!yyerrstatus)
2695 {
2696 ++yynerrs;
2697 #if ! YYERROR_VERBOSE
2698 yyerror (ctx, YY_("syntax error"));
2699 #else
2700 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2701 yyssp, yytoken)
2702 {
2703 char const *yymsgp = YY_("syntax error");
2704 int yysyntax_error_status;
2705 yysyntax_error_status = YYSYNTAX_ERROR;
2706 if (yysyntax_error_status == 0)
2707 yymsgp = yymsg;
2708 else if (yysyntax_error_status == 1)
2709 {
2710 if (yymsg != yymsgbuf)
2711 YYSTACK_FREE (yymsg);
2712 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
2713 if (!yymsg)
2714 {
2715 yymsg = yymsgbuf;
2716 yymsg_alloc = sizeof yymsgbuf;
2717 yysyntax_error_status = 2;
2718 }
2719 else
2720 {
2721 yysyntax_error_status = YYSYNTAX_ERROR;
2722 yymsgp = yymsg;
2723 }
2724 }
2725 yyerror (ctx, yymsgp);
2726 if (yysyntax_error_status == 2)
2727 goto yyexhaustedlab;
2728 }
2729 # undef YYSYNTAX_ERROR
2730 #endif
2731 }
2732
2733
2734
2735 if (yyerrstatus == 3)
2736 {
2737 /* If just tried and failed to reuse lookahead token after an
2738 error, discard it. */
2739
2740 if (yychar <= YYEOF)
2741 {
2742 /* Return failure if at end of input. */
2743 if (yychar == YYEOF)
2744 YYABORT;
2745 }
2746 else
2747 {
2748 yydestruct ("Error: discarding",
2749 yytoken, &yylval, ctx);
2750 yychar = YYEMPTY;
2751 }
2752 }
2753
2754 /* Else will try to reuse lookahead token after shifting the error
2755 token. */
2756 goto yyerrlab1;
2757
2758
2759 /*---------------------------------------------------.
2760 | yyerrorlab -- error raised explicitly by YYERROR. |
2761 `---------------------------------------------------*/
2762 yyerrorlab:
2763
2764 /* Pacify compilers like GCC when the user code never invokes
2765 YYERROR and the label yyerrorlab therefore never appears in user
2766 code. */
2767 if (/*CONSTCOND*/ 0)
2768 goto yyerrorlab;
2769
2770 /* Do not reclaim the symbols of the rule whose action triggered
2771 this YYERROR. */
2772 YYPOPSTACK (yylen);
2773 yylen = 0;
2774 YY_STACK_PRINT (yyss, yyssp);
2775 yystate = *yyssp;
2776 goto yyerrlab1;
2777
2778
2779 /*-------------------------------------------------------------.
2780 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2781 `-------------------------------------------------------------*/
2782 yyerrlab1:
2783 yyerrstatus = 3; /* Each real token shifted decrements this. */
2784
2785 for (;;)
2786 {
2787 yyn = yypact[yystate];
2788 if (!yypact_value_is_default (yyn))
2789 {
2790 yyn += YYTERROR;
2791 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2792 {
2793 yyn = yytable[yyn];
2794 if (0 < yyn)
2795 break;
2796 }
2797 }
2798
2799 /* Pop the current state because it cannot handle the error token. */
2800 if (yyssp == yyss)
2801 YYABORT;
2802
2803
2804 yydestruct ("Error: popping",
2805 yystos[yystate], yyvsp, ctx);
2806 YYPOPSTACK (1);
2807 yystate = *yyssp;
2808 YY_STACK_PRINT (yyss, yyssp);
2809 }
2810
2811 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2812 *++yyvsp = yylval;
2813 YY_IGNORE_MAYBE_UNINITIALIZED_END
2814
2815
2816 /* Shift the error token. */
2817 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2818
2819 yystate = yyn;
2820 goto yynewstate;
2821
2822
2823 /*-------------------------------------.
2824 | yyacceptlab -- YYACCEPT comes here. |
2825 `-------------------------------------*/
2826 yyacceptlab:
2827 yyresult = 0;
2828 goto yyreturn;
2829
2830 /*-----------------------------------.
2831 | yyabortlab -- YYABORT comes here. |
2832 `-----------------------------------*/
2833 yyabortlab:
2834 yyresult = 1;
2835 goto yyreturn;
2836
2837 #if !defined yyoverflow || YYERROR_VERBOSE
2838 /*-------------------------------------------------.
2839 | yyexhaustedlab -- memory exhaustion comes here. |
2840 `-------------------------------------------------*/
2841 yyexhaustedlab:
2842 yyerror (ctx, YY_("memory exhausted"));
2843 yyresult = 2;
2844 /* Fall through. */
2845 #endif
2846
2847 yyreturn:
2848 if (yychar != YYEMPTY)
2849 {
2850 /* Make sure we have latest lookahead translation. See comments at
2851 user semantic actions for why this is necessary. */
2852 yytoken = YYTRANSLATE (yychar);
2853 yydestruct ("Cleanup: discarding lookahead",
2854 yytoken, &yylval, ctx);
2855 }
2856 /* Do not reclaim the symbols of the rule whose action triggered
2857 this YYABORT or YYACCEPT. */
2858 YYPOPSTACK (yylen);
2859 YY_STACK_PRINT (yyss, yyssp);
2860 while (yyssp != yyss)
2861 {
2862 yydestruct ("Cleanup: popping",
2863 yystos[*yyssp], yyvsp, ctx);
2864 YYPOPSTACK (1);
2865 }
2866 #ifndef yyoverflow
2867 if (yyss != yyssa)
2868 YYSTACK_FREE (yyss);
2869 #endif
2870 #if YYERROR_VERBOSE
2871 if (yymsg != yymsgbuf)
2872 YYSTACK_FREE (yymsg);
2873 #endif
2874 return yyresult;
2875 }
2876 #line 451 "parser.y" /* yacc.c:1906 */
2877
2878
2879 static int parser_error(parser_ctx_t *ctx, const char *str)
2880 {
2881 return 0;
2882 }
2883
2884 static void source_add_statement(parser_ctx_t *ctx, statement_t *stat)
2885 {
2886 if(!stat)
2887 return;
2888
2889 if(ctx->stats) {
2890 ctx->stats_tail->next = stat;
2891 ctx->stats_tail = stat;
2892 }else {
2893 ctx->stats = ctx->stats_tail = stat;
2894 }
2895 }
2896
2897 static void source_add_class(parser_ctx_t *ctx, class_decl_t *class_decl)
2898 {
2899 class_decl->next = ctx->class_decls;
2900 ctx->class_decls = class_decl;
2901 }
2902
2903 static void parse_complete(parser_ctx_t *ctx, BOOL option_explicit)
2904 {
2905 ctx->parse_complete = TRUE;
2906 ctx->option_explicit = option_explicit;
2907 }
2908
2909 static void *new_expression(parser_ctx_t *ctx, expression_type_t type, size_t size)
2910 {
2911 expression_t *expr;
2912
2913 expr = parser_alloc(ctx, size ? size : sizeof(*expr));
2914 if(expr) {
2915 expr->type = type;
2916 expr->next = NULL;
2917 }
2918
2919 return expr;
2920 }
2921
2922 static expression_t *new_bool_expression(parser_ctx_t *ctx, VARIANT_BOOL value)
2923 {
2924 bool_expression_t *expr;
2925
2926 expr = new_expression(ctx, EXPR_BOOL, sizeof(*expr));
2927 if(!expr)
2928 return NULL;
2929
2930 expr->value = value;
2931 return &expr->expr;
2932 }
2933
2934 static expression_t *new_string_expression(parser_ctx_t *ctx, const WCHAR *value)
2935 {
2936 string_expression_t *expr;
2937
2938 expr = new_expression(ctx, EXPR_STRING, sizeof(*expr));
2939 if(!expr)
2940 return NULL;
2941
2942 expr->value = value;
2943 return &expr->expr;
2944 }
2945
2946 static expression_t *new_long_expression(parser_ctx_t *ctx, expression_type_t type, LONG value)
2947 {
2948 int_expression_t *expr;
2949
2950 expr = new_expression(ctx, type, sizeof(*expr));
2951 if(!expr)
2952 return NULL;
2953
2954 expr->value = value;
2955 return &expr->expr;
2956 }
2957
2958 static expression_t *new_double_expression(parser_ctx_t *ctx, double value)
2959 {
2960 double_expression_t *expr;
2961
2962 expr = new_expression(ctx, EXPR_DOUBLE, sizeof(*expr));
2963 if(!expr)
2964 return NULL;
2965
2966 expr->value = value;
2967 return &expr->expr;
2968 }
2969
2970 static expression_t *new_unary_expression(parser_ctx_t *ctx, expression_type_t type, expression_t *subexpr)
2971 {
2972 unary_expression_t *expr;
2973
2974 expr = new_expression(ctx, type, sizeof(*expr));
2975 if(!expr)
2976 return NULL;
2977
2978 expr->subexpr = subexpr;
2979 return &expr->expr;
2980 }
2981
2982 static expression_t *new_binary_expression(parser_ctx_t *ctx, expression_type_t type, expression_t *left, expression_t *right)
2983 {
2984 binary_expression_t *expr;
2985
2986 expr = new_expression(ctx, type, sizeof(*expr));
2987 if(!expr)
2988 return NULL;
2989
2990 expr->left = left;
2991 expr->right = right;
2992 return &expr->expr;
2993 }
2994
2995 static member_expression_t *new_member_expression(parser_ctx_t *ctx, expression_t *obj_expr, const WCHAR *identifier)
2996 {
2997 member_expression_t *expr;
2998
2999 expr = new_expression(ctx, EXPR_MEMBER, sizeof(*expr));
3000 if(!expr)
3001 return NULL;
3002
3003 expr->obj_expr = obj_expr;
3004 expr->identifier = identifier;
3005 expr->args = NULL;
3006 return expr;
3007 }
3008
3009 static expression_t *new_new_expression(parser_ctx_t *ctx, const WCHAR *identifier)
3010 {
3011 string_expression_t *expr;
3012
3013 expr = new_expression(ctx, EXPR_NEW, sizeof(*expr));
3014 if(!expr)
3015 return NULL;
3016
3017 expr->value = identifier;
3018 return &expr->expr;
3019 }
3020
3021 static void *new_statement(parser_ctx_t *ctx, statement_type_t type, size_t size)
3022 {
3023 statement_t *stat;
3024
3025 stat = parser_alloc(ctx, size ? size : sizeof(*stat));
3026 if(stat) {
3027 stat->type = type;
3028 stat->next = NULL;
3029 }
3030
3031 return stat;
3032 }
3033
3034 static statement_t *new_call_statement(parser_ctx_t *ctx, BOOL is_strict, member_expression_t *expr)
3035 {
3036 call_statement_t *stat;
3037
3038 stat = new_statement(ctx, STAT_CALL, sizeof(*stat));
3039 if(!stat)
3040 return NULL;
3041
3042 stat->expr = expr;
3043 stat->is_strict = is_strict;
3044 return &stat->stat;
3045 }
3046
3047 static statement_t *new_assign_statement(parser_ctx_t *ctx, member_expression_t *left, expression_t *right)
3048 {
3049 assign_statement_t *stat;
3050
3051 stat = new_statement(ctx, STAT_ASSIGN, sizeof(*stat));
3052 if(!stat)
3053 return NULL;
3054
3055 stat->member_expr = left;
3056 stat->value_expr = right;
3057 return &stat->stat;
3058 }
3059
3060 static statement_t *new_set_statement(parser_ctx_t *ctx, member_expression_t *left, expression_t *right)
3061 {
3062 assign_statement_t *stat;
3063
3064 stat = new_statement(ctx, STAT_SET, sizeof(*stat));
3065 if(!stat)
3066 return NULL;
3067
3068 stat->member_expr = left;
3069 stat->value_expr = right;
3070 return &stat->stat;
3071 }
3072
3073 static dim_decl_t *new_dim_decl(parser_ctx_t *ctx, const WCHAR *name, BOOL is_array, dim_list_t *dims)
3074 {
3075 dim_decl_t *decl;
3076
3077 decl = parser_alloc(ctx, sizeof(*decl));
3078 if(!decl)
3079 return NULL;
3080
3081 decl->name = name;
3082 decl->is_array = is_array;
3083 decl->dims = dims;
3084 decl->next = NULL;
3085 return decl;
3086 }
3087
3088 static dim_list_t *new_dim(parser_ctx_t *ctx, unsigned val, dim_list_t *next)
3089 {
3090 dim_list_t *ret;
3091
3092 ret = parser_alloc(ctx, sizeof(*ret));
3093 if(!ret)
3094 return NULL;
3095
3096 ret->val = val;
3097 ret->next = next;
3098 return ret;
3099 }
3100
3101 static statement_t *new_dim_statement(parser_ctx_t *ctx, dim_decl_t *decls)
3102 {
3103 dim_statement_t *stat;
3104
3105 stat = new_statement(ctx, STAT_DIM, sizeof(*stat));
3106 if(!stat)
3107 return NULL;
3108
3109 stat->dim_decls = decls;
3110 return &stat->stat;
3111 }
3112
3113 static elseif_decl_t *new_elseif_decl(parser_ctx_t *ctx, expression_t *expr, statement_t *stat)
3114 {
3115 elseif_decl_t *decl;
3116
3117 decl = parser_alloc(ctx, sizeof(*decl));
3118 if(!decl)
3119 return NULL;
3120
3121 decl->expr = expr;
3122 decl->stat = stat;
3123 decl->next = NULL;
3124 return decl;
3125 }
3126
3127 static statement_t *new_while_statement(parser_ctx_t *ctx, statement_type_t type, expression_t *expr, statement_t *body)
3128 {
3129 while_statement_t *stat;
3130
3131 stat = new_statement(ctx, type, sizeof(*stat));
3132 if(!stat)
3133 return NULL;
3134
3135 stat->expr = expr;
3136 stat->body = body;
3137 return &stat->stat;
3138 }
3139
3140 static statement_t *new_forto_statement(parser_ctx_t *ctx, const WCHAR *identifier, expression_t *from_expr,
3141 expression_t *to_expr, expression_t *step_expr, statement_t *body)
3142 {
3143 forto_statement_t *stat;
3144
3145 stat = new_statement(ctx, STAT_FORTO, sizeof(*stat));
3146 if(!stat)
3147 return NULL;
3148
3149 stat->identifier = identifier;
3150 stat->from_expr = from_expr;
3151 stat->to_expr = to_expr;
3152 stat->step_expr = step_expr;
3153 stat->body = body;
3154 return &stat->stat;
3155 }
3156
3157 static statement_t *new_foreach_statement(parser_ctx_t *ctx, const WCHAR *identifier, expression_t *group_expr,
3158 statement_t *body)
3159 {
3160 foreach_statement_t *stat;
3161
3162 stat = new_statement(ctx, STAT_FOREACH, sizeof(*stat));
3163 if(!stat)
3164 return NULL;
3165
3166 stat->identifier = identifier;
3167 stat->group_expr = group_expr;
3168 stat->body = body;
3169 return &stat->stat;
3170 }
3171
3172 static statement_t *new_if_statement(parser_ctx_t *ctx, expression_t *expr, statement_t *if_stat, elseif_decl_t *elseif_decl,
3173 statement_t *else_stat)
3174 {
3175 if_statement_t *stat;
3176
3177 stat = new_statement(ctx, STAT_IF, sizeof(*stat));
3178 if(!stat)
3179 return NULL;
3180
3181 stat->expr = expr;
3182 stat->if_stat = if_stat;
3183 stat->elseifs = elseif_decl;
3184 stat->else_stat = else_stat;
3185 return &stat->stat;
3186 }
3187
3188 static statement_t *new_select_statement(parser_ctx_t *ctx, expression_t *expr, case_clausule_t *case_clausules)
3189 {
3190 select_statement_t *stat;
3191
3192 stat = new_statement(ctx, STAT_SELECT, sizeof(*stat));
3193 if(!stat)
3194 return NULL;
3195
3196 stat->expr = expr;
3197 stat->case_clausules = case_clausules;
3198 return &stat->stat;
3199 }
3200
3201 static case_clausule_t *new_case_clausule(parser_ctx_t *ctx, expression_t *expr, statement_t *stat, case_clausule_t *next)
3202 {
3203 case_clausule_t *ret;
3204
3205 ret = parser_alloc(ctx, sizeof(*ret));
3206 if(!ret)
3207 return NULL;
3208
3209 ret->expr = expr;
3210 ret->stat = stat;
3211 ret->next = next;
3212 return ret;
3213 }
3214
3215 static statement_t *new_onerror_statement(parser_ctx_t *ctx, BOOL resume_next)
3216 {
3217 onerror_statement_t *stat;
3218
3219 stat = new_statement(ctx, STAT_ONERROR, sizeof(*stat));
3220 if(!stat)
3221 return NULL;
3222
3223 stat->resume_next = resume_next;
3224 return &stat->stat;
3225 }
3226
3227 static arg_decl_t *new_argument_decl(parser_ctx_t *ctx, const WCHAR *name, BOOL by_ref)
3228 {
3229 arg_decl_t *arg_decl;
3230
3231 arg_decl = parser_alloc(ctx, sizeof(*arg_decl));
3232 if(!arg_decl)
3233 return NULL;
3234
3235 arg_decl->name = name;
3236 arg_decl->by_ref = by_ref;
3237 arg_decl->next = NULL;
3238 return arg_decl;
3239 }
3240
3241 static function_decl_t *new_function_decl(parser_ctx_t *ctx, const WCHAR *name, function_type_t type,
3242 unsigned storage_flags, arg_decl_t *arg_decl, statement_t *body)
3243 {
3244 function_decl_t *decl;
3245
3246 if(storage_flags & STORAGE_IS_DEFAULT) {
3247 if(type == FUNC_PROPGET) {
3248 type = FUNC_DEFGET;
3249 }else {
3250 FIXME("Invalid default property\n");
3251 ctx->hres = E_FAIL;
3252 return NULL;
3253 }
3254 }
3255
3256 decl = parser_alloc(ctx, sizeof(*decl));
3257 if(!decl)
3258 return NULL;
3259
3260 decl->name = name;
3261 decl->type = type;
3262 decl->is_public = !(storage_flags & STORAGE_IS_PRIVATE);
3263 decl->args = arg_decl;
3264 decl->body = body;
3265 decl->next = NULL;
3266 decl->next_prop_func = NULL;
3267 return decl;
3268 }
3269
3270 static statement_t *new_function_statement(parser_ctx_t *ctx, function_decl_t *decl)
3271 {
3272 function_statement_t *stat;
3273
3274 stat = new_statement(ctx, STAT_FUNC, sizeof(*stat));
3275 if(!stat)
3276 return NULL;
3277
3278 stat->func_decl = decl;
3279 return &stat->stat;
3280 }
3281
3282 static class_decl_t *new_class_decl(parser_ctx_t *ctx)
3283 {
3284 class_decl_t *class_decl;
3285
3286 class_decl = parser_alloc(ctx, sizeof(*class_decl));
3287 if(!class_decl)
3288 return NULL;
3289
3290 class_decl->funcs = NULL;
3291 class_decl->props = NULL;
3292 class_decl->next = NULL;
3293 return class_decl;
3294 }
3295
3296 static class_decl_t *add_class_function(parser_ctx_t *ctx, class_decl_t *class_decl, function_decl_t *decl)
3297 {
3298 function_decl_t *iter;
3299
3300 for(iter = class_decl->funcs; iter; iter = iter->next) {
3301 if(!strcmpiW(iter->name, decl->name)) {
3302 if(decl->type == FUNC_SUB || decl->type == FUNC_FUNCTION) {
3303 FIXME("Redefinition of %s::%s\n", debugstr_w(class_decl->name), debugstr_w(decl->name));
3304 ctx->hres = E_FAIL;
3305 return NULL;
3306 }
3307
3308 while(1) {
3309 if(iter->type == decl->type) {
3310 FIXME("Redefinition of %s::%s\n", debugstr_w(class_decl->name), debugstr_w(decl->name));
3311 ctx->hres = E_FAIL;
3312 return NULL;
3313 }
3314 if(!iter->next_prop_func)
3315 break;
3316 iter = iter->next_prop_func;
3317 }
3318
3319 iter->next_prop_func = decl;
3320 return class_decl;
3321 }
3322 }
3323
3324 decl->next = class_decl->funcs;
3325 class_decl->funcs = decl;
3326 return class_decl;
3327 }
3328
3329 static class_decl_t *add_dim_prop(parser_ctx_t *ctx, class_decl_t *class_decl, dim_decl_t *dim_decl, unsigned storage_flags)
3330 {
3331 if(storage_flags & STORAGE_IS_DEFAULT) {
3332 FIXME("variant prop van't be default value\n");
3333 ctx->hres = E_FAIL;
3334 return NULL;
3335 }
3336
3337 dim_decl->is_public = !(storage_flags & STORAGE_IS_PRIVATE);
3338 dim_decl->next = class_decl->props;
3339 class_decl->props = dim_decl;
3340 return class_decl;
3341 }
3342
3343 static const_decl_t *new_const_decl(parser_ctx_t *ctx, const WCHAR *name, expression_t *expr)
3344 {
3345 const_decl_t *decl;
3346
3347 decl = parser_alloc(ctx, sizeof(*decl));
3348 if(!decl)
3349 return NULL;
3350
3351 decl->name = name;
3352 decl->value_expr = expr;
3353 decl->next = NULL;
3354 return decl;
3355 }
3356
3357 static statement_t *new_const_statement(parser_ctx_t *ctx, const_decl_t *decls)
3358 {
3359 const_statement_t *stat;
3360
3361 stat = new_statement(ctx, STAT_CONST, sizeof(*stat));
3362 if(!stat)
3363 return NULL;
3364
3365 stat->decls = decls;
3366 return &stat->stat;
3367 }
3368
3369 static statement_t *link_statements(statement_t *head, statement_t *tail)
3370 {
3371 statement_t *iter;
3372
3373 for(iter = head; iter->next; iter = iter->next);
3374 iter->next = tail;
3375
3376 return head;
3377 }
3378
3379 void *parser_alloc(parser_ctx_t *ctx, size_t size)
3380 {
3381 void *ret;
3382
3383 ret = heap_pool_alloc(&ctx->heap, size);
3384 if(!ret)
3385 ctx->hres = E_OUTOFMEMORY;
3386 return ret;
3387 }
3388
3389 HRESULT parse_script(parser_ctx_t *ctx, const WCHAR *code, const WCHAR *delimiter)
3390 {
3391 const WCHAR html_delimiterW[] = {'<','/','s','c','r','i','p','t','>',0};
3392
3393 ctx->code = ctx->ptr = code;
3394 ctx->end = ctx->code + strlenW(ctx->code);
3395
3396 heap_pool_init(&ctx->heap);
3397
3398 ctx->parse_complete = FALSE;
3399 ctx->hres = S_OK;
3400
3401 ctx->last_token = tNL;
3402 ctx->last_nl = 0;
3403 ctx->stats = ctx->stats_tail = NULL;
3404 ctx->class_decls = NULL;
3405 ctx->option_explicit = FALSE;
3406 ctx->is_html = delimiter && !strcmpiW(delimiter, html_delimiterW);
3407
3408 parser_parse(ctx);
3409
3410 if(FAILED(ctx->hres))
3411 return ctx->hres;
3412 if(!ctx->parse_complete) {
3413 FIXME("parser failed around %s\n", debugstr_w(ctx->code+20 > ctx->ptr ? ctx->code : ctx->ptr-20));
3414 return E_FAIL;
3415 }
3416
3417 return S_OK;
3418 }
3419
3420 void parser_release(parser_ctx_t *ctx)
3421 {
3422 heap_pool_free(&ctx->heap);
3423 }