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