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