1 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
2 // Copyright (c) Lawrence Livermore National Security, LLC and other Ascent
3 // Project developers. See top-level LICENSE AND COPYRIGHT files for dates and
4 // other details. No copyright assignment is required to contribute to Ascent.
5 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
6
7 /* A Bison parser, made by GNU Bison 3.6. */
8
9 /* Bison implementation for Yacc-like parsers in C
10
11 Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation,
12 Inc.
13
14 This program is free software: you can redistribute it and/or modify
15 it under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 This program is distributed in the hope that it will be useful,
20 but WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 GNU General Public License for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with this program. If not, see <http://www.gnu.org/licenses/>. */
26
27 /* As a special exception, you may create a larger work that contains
28 part or all of the Bison parser skeleton and distribute that work
29 under terms of your choice, so long as that work isn't itself a
30 parser generator using the skeleton or a modified version thereof
31 as a parser skeleton. Alternatively, if you modify or redistribute
32 the parser skeleton itself, you may (at your option) remove this
33 special exception, which will cause the skeleton and the resulting
34 Bison output files to be licensed under the GNU General Public
35 License without this special exception.
36
37 This special exception was added by the Free Software Foundation in
38 version 2.2 of Bison. */
39
40 /* C LALR(1) parser skeleton written by Richard Stallman, by
41 simplifying the original so-called "semantic" parser. */
42
43 /* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
44 especially those whose name start with YY_ or yy_. They are
45 private implementation details that can be changed or removed. */
46
47 /* All symbols defined below should begin with yy or YY, to avoid
48 infringing on user name space. This should be done even for local
49 variables, as they might otherwise be expanded by user macros.
50 There are some unavoidable exceptions within include files to
51 define necessary library symbols; they are noted "INFRINGES ON
52 USER NAME SPACE" below. */
53
54 /* Identify Bison output. */
55 #define YYBISON 1
56
57 /* Bison version. */
58 #define YYBISON_VERSION "3.6"
59
60 /* Skeleton name. */
61 #define YYSKELETON_NAME "yacc.c"
62
63 /* Pure parsers. */
64 #define YYPURE 0
65
66 /* Push parsers. */
67 #define YYPUSH 0
68
69 /* Pull parsers. */
70 #define YYPULL 1
71
72
73 /* Substitute the variable and function names. */
74 #define yyparse ascentparse
75 #define yylex ascentlex
76 #define yyerror ascenterror
77 #define yydebug ascentdebug
78 #define yynerrs ascentnerrs
79 #define yylval ascentlval
80 #define yychar ascentchar
81
82 /* First part of user prologue. */
83 #line 1 "parser.y"
84
85 #include "ascent_expressions_ast.hpp"
86 #include <cstdio>
87 #include <cstdlib>
88
89 ASTNode *root_node; /* the top level root node of our final AST */
90
91 extern int yylex();
92 extern void scan_string(const char *);
yyerror(const char * s)93 void yyerror(const char *s)
94 {
95 throw "syntax error";
96 }
get_result()97 ASTNode *get_result() { return root_node; }
98
99 #line 94 "ascent_expressions_parser.cpp"
100
101 # ifndef YY_CAST
102 # ifdef __cplusplus
103 # define YY_CAST(Type, Val) static_cast<Type> (Val)
104 # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
105 # else
106 # define YY_CAST(Type, Val) ((Type) (Val))
107 # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
108 # endif
109 # endif
110 # ifndef YY_NULLPTR
111 # if defined __cplusplus
112 # if 201103L <= __cplusplus
113 # define YY_NULLPTR nullptr
114 # else
115 # define YY_NULLPTR 0
116 # endif
117 # else
118 # define YY_NULLPTR ((void*)0)
119 # endif
120 # endif
121
122 /* Use api.header.include to #include this header
123 instead of duplicating it here. */
124 #ifndef YY_ASCENT_ASCENT_EXPRESSIONS_PARSER_HPP_INCLUDED
125 # define YY_ASCENT_ASCENT_EXPRESSIONS_PARSER_HPP_INCLUDED
126 /* Debug traces. */
127 #ifndef YYDEBUG
128 # define YYDEBUG 1
129 #endif
130 #if YYDEBUG
131 extern int ascentdebug;
132 #endif
133
134 /* Token kinds. */
135 #ifndef YYTOKENTYPE
136 # define YYTOKENTYPE
137 enum yytokentype
138 {
139 YYEMPTY = -2,
140 YYEOF = 0, /* "end of file" */
141 YYerror = 256, /* error */
142 YYUNDEF = 257, /* "invalid token" */
143 TIDENTIFIER = 258, /* TIDENTIFIER */
144 TINTEGER = 259, /* TINTEGER */
145 TDOUBLE = 260, /* TDOUBLE */
146 TSTRING = 261, /* TSTRING */
147 TOR = 262, /* TOR */
148 TAND = 263, /* TAND */
149 TNOT = 264, /* TNOT */
150 TTRUE = 265, /* TTRUE */
151 TFALSE = 266, /* TFALSE */
152 TIF = 267, /* TIF */
153 TTHEN = 268, /* TTHEN */
154 TELSE = 269, /* TELSE */
155 TAEQ = 270, /* TAEQ */
156 TCEQ = 271, /* TCEQ */
157 TCNE = 272, /* TCNE */
158 TCLT = 273, /* TCLT */
159 TCLE = 274, /* TCLE */
160 TCGT = 275, /* TCGT */
161 TCGE = 276, /* TCGE */
162 TLPAREN = 277, /* TLPAREN */
163 TRPAREN = 278, /* TRPAREN */
164 TLBRACKET = 279, /* TLBRACKET */
165 TRBRACKET = 280, /* TRBRACKET */
166 TCOMMA = 281, /* TCOMMA */
167 TDOT = 282, /* TDOT */
168 TENDEXPR = 283, /* TENDEXPR */
169 TPLUS = 284, /* TPLUS */
170 TMINUS = 285, /* TMINUS */
171 TMUL = 286, /* TMUL */
172 TDIV = 287, /* TDIV */
173 TMOD = 288, /* TMOD */
174 TNEG = 289 /* TNEG */
175 };
176 typedef enum yytokentype yytoken_kind_t;
177 #endif
178
179 /* Value type. */
180 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
181 union YYSTYPE
182 {
183 #line 21 "parser.y"
184
185 ASTNode *node;
186 ASTBlock *block;
187 ASTExpression *expr;
188 ASTIdentifier *ident;
189 ASTString *string_literal;
190 ASTBoolean *bool_literal;
191 ASTExpressionList *expr_list;
192 ASTNamedExpression *named_expr;
193 ASTNamedExpressionList *named_expr_list;
194 ASTArguments *args;
195 std::string *string;
196 int token;
197
198 #line 193 "ascent_expressions_parser.cpp"
199
200 };
201 typedef union YYSTYPE YYSTYPE;
202 # define YYSTYPE_IS_TRIVIAL 1
203 # define YYSTYPE_IS_DECLARED 1
204 #endif
205
206
207 extern YYSTYPE ascentlval;
208
209 int ascentparse (void);
210 /* "%code provides" blocks. */
211 #line 16 "parser.y"
212
213 ASTNode *get_result();
214
215 #line 210 "ascent_expressions_parser.cpp"
216
217 #endif /* !YY_ASCENT_ASCENT_EXPRESSIONS_PARSER_HPP_INCLUDED */
218 /* Symbol kind. */
219 enum yysymbol_kind_t
220 {
221 YYSYMBOL_YYEMPTY = -2,
222 YYSYMBOL_YYEOF = 0, /* "end of file" */
223 YYSYMBOL_YYerror = 1, /* error */
224 YYSYMBOL_YYUNDEF = 2, /* "invalid token" */
225 YYSYMBOL_TIDENTIFIER = 3, /* TIDENTIFIER */
226 YYSYMBOL_TINTEGER = 4, /* TINTEGER */
227 YYSYMBOL_TDOUBLE = 5, /* TDOUBLE */
228 YYSYMBOL_TSTRING = 6, /* TSTRING */
229 YYSYMBOL_TOR = 7, /* TOR */
230 YYSYMBOL_TAND = 8, /* TAND */
231 YYSYMBOL_TNOT = 9, /* TNOT */
232 YYSYMBOL_TTRUE = 10, /* TTRUE */
233 YYSYMBOL_TFALSE = 11, /* TFALSE */
234 YYSYMBOL_TIF = 12, /* TIF */
235 YYSYMBOL_TTHEN = 13, /* TTHEN */
236 YYSYMBOL_TELSE = 14, /* TELSE */
237 YYSYMBOL_TAEQ = 15, /* TAEQ */
238 YYSYMBOL_TCEQ = 16, /* TCEQ */
239 YYSYMBOL_TCNE = 17, /* TCNE */
240 YYSYMBOL_TCLT = 18, /* TCLT */
241 YYSYMBOL_TCLE = 19, /* TCLE */
242 YYSYMBOL_TCGT = 20, /* TCGT */
243 YYSYMBOL_TCGE = 21, /* TCGE */
244 YYSYMBOL_TLPAREN = 22, /* TLPAREN */
245 YYSYMBOL_TRPAREN = 23, /* TRPAREN */
246 YYSYMBOL_TLBRACKET = 24, /* TLBRACKET */
247 YYSYMBOL_TRBRACKET = 25, /* TRBRACKET */
248 YYSYMBOL_TCOMMA = 26, /* TCOMMA */
249 YYSYMBOL_TDOT = 27, /* TDOT */
250 YYSYMBOL_TENDEXPR = 28, /* TENDEXPR */
251 YYSYMBOL_TPLUS = 29, /* TPLUS */
252 YYSYMBOL_TMINUS = 30, /* TMINUS */
253 YYSYMBOL_TMUL = 31, /* TMUL */
254 YYSYMBOL_TDIV = 32, /* TDIV */
255 YYSYMBOL_TMOD = 33, /* TMOD */
256 YYSYMBOL_TNEG = 34, /* TNEG */
257 YYSYMBOL_YYACCEPT = 35, /* $accept */
258 YYSYMBOL_root = 36, /* root */
259 YYSYMBOL_block = 37, /* block */
260 YYSYMBOL_stmts = 38, /* stmts */
261 YYSYMBOL_stmt = 39, /* stmt */
262 YYSYMBOL_ident = 40, /* ident */
263 YYSYMBOL_numeric = 41, /* numeric */
264 YYSYMBOL_call_args = 42, /* call_args */
265 YYSYMBOL_pos_args = 43, /* pos_args */
266 YYSYMBOL_named_args = 44, /* named_args */
267 YYSYMBOL_named_arg = 45, /* named_arg */
268 YYSYMBOL_if_expr = 46, /* if_expr */
269 YYSYMBOL_string_literal = 47, /* string_literal */
270 YYSYMBOL_array_access = 48, /* array_access */
271 YYSYMBOL_dot_access = 49, /* dot_access */
272 YYSYMBOL_list = 50, /* list */
273 YYSYMBOL_bool_literal = 51, /* bool_literal */
274 YYSYMBOL_expr = 52 /* expr */
275 };
276 typedef enum yysymbol_kind_t yysymbol_kind_t;
277
278
279
280
281 #ifdef short
282 # undef short
283 #endif
284
285 /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
286 <limits.h> and (if available) <stdint.h> are included
287 so that the code can choose integer types of a good width. */
288
289 #ifndef __PTRDIFF_MAX__
290 # include <limits.h> /* INFRINGES ON USER NAME SPACE */
291 # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
292 # include <stdint.h> /* INFRINGES ON USER NAME SPACE */
293 # define YY_STDINT_H
294 # endif
295 #endif
296
297 /* Narrow types that promote to a signed type and that can represent a
298 signed or unsigned integer of at least N bits. In tables they can
299 save space and decrease cache pressure. Promoting to a signed type
300 helps avoid bugs in integer arithmetic. */
301
302 #ifdef __INT_LEAST8_MAX__
303 typedef __INT_LEAST8_TYPE__ yytype_int8;
304 #elif defined YY_STDINT_H
305 typedef int_least8_t yytype_int8;
306 #else
307 typedef signed char yytype_int8;
308 #endif
309
310 #ifdef __INT_LEAST16_MAX__
311 typedef __INT_LEAST16_TYPE__ yytype_int16;
312 #elif defined YY_STDINT_H
313 typedef int_least16_t yytype_int16;
314 #else
315 typedef short yytype_int16;
316 #endif
317
318 #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
319 typedef __UINT_LEAST8_TYPE__ yytype_uint8;
320 #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
321 && UINT_LEAST8_MAX <= INT_MAX)
322 typedef uint_least8_t yytype_uint8;
323 #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
324 typedef unsigned char yytype_uint8;
325 #else
326 typedef short yytype_uint8;
327 #endif
328
329 #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
330 typedef __UINT_LEAST16_TYPE__ yytype_uint16;
331 #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
332 && UINT_LEAST16_MAX <= INT_MAX)
333 typedef uint_least16_t yytype_uint16;
334 #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
335 typedef unsigned short yytype_uint16;
336 #else
337 typedef int yytype_uint16;
338 #endif
339
340 #ifndef YYPTRDIFF_T
341 # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
342 # define YYPTRDIFF_T __PTRDIFF_TYPE__
343 # define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
344 # elif defined PTRDIFF_MAX
345 # ifndef ptrdiff_t
346 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
347 # endif
348 # define YYPTRDIFF_T ptrdiff_t
349 # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
350 # else
351 # define YYPTRDIFF_T long
352 # define YYPTRDIFF_MAXIMUM LONG_MAX
353 # endif
354 #endif
355
356 #ifndef YYSIZE_T
357 # ifdef __SIZE_TYPE__
358 # define YYSIZE_T __SIZE_TYPE__
359 # elif defined size_t
360 # define YYSIZE_T size_t
361 # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
362 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
363 # define YYSIZE_T size_t
364 # else
365 # define YYSIZE_T unsigned
366 # endif
367 #endif
368
369 #define YYSIZE_MAXIMUM \
370 YY_CAST (YYPTRDIFF_T, \
371 (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
372 ? YYPTRDIFF_MAXIMUM \
373 : YY_CAST (YYSIZE_T, -1)))
374
375 #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
376
377
378 /* Stored state numbers (used for stacks). */
379 typedef yytype_int8 yy_state_t;
380
381 /* State numbers in computations. */
382 typedef int yy_state_fast_t;
383
384 #ifndef YY_
385 # if defined YYENABLE_NLS && YYENABLE_NLS
386 # if ENABLE_NLS
387 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
388 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
389 # endif
390 # endif
391 # ifndef YY_
392 # define YY_(Msgid) Msgid
393 # endif
394 #endif
395
396
397 #ifndef YY_ATTRIBUTE_PURE
398 # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
399 # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
400 # else
401 # define YY_ATTRIBUTE_PURE
402 # endif
403 #endif
404
405 #ifndef YY_ATTRIBUTE_UNUSED
406 # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
407 # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
408 # else
409 # define YY_ATTRIBUTE_UNUSED
410 # endif
411 #endif
412
413 /* Suppress unused-variable warnings by "using" E. */
414 #if ! defined lint || defined __GNUC__
415 # define YYUSE(E) ((void) (E))
416 #else
417 # define YYUSE(E) /* empty */
418 #endif
419
420 #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
421 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
422 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
423 _Pragma ("GCC diagnostic push") \
424 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
425 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
426 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
427 _Pragma ("GCC diagnostic pop")
428 #else
429 # define YY_INITIAL_VALUE(Value) Value
430 #endif
431 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
432 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
433 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
434 #endif
435 #ifndef YY_INITIAL_VALUE
436 # define YY_INITIAL_VALUE(Value) /* Nothing. */
437 #endif
438
439 #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
440 # define YY_IGNORE_USELESS_CAST_BEGIN \
441 _Pragma ("GCC diagnostic push") \
442 _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
443 # define YY_IGNORE_USELESS_CAST_END \
444 _Pragma ("GCC diagnostic pop")
445 #endif
446 #ifndef YY_IGNORE_USELESS_CAST_BEGIN
447 # define YY_IGNORE_USELESS_CAST_BEGIN
448 # define YY_IGNORE_USELESS_CAST_END
449 #endif
450
451
452 #define YY_ASSERT(E) ((void) (0 && (E)))
453
454 #if !defined yyoverflow
455
456 /* The parser invokes alloca or malloc; define the necessary symbols. */
457
458 # ifdef YYSTACK_USE_ALLOCA
459 # if YYSTACK_USE_ALLOCA
460 # ifdef __GNUC__
461 # define YYSTACK_ALLOC __builtin_alloca
462 # elif defined __BUILTIN_VA_ARG_INCR
463 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
464 # elif defined _AIX
465 # define YYSTACK_ALLOC __alloca
466 # elif defined _MSC_VER
467 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
468 # define alloca _alloca
469 # else
470 # define YYSTACK_ALLOC alloca
471 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
472 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
473 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
474 # ifndef EXIT_SUCCESS
475 # define EXIT_SUCCESS 0
476 # endif
477 # endif
478 # endif
479 # endif
480 # endif
481
482 # ifdef YYSTACK_ALLOC
483 /* Pacify GCC's 'empty if-body' warning. */
484 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
485 # ifndef YYSTACK_ALLOC_MAXIMUM
486 /* The OS might guarantee only one guard page at the bottom of the stack,
487 and a page size can be as small as 4096 bytes. So we cannot safely
488 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
489 to allow for a few compiler-allocated temporary stack slots. */
490 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
491 # endif
492 # else
493 # define YYSTACK_ALLOC YYMALLOC
494 # define YYSTACK_FREE YYFREE
495 # ifndef YYSTACK_ALLOC_MAXIMUM
496 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
497 # endif
498 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
499 && ! ((defined YYMALLOC || defined malloc) \
500 && (defined YYFREE || defined free)))
501 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
502 # ifndef EXIT_SUCCESS
503 # define EXIT_SUCCESS 0
504 # endif
505 # endif
506 # ifndef YYMALLOC
507 # define YYMALLOC malloc
508 # if ! defined malloc && ! defined EXIT_SUCCESS
509 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
510 # endif
511 # endif
512 # ifndef YYFREE
513 # define YYFREE free
514 # if ! defined free && ! defined EXIT_SUCCESS
515 void free (void *); /* INFRINGES ON USER NAME SPACE */
516 # endif
517 # endif
518 # endif
519 #endif /* !defined yyoverflow */
520
521 #if (! defined yyoverflow \
522 && (! defined __cplusplus \
523 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
524
525 /* A type that is properly aligned for any stack member. */
526 union yyalloc
527 {
528 yy_state_t yyss_alloc;
529 YYSTYPE yyvs_alloc;
530 };
531
532 /* The size of the maximum gap between one aligned stack and the next. */
533 # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
534
535 /* The size of an array large to enough to hold all stacks, each with
536 N elements. */
537 # define YYSTACK_BYTES(N) \
538 ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
539 + YYSTACK_GAP_MAXIMUM)
540
541 # define YYCOPY_NEEDED 1
542
543 /* Relocate STACK from its old location to the new one. The
544 local variables YYSIZE and YYSTACKSIZE give the old and new number of
545 elements in the stack, and YYPTR gives the new location of the
546 stack. Advance YYPTR to a properly aligned location for the next
547 stack. */
548 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
549 do \
550 { \
551 YYPTRDIFF_T yynewbytes; \
552 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
553 Stack = &yyptr->Stack_alloc; \
554 yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
555 yyptr += yynewbytes / YYSIZEOF (*yyptr); \
556 } \
557 while (0)
558
559 #endif
560
561 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
562 /* Copy COUNT objects from SRC to DST. The source and destination do
563 not overlap. */
564 # ifndef YYCOPY
565 # if defined __GNUC__ && 1 < __GNUC__
566 # define YYCOPY(Dst, Src, Count) \
567 __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
568 # else
569 # define YYCOPY(Dst, Src, Count) \
570 do \
571 { \
572 YYPTRDIFF_T yyi; \
573 for (yyi = 0; yyi < (Count); yyi++) \
574 (Dst)[yyi] = (Src)[yyi]; \
575 } \
576 while (0)
577 # endif
578 # endif
579 #endif /* !YYCOPY_NEEDED */
580
581 /* YYFINAL -- State number of the termination state. */
582 #define YYFINAL 4
583 /* YYLAST -- Last index in YYTABLE. */
584 #define YYLAST 306
585
586 /* YYNTOKENS -- Number of terminals. */
587 #define YYNTOKENS 35
588 /* YYNNTS -- Number of nonterminals. */
589 #define YYNNTS 18
590 /* YYNRULES -- Number of rules. */
591 #define YYNRULES 52
592 /* YYNSTATES -- Number of states. */
593 #define YYNSTATES 91
594
595 #define YYMAXUTOK 289
596
597
598 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
599 as returned by yylex, with out-of-bounds checking. */
600 #define YYTRANSLATE(YYX) \
601 (0 <= (YYX) && (YYX) <= YYMAXUTOK \
602 ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \
603 : YYSYMBOL_YYUNDEF)
604
605 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
606 as returned by yylex. */
607 static const yytype_int8 yytranslate[] =
608 {
609 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
610 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
611 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
612 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
613 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
614 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
615 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
616 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
617 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
618 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
619 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
620 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
621 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
622 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
623 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
624 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
625 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
626 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
627 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
628 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
629 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
630 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
631 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
632 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
633 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
634 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
635 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
636 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
637 25, 26, 27, 28, 29, 30, 31, 32, 33, 34
638 };
639
640 #if YYDEBUG
641 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
642 static const yytype_uint8 yyrline[] =
643 {
644 0, 86, 86, 89, 90, 93, 94, 97, 100, 103,
645 104, 107, 108, 109, 110, 113, 114, 117, 118, 121,
646 124, 127, 130, 133, 136, 137, 140, 141, 144, 145,
647 146, 147, 148, 149, 150, 151, 152, 153, 154, 155,
648 156, 157, 158, 159, 160, 161, 162, 163, 164, 165,
649 166, 167, 168
650 };
651 #endif
652
653 /** Accessing symbol of state STATE. */
654 #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
655
656 #if YYDEBUG || 0
657 /* The user-facing name of the symbol whose (internal) number is
658 YYSYMBOL. No bounds checking. */
659 static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
660
661 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
662 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
663 static const char *const yytname[] =
664 {
665 "\"end of file\"", "error", "\"invalid token\"", "TIDENTIFIER",
666 "TINTEGER", "TDOUBLE", "TSTRING", "TOR", "TAND", "TNOT", "TTRUE",
667 "TFALSE", "TIF", "TTHEN", "TELSE", "TAEQ", "TCEQ", "TCNE", "TCLT",
668 "TCLE", "TCGT", "TCGE", "TLPAREN", "TRPAREN", "TLBRACKET", "TRBRACKET",
669 "TCOMMA", "TDOT", "TENDEXPR", "TPLUS", "TMINUS", "TMUL", "TDIV", "TMOD",
670 "TNEG", "$accept", "root", "block", "stmts", "stmt", "ident", "numeric",
671 "call_args", "pos_args", "named_args", "named_arg", "if_expr",
672 "string_literal", "array_access", "dot_access", "list", "bool_literal",
673 "expr", YY_NULLPTR
674 };
675
676 static const char *
yysymbol_name(yysymbol_kind_t yysymbol)677 yysymbol_name (yysymbol_kind_t yysymbol)
678 {
679 return yytname[yysymbol];
680 }
681 #endif
682
683 #ifdef YYPRINT
684 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
685 (internal) symbol number NUM (which must be that of a token). */
686 static const yytype_int16 yytoknum[] =
687 {
688 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
689 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
690 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
691 285, 286, 287, 288, 289
692 };
693 #endif
694
695 #define YYPACT_NINF (-53)
696
697 #define yypact_value_is_default(Yyn) \
698 ((Yyn) == YYPACT_NINF)
699
700 #define YYTABLE_NINF (-1)
701
702 #define yytable_value_is_error(Yyn) \
703 0
704
705 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
706 STATE-NUM. */
707 static const yytype_int16 yypact[] =
708 {
709 -53, 3, -53, 83, -53, -53, -53, -53, -53, 83,
710 -53, -53, 83, 83, 50, 83, -53, -14, -53, -53,
711 -53, -53, -53, -53, -53, 101, -18, 263, 128, 146,
712 -53, -8, 227, -22, 83, 83, 83, 83, 83, 83,
713 83, 83, 83, 83, 83, 4, -53, 83, 83, 83,
714 83, 83, 83, -53, -53, 83, 164, 35, -2, -6,
715 6, -53, 245, 263, -5, -5, 273, 273, 273, 273,
716 182, -53, 79, 79, -22, -22, -22, 209, 227, -53,
717 83, -53, 83, 20, -53, 83, 227, 6, 14, -53,
718 -22
719 };
720
721 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
722 Performed when YYTABLE does not specify something else to do. Zero
723 means the default is an error. */
724 static const yytype_int8 yydefact[] =
725 {
726 5, 0, 2, 0, 1, 8, 9, 10, 21, 0,
727 26, 27, 0, 0, 0, 0, 6, 29, 36, 34,
728 31, 32, 33, 35, 30, 4, 29, 51, 0, 0,
729 24, 0, 15, 42, 0, 11, 0, 0, 0, 0,
730 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
731 0, 0, 0, 52, 25, 0, 0, 29, 0, 12,
732 13, 17, 49, 50, 43, 44, 45, 46, 47, 48,
733 0, 23, 40, 41, 37, 38, 39, 0, 16, 7,
734 0, 28, 0, 0, 22, 0, 19, 14, 0, 18,
735 20
736 };
737
738 /* YYPGOTO[NTERM-NUM]. */
739 static const yytype_int8 yypgoto[] =
740 {
741 -53, -53, -53, -53, -53, 8, -53, -53, 7, -52,
742 -32, -53, -53, -53, -53, -53, -53, -3
743 };
744
745 /* YYDEFGOTO[NTERM-NUM]. */
746 static const yytype_int8 yydefgoto[] =
747 {
748 -1, 1, 2, 3, 16, 26, 18, 58, 31, 60,
749 61, 19, 20, 21, 22, 23, 24, 32
750 };
751
752 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
753 positive, shift that token. If negative, reduce the rule whose
754 number is the opposite. If YYTABLE_NINF, syntax error. */
755 static const yytype_int8 yytable[] =
756 {
757 25, 34, 44, 4, 35, 45, 27, 71, 35, 28,
758 29, 17, 33, 40, 41, 42, 43, 54, 55, 44,
759 82, 81, 45, 5, 47, 48, 49, 50, 51, 80,
760 87, 56, 83, 62, 63, 64, 65, 66, 67, 68,
761 69, 70, 59, 57, 72, 73, 74, 75, 76, 77,
762 80, 89, 78, 5, 6, 7, 8, 35, 0, 9,
763 10, 11, 12, 0, 0, 0, 0, 0, 0, 0,
764 0, 0, 13, 0, 14, 30, 0, 86, 0, 78,
765 15, 0, 90, 0, 0, 0, 5, 6, 7, 8,
766 57, 88, 9, 10, 11, 12, 0, 0, 0, 0,
767 0, 0, 0, 44, 0, 13, 45, 14, 36, 37,
768 49, 50, 51, 15, 0, 0, 0, 38, 39, 40,
769 41, 42, 43, 0, 0, 44, 0, 0, 45, 46,
770 47, 48, 49, 50, 51, 36, 37, 0, 0, 0,
771 0, 52, 0, 0, 38, 39, 40, 41, 42, 43,
772 0, 0, 44, 36, 37, 45, 0, 47, 48, 49,
773 50, 51, 38, 39, 40, 41, 42, 43, 0, 53,
774 44, 36, 37, 45, 0, 47, 48, 49, 50, 51,
775 38, 39, 40, 41, 42, 43, 0, 0, 44, 36,
776 37, 45, 79, 47, 48, 49, 50, 51, 38, 39,
777 40, 41, 42, 43, 0, 0, 44, 84, 0, 45,
778 0, 47, 48, 49, 50, 51, 36, 37, 0, 0,
779 0, 0, 0, 85, 0, 38, 39, 40, 41, 42,
780 43, 0, 0, 44, 36, 37, 45, 0, 47, 48,
781 49, 50, 51, 38, 39, 40, 41, 42, 43, 0,
782 0, 44, 0, 37, 45, 0, 47, 48, 49, 50,
783 51, 38, 39, 40, 41, 42, 43, 0, 0, 44,
784 0, 0, 45, 0, 47, 48, 49, 50, 51, 38,
785 39, 40, 41, 42, 43, 0, 0, 44, 0, 0,
786 45, 0, 47, 48, 49, 50, 51, 44, 0, 0,
787 45, 0, 47, 48, 49, 50, 51
788 };
789
790 static const yytype_int8 yycheck[] =
791 {
792 3, 15, 24, 0, 22, 27, 9, 3, 22, 12,
793 13, 3, 15, 18, 19, 20, 21, 25, 26, 24,
794 26, 23, 27, 3, 29, 30, 31, 32, 33, 15,
795 82, 34, 26, 36, 37, 38, 39, 40, 41, 42,
796 43, 44, 35, 35, 47, 48, 49, 50, 51, 52,
797 15, 83, 55, 3, 4, 5, 6, 22, -1, 9,
798 10, 11, 12, -1, -1, -1, -1, -1, -1, -1,
799 -1, -1, 22, -1, 24, 25, -1, 80, -1, 82,
800 30, -1, 85, -1, -1, -1, 3, 4, 5, 6,
801 82, 83, 9, 10, 11, 12, -1, -1, -1, -1,
802 -1, -1, -1, 24, -1, 22, 27, 24, 7, 8,
803 31, 32, 33, 30, -1, -1, -1, 16, 17, 18,
804 19, 20, 21, -1, -1, 24, -1, -1, 27, 28,
805 29, 30, 31, 32, 33, 7, 8, -1, -1, -1,
806 -1, 13, -1, -1, 16, 17, 18, 19, 20, 21,
807 -1, -1, 24, 7, 8, 27, -1, 29, 30, 31,
808 32, 33, 16, 17, 18, 19, 20, 21, -1, 23,
809 24, 7, 8, 27, -1, 29, 30, 31, 32, 33,
810 16, 17, 18, 19, 20, 21, -1, -1, 24, 7,
811 8, 27, 28, 29, 30, 31, 32, 33, 16, 17,
812 18, 19, 20, 21, -1, -1, 24, 25, -1, 27,
813 -1, 29, 30, 31, 32, 33, 7, 8, -1, -1,
814 -1, -1, -1, 14, -1, 16, 17, 18, 19, 20,
815 21, -1, -1, 24, 7, 8, 27, -1, 29, 30,
816 31, 32, 33, 16, 17, 18, 19, 20, 21, -1,
817 -1, 24, -1, 8, 27, -1, 29, 30, 31, 32,
818 33, 16, 17, 18, 19, 20, 21, -1, -1, 24,
819 -1, -1, 27, -1, 29, 30, 31, 32, 33, 16,
820 17, 18, 19, 20, 21, -1, -1, 24, -1, -1,
821 27, -1, 29, 30, 31, 32, 33, 24, -1, -1,
822 27, -1, 29, 30, 31, 32, 33
823 };
824
825 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
826 symbol of state STATE-NUM. */
827 static const yytype_int8 yystos[] =
828 {
829 0, 36, 37, 38, 0, 3, 4, 5, 6, 9,
830 10, 11, 12, 22, 24, 30, 39, 40, 41, 46,
831 47, 48, 49, 50, 51, 52, 40, 52, 52, 52,
832 25, 43, 52, 52, 15, 22, 7, 8, 16, 17,
833 18, 19, 20, 21, 24, 27, 28, 29, 30, 31,
834 32, 33, 13, 23, 25, 26, 52, 40, 42, 43,
835 44, 45, 52, 52, 52, 52, 52, 52, 52, 52,
836 52, 3, 52, 52, 52, 52, 52, 52, 52, 28,
837 15, 23, 26, 26, 25, 14, 52, 44, 40, 45,
838 52
839 };
840
841 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
842 static const yytype_int8 yyr1[] =
843 {
844 0, 35, 36, 37, 37, 38, 38, 39, 40, 41,
845 41, 42, 42, 42, 42, 43, 43, 44, 44, 45,
846 46, 47, 48, 49, 50, 50, 51, 51, 52, 52,
847 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
848 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
849 52, 52, 52
850 };
851
852 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
853 static const yytype_int8 yyr2[] =
854 {
855 0, 2, 1, 3, 2, 0, 2, 4, 1, 1,
856 1, 0, 1, 1, 3, 1, 3, 1, 3, 3,
857 6, 1, 4, 3, 2, 3, 1, 1, 4, 1,
858 1, 1, 1, 1, 1, 1, 1, 3, 3, 3,
859 3, 3, 2, 3, 3, 3, 3, 3, 3, 3,
860 3, 2, 3
861 };
862
863
864 enum { YYENOMEM = -2 };
865
866 #define yyerrok (yyerrstatus = 0)
867 #define yyclearin (yychar = YYEMPTY)
868
869 #define YYACCEPT goto yyacceptlab
870 #define YYABORT goto yyabortlab
871 #define YYERROR goto yyerrorlab
872
873
874 #define YYRECOVERING() (!!yyerrstatus)
875
876 #define YYBACKUP(Token, Value) \
877 do \
878 if (yychar == YYEMPTY) \
879 { \
880 yychar = (Token); \
881 yylval = (Value); \
882 YYPOPSTACK (yylen); \
883 yystate = *yyssp; \
884 goto yybackup; \
885 } \
886 else \
887 { \
888 yyerror (YY_("syntax error: cannot back up")); \
889 YYERROR; \
890 } \
891 while (0)
892
893 /* Backward compatibility with an undocumented macro.
894 Use YYerror or YYUNDEF. */
895 #define YYERRCODE YYUNDEF
896
897
898 /* Enable debugging if requested. */
899 #if YYDEBUG
900
901 # ifndef YYFPRINTF
902 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
903 # define YYFPRINTF fprintf
904 # endif
905
906 # define YYDPRINTF(Args) \
907 do { \
908 if (yydebug) \
909 YYFPRINTF Args; \
910 } while (0)
911
912 /* This macro is provided for backward compatibility. */
913 # ifndef YY_LOCATION_PRINT
914 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
915 # endif
916
917
918 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
919 do { \
920 if (yydebug) \
921 { \
922 YYFPRINTF (stderr, "%s ", Title); \
923 yy_symbol_print (stderr, \
924 Kind, Value); \
925 YYFPRINTF (stderr, "\n"); \
926 } \
927 } while (0)
928
929
930 /*-----------------------------------.
931 | Print this symbol's value on YYO. |
932 `-----------------------------------*/
933
934 static void
yy_symbol_value_print(FILE * yyo,yysymbol_kind_t yykind,YYSTYPE const * const yyvaluep)935 yy_symbol_value_print (FILE *yyo,
936 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
937 {
938 FILE *yyoutput = yyo;
939 YYUSE (yyoutput);
940 if (!yyvaluep)
941 return;
942 # ifdef YYPRINT
943 if (yykind < YYNTOKENS)
944 YYPRINT (yyo, yytoknum[yykind], *yyvaluep);
945 # endif
946 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
947 YYUSE (yykind);
948 YY_IGNORE_MAYBE_UNINITIALIZED_END
949 }
950
951
952 /*---------------------------.
953 | Print this symbol on YYO. |
954 `---------------------------*/
955
956 static void
yy_symbol_print(FILE * yyo,yysymbol_kind_t yykind,YYSTYPE const * const yyvaluep)957 yy_symbol_print (FILE *yyo,
958 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
959 {
960 YYFPRINTF (yyo, "%s %s (",
961 yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
962
963 yy_symbol_value_print (yyo, yykind, yyvaluep);
964 YYFPRINTF (yyo, ")");
965 }
966
967 /*------------------------------------------------------------------.
968 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
969 | TOP (included). |
970 `------------------------------------------------------------------*/
971
972 static void
yy_stack_print(yy_state_t * yybottom,yy_state_t * yytop)973 yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
974 {
975 YYFPRINTF (stderr, "Stack now");
976 for (; yybottom <= yytop; yybottom++)
977 {
978 int yybot = *yybottom;
979 YYFPRINTF (stderr, " %d", yybot);
980 }
981 YYFPRINTF (stderr, "\n");
982 }
983
984 # define YY_STACK_PRINT(Bottom, Top) \
985 do { \
986 if (yydebug) \
987 yy_stack_print ((Bottom), (Top)); \
988 } while (0)
989
990
991 /*------------------------------------------------.
992 | Report that the YYRULE is going to be reduced. |
993 `------------------------------------------------*/
994
995 static void
yy_reduce_print(yy_state_t * yyssp,YYSTYPE * yyvsp,int yyrule)996 yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
997 int yyrule)
998 {
999 int yylno = yyrline[yyrule];
1000 int yynrhs = yyr2[yyrule];
1001 int yyi;
1002 YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
1003 yyrule - 1, yylno);
1004 /* The symbols being reduced. */
1005 for (yyi = 0; yyi < yynrhs; yyi++)
1006 {
1007 YYFPRINTF (stderr, " $%d = ", yyi + 1);
1008 yy_symbol_print (stderr,
1009 YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
1010 &yyvsp[(yyi + 1) - (yynrhs)]);
1011 YYFPRINTF (stderr, "\n");
1012 }
1013 }
1014
1015 # define YY_REDUCE_PRINT(Rule) \
1016 do { \
1017 if (yydebug) \
1018 yy_reduce_print (yyssp, yyvsp, Rule); \
1019 } while (0)
1020
1021 /* Nonzero means print parse trace. It is left uninitialized so that
1022 multiple parsers can coexist. */
1023 int yydebug;
1024 #else /* !YYDEBUG */
1025 # define YYDPRINTF(Args) ((void) 0)
1026 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
1027 # define YY_STACK_PRINT(Bottom, Top)
1028 # define YY_REDUCE_PRINT(Rule)
1029 #endif /* !YYDEBUG */
1030
1031
1032 /* YYINITDEPTH -- initial size of the parser's stacks. */
1033 #ifndef YYINITDEPTH
1034 # define YYINITDEPTH 200
1035 #endif
1036
1037 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1038 if the built-in stack extension method is used).
1039
1040 Do not make this value too large; the results are undefined if
1041 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1042 evaluated with infinite-precision integer arithmetic. */
1043
1044 #ifndef YYMAXDEPTH
1045 # define YYMAXDEPTH 10000
1046 #endif
1047
1048
1049
1050
1051
1052
1053 /*-----------------------------------------------.
1054 | Release the memory associated to this symbol. |
1055 `-----------------------------------------------*/
1056
1057 static void
yydestruct(const char * yymsg,yysymbol_kind_t yykind,YYSTYPE * yyvaluep)1058 yydestruct (const char *yymsg,
1059 yysymbol_kind_t yykind, YYSTYPE *yyvaluep)
1060 {
1061 YYUSE (yyvaluep);
1062 if (!yymsg)
1063 yymsg = "Deleting";
1064 YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
1065
1066 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1067 YYUSE (yykind);
1068 YY_IGNORE_MAYBE_UNINITIALIZED_END
1069 }
1070
1071
1072 /* The lookahead symbol. */
1073 int yychar;
1074
1075 /* The semantic value of the lookahead symbol. */
1076 YYSTYPE yylval;
1077 /* Number of syntax errors so far. */
1078 int yynerrs;
1079
1080
1081
1082
1083 /*----------.
1084 | yyparse. |
1085 `----------*/
1086
1087 int
yyparse(void)1088 yyparse (void)
1089 {
1090 yy_state_fast_t yystate;
1091 /* Number of tokens to shift before error messages enabled. */
1092 int yyerrstatus;
1093
1094 /* The stacks and their tools:
1095 'yyss': related to states.
1096 'yyvs': related to semantic values.
1097
1098 Refer to the stacks through separate pointers, to allow yyoverflow
1099 to reallocate them elsewhere. */
1100
1101 /* Their size. */
1102 YYPTRDIFF_T yystacksize;
1103
1104 /* The state stack. */
1105 yy_state_t yyssa[YYINITDEPTH];
1106 yy_state_t *yyss;
1107 yy_state_t *yyssp;
1108
1109 /* The semantic value stack. */
1110 YYSTYPE yyvsa[YYINITDEPTH];
1111 YYSTYPE *yyvs;
1112 YYSTYPE *yyvsp;
1113
1114 int yyn;
1115 /* The return value of yyparse. */
1116 int yyresult;
1117 /* Lookahead token as an internal (translated) token number. */
1118 yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
1119 /* The variables used to return semantic value and location from the
1120 action routines. */
1121 YYSTYPE yyval;
1122
1123
1124
1125 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1126
1127 /* The number of symbols on the RHS of the reduced rule.
1128 Keep to zero when no symbol should be popped. */
1129 int yylen = 0;
1130
1131 yynerrs = 0;
1132 yystate = 0;
1133 yyerrstatus = 0;
1134
1135 yystacksize = YYINITDEPTH;
1136 yyssp = yyss = yyssa;
1137 yyvsp = yyvs = yyvsa;
1138
1139
1140 YYDPRINTF ((stderr, "Starting parse\n"));
1141
1142 yychar = YYEMPTY; /* Cause a token to be read. */
1143 goto yysetstate;
1144
1145
1146 /*------------------------------------------------------------.
1147 | yynewstate -- push a new state, which is found in yystate. |
1148 `------------------------------------------------------------*/
1149 yynewstate:
1150 /* In all cases, when you get here, the value and location stacks
1151 have just been pushed. So pushing a state here evens the stacks. */
1152 yyssp++;
1153
1154
1155 /*--------------------------------------------------------------------.
1156 | yysetstate -- set current state (the top of the stack) to yystate. |
1157 `--------------------------------------------------------------------*/
1158 yysetstate:
1159 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1160 YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
1161 YY_IGNORE_USELESS_CAST_BEGIN
1162 *yyssp = YY_CAST (yy_state_t, yystate);
1163 YY_IGNORE_USELESS_CAST_END
1164 YY_STACK_PRINT (yyss, yyssp);
1165
1166 if (yyss + yystacksize - 1 <= yyssp)
1167 #if !defined yyoverflow && !defined YYSTACK_RELOCATE
1168 goto yyexhaustedlab;
1169 #else
1170 {
1171 /* Get the current used size of the three stacks, in elements. */
1172 YYPTRDIFF_T yysize = yyssp - yyss + 1;
1173
1174 # if defined yyoverflow
1175 {
1176 /* Give user a chance to reallocate the stack. Use copies of
1177 these so that the &'s don't force the real ones into
1178 memory. */
1179 yy_state_t *yyss1 = yyss;
1180 YYSTYPE *yyvs1 = yyvs;
1181
1182 /* Each stack pointer address is followed by the size of the
1183 data in use in that stack, in bytes. This used to be a
1184 conditional around just the two extra args, but that might
1185 be undefined if yyoverflow is a macro. */
1186 yyoverflow (YY_("memory exhausted"),
1187 &yyss1, yysize * YYSIZEOF (*yyssp),
1188 &yyvs1, yysize * YYSIZEOF (*yyvsp),
1189 &yystacksize);
1190 yyss = yyss1;
1191 yyvs = yyvs1;
1192 }
1193 # else /* defined YYSTACK_RELOCATE */
1194 /* Extend the stack our own way. */
1195 if (YYMAXDEPTH <= yystacksize)
1196 goto yyexhaustedlab;
1197 yystacksize *= 2;
1198 if (YYMAXDEPTH < yystacksize)
1199 yystacksize = YYMAXDEPTH;
1200
1201 {
1202 yy_state_t *yyss1 = yyss;
1203 union yyalloc *yyptr =
1204 YY_CAST (union yyalloc *,
1205 YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
1206 if (! yyptr)
1207 goto yyexhaustedlab;
1208 YYSTACK_RELOCATE (yyss_alloc, yyss);
1209 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1210 # undef YYSTACK_RELOCATE
1211 if (yyss1 != yyssa)
1212 YYSTACK_FREE (yyss1);
1213 }
1214 # endif
1215
1216 yyssp = yyss + yysize - 1;
1217 yyvsp = yyvs + yysize - 1;
1218
1219 YY_IGNORE_USELESS_CAST_BEGIN
1220 YYDPRINTF ((stderr, "Stack size increased to %ld\n",
1221 YY_CAST (long, yystacksize)));
1222 YY_IGNORE_USELESS_CAST_END
1223
1224 if (yyss + yystacksize - 1 <= yyssp)
1225 YYABORT;
1226 }
1227 #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1228
1229 if (yystate == YYFINAL)
1230 YYACCEPT;
1231
1232 goto yybackup;
1233
1234
1235 /*-----------.
1236 | yybackup. |
1237 `-----------*/
1238 yybackup:
1239 /* Do appropriate processing given the current state. Read a
1240 lookahead token if we need one and don't already have one. */
1241
1242 /* First try to decide what to do without reference to lookahead token. */
1243 yyn = yypact[yystate];
1244 if (yypact_value_is_default (yyn))
1245 goto yydefault;
1246
1247 /* Not known => get a lookahead token if don't already have one. */
1248
1249 /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */
1250 if (yychar == YYEMPTY)
1251 {
1252 YYDPRINTF ((stderr, "Reading a token\n"));
1253 yychar = yylex ();
1254 }
1255
1256 if (yychar <= YYEOF)
1257 {
1258 yychar = YYEOF;
1259 yytoken = YYSYMBOL_YYEOF;
1260 YYDPRINTF ((stderr, "Now at end of input.\n"));
1261 }
1262 else if (yychar == YYerror)
1263 {
1264 /* The scanner already issued an error message, process directly
1265 to error recovery. But do not keep the error token as
1266 lookahead, it is too special and may lead us to an endless
1267 loop in error recovery. */
1268 yychar = YYUNDEF;
1269 yytoken = YYSYMBOL_YYerror;
1270 goto yyerrlab1;
1271 }
1272 else
1273 {
1274 yytoken = YYTRANSLATE (yychar);
1275 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1276 }
1277
1278 /* If the proper action on seeing token YYTOKEN is to reduce or to
1279 detect an error, take that action. */
1280 yyn += yytoken;
1281 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1282 goto yydefault;
1283 yyn = yytable[yyn];
1284 if (yyn <= 0)
1285 {
1286 if (yytable_value_is_error (yyn))
1287 goto yyerrlab;
1288 yyn = -yyn;
1289 goto yyreduce;
1290 }
1291
1292 /* Count tokens shifted since error; after three, turn off error
1293 status. */
1294 if (yyerrstatus)
1295 yyerrstatus--;
1296
1297 /* Shift the lookahead token. */
1298 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1299 yystate = yyn;
1300 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1301 *++yyvsp = yylval;
1302 YY_IGNORE_MAYBE_UNINITIALIZED_END
1303
1304 /* Discard the shifted token. */
1305 yychar = YYEMPTY;
1306 goto yynewstate;
1307
1308
1309 /*-----------------------------------------------------------.
1310 | yydefault -- do the default action for the current state. |
1311 `-----------------------------------------------------------*/
1312 yydefault:
1313 yyn = yydefact[yystate];
1314 if (yyn == 0)
1315 goto yyerrlab;
1316 goto yyreduce;
1317
1318
1319 /*-----------------------------.
1320 | yyreduce -- do a reduction. |
1321 `-----------------------------*/
1322 yyreduce:
1323 /* yyn is the number of a rule to reduce with. */
1324 yylen = yyr2[yyn];
1325
1326 /* If YYLEN is nonzero, implement the default value of the action:
1327 '$$ = $1'.
1328
1329 Otherwise, the following line sets YYVAL to garbage.
1330 This behavior is undocumented and Bison
1331 users should not rely upon it. Assigning to YYVAL
1332 unconditionally makes the parser a bit smaller, and it avoids a
1333 GCC warning that YYVAL may be used uninitialized. */
1334 yyval = yyvsp[1-yylen];
1335
1336
1337 YY_REDUCE_PRINT (yyn);
1338 switch (yyn)
1339 {
1340 case 2:
1341 #line 86 "parser.y"
1342 { root_node = (yyvsp[0].block); }
1343 #line 1338 "ascent_expressions_parser.cpp"
1344 break;
1345
1346 case 3:
1347 #line 89 "parser.y"
1348 { (yyval.block) = new ASTBlock((yyvsp[-2].named_expr_list), (yyvsp[-1].expr)); }
1349 #line 1344 "ascent_expressions_parser.cpp"
1350 break;
1351
1352 case 4:
1353 #line 90 "parser.y"
1354 { (yyval.block) = new ASTBlock((yyvsp[-1].named_expr_list), (yyvsp[0].expr)); }
1355 #line 1350 "ascent_expressions_parser.cpp"
1356 break;
1357
1358 case 5:
1359 #line 93 "parser.y"
1360 { (yyval.named_expr_list) = new ASTNamedExpressionList(); }
1361 #line 1356 "ascent_expressions_parser.cpp"
1362 break;
1363
1364 case 6:
1365 #line 94 "parser.y"
1366 { (yyvsp[-1].named_expr_list)->push_back((yyvsp[0].named_expr)); }
1367 #line 1362 "ascent_expressions_parser.cpp"
1368 break;
1369
1370 case 7:
1371 #line 97 "parser.y"
1372 { (yyval.named_expr) = new ASTNamedExpression((yyvsp[-3].ident), (yyvsp[-1].expr)); }
1373 #line 1368 "ascent_expressions_parser.cpp"
1374 break;
1375
1376 case 8:
1377 #line 100 "parser.y"
1378 { (yyval.ident) = new ASTIdentifier(*(yyvsp[0].string)); delete (yyvsp[0].string); }
1379 #line 1374 "ascent_expressions_parser.cpp"
1380 break;
1381
1382 case 9:
1383 #line 103 "parser.y"
1384 { (yyval.expr) = new ASTInteger(std::stoi(*(yyvsp[0].string))); delete (yyvsp[0].string); }
1385 #line 1380 "ascent_expressions_parser.cpp"
1386 break;
1387
1388 case 10:
1389 #line 104 "parser.y"
1390 { (yyval.expr) = new ASTDouble(std::stod(*(yyvsp[0].string))); delete (yyvsp[0].string); }
1391 #line 1386 "ascent_expressions_parser.cpp"
1392 break;
1393
1394 case 11:
1395 #line 107 "parser.y"
1396 { (yyval.args) = new ASTArguments(nullptr, nullptr); }
1397 #line 1392 "ascent_expressions_parser.cpp"
1398 break;
1399
1400 case 12:
1401 #line 108 "parser.y"
1402 { (yyval.args) = new ASTArguments((yyvsp[0].expr_list), nullptr); }
1403 #line 1398 "ascent_expressions_parser.cpp"
1404 break;
1405
1406 case 13:
1407 #line 109 "parser.y"
1408 { (yyval.args) = new ASTArguments(nullptr, (yyvsp[0].named_expr_list)); }
1409 #line 1404 "ascent_expressions_parser.cpp"
1410 break;
1411
1412 case 14:
1413 #line 110 "parser.y"
1414 { (yyval.args) = new ASTArguments((yyvsp[-2].expr_list), (yyvsp[0].named_expr_list)); }
1415 #line 1410 "ascent_expressions_parser.cpp"
1416 break;
1417
1418 case 15:
1419 #line 113 "parser.y"
1420 { (yyval.expr_list) = new ASTExpressionList(); (yyval.expr_list)->exprs.push_back((yyvsp[0].expr)); }
1421 #line 1416 "ascent_expressions_parser.cpp"
1422 break;
1423
1424 case 16:
1425 #line 114 "parser.y"
1426 { (yyvsp[-2].expr_list)->exprs.push_back((yyvsp[0].expr)); }
1427 #line 1422 "ascent_expressions_parser.cpp"
1428 break;
1429
1430 case 17:
1431 #line 117 "parser.y"
1432 { (yyval.named_expr_list) = new ASTNamedExpressionList(); (yyval.named_expr_list)->push_back((yyvsp[0].named_expr)); }
1433 #line 1428 "ascent_expressions_parser.cpp"
1434 break;
1435
1436 case 18:
1437 #line 118 "parser.y"
1438 { (yyvsp[-2].named_expr_list)->push_back((yyvsp[0].named_expr)); }
1439 #line 1434 "ascent_expressions_parser.cpp"
1440 break;
1441
1442 case 19:
1443 #line 121 "parser.y"
1444 { (yyval.named_expr) = new ASTNamedExpression((yyvsp[-2].ident), (yyvsp[0].expr)); }
1445 #line 1440 "ascent_expressions_parser.cpp"
1446 break;
1447
1448 case 20:
1449 #line 124 "parser.y"
1450 { (yyval.expr) = new ASTIfExpr((yyvsp[-4].expr), (yyvsp[-2].expr), (yyvsp[0].expr)); }
1451 #line 1446 "ascent_expressions_parser.cpp"
1452 break;
1453
1454 case 21:
1455 #line 127 "parser.y"
1456 { (yyval.string_literal) = new ASTString(*(yyvsp[0].string)); delete (yyvsp[0].string); }
1457 #line 1452 "ascent_expressions_parser.cpp"
1458 break;
1459
1460 case 22:
1461 #line 130 "parser.y"
1462 { (yyval.expr) = new ASTArrayAccess((yyvsp[-3].expr), (yyvsp[-1].expr)); }
1463 #line 1458 "ascent_expressions_parser.cpp"
1464 break;
1465
1466 case 23:
1467 #line 133 "parser.y"
1468 { (yyval.expr) = new ASTDotAccess((yyvsp[-2].expr), *(yyvsp[0].string)); delete (yyvsp[0].string); }
1469 #line 1464 "ascent_expressions_parser.cpp"
1470 break;
1471
1472 case 24:
1473 #line 136 "parser.y"
1474 {(yyval.expr_list) = new ASTExpressionList();}
1475 #line 1470 "ascent_expressions_parser.cpp"
1476 break;
1477
1478 case 25:
1479 #line 137 "parser.y"
1480 { (yyval.expr_list) = (yyvsp[-1].expr_list); }
1481 #line 1476 "ascent_expressions_parser.cpp"
1482 break;
1483
1484 case 26:
1485 #line 140 "parser.y"
1486 { (yyval.bool_literal) = new ASTBoolean((yyvsp[0].token)); }
1487 #line 1482 "ascent_expressions_parser.cpp"
1488 break;
1489
1490 case 27:
1491 #line 141 "parser.y"
1492 { (yyval.bool_literal) = new ASTBoolean((yyvsp[0].token)); }
1493 #line 1488 "ascent_expressions_parser.cpp"
1494 break;
1495
1496 case 28:
1497 #line 144 "parser.y"
1498 { (yyval.expr) = new ASTMethodCall((yyvsp[-3].ident), (yyvsp[-1].args)); }
1499 #line 1494 "ascent_expressions_parser.cpp"
1500 break;
1501
1502 case 29:
1503 #line 145 "parser.y"
1504 { (yyval.expr) = (yyvsp[0].ident); }
1505 #line 1500 "ascent_expressions_parser.cpp"
1506 break;
1507
1508 case 30:
1509 #line 146 "parser.y"
1510 { (yyval.expr) = (yyvsp[0].bool_literal); }
1511 #line 1506 "ascent_expressions_parser.cpp"
1512 break;
1513
1514 case 31:
1515 #line 147 "parser.y"
1516 { (yyval.expr) = (yyvsp[0].string_literal); }
1517 #line 1512 "ascent_expressions_parser.cpp"
1518 break;
1519
1520 case 32:
1521 #line 148 "parser.y"
1522 { (yyval.expr) = (yyvsp[0].expr); }
1523 #line 1518 "ascent_expressions_parser.cpp"
1524 break;
1525
1526 case 33:
1527 #line 149 "parser.y"
1528 { (yyval.expr) = (yyvsp[0].expr); }
1529 #line 1524 "ascent_expressions_parser.cpp"
1530 break;
1531
1532 case 34:
1533 #line 150 "parser.y"
1534 { (yyval.expr) = (yyvsp[0].expr); }
1535 #line 1530 "ascent_expressions_parser.cpp"
1536 break;
1537
1538 case 35:
1539 #line 151 "parser.y"
1540 { (yyval.expr) = (yyvsp[0].expr_list); }
1541 #line 1536 "ascent_expressions_parser.cpp"
1542 break;
1543
1544 case 37:
1545 #line 153 "parser.y"
1546 { (yyval.expr) = new ASTBinaryOp((yyvsp[-2].expr), (yyvsp[-1].token), (yyvsp[0].expr)); }
1547 #line 1542 "ascent_expressions_parser.cpp"
1548 break;
1549
1550 case 38:
1551 #line 154 "parser.y"
1552 { (yyval.expr) = new ASTBinaryOp((yyvsp[-2].expr), (yyvsp[-1].token), (yyvsp[0].expr)); }
1553 #line 1548 "ascent_expressions_parser.cpp"
1554 break;
1555
1556 case 39:
1557 #line 155 "parser.y"
1558 { (yyval.expr) = new ASTBinaryOp((yyvsp[-2].expr), (yyvsp[-1].token), (yyvsp[0].expr)); }
1559 #line 1554 "ascent_expressions_parser.cpp"
1560 break;
1561
1562 case 40:
1563 #line 156 "parser.y"
1564 { (yyval.expr) = new ASTBinaryOp((yyvsp[-2].expr), (yyvsp[-1].token), (yyvsp[0].expr)); }
1565 #line 1560 "ascent_expressions_parser.cpp"
1566 break;
1567
1568 case 41:
1569 #line 157 "parser.y"
1570 { (yyval.expr) = new ASTBinaryOp((yyvsp[-2].expr), (yyvsp[-1].token), (yyvsp[0].expr)); }
1571 #line 1566 "ascent_expressions_parser.cpp"
1572 break;
1573
1574 case 42:
1575 #line 158 "parser.y"
1576 { (yyval.expr) = new ASTBinaryOp(new ASTInteger(-1),TMUL,(yyvsp[0].expr)); }
1577 #line 1572 "ascent_expressions_parser.cpp"
1578 break;
1579
1580 case 43:
1581 #line 159 "parser.y"
1582 { (yyval.expr) = new ASTBinaryOp((yyvsp[-2].expr), (yyvsp[-1].token), (yyvsp[0].expr)); }
1583 #line 1578 "ascent_expressions_parser.cpp"
1584 break;
1585
1586 case 44:
1587 #line 160 "parser.y"
1588 { (yyval.expr) = new ASTBinaryOp((yyvsp[-2].expr), (yyvsp[-1].token), (yyvsp[0].expr)); }
1589 #line 1584 "ascent_expressions_parser.cpp"
1590 break;
1591
1592 case 45:
1593 #line 161 "parser.y"
1594 { (yyval.expr) = new ASTBinaryOp((yyvsp[-2].expr), (yyvsp[-1].token), (yyvsp[0].expr)); }
1595 #line 1590 "ascent_expressions_parser.cpp"
1596 break;
1597
1598 case 46:
1599 #line 162 "parser.y"
1600 { (yyval.expr) = new ASTBinaryOp((yyvsp[-2].expr), (yyvsp[-1].token), (yyvsp[0].expr)); }
1601 #line 1596 "ascent_expressions_parser.cpp"
1602 break;
1603
1604 case 47:
1605 #line 163 "parser.y"
1606 { (yyval.expr) = new ASTBinaryOp((yyvsp[-2].expr), (yyvsp[-1].token), (yyvsp[0].expr)); }
1607 #line 1602 "ascent_expressions_parser.cpp"
1608 break;
1609
1610 case 48:
1611 #line 164 "parser.y"
1612 { (yyval.expr) = new ASTBinaryOp((yyvsp[-2].expr), (yyvsp[-1].token), (yyvsp[0].expr)); }
1613 #line 1608 "ascent_expressions_parser.cpp"
1614 break;
1615
1616 case 49:
1617 #line 165 "parser.y"
1618 { (yyval.expr) = new ASTBinaryOp((yyvsp[-2].expr), (yyvsp[-1].token), (yyvsp[0].expr)); }
1619 #line 1614 "ascent_expressions_parser.cpp"
1620 break;
1621
1622 case 50:
1623 #line 166 "parser.y"
1624 { (yyval.expr) = new ASTBinaryOp((yyvsp[-2].expr), (yyvsp[-1].token), (yyvsp[0].expr)); }
1625 #line 1620 "ascent_expressions_parser.cpp"
1626 break;
1627
1628 case 51:
1629 #line 167 "parser.y"
1630 { (yyval.expr) = new ASTBinaryOp(new ASTExpression(), (yyvsp[-1].token), (yyvsp[0].expr)); }
1631 #line 1626 "ascent_expressions_parser.cpp"
1632 break;
1633
1634 case 52:
1635 #line 168 "parser.y"
1636 { (yyval.expr) = (yyvsp[-1].expr); }
1637 #line 1632 "ascent_expressions_parser.cpp"
1638 break;
1639
1640
1641 #line 1636 "ascent_expressions_parser.cpp"
1642
1643 default: break;
1644 }
1645 /* User semantic actions sometimes alter yychar, and that requires
1646 that yytoken be updated with the new translation. We take the
1647 approach of translating immediately before every use of yytoken.
1648 One alternative is translating here after every semantic action,
1649 but that translation would be missed if the semantic action invokes
1650 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1651 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1652 incorrect destructor might then be invoked immediately. In the
1653 case of YYERROR or YYBACKUP, subsequent parser actions might lead
1654 to an incorrect destructor call or verbose syntax error message
1655 before the lookahead is translated. */
1656 YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
1657
1658 YYPOPSTACK (yylen);
1659 yylen = 0;
1660
1661 *++yyvsp = yyval;
1662
1663 /* Now 'shift' the result of the reduction. Determine what state
1664 that goes to, based on the state we popped back to and the rule
1665 number reduced by. */
1666 {
1667 const int yylhs = yyr1[yyn] - YYNTOKENS;
1668 const int yyi = yypgoto[yylhs] + *yyssp;
1669 yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
1670 ? yytable[yyi]
1671 : yydefgoto[yylhs]);
1672 }
1673
1674 goto yynewstate;
1675
1676
1677 /*--------------------------------------.
1678 | yyerrlab -- here on detecting error. |
1679 `--------------------------------------*/
1680 yyerrlab:
1681 /* Make sure we have latest lookahead translation. See comments at
1682 user semantic actions for why this is necessary. */
1683 yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
1684 /* If not already recovering from an error, report this error. */
1685 if (!yyerrstatus)
1686 {
1687 ++yynerrs;
1688 yyerror (YY_("syntax error"));
1689 }
1690
1691 if (yyerrstatus == 3)
1692 {
1693 /* If just tried and failed to reuse lookahead token after an
1694 error, discard it. */
1695
1696 if (yychar <= YYEOF)
1697 {
1698 /* Return failure if at end of input. */
1699 if (yychar == YYEOF)
1700 YYABORT;
1701 }
1702 else
1703 {
1704 yydestruct ("Error: discarding",
1705 yytoken, &yylval);
1706 yychar = YYEMPTY;
1707 }
1708 }
1709
1710 /* Else will try to reuse lookahead token after shifting the error
1711 token. */
1712 goto yyerrlab1;
1713
1714
1715 /*---------------------------------------------------.
1716 | yyerrorlab -- error raised explicitly by YYERROR. |
1717 `---------------------------------------------------*/
1718 yyerrorlab:
1719 /* Pacify compilers when the user code never invokes YYERROR and the
1720 label yyerrorlab therefore never appears in user code. */
1721 if (0)
1722 YYERROR;
1723
1724 /* Do not reclaim the symbols of the rule whose action triggered
1725 this YYERROR. */
1726 YYPOPSTACK (yylen);
1727 yylen = 0;
1728 YY_STACK_PRINT (yyss, yyssp);
1729 yystate = *yyssp;
1730 goto yyerrlab1;
1731
1732
1733 /*-------------------------------------------------------------.
1734 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1735 `-------------------------------------------------------------*/
1736 yyerrlab1:
1737 yyerrstatus = 3; /* Each real token shifted decrements this. */
1738
1739 // Pop stack until we find a state that shifts the error token.
1740 for (;;)
1741 {
1742 yyn = yypact[yystate];
1743 if (!yypact_value_is_default (yyn))
1744 {
1745 yyn += YYSYMBOL_YYerror;
1746 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
1747 {
1748 yyn = yytable[yyn];
1749 if (0 < yyn)
1750 break;
1751 }
1752 }
1753
1754 /* Pop the current state because it cannot handle the error token. */
1755 if (yyssp == yyss)
1756 YYABORT;
1757
1758
1759 yydestruct ("Error: popping",
1760 YY_ACCESSING_SYMBOL (yystate), yyvsp);
1761 YYPOPSTACK (1);
1762 yystate = *yyssp;
1763 YY_STACK_PRINT (yyss, yyssp);
1764 }
1765
1766 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1767 *++yyvsp = yylval;
1768 YY_IGNORE_MAYBE_UNINITIALIZED_END
1769
1770
1771 /* Shift the error token. */
1772 YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
1773
1774 yystate = yyn;
1775 goto yynewstate;
1776
1777
1778 /*-------------------------------------.
1779 | yyacceptlab -- YYACCEPT comes here. |
1780 `-------------------------------------*/
1781 yyacceptlab:
1782 yyresult = 0;
1783 goto yyreturn;
1784
1785
1786 /*-----------------------------------.
1787 | yyabortlab -- YYABORT comes here. |
1788 `-----------------------------------*/
1789 yyabortlab:
1790 yyresult = 1;
1791 goto yyreturn;
1792
1793
1794 #if !defined yyoverflow
1795 /*-------------------------------------------------.
1796 | yyexhaustedlab -- memory exhaustion comes here. |
1797 `-------------------------------------------------*/
1798 yyexhaustedlab:
1799 yyerror (YY_("memory exhausted"));
1800 yyresult = 2;
1801 /* Fall through. */
1802 #endif
1803
1804
1805 /*-----------------------------------------------------.
1806 | yyreturn -- parsing is finished, return the result. |
1807 `-----------------------------------------------------*/
1808 yyreturn:
1809 if (yychar != YYEMPTY)
1810 {
1811 /* Make sure we have latest lookahead translation. See comments at
1812 user semantic actions for why this is necessary. */
1813 yytoken = YYTRANSLATE (yychar);
1814 yydestruct ("Cleanup: discarding lookahead",
1815 yytoken, &yylval);
1816 }
1817 /* Do not reclaim the symbols of the rule whose action triggered
1818 this YYABORT or YYACCEPT. */
1819 YYPOPSTACK (yylen);
1820 YY_STACK_PRINT (yyss, yyssp);
1821 while (yyssp != yyss)
1822 {
1823 yydestruct ("Cleanup: popping",
1824 YY_ACCESSING_SYMBOL (+*yyssp), yyvsp);
1825 YYPOPSTACK (1);
1826 }
1827 #ifndef yyoverflow
1828 if (yyss != yyssa)
1829 YYSTACK_FREE (yyss);
1830 #endif
1831
1832 return yyresult;
1833 }
1834
1835 #line 171 "parser.y"
1836
1837