1 /* A Bison parser, made by GNU Bison 3.8.2. */
3 /* Bison implementation for Yacc-like parsers in C
5 Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <https://www.gnu.org/licenses/>. */
21 /* As a special exception, you may create a larger work that contains
22 part or all of the Bison parser skeleton and distribute that work
23 under terms of your choice, so long as that work isn't itself a
24 parser generator using the skeleton or a modified version thereof
25 as a parser skeleton. Alternatively, if you modify or redistribute
26 the parser skeleton itself, you may (at your option) remove this
27 special exception, which will cause the skeleton and the resulting
28 Bison output files to be licensed under the GNU General Public
29 License without this special exception.
31 This special exception was added by the Free Software Foundation in
32 version 2.2 of Bison. */
34 /* C LALR(1) parser skeleton written by Richard Stallman, by
35 simplifying the original so-called "semantic" parser. */
37 /* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
38 especially those whose name start with YY_ or yy_. They are
39 private implementation details that can be changed or removed. */
41 /* All symbols defined below should begin with yy or YY, to avoid
42 infringing on user name space. This should be done even for local
43 variables, as they might otherwise be expanded by user macros.
44 There are some unavoidable exceptions within include files to
45 define necessary library symbols; they are noted "INFRINGES ON
46 USER NAME SPACE" below. */
48 /* Identify Bison output, and Bison version. */
51 /* Bison version string. */
52 #define YYBISON_VERSION "3.8.2"
55 #define YYSKELETON_NAME "yacc.c"
69 /* First part of user prologue. */
74 * Copyright (c) 1997-1998 Markku Rossi.
76 * Author: Markku Rossi <mtr@iki.fi>
80 * This file is part of GNU Enscript.
82 * Enscript is free software: you can redistribute it and/or modify
83 * it under the terms of the GNU General Public License as published by
84 * the Free Software Foundation, either version 3 of the License, or
85 * (at your option) any later version.
87 * Enscript is distributed in the hope that it will be useful,
88 * but WITHOUT ANY WARRANTY; without even the implied warranty of
89 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
90 * GNU General Public License for more details.
92 * You should have received a copy of the GNU General Public License
93 * along with Enscript. If not, see <http://www.gnu.org/licenses/>.
97 * $Id: gram.y,v 1.1.1.1 2003/03/05 07:25:52 mtr Exp $
106 # define YY_CAST(Type, Val) static_cast<Type> (Val)
107 # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
109 # define YY_CAST(Type, Val) ((Type) (Val))
110 # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
114 # if defined __cplusplus
115 # if 201103L <= __cplusplus
116 # define YY_NULLPTR nullptr
118 # define YY_NULLPTR 0
121 # define YY_NULLPTR ((void*)0)
125 /* Use api.header.include to #include this header
126 instead of duplicating it here. */
127 #ifndef YY_YY_GRAM_H_INCLUDED
128 # define YY_YY_GRAM_H_INCLUDED
143 YYEOF = 0, /* "end of file" */
144 YYerror = 256, /* error */
145 YYUNDEF = 257, /* "invalid token" */
146 tSYMBOL = 258, /* tSYMBOL */
147 tREGEXP = 259, /* tREGEXP */
148 tSTRING = 260, /* tSTRING */
149 tINTEGER = 261, /* tINTEGER */
150 tREAL = 262, /* tREAL */
151 tSUB = 263, /* tSUB */
152 tSTATE = 264, /* tSTATE */
153 tSTART = 265, /* tSTART */
154 tSTARTRULES = 266, /* tSTARTRULES */
155 tNAMERULES = 267, /* tNAMERULES */
156 tBEGIN = 268, /* tBEGIN */
157 tEND = 269, /* tEND */
158 tRETURN = 270, /* tRETURN */
160 tELSE = 272, /* tELSE */
161 tLOCAL = 273, /* tLOCAL */
162 tWHILE = 274, /* tWHILE */
163 tFOR = 275, /* tFOR */
164 tEXTENDS = 276, /* tEXTENDS */
165 tADDASSIGN = 277, /* tADDASSIGN */
166 tSUBASSIGN = 278, /* tSUBASSIGN */
167 tMULASSIGN = 279, /* tMULASSIGN */
168 tDIVASSIGN = 280, /* tDIVASSIGN */
170 tAND = 282, /* tAND */
175 tDIV = 287, /* tDIV */
176 tPLUSPLUS = 288, /* tPLUSPLUS */
177 tMINUSMINUS = 289 /* tMINUSMINUS */
179 typedef enum yytokentype yytoken_kind_t;
194 #define tSTARTRULES 266
195 #define tNAMERULES 267
205 #define tADDASSIGN 277
206 #define tSUBASSIGN 278
207 #define tMULASSIGN 279
208 #define tDIVASSIGN 280
216 #define tPLUSPLUS 288
217 #define tMINUSMINUS 289
220 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
234 typedef union YYSTYPE YYSTYPE;
235 # define YYSTYPE_IS_TRIVIAL 1
236 # define YYSTYPE_IS_DECLARED 1
240 extern YYSTYPE yylval;
246 #endif /* !YY_YY_GRAM_H_INCLUDED */
250 YYSYMBOL_YYEMPTY = -2,
251 YYSYMBOL_YYEOF = 0, /* "end of file" */
252 YYSYMBOL_YYerror = 1, /* error */
253 YYSYMBOL_YYUNDEF = 2, /* "invalid token" */
254 YYSYMBOL_tSYMBOL = 3, /* tSYMBOL */
255 YYSYMBOL_tREGEXP = 4, /* tREGEXP */
256 YYSYMBOL_tSTRING = 5, /* tSTRING */
257 YYSYMBOL_tINTEGER = 6, /* tINTEGER */
258 YYSYMBOL_tREAL = 7, /* tREAL */
259 YYSYMBOL_tSUB = 8, /* tSUB */
260 YYSYMBOL_tSTATE = 9, /* tSTATE */
261 YYSYMBOL_tSTART = 10, /* tSTART */
262 YYSYMBOL_tSTARTRULES = 11, /* tSTARTRULES */
263 YYSYMBOL_tNAMERULES = 12, /* tNAMERULES */
264 YYSYMBOL_tBEGIN = 13, /* tBEGIN */
265 YYSYMBOL_tEND = 14, /* tEND */
266 YYSYMBOL_tRETURN = 15, /* tRETURN */
267 YYSYMBOL_tIF = 16, /* tIF */
268 YYSYMBOL_tELSE = 17, /* tELSE */
269 YYSYMBOL_tLOCAL = 18, /* tLOCAL */
270 YYSYMBOL_tWHILE = 19, /* tWHILE */
271 YYSYMBOL_tFOR = 20, /* tFOR */
272 YYSYMBOL_tEXTENDS = 21, /* tEXTENDS */
273 YYSYMBOL_22_ = 22, /* '=' */
274 YYSYMBOL_tADDASSIGN = 23, /* tADDASSIGN */
275 YYSYMBOL_tSUBASSIGN = 24, /* tSUBASSIGN */
276 YYSYMBOL_tMULASSIGN = 25, /* tMULASSIGN */
277 YYSYMBOL_tDIVASSIGN = 26, /* tDIVASSIGN */
278 YYSYMBOL_27_ = 27, /* '?' */
279 YYSYMBOL_28_ = 28, /* ':' */
280 YYSYMBOL_tOR = 29, /* tOR */
281 YYSYMBOL_tAND = 30, /* tAND */
282 YYSYMBOL_tEQ = 31, /* tEQ */
283 YYSYMBOL_tNE = 32, /* tNE */
284 YYSYMBOL_33_ = 33, /* '<' */
285 YYSYMBOL_34_ = 34, /* '>' */
286 YYSYMBOL_tGE = 35, /* tGE */
287 YYSYMBOL_tLE = 36, /* tLE */
288 YYSYMBOL_37_ = 37, /* '+' */
289 YYSYMBOL_38_ = 38, /* '-' */
290 YYSYMBOL_39_ = 39, /* '*' */
291 YYSYMBOL_tDIV = 40, /* tDIV */
292 YYSYMBOL_41_ = 41, /* '!' */
293 YYSYMBOL_tPLUSPLUS = 42, /* tPLUSPLUS */
294 YYSYMBOL_tMINUSMINUS = 43, /* tMINUSMINUS */
295 YYSYMBOL_44_ = 44, /* '[' */
296 YYSYMBOL_45_ = 45, /* ']' */
297 YYSYMBOL_46_ = 46, /* '{' */
298 YYSYMBOL_47_ = 47, /* '}' */
299 YYSYMBOL_48_ = 48, /* ';' */
300 YYSYMBOL_49_ = 49, /* ',' */
301 YYSYMBOL_50_ = 50, /* '(' */
302 YYSYMBOL_51_ = 51, /* ')' */
303 YYSYMBOL_YYACCEPT = 52, /* $accept */
304 YYSYMBOL_file = 53, /* file */
305 YYSYMBOL_toplevel = 54, /* toplevel */
306 YYSYMBOL_regexp_sym_list = 55, /* regexp_sym_list */
307 YYSYMBOL_staterules = 56, /* staterules */
308 YYSYMBOL_staterule = 57, /* staterule */
309 YYSYMBOL_symbol_list = 58, /* symbol_list */
310 YYSYMBOL_rest_symbol_list = 59, /* rest_symbol_list */
311 YYSYMBOL_locals = 60, /* locals */
312 YYSYMBOL_locals_rest = 61, /* locals_rest */
313 YYSYMBOL_local_def = 62, /* local_def */
314 YYSYMBOL_stmt_list = 63, /* stmt_list */
315 YYSYMBOL_stmt = 64, /* stmt */
316 YYSYMBOL_expr = 65, /* expr */
317 YYSYMBOL_cond_expr = 66, /* cond_expr */
318 YYSYMBOL_expr_list = 67, /* expr_list */
319 YYSYMBOL_rest_expr_list = 68 /* rest_expr_list */
321 typedef enum yysymbol_kind_t yysymbol_kind_t;
330 /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
331 <limits.h> and (if available) <stdint.h> are included
332 so that the code can choose integer types of a good width. */
334 #ifndef __PTRDIFF_MAX__
335 # include <limits.h> /* INFRINGES ON USER NAME SPACE */
336 # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
337 # include <stdint.h> /* INFRINGES ON USER NAME SPACE */
342 /* Narrow types that promote to a signed type and that can represent a
343 signed or unsigned integer of at least N bits. In tables they can
344 save space and decrease cache pressure. Promoting to a signed type
345 helps avoid bugs in integer arithmetic. */
347 #ifdef __INT_LEAST8_MAX__
348 typedef __INT_LEAST8_TYPE__ yytype_int8;
349 #elif defined YY_STDINT_H
350 typedef int_least8_t yytype_int8;
352 typedef signed char yytype_int8;
355 #ifdef __INT_LEAST16_MAX__
356 typedef __INT_LEAST16_TYPE__ yytype_int16;
357 #elif defined YY_STDINT_H
358 typedef int_least16_t yytype_int16;
360 typedef short yytype_int16;
363 /* Work around bug in HP-UX 11.23, which defines these macros
364 incorrectly for preprocessor constants. This workaround can likely
365 be removed in 2023, as HPE has promised support for HP-UX 11.23
366 (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
367 <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>. */
369 # undef UINT_LEAST8_MAX
370 # undef UINT_LEAST16_MAX
371 # define UINT_LEAST8_MAX 255
372 # define UINT_LEAST16_MAX 65535
375 #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
376 typedef __UINT_LEAST8_TYPE__ yytype_uint8;
377 #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
378 && UINT_LEAST8_MAX <= INT_MAX)
379 typedef uint_least8_t yytype_uint8;
380 #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
381 typedef unsigned char yytype_uint8;
383 typedef short yytype_uint8;
386 #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
387 typedef __UINT_LEAST16_TYPE__ yytype_uint16;
388 #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
389 && UINT_LEAST16_MAX <= INT_MAX)
390 typedef uint_least16_t yytype_uint16;
391 #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
392 typedef unsigned short yytype_uint16;
394 typedef int yytype_uint16;
398 # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
399 # define YYPTRDIFF_T __PTRDIFF_TYPE__
400 # define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
401 # elif defined PTRDIFF_MAX
403 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
405 # define YYPTRDIFF_T ptrdiff_t
406 # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
408 # define YYPTRDIFF_T long
409 # define YYPTRDIFF_MAXIMUM LONG_MAX
414 # ifdef __SIZE_TYPE__
415 # define YYSIZE_T __SIZE_TYPE__
416 # elif defined size_t
417 # define YYSIZE_T size_t
418 # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
419 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
420 # define YYSIZE_T size_t
422 # define YYSIZE_T unsigned
426 #define YYSIZE_MAXIMUM \
427 YY_CAST (YYPTRDIFF_T, \
428 (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
429 ? YYPTRDIFF_MAXIMUM \
430 : YY_CAST (YYSIZE_T, -1)))
432 #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
435 /* Stored state numbers (used for stacks). */
436 typedef yytype_uint8 yy_state_t;
438 /* State numbers in computations. */
439 typedef int yy_state_fast_t;
442 # if defined YYENABLE_NLS && YYENABLE_NLS
444 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
445 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
449 # define YY_(Msgid) Msgid
454 #ifndef YY_ATTRIBUTE_PURE
455 # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
456 # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
458 # define YY_ATTRIBUTE_PURE
462 #ifndef YY_ATTRIBUTE_UNUSED
463 # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
464 # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
466 # define YY_ATTRIBUTE_UNUSED
470 /* Suppress unused-variable warnings by "using" E. */
471 #if ! defined lint || defined __GNUC__
472 # define YY_USE(E) ((void) (E))
474 # define YY_USE(E) /* empty */
477 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
478 #if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
479 # if __GNUC__ * 100 + __GNUC_MINOR__ < 407
480 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
481 _Pragma ("GCC diagnostic push") \
482 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")
484 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
485 _Pragma ("GCC diagnostic push") \
486 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
487 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
489 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
490 _Pragma ("GCC diagnostic pop")
492 # define YY_INITIAL_VALUE(Value) Value
494 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
495 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
496 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
498 #ifndef YY_INITIAL_VALUE
499 # define YY_INITIAL_VALUE(Value) /* Nothing. */
502 #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
503 # define YY_IGNORE_USELESS_CAST_BEGIN \
504 _Pragma ("GCC diagnostic push") \
505 _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
506 # define YY_IGNORE_USELESS_CAST_END \
507 _Pragma ("GCC diagnostic pop")
509 #ifndef YY_IGNORE_USELESS_CAST_BEGIN
510 # define YY_IGNORE_USELESS_CAST_BEGIN
511 # define YY_IGNORE_USELESS_CAST_END
515 #define YY_ASSERT(E) ((void) (0 && (E)))
517 #if !defined yyoverflow
519 /* The parser invokes alloca or malloc; define the necessary symbols. */
521 # ifdef YYSTACK_USE_ALLOCA
522 # if YYSTACK_USE_ALLOCA
524 # define YYSTACK_ALLOC __builtin_alloca
525 # elif defined __BUILTIN_VA_ARG_INCR
526 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
528 # define YYSTACK_ALLOC __alloca
529 # elif defined _MSC_VER
530 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
531 # define alloca _alloca
533 # define YYSTACK_ALLOC alloca
534 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
535 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
536 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
537 # ifndef EXIT_SUCCESS
538 # define EXIT_SUCCESS 0
545 # ifdef YYSTACK_ALLOC
546 /* Pacify GCC's 'empty if-body' warning. */
547 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
548 # ifndef YYSTACK_ALLOC_MAXIMUM
549 /* The OS might guarantee only one guard page at the bottom of the stack,
550 and a page size can be as small as 4096 bytes. So we cannot safely
551 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
552 to allow for a few compiler-allocated temporary stack slots. */
553 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
556 # define YYSTACK_ALLOC YYMALLOC
557 # define YYSTACK_FREE YYFREE
558 # ifndef YYSTACK_ALLOC_MAXIMUM
559 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
561 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
562 && ! ((defined YYMALLOC || defined malloc) \
563 && (defined YYFREE || defined free)))
564 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
565 # ifndef EXIT_SUCCESS
566 # define EXIT_SUCCESS 0
570 # define YYMALLOC malloc
571 # if ! defined malloc && ! defined EXIT_SUCCESS
572 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
577 # if ! defined free && ! defined EXIT_SUCCESS
578 void free (void *); /* INFRINGES ON USER NAME SPACE */
582 #endif /* !defined yyoverflow */
584 #if (! defined yyoverflow \
585 && (! defined __cplusplus \
586 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
588 /* A type that is properly aligned for any stack member. */
591 yy_state_t yyss_alloc;
595 /* The size of the maximum gap between one aligned stack and the next. */
596 # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
598 /* The size of an array large to enough to hold all stacks, each with
600 # define YYSTACK_BYTES(N) \
601 ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
602 + YYSTACK_GAP_MAXIMUM)
604 # define YYCOPY_NEEDED 1
606 /* Relocate STACK from its old location to the new one. The
607 local variables YYSIZE and YYSTACKSIZE give the old and new number of
608 elements in the stack, and YYPTR gives the new location of the
609 stack. Advance YYPTR to a properly aligned location for the next
611 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
614 YYPTRDIFF_T yynewbytes; \
615 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
616 Stack = &yyptr->Stack_alloc; \
617 yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
618 yyptr += yynewbytes / YYSIZEOF (*yyptr); \
624 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
625 /* Copy COUNT objects from SRC to DST. The source and destination do
628 # if defined __GNUC__ && 1 < __GNUC__
629 # define YYCOPY(Dst, Src, Count) \
630 __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
632 # define YYCOPY(Dst, Src, Count) \
636 for (yyi = 0; yyi < (Count); yyi++) \
637 (Dst)[yyi] = (Src)[yyi]; \
642 #endif /* !YYCOPY_NEEDED */
644 /* YYFINAL -- State number of the termination state. */
646 /* YYLAST -- Last index in YYTABLE. */
649 /* YYNTOKENS -- Number of terminals. */
651 /* YYNNTS -- Number of nonterminals. */
653 /* YYNRULES -- Number of rules. */
655 /* YYNSTATES -- Number of states. */
656 #define YYNSTATES 167
658 /* YYMAXUTOK -- Last valid token kind. */
659 #define YYMAXUTOK 289
662 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
663 as returned by yylex, with out-of-bounds checking. */
664 #define YYTRANSLATE(YYX) \
665 (0 <= (YYX) && (YYX) <= YYMAXUTOK \
666 ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \
669 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
670 as returned by yylex. */
671 static const yytype_int8 yytranslate[] =
673 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
674 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
675 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
676 2, 2, 2, 41, 2, 2, 2, 2, 2, 2,
677 50, 51, 39, 37, 49, 38, 2, 2, 2, 2,
678 2, 2, 2, 2, 2, 2, 2, 2, 28, 48,
679 33, 22, 34, 27, 2, 2, 2, 2, 2, 2,
680 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
681 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
682 2, 44, 2, 45, 2, 2, 2, 2, 2, 2,
683 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
684 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
685 2, 2, 2, 46, 2, 47, 2, 2, 2, 2,
686 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
687 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
688 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
689 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
690 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
691 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
692 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
693 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
694 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
695 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
696 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
697 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
698 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
699 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
700 15, 16, 17, 18, 19, 20, 21, 23, 24, 25,
701 26, 29, 30, 31, 32, 35, 36, 40, 42, 43
705 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
706 static const yytype_uint8 yyrline[] =
708 0, 65, 65, 66, 69, 70, 72, 74, 76, 78,
709 81, 82, 86, 87, 89, 90, 91, 92, 95, 96,
710 99, 100, 103, 104, 107, 108, 111, 112, 115, 116,
711 119, 121, 123, 128, 130, 132, 135, 137, 140, 144,
712 146, 148, 150, 152, 154, 156, 157, 158, 160, 162,
713 164, 166, 168, 170, 172, 174, 176, 178, 180, 181,
714 183, 185, 186, 187, 188, 190, 191, 192, 193, 194,
715 195, 198, 199, 202, 203, 206, 207
719 /** Accessing symbol of state STATE. */
720 #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
723 /* The user-facing name of the symbol whose (internal) number is
724 YYSYMBOL. No bounds checking. */
725 static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
727 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
728 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
729 static const char *const yytname[] =
731 "\"end of file\"", "error", "\"invalid token\"", "tSYMBOL", "tREGEXP",
732 "tSTRING", "tINTEGER", "tREAL", "tSUB", "tSTATE", "tSTART",
733 "tSTARTRULES", "tNAMERULES", "tBEGIN", "tEND", "tRETURN", "tIF", "tELSE",
734 "tLOCAL", "tWHILE", "tFOR", "tEXTENDS", "'='", "tADDASSIGN",
735 "tSUBASSIGN", "tMULASSIGN", "tDIVASSIGN", "'?'", "':'", "tOR", "tAND",
736 "tEQ", "tNE", "'<'", "'>'", "tGE", "tLE", "'+'", "'-'", "'*'", "tDIV",
737 "'!'", "tPLUSPLUS", "tMINUSMINUS", "'['", "']'", "'{'", "'}'", "';'",
738 "','", "'('", "')'", "$accept", "file", "toplevel", "regexp_sym_list",
739 "staterules", "staterule", "symbol_list", "rest_symbol_list", "locals",
740 "locals_rest", "local_def", "stmt_list", "stmt", "expr", "cond_expr",
741 "expr_list", "rest_expr_list", YY_NULLPTR
745 yysymbol_name (yysymbol_kind_t yysymbol)
747 return yytname[yysymbol];
751 #define YYPACT_NINF (-41)
753 #define yypact_value_is_default(Yyn) \
754 ((Yyn) == YYPACT_NINF)
756 #define YYTABLE_NINF (-1)
758 #define yytable_value_is_error(Yyn) \
761 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
763 static const yytype_int16 yypact[] =
765 -41, 71, -41, 300, -41, -41, -41, -41, 1, 9,
766 -40, -28, -27, 18, -24, -18, -17, 296, 28, 31,
767 -41, 296, -41, -41, 391, 296, 296, 296, 296, 296,
768 -41, -41, 296, -15, -19, -41, -41, -41, -41, 411,
769 296, 296, 296, 12, -41, -41, 126, 322, 296, 296,
770 296, 296, 296, 296, 296, 296, 296, 296, 296, 296,
771 296, 296, -41, 486, 486, 486, 486, 486, 486, 6,
772 20, 64, 67, -41, 146, 3, 4, -41, 345, 368,
773 486, 10, -41, -41, -41, 470, 501, 515, 527, 527,
774 55, 55, 55, 55, 45, 45, 12, 12, 451, -41,
775 296, -41, 21, 24, 60, 49, -41, 94, -41, -41,
776 290, 290, 296, 296, 85, 486, 62, 112, -41, 70,
777 73, 74, 76, -41, -41, 75, 107, -41, 431, 486,
778 296, 108, -41, 51, -41, -41, -41, -41, -41, 290,
779 296, 486, 122, -41, -41, 175, 194, 223, 242, -41,
780 84, 105, -38, -41, 271, -41, -41, -41, -41, 290,
781 296, -41, 122, -41, -41, 486, -41
784 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
785 Performed when YYTABLE does not specify something else to do. Zero
786 means the default is an error. */
787 static const yytype_int8 yydefact[] =
789 2, 0, 1, 43, 40, 39, 41, 42, 0, 0,
790 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
791 28, 0, 3, 9, 0, 0, 0, 0, 0, 0,
792 53, 54, 73, 0, 0, 28, 10, 10, 30, 0,
793 0, 0, 71, 44, 55, 56, 0, 0, 0, 0,
794 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
795 0, 0, 38, 48, 49, 50, 51, 52, 75, 0,
796 74, 18, 0, 12, 0, 0, 0, 31, 0, 0,
797 72, 0, 33, 29, 58, 0, 46, 45, 67, 68,
798 65, 66, 69, 70, 63, 64, 61, 62, 0, 47,
799 0, 20, 0, 19, 0, 0, 4, 0, 5, 6,
800 0, 0, 0, 0, 59, 76, 0, 0, 12, 0,
801 0, 0, 0, 7, 13, 0, 34, 36, 0, 60,
802 0, 22, 21, 0, 28, 28, 28, 28, 11, 0,
803 71, 57, 0, 28, 8, 0, 0, 0, 0, 35,
804 0, 26, 0, 24, 0, 17, 16, 14, 15, 0,
805 0, 23, 0, 32, 37, 27, 25
808 /* YYPGOTO[NTERM-NUM]. */
809 static const yytype_int8 yypgoto[] =
811 -41, -41, -41, 99, 19, -41, -41, -41, -41, -41,
812 -23, -32, -1, -12, 0, -41, -41
815 /* YYDEFGOTO[NTERM-NUM]. */
816 static const yytype_uint8 yydefgoto[] =
818 0, 1, 22, 75, 105, 124, 102, 103, 143, 152,
819 153, 46, 83, 24, 81, 69, 70
822 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
823 positive, shift that token. If negative, reduce the rule whose
824 number is the opposite. If YYTABLE_NINF, syntax error. */
825 static const yytype_uint8 yytable[] =
827 23, 39, 72, 74, 33, 43, 35, 107, 107, 47,
828 161, 162, 34, 63, 64, 65, 66, 67, 36, 37,
829 68, 3, 4, 5, 6, 7, 40, 73, 78, 79,
830 80, 44, 41, 42, 45, 71, 85, 86, 87, 88,
831 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,
832 108, 109, 119, 120, 119, 120, 61, 99, 112, 17,
833 18, 19, 121, 122, 121, 122, 38, 101, 21, 100,
834 104, 2, 116, 117, 3, 4, 5, 6, 7, 8,
835 9, 10, 11, 12, 59, 60, 13, 14, 115, 61,
836 15, 16, 57, 58, 59, 60, 123, 125, 144, 61,
837 128, 129, 145, 146, 147, 148, 118, 130, 131, 126,
838 127, 154, 17, 18, 19, 132, 134, 20, 141, 135,
839 136, 21, 137, 138, 139, 151, 142, 160, 80, 3,
840 4, 5, 6, 7, 8, 159, 76, 133, 149, 166,
841 150, 13, 14, 0, 0, 15, 16, 0, 165, 3,
842 4, 5, 6, 7, 8, 0, 0, 0, 164, 0,
843 0, 13, 14, 0, 0, 15, 16, 17, 18, 19,
844 0, 0, 20, 82, 0, 0, 21, 0, 3, 4,
845 5, 6, 7, 8, 0, 0, 0, 17, 18, 19,
846 13, 14, 20, 106, 15, 16, 21, 3, 4, 5,
847 6, 7, 8, 0, 0, 0, 0, 0, 0, 13,
848 14, 0, 0, 15, 16, 0, 17, 18, 19, 0,
849 0, 20, 155, 0, 0, 21, 3, 4, 5, 6,
850 7, 8, 0, 0, 0, 17, 18, 19, 13, 14,
851 20, 156, 15, 16, 21, 3, 4, 5, 6, 7,
852 8, 0, 0, 0, 0, 0, 0, 13, 14, 0,
853 0, 15, 16, 0, 17, 18, 19, 0, 0, 20,
854 157, 0, 0, 21, 3, 4, 5, 6, 7, 8,
855 0, 0, 0, 17, 18, 19, 13, 14, 20, 158,
856 15, 16, 21, 3, 4, 5, 6, 7, 8, 3,
857 4, 5, 6, 7, 0, 13, 14, 0, 0, 15,
858 16, 0, 17, 18, 19, 0, 0, 20, 163, 0,
859 0, 21, 25, 26, 27, 28, 29, 0, 0, 0,
860 0, 17, 18, 19, 0, 0, 20, 17, 18, 19,
861 21, 0, 30, 31, 0, 0, 21, 0, 0, 48,
862 32, 49, 50, 51, 52, 53, 54, 55, 56, 57,
863 58, 59, 60, 0, 0, 0, 61, 0, 0, 0,
864 0, 0, 48, 84, 49, 50, 51, 52, 53, 54,
865 55, 56, 57, 58, 59, 60, 0, 0, 0, 61,
866 0, 0, 0, 0, 0, 48, 110, 49, 50, 51,
867 52, 53, 54, 55, 56, 57, 58, 59, 60, 0,
868 0, 0, 61, 0, 0, 0, 0, 0, 48, 111,
869 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
870 59, 60, 0, 0, 0, 61, 0, 0, 48, 62,
871 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
872 59, 60, 0, 0, 0, 61, 0, 0, 48, 77,
873 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
874 59, 60, 0, 0, 0, 61, 0, 0, 48, 140,
875 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
876 59, 60, 0, 0, 0, 61, 114, 48, 113, 49,
877 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
878 60, 0, 0, 48, 61, 49, 50, 51, 52, 53,
879 54, 55, 56, 57, 58, 59, 60, 0, 0, 0,
880 61, 50, 51, 52, 53, 54, 55, 56, 57, 58,
881 59, 60, 0, 0, 0, 61, 51, 52, 53, 54,
882 55, 56, 57, 58, 59, 60, 0, 0, 0, 61,
883 53, 54, 55, 56, 57, 58, 59, 60, 0, 0,
887 static const yytype_int16 yycheck[] =
889 1, 13, 21, 35, 3, 17, 46, 4, 4, 21,
890 48, 49, 3, 25, 26, 27, 28, 29, 46, 46,
891 32, 3, 4, 5, 6, 7, 50, 46, 40, 41,
892 42, 3, 50, 50, 3, 50, 48, 49, 50, 51,
893 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
894 47, 47, 3, 4, 3, 4, 44, 51, 48, 41,
895 42, 43, 13, 14, 13, 14, 48, 3, 50, 49,
896 3, 0, 51, 49, 3, 4, 5, 6, 7, 8,
897 9, 10, 11, 12, 39, 40, 15, 16, 100, 44,
898 19, 20, 37, 38, 39, 40, 47, 3, 47, 44,
899 112, 113, 134, 135, 136, 137, 46, 22, 46, 110,
900 111, 143, 41, 42, 43, 3, 46, 46, 130, 46,
901 46, 50, 46, 48, 17, 3, 18, 22, 140, 3,
902 4, 5, 6, 7, 8, 51, 37, 118, 139, 162,
903 140, 15, 16, -1, -1, 19, 20, -1, 160, 3,
904 4, 5, 6, 7, 8, -1, -1, -1, 159, -1,
905 -1, 15, 16, -1, -1, 19, 20, 41, 42, 43,
906 -1, -1, 46, 47, -1, -1, 50, -1, 3, 4,
907 5, 6, 7, 8, -1, -1, -1, 41, 42, 43,
908 15, 16, 46, 47, 19, 20, 50, 3, 4, 5,
909 6, 7, 8, -1, -1, -1, -1, -1, -1, 15,
910 16, -1, -1, 19, 20, -1, 41, 42, 43, -1,
911 -1, 46, 47, -1, -1, 50, 3, 4, 5, 6,
912 7, 8, -1, -1, -1, 41, 42, 43, 15, 16,
913 46, 47, 19, 20, 50, 3, 4, 5, 6, 7,
914 8, -1, -1, -1, -1, -1, -1, 15, 16, -1,
915 -1, 19, 20, -1, 41, 42, 43, -1, -1, 46,
916 47, -1, -1, 50, 3, 4, 5, 6, 7, 8,
917 -1, -1, -1, 41, 42, 43, 15, 16, 46, 47,
918 19, 20, 50, 3, 4, 5, 6, 7, 8, 3,
919 4, 5, 6, 7, -1, 15, 16, -1, -1, 19,
920 20, -1, 41, 42, 43, -1, -1, 46, 47, -1,
921 -1, 50, 22, 23, 24, 25, 26, -1, -1, -1,
922 -1, 41, 42, 43, -1, -1, 46, 41, 42, 43,
923 50, -1, 42, 43, -1, -1, 50, -1, -1, 27,
924 50, 29, 30, 31, 32, 33, 34, 35, 36, 37,
925 38, 39, 40, -1, -1, -1, 44, -1, -1, -1,
926 -1, -1, 27, 51, 29, 30, 31, 32, 33, 34,
927 35, 36, 37, 38, 39, 40, -1, -1, -1, 44,
928 -1, -1, -1, -1, -1, 27, 51, 29, 30, 31,
929 32, 33, 34, 35, 36, 37, 38, 39, 40, -1,
930 -1, -1, 44, -1, -1, -1, -1, -1, 27, 51,
931 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
932 39, 40, -1, -1, -1, 44, -1, -1, 27, 48,
933 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
934 39, 40, -1, -1, -1, 44, -1, -1, 27, 48,
935 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
936 39, 40, -1, -1, -1, 44, -1, -1, 27, 48,
937 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
938 39, 40, -1, -1, -1, 44, 45, 27, 28, 29,
939 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
940 40, -1, -1, 27, 44, 29, 30, 31, 32, 33,
941 34, 35, 36, 37, 38, 39, 40, -1, -1, -1,
942 44, 30, 31, 32, 33, 34, 35, 36, 37, 38,
943 39, 40, -1, -1, -1, 44, 31, 32, 33, 34,
944 35, 36, 37, 38, 39, 40, -1, -1, -1, 44,
945 33, 34, 35, 36, 37, 38, 39, 40, -1, -1,
949 /* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
951 static const yytype_int8 yystos[] =
953 0, 53, 0, 3, 4, 5, 6, 7, 8, 9,
954 10, 11, 12, 15, 16, 19, 20, 41, 42, 43,
955 46, 50, 54, 64, 65, 22, 23, 24, 25, 26,
956 42, 43, 50, 3, 3, 46, 46, 46, 48, 65,
957 50, 50, 50, 65, 3, 3, 63, 65, 27, 29,
958 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
959 40, 44, 48, 65, 65, 65, 65, 65, 65, 67,
960 68, 50, 21, 46, 63, 55, 55, 48, 65, 65,
961 65, 66, 47, 64, 51, 65, 65, 65, 65, 65,
962 65, 65, 65, 65, 65, 65, 65, 65, 65, 51,
963 49, 3, 58, 59, 3, 56, 47, 4, 47, 47,
964 51, 51, 48, 28, 45, 65, 51, 49, 46, 3,
965 4, 13, 14, 47, 57, 3, 64, 64, 65, 65,
966 22, 46, 3, 56, 46, 46, 46, 46, 48, 17,
967 48, 65, 18, 60, 47, 63, 63, 63, 63, 64,
968 66, 3, 61, 62, 63, 47, 47, 47, 47, 51,
969 22, 48, 49, 47, 64, 65, 62
972 /* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */
973 static const yytype_int8 yyr1[] =
975 0, 52, 53, 53, 54, 54, 54, 54, 54, 54,
976 55, 55, 56, 56, 57, 57, 57, 57, 58, 58,
977 59, 59, 60, 60, 61, 61, 62, 62, 63, 63,
978 64, 64, 64, 64, 64, 64, 64, 64, 64, 65,
979 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
980 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
981 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
982 65, 66, 66, 67, 67, 68, 68
985 /* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */
986 static const yytype_int8 yyr2[] =
988 0, 2, 0, 2, 4, 4, 4, 5, 7, 1,
989 0, 4, 0, 2, 4, 4, 4, 4, 0, 1,
990 1, 3, 0, 3, 1, 3, 1, 3, 0, 2,
991 2, 3, 9, 3, 5, 7, 5, 9, 2, 1,
992 1, 1, 1, 1, 2, 3, 3, 4, 3, 3,
993 3, 3, 3, 2, 2, 2, 2, 6, 3, 4,
994 5, 3, 3, 3, 3, 3, 3, 3, 3, 3,
999 enum { YYENOMEM = -2 };
1001 #define yyerrok (yyerrstatus = 0)
1002 #define yyclearin (yychar = YYEMPTY)
1004 #define YYACCEPT goto yyacceptlab
1005 #define YYABORT goto yyabortlab
1006 #define YYERROR goto yyerrorlab
1007 #define YYNOMEM goto yyexhaustedlab
1010 #define YYRECOVERING() (!!yyerrstatus)
1012 #define YYBACKUP(Token, Value) \
1014 if (yychar == YYEMPTY) \
1018 YYPOPSTACK (yylen); \
1024 yyerror (YY_("syntax error: cannot back up")); \
1029 /* Backward compatibility with an undocumented macro.
1030 Use YYerror or YYUNDEF. */
1031 #define YYERRCODE YYUNDEF
1034 /* Enable debugging if requested. */
1038 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1039 # define YYFPRINTF fprintf
1042 # define YYDPRINTF(Args) \
1051 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
1055 YYFPRINTF (stderr, "%s ", Title); \
1056 yy_symbol_print (stderr, \
1058 YYFPRINTF (stderr, "\n"); \
1063 /*-----------------------------------.
1064 | Print this symbol's value on YYO. |
1065 `-----------------------------------*/
1068 yy_symbol_value_print (FILE *yyo,
1069 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
1071 FILE *yyoutput = yyo;
1075 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1077 YY_IGNORE_MAYBE_UNINITIALIZED_END
1081 /*---------------------------.
1082 | Print this symbol on YYO. |
1083 `---------------------------*/
1086 yy_symbol_print (FILE *yyo,
1087 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
1089 YYFPRINTF (yyo, "%s %s (",
1090 yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
1092 yy_symbol_value_print (yyo, yykind, yyvaluep);
1093 YYFPRINTF (yyo, ")");
1096 /*------------------------------------------------------------------.
1097 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1099 `------------------------------------------------------------------*/
1102 yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
1104 YYFPRINTF (stderr, "Stack now");
1105 for (; yybottom <= yytop; yybottom++)
1107 int yybot = *yybottom;
1108 YYFPRINTF (stderr, " %d", yybot);
1110 YYFPRINTF (stderr, "\n");
1113 # define YY_STACK_PRINT(Bottom, Top) \
1116 yy_stack_print ((Bottom), (Top)); \
1120 /*------------------------------------------------.
1121 | Report that the YYRULE is going to be reduced. |
1122 `------------------------------------------------*/
1125 yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
1128 int yylno = yyrline[yyrule];
1129 int yynrhs = yyr2[yyrule];
1131 YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
1133 /* The symbols being reduced. */
1134 for (yyi = 0; yyi < yynrhs; yyi++)
1136 YYFPRINTF (stderr, " $%d = ", yyi + 1);
1137 yy_symbol_print (stderr,
1138 YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
1139 &yyvsp[(yyi + 1) - (yynrhs)]);
1140 YYFPRINTF (stderr, "\n");
1144 # define YY_REDUCE_PRINT(Rule) \
1147 yy_reduce_print (yyssp, yyvsp, Rule); \
1150 /* Nonzero means print parse trace. It is left uninitialized so that
1151 multiple parsers can coexist. */
1153 #else /* !YYDEBUG */
1154 # define YYDPRINTF(Args) ((void) 0)
1155 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
1156 # define YY_STACK_PRINT(Bottom, Top)
1157 # define YY_REDUCE_PRINT(Rule)
1158 #endif /* !YYDEBUG */
1161 /* YYINITDEPTH -- initial size of the parser's stacks. */
1163 # define YYINITDEPTH 200
1166 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1167 if the built-in stack extension method is used).
1169 Do not make this value too large; the results are undefined if
1170 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1171 evaluated with infinite-precision integer arithmetic. */
1174 # define YYMAXDEPTH 10000
1182 /*-----------------------------------------------.
1183 | Release the memory associated to this symbol. |
1184 `-----------------------------------------------*/
1187 yydestruct (const char *yymsg,
1188 yysymbol_kind_t yykind, YYSTYPE *yyvaluep)
1193 YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
1195 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1197 YY_IGNORE_MAYBE_UNINITIALIZED_END
1201 /* Lookahead token kind. */
1204 /* The semantic value of the lookahead symbol. */
1206 /* Number of syntax errors so far. */
1219 yy_state_fast_t yystate = 0;
1220 /* Number of tokens to shift before error messages enabled. */
1221 int yyerrstatus = 0;
1223 /* Refer to the stacks through separate pointers, to allow yyoverflow
1224 to reallocate them elsewhere. */
1227 YYPTRDIFF_T yystacksize = YYINITDEPTH;
1229 /* The state stack: array, bottom, top. */
1230 yy_state_t yyssa[YYINITDEPTH];
1231 yy_state_t *yyss = yyssa;
1232 yy_state_t *yyssp = yyss;
1234 /* The semantic value stack: array, bottom, top. */
1235 YYSTYPE yyvsa[YYINITDEPTH];
1236 YYSTYPE *yyvs = yyvsa;
1237 YYSTYPE *yyvsp = yyvs;
1240 /* The return value of yyparse. */
1242 /* Lookahead symbol kind. */
1243 yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
1244 /* The variables used to return semantic value and location from the
1250 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1252 /* The number of symbols on the RHS of the reduced rule.
1253 Keep to zero when no symbol should be popped. */
1256 YYDPRINTF ((stderr, "Starting parse\n"));
1258 yychar = YYEMPTY; /* Cause a token to be read. */
1263 /*------------------------------------------------------------.
1264 | yynewstate -- push a new state, which is found in yystate. |
1265 `------------------------------------------------------------*/
1267 /* In all cases, when you get here, the value and location stacks
1268 have just been pushed. So pushing a state here evens the stacks. */
1272 /*--------------------------------------------------------------------.
1273 | yysetstate -- set current state (the top of the stack) to yystate. |
1274 `--------------------------------------------------------------------*/
1276 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1277 YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
1278 YY_IGNORE_USELESS_CAST_BEGIN
1279 *yyssp = YY_CAST (yy_state_t, yystate);
1280 YY_IGNORE_USELESS_CAST_END
1281 YY_STACK_PRINT (yyss, yyssp);
1283 if (yyss + yystacksize - 1 <= yyssp)
1284 #if !defined yyoverflow && !defined YYSTACK_RELOCATE
1288 /* Get the current used size of the three stacks, in elements. */
1289 YYPTRDIFF_T yysize = yyssp - yyss + 1;
1291 # if defined yyoverflow
1293 /* Give user a chance to reallocate the stack. Use copies of
1294 these so that the &'s don't force the real ones into
1296 yy_state_t *yyss1 = yyss;
1297 YYSTYPE *yyvs1 = yyvs;
1299 /* Each stack pointer address is followed by the size of the
1300 data in use in that stack, in bytes. This used to be a
1301 conditional around just the two extra args, but that might
1302 be undefined if yyoverflow is a macro. */
1303 yyoverflow (YY_("memory exhausted"),
1304 &yyss1, yysize * YYSIZEOF (*yyssp),
1305 &yyvs1, yysize * YYSIZEOF (*yyvsp),
1310 # else /* defined YYSTACK_RELOCATE */
1311 /* Extend the stack our own way. */
1312 if (YYMAXDEPTH <= yystacksize)
1315 if (YYMAXDEPTH < yystacksize)
1316 yystacksize = YYMAXDEPTH;
1319 yy_state_t *yyss1 = yyss;
1320 union yyalloc *yyptr =
1321 YY_CAST (union yyalloc *,
1322 YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
1325 YYSTACK_RELOCATE (yyss_alloc, yyss);
1326 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1327 # undef YYSTACK_RELOCATE
1329 YYSTACK_FREE (yyss1);
1333 yyssp = yyss + yysize - 1;
1334 yyvsp = yyvs + yysize - 1;
1336 YY_IGNORE_USELESS_CAST_BEGIN
1337 YYDPRINTF ((stderr, "Stack size increased to %ld\n",
1338 YY_CAST (long, yystacksize)));
1339 YY_IGNORE_USELESS_CAST_END
1341 if (yyss + yystacksize - 1 <= yyssp)
1344 #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1347 if (yystate == YYFINAL)
1357 /* Do appropriate processing given the current state. Read a
1358 lookahead token if we need one and don't already have one. */
1360 /* First try to decide what to do without reference to lookahead token. */
1361 yyn = yypact[yystate];
1362 if (yypact_value_is_default (yyn))
1365 /* Not known => get a lookahead token if don't already have one. */
1367 /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */
1368 if (yychar == YYEMPTY)
1370 YYDPRINTF ((stderr, "Reading a token\n"));
1374 if (yychar <= YYEOF)
1377 yytoken = YYSYMBOL_YYEOF;
1378 YYDPRINTF ((stderr, "Now at end of input.\n"));
1380 else if (yychar == YYerror)
1382 /* The scanner already issued an error message, process directly
1383 to error recovery. But do not keep the error token as
1384 lookahead, it is too special and may lead us to an endless
1385 loop in error recovery. */
1387 yytoken = YYSYMBOL_YYerror;
1392 yytoken = YYTRANSLATE (yychar);
1393 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1396 /* If the proper action on seeing token YYTOKEN is to reduce or to
1397 detect an error, take that action. */
1399 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1404 if (yytable_value_is_error (yyn))
1410 /* Count tokens shifted since error; after three, turn off error
1415 /* Shift the lookahead token. */
1416 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1418 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1420 YY_IGNORE_MAYBE_UNINITIALIZED_END
1422 /* Discard the shifted token. */
1427 /*-----------------------------------------------------------.
1428 | yydefault -- do the default action for the current state. |
1429 `-----------------------------------------------------------*/
1431 yyn = yydefact[yystate];
1437 /*-----------------------------.
1438 | yyreduce -- do a reduction. |
1439 `-----------------------------*/
1441 /* yyn is the number of a rule to reduce with. */
1444 /* If YYLEN is nonzero, implement the default value of the action:
1447 Otherwise, the following line sets YYVAL to garbage.
1448 This behavior is undocumented and Bison
1449 users should not rely upon it. Assigning to YYVAL
1450 unconditionally makes the parser a bit smaller, and it avoids a
1451 GCC warning that YYVAL may be used uninitialized. */
1452 yyval = yyvsp[1-yylen];
1455 YY_REDUCE_PRINT (yyn);
1458 case 4: /* toplevel: tSTART '{' stmt_list '}' */
1460 { start_stmts = (yyvsp[-1].lst); }
1464 case 5: /* toplevel: tSTARTRULES '{' regexp_sym_list '}' */
1466 { startrules = (yyvsp[-1].lst); }
1470 case 6: /* toplevel: tNAMERULES '{' regexp_sym_list '}' */
1472 { namerules = (yyvsp[-1].lst); }
1476 case 7: /* toplevel: tSTATE tSYMBOL '{' staterules '}' */
1478 { define_state ((yyvsp[-3].node), NULL, (yyvsp[-1].lst)); }
1482 case 8: /* toplevel: tSTATE tSYMBOL tEXTENDS tSYMBOL '{' staterules '}' */
1484 { define_state ((yyvsp[-5].node), (yyvsp[-3].node), (yyvsp[-1].lst)); }
1488 case 9: /* toplevel: stmt */
1490 { list_append (global_stmts, (yyvsp[0].stmt)); }
1494 case 10: /* regexp_sym_list: %empty */
1496 { (yyval.lst) = list (); }
1500 case 11: /* regexp_sym_list: regexp_sym_list tREGEXP tSYMBOL ';' */
1502 { list_append ((yyvsp[-3].lst), cons ((yyvsp[-2].node), (yyvsp[-1].node))); }
1506 case 12: /* staterules: %empty */
1508 { (yyval.lst) = list (); }
1512 case 13: /* staterules: staterules staterule */
1514 { list_append ((yyvsp[-1].lst), (yyvsp[0].cons)); }
1518 case 14: /* staterule: tBEGIN '{' stmt_list '}' */
1520 { (yyval.cons) = cons (RULE_BEGIN, (yyvsp[-1].lst)); }
1524 case 15: /* staterule: tEND '{' stmt_list '}' */
1526 { (yyval.cons) = cons (RULE_END, (yyvsp[-1].lst)); }
1530 case 16: /* staterule: tREGEXP '{' stmt_list '}' */
1532 { (yyval.cons) = cons ((yyvsp[-3].node), (yyvsp[-1].lst)); }
1536 case 17: /* staterule: tSYMBOL '{' stmt_list '}' */
1538 { (yyval.cons) = cons ((yyvsp[-3].node), (yyvsp[-1].lst)); }
1542 case 18: /* symbol_list: %empty */
1544 { (yyval.lst) = list (); }
1548 case 19: /* symbol_list: rest_symbol_list */
1550 { (yyval.lst) = (yyvsp[0].lst); }
1554 case 20: /* rest_symbol_list: tSYMBOL */
1556 { (yyval.lst) = list (); list_append ((yyval.lst), (yyvsp[0].node)); }
1560 case 21: /* rest_symbol_list: rest_symbol_list ',' tSYMBOL */
1562 { list_append ((yyvsp[-2].lst), (yyvsp[0].node)); }
1566 case 22: /* locals: %empty */
1568 { (yyval.lst) = list (); }
1572 case 23: /* locals: tLOCAL locals_rest ';' */
1574 { (yyval.lst) = (yyvsp[-1].lst); }
1578 case 24: /* locals_rest: local_def */
1580 { (yyval.lst) = list (); list_append ((yyval.lst), (yyvsp[0].cons)); }
1584 case 25: /* locals_rest: locals_rest ',' local_def */
1586 { list_append ((yyvsp[-2].lst), (yyvsp[0].cons)); }
1590 case 26: /* local_def: tSYMBOL */
1592 { (yyval.cons) = cons ((yyvsp[0].node), NULL); }
1596 case 27: /* local_def: tSYMBOL '=' expr */
1598 { (yyval.cons) = cons ((yyvsp[-2].node), (yyvsp[0].expr)); }
1602 case 28: /* stmt_list: %empty */
1604 { (yyval.lst) = list (); }
1608 case 29: /* stmt_list: stmt_list stmt */
1610 { list_append ((yyvsp[-1].lst), (yyvsp[0].stmt)); }
1614 case 30: /* stmt: tRETURN ';' */
1616 { (yyval.stmt) = mk_stmt (sRETURN, NULL, NULL,
1621 case 31: /* stmt: tRETURN expr ';' */
1623 { (yyval.stmt) = mk_stmt (sRETURN, (yyvsp[-1].expr), NULL,
1628 case 32: /* stmt: tSUB tSYMBOL '(' symbol_list ')' '{' locals stmt_list '}' */
1630 { (yyval.stmt) = mk_stmt (sDEFSUB, (yyvsp[-7].node),
1631 cons (cons ((yyvsp[-5].lst), (yyvsp[-2].lst)),
1637 case 33: /* stmt: '{' stmt_list '}' */
1639 { (yyval.stmt) = mk_stmt (sBLOCK, (yyvsp[-1].lst), NULL,
1644 case 34: /* stmt: tIF '(' expr ')' stmt */
1646 { (yyval.stmt) = mk_stmt (sIF, (yyvsp[-2].expr), (yyvsp[0].stmt), NULL,
1651 case 35: /* stmt: tIF '(' expr ')' stmt tELSE stmt */
1653 { (yyval.stmt) = mk_stmt (sIF, (yyvsp[-4].expr), (yyvsp[-2].stmt), (yyvsp[0].stmt),
1658 case 36: /* stmt: tWHILE '(' expr ')' stmt */
1660 { (yyval.stmt) = mk_stmt (sWHILE, (yyvsp[-2].expr), (yyvsp[0].stmt),
1665 case 37: /* stmt: tFOR '(' cond_expr ';' expr ';' cond_expr ')' stmt */
1667 { (yyval.stmt) = mk_stmt (sFOR, (yyvsp[-6].expr), (yyvsp[-4].expr), (yyvsp[-2].expr),
1672 case 38: /* stmt: expr ';' */
1674 { (yyval.stmt) = mk_stmt (sEXPR, (yyvsp[-1].expr), NULL,
1679 case 39: /* expr: tSTRING */
1681 { (yyval.expr) = mk_expr (eSTRING, (yyvsp[0].node), NULL,
1686 case 40: /* expr: tREGEXP */
1688 { (yyval.expr) = mk_expr (eREGEXP, (yyvsp[0].node), NULL,
1693 case 41: /* expr: tINTEGER */
1695 { (yyval.expr) = mk_expr (eINTEGER, (yyvsp[0].node), NULL,
1700 case 42: /* expr: tREAL */
1702 { (yyval.expr) = mk_expr (eREAL, (yyvsp[0].node), NULL,
1707 case 43: /* expr: tSYMBOL */
1709 { (yyval.expr) = mk_expr (eSYMBOL, (yyvsp[0].node), NULL,
1714 case 44: /* expr: '!' expr */
1716 { (yyval.expr) = mk_expr (eNOT, (yyvsp[0].expr), NULL,
1721 case 45: /* expr: expr tAND expr */
1723 { (yyval.expr) = mk_expr (eAND, (yyvsp[-2].expr), (yyvsp[0].expr), NULL); }
1727 case 46: /* expr: expr tOR expr */
1729 { (yyval.expr) = mk_expr (eOR, (yyvsp[-2].expr), (yyvsp[0].expr), NULL); }
1733 case 47: /* expr: tSYMBOL '(' expr_list ')' */
1735 { (yyval.expr) = mk_expr (eFCALL, (yyvsp[-3].node), (yyvsp[-1].lst),
1740 case 48: /* expr: tSYMBOL '=' expr */
1742 { (yyval.expr) = mk_expr (eASSIGN, (yyvsp[-2].node), (yyvsp[0].expr),
1747 case 49: /* expr: tSYMBOL tADDASSIGN expr */
1749 { (yyval.expr) = mk_expr (eADDASSIGN, (yyvsp[-2].node), (yyvsp[0].expr),
1754 case 50: /* expr: tSYMBOL tSUBASSIGN expr */
1756 { (yyval.expr) = mk_expr (eSUBASSIGN, (yyvsp[-2].node), (yyvsp[0].expr),
1761 case 51: /* expr: tSYMBOL tMULASSIGN expr */
1763 { (yyval.expr) = mk_expr (eMULASSIGN, (yyvsp[-2].node), (yyvsp[0].expr),
1768 case 52: /* expr: tSYMBOL tDIVASSIGN expr */
1770 { (yyval.expr) = mk_expr (eDIVASSIGN, (yyvsp[-2].node), (yyvsp[0].expr),
1775 case 53: /* expr: tSYMBOL tPLUSPLUS */
1777 { (yyval.expr) = mk_expr (ePOSTFIXADD, (yyvsp[-1].node), NULL,
1782 case 54: /* expr: tSYMBOL tMINUSMINUS */
1784 { (yyval.expr) = mk_expr (ePOSTFIXSUB, (yyvsp[-1].node), NULL,
1789 case 55: /* expr: tPLUSPLUS tSYMBOL */
1791 { (yyval.expr) = mk_expr (ePREFIXADD, (yyvsp[0].node), NULL,
1796 case 56: /* expr: tMINUSMINUS tSYMBOL */
1798 { (yyval.expr) = mk_expr (ePREFIXSUB, (yyvsp[0].node), NULL,
1803 case 57: /* expr: expr '[' expr ']' '=' expr */
1805 { (yyval.expr) = mk_expr (eARRAYASSIGN, (yyvsp[-5].expr), (yyvsp[-3].expr),
1810 case 58: /* expr: '(' expr ')' */
1812 { (yyval.expr) = (yyvsp[-1].expr); }
1816 case 59: /* expr: expr '[' expr ']' */
1818 { (yyval.expr) = mk_expr (eARRAYREF, (yyvsp[-3].expr), (yyvsp[-1].expr),
1823 case 60: /* expr: expr '?' expr ':' expr */
1825 { (yyval.expr) = mk_expr (eQUESTCOLON, (yyvsp[-4].expr), (yyvsp[-2].expr),
1830 case 61: /* expr: expr '*' expr */
1832 { (yyval.expr) = mk_expr (eMULT, (yyvsp[-2].expr), (yyvsp[0].expr), NULL); }
1836 case 62: /* expr: expr tDIV expr */
1838 { (yyval.expr) = mk_expr (eDIV, (yyvsp[-2].expr), (yyvsp[0].expr), NULL); }
1842 case 63: /* expr: expr '+' expr */
1844 { (yyval.expr) = mk_expr (ePLUS, (yyvsp[-2].expr), (yyvsp[0].expr), NULL); }
1848 case 64: /* expr: expr '-' expr */
1850 { (yyval.expr) = mk_expr (eMINUS, (yyvsp[-2].expr), (yyvsp[0].expr),
1855 case 65: /* expr: expr '<' expr */
1857 { (yyval.expr) = mk_expr (eLT, (yyvsp[-2].expr), (yyvsp[0].expr), NULL); }
1861 case 66: /* expr: expr '>' expr */
1863 { (yyval.expr) = mk_expr (eGT, (yyvsp[-2].expr), (yyvsp[0].expr), NULL); }
1867 case 67: /* expr: expr tEQ expr */
1869 { (yyval.expr) = mk_expr (eEQ, (yyvsp[-2].expr), (yyvsp[0].expr), NULL); }
1873 case 68: /* expr: expr tNE expr */
1875 { (yyval.expr) = mk_expr (eNE, (yyvsp[-2].expr), (yyvsp[0].expr), NULL); }
1879 case 69: /* expr: expr tGE expr */
1881 { (yyval.expr) = mk_expr (eGE, (yyvsp[-2].expr), (yyvsp[0].expr), NULL); }
1885 case 70: /* expr: expr tLE expr */
1887 { (yyval.expr) = mk_expr (eLE, (yyvsp[-2].expr), (yyvsp[0].expr), NULL); }
1891 case 71: /* cond_expr: %empty */
1893 { (yyval.expr) = NULL; }
1897 case 72: /* cond_expr: expr */
1899 { (yyval.expr) = (yyvsp[0].expr); }
1903 case 73: /* expr_list: %empty */
1905 { (yyval.lst) = list (); }
1909 case 74: /* expr_list: rest_expr_list */
1911 { (yyval.lst) = (yyvsp[0].lst); }
1915 case 75: /* rest_expr_list: expr */
1917 { (yyval.lst) = list (); list_append ((yyval.lst), (yyvsp[0].expr)); }
1921 case 76: /* rest_expr_list: rest_expr_list ',' expr */
1923 { list_append ((yyvsp[-2].lst), (yyvsp[0].expr)); }
1932 /* User semantic actions sometimes alter yychar, and that requires
1933 that yytoken be updated with the new translation. We take the
1934 approach of translating immediately before every use of yytoken.
1935 One alternative is translating here after every semantic action,
1936 but that translation would be missed if the semantic action invokes
1937 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1938 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1939 incorrect destructor might then be invoked immediately. In the
1940 case of YYERROR or YYBACKUP, subsequent parser actions might lead
1941 to an incorrect destructor call or verbose syntax error message
1942 before the lookahead is translated. */
1943 YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
1950 /* Now 'shift' the result of the reduction. Determine what state
1951 that goes to, based on the state we popped back to and the rule
1952 number reduced by. */
1954 const int yylhs = yyr1[yyn] - YYNTOKENS;
1955 const int yyi = yypgoto[yylhs] + *yyssp;
1956 yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
1958 : yydefgoto[yylhs]);
1964 /*--------------------------------------.
1965 | yyerrlab -- here on detecting error. |
1966 `--------------------------------------*/
1968 /* Make sure we have latest lookahead translation. See comments at
1969 user semantic actions for why this is necessary. */
1970 yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
1971 /* If not already recovering from an error, report this error. */
1975 yyerror (YY_("syntax error"));
1978 if (yyerrstatus == 3)
1980 /* If just tried and failed to reuse lookahead token after an
1981 error, discard it. */
1983 if (yychar <= YYEOF)
1985 /* Return failure if at end of input. */
1986 if (yychar == YYEOF)
1991 yydestruct ("Error: discarding",
1997 /* Else will try to reuse lookahead token after shifting the error
2002 /*---------------------------------------------------.
2003 | yyerrorlab -- error raised explicitly by YYERROR. |
2004 `---------------------------------------------------*/
2006 /* Pacify compilers when the user code never invokes YYERROR and the
2007 label yyerrorlab therefore never appears in user code. */
2012 /* Do not reclaim the symbols of the rule whose action triggered
2016 YY_STACK_PRINT (yyss, yyssp);
2021 /*-------------------------------------------------------------.
2022 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2023 `-------------------------------------------------------------*/
2025 yyerrstatus = 3; /* Each real token shifted decrements this. */
2027 /* Pop stack until we find a state that shifts the error token. */
2030 yyn = yypact[yystate];
2031 if (!yypact_value_is_default (yyn))
2033 yyn += YYSYMBOL_YYerror;
2034 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
2042 /* Pop the current state because it cannot handle the error token. */
2047 yydestruct ("Error: popping",
2048 YY_ACCESSING_SYMBOL (yystate), yyvsp);
2051 YY_STACK_PRINT (yyss, yyssp);
2054 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2056 YY_IGNORE_MAYBE_UNINITIALIZED_END
2059 /* Shift the error token. */
2060 YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
2066 /*-------------------------------------.
2067 | yyacceptlab -- YYACCEPT comes here. |
2068 `-------------------------------------*/
2074 /*-----------------------------------.
2075 | yyabortlab -- YYABORT comes here. |
2076 `-----------------------------------*/
2082 /*-----------------------------------------------------------.
2083 | yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. |
2084 `-----------------------------------------------------------*/
2086 yyerror (YY_("memory exhausted"));
2091 /*----------------------------------------------------------.
2092 | yyreturnlab -- parsing is finished, clean up and return. |
2093 `----------------------------------------------------------*/
2095 if (yychar != YYEMPTY)
2097 /* Make sure we have latest lookahead translation. See comments at
2098 user semantic actions for why this is necessary. */
2099 yytoken = YYTRANSLATE (yychar);
2100 yydestruct ("Cleanup: discarding lookahead",
2103 /* Do not reclaim the symbols of the rule whose action triggered
2104 this YYABORT or YYACCEPT. */
2106 YY_STACK_PRINT (yyss, yyssp);
2107 while (yyssp != yyss)
2109 yydestruct ("Cleanup: popping",
2110 YY_ACCESSING_SYMBOL (+*yyssp), yyvsp);
2115 YYSTACK_FREE (yyss);
2128 fprintf (stderr, "%s:%d: %s\n", yyin_name, linenum, msg);