Updating the ChangeLog file
[enscript.git] / states / gram.c
1 /* A Bison parser, made by GNU Bison 3.8.2.  */
2
3 /* Bison implementation for Yacc-like parsers in C
4
5    Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
6    Inc.
7
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.
12
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.
17
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/>.  */
20
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.
30
31    This special exception was added by the Free Software Foundation in
32    version 2.2 of Bison.  */
33
34 /* C LALR(1) parser skeleton written by Richard Stallman, by
35    simplifying the original so-called "semantic" parser.  */
36
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.  */
40
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.  */
47
48 /* Identify Bison output, and Bison version.  */
49 #define YYBISON 30802
50
51 /* Bison version string.  */
52 #define YYBISON_VERSION "3.8.2"
53
54 /* Skeleton name.  */
55 #define YYSKELETON_NAME "yacc.c"
56
57 /* Pure parsers.  */
58 #define YYPURE 0
59
60 /* Push parsers.  */
61 #define YYPUSH 0
62
63 /* Pull parsers.  */
64 #define YYPULL 1
65
66
67
68
69 /* First part of user prologue.  */
70 #line 1 "gram.y"
71
72 /*                                                              -*- c -*-
73  * Grammar for states.
74  * Copyright (c) 1997-1998 Markku Rossi.
75  *
76  * Author: Markku Rossi <mtr@iki.fi>
77  */
78
79 /*
80  * This file is part of GNU Enscript.
81  *
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.
86  *
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.
91  *
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/>.
94  */
95
96 /*
97  * $Id: gram.y,v 1.1.1.1 2003/03/05 07:25:52 mtr Exp $
98  */
99
100 #include "defs.h"
101
102 #line 103 "gram.c"
103
104 # ifndef YY_CAST
105 #  ifdef __cplusplus
106 #   define YY_CAST(Type, Val) static_cast<Type> (Val)
107 #   define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
108 #  else
109 #   define YY_CAST(Type, Val) ((Type) (Val))
110 #   define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
111 #  endif
112 # endif
113 # ifndef YY_NULLPTR
114 #  if defined __cplusplus
115 #   if 201103L <= __cplusplus
116 #    define YY_NULLPTR nullptr
117 #   else
118 #    define YY_NULLPTR 0
119 #   endif
120 #  else
121 #   define YY_NULLPTR ((void*)0)
122 #  endif
123 # endif
124
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
129 /* Debug traces.  */
130 #ifndef YYDEBUG
131 # define YYDEBUG 0
132 #endif
133 #if YYDEBUG
134 extern int yydebug;
135 #endif
136
137 /* Token kinds.  */
138 #ifndef YYTOKENTYPE
139 # define YYTOKENTYPE
140   enum yytokentype
141   {
142     YYEMPTY = -2,
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  */
159     tIF = 271,                     /* tIF  */
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  */
169     tOR = 281,                     /* tOR  */
170     tAND = 282,                    /* tAND  */
171     tEQ = 283,                     /* tEQ  */
172     tNE = 284,                     /* tNE  */
173     tGE = 285,                     /* tGE  */
174     tLE = 286,                     /* tLE  */
175     tDIV = 287,                    /* tDIV  */
176     tPLUSPLUS = 288,               /* tPLUSPLUS  */
177     tMINUSMINUS = 289              /* tMINUSMINUS  */
178   };
179   typedef enum yytokentype yytoken_kind_t;
180 #endif
181 /* Token kinds.  */
182 #define YYEMPTY -2
183 #define YYEOF 0
184 #define YYerror 256
185 #define YYUNDEF 257
186 #define tSYMBOL 258
187 #define tREGEXP 259
188 #define tSTRING 260
189 #define tINTEGER 261
190 #define tREAL 262
191 #define tSUB 263
192 #define tSTATE 264
193 #define tSTART 265
194 #define tSTARTRULES 266
195 #define tNAMERULES 267
196 #define tBEGIN 268
197 #define tEND 269
198 #define tRETURN 270
199 #define tIF 271
200 #define tELSE 272
201 #define tLOCAL 273
202 #define tWHILE 274
203 #define tFOR 275
204 #define tEXTENDS 276
205 #define tADDASSIGN 277
206 #define tSUBASSIGN 278
207 #define tMULASSIGN 279
208 #define tDIVASSIGN 280
209 #define tOR 281
210 #define tAND 282
211 #define tEQ 283
212 #define tNE 284
213 #define tGE 285
214 #define tLE 286
215 #define tDIV 287
216 #define tPLUSPLUS 288
217 #define tMINUSMINUS 289
218
219 /* Value type.  */
220 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
221 union YYSTYPE
222 {
223 #line 34 "gram.y"
224
225   List *lst;
226   Node *node;
227   Cons *cons;
228   Stmt *stmt;
229   Expr *expr;
230
231 #line 232 "gram.c"
232
233 };
234 typedef union YYSTYPE YYSTYPE;
235 # define YYSTYPE_IS_TRIVIAL 1
236 # define YYSTYPE_IS_DECLARED 1
237 #endif
238
239
240 extern YYSTYPE yylval;
241
242
243 int yyparse (void);
244
245
246 #endif /* !YY_YY_GRAM_H_INCLUDED  */
247 /* Symbol kind.  */
248 enum yysymbol_kind_t
249 {
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  */
320 };
321 typedef enum yysymbol_kind_t yysymbol_kind_t;
322
323
324
325
326 #ifdef short
327 # undef short
328 #endif
329
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.  */
333
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 */
338 #  define YY_STDINT_H
339 # endif
340 #endif
341
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.  */
346
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;
351 #else
352 typedef signed char yytype_int8;
353 #endif
354
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;
359 #else
360 typedef short yytype_int16;
361 #endif
362
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>.  */
368 #ifdef __hpux
369 # undef UINT_LEAST8_MAX
370 # undef UINT_LEAST16_MAX
371 # define UINT_LEAST8_MAX 255
372 # define UINT_LEAST16_MAX 65535
373 #endif
374
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;
382 #else
383 typedef short yytype_uint8;
384 #endif
385
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;
393 #else
394 typedef int yytype_uint16;
395 #endif
396
397 #ifndef YYPTRDIFF_T
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
402 #  ifndef ptrdiff_t
403 #   include <stddef.h> /* INFRINGES ON USER NAME SPACE */
404 #  endif
405 #  define YYPTRDIFF_T ptrdiff_t
406 #  define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
407 # else
408 #  define YYPTRDIFF_T long
409 #  define YYPTRDIFF_MAXIMUM LONG_MAX
410 # endif
411 #endif
412
413 #ifndef YYSIZE_T
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
421 # else
422 #  define YYSIZE_T unsigned
423 # endif
424 #endif
425
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)))
431
432 #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
433
434
435 /* Stored state numbers (used for stacks). */
436 typedef yytype_uint8 yy_state_t;
437
438 /* State numbers in computations.  */
439 typedef int yy_state_fast_t;
440
441 #ifndef YY_
442 # if defined YYENABLE_NLS && YYENABLE_NLS
443 #  if ENABLE_NLS
444 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
445 #   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
446 #  endif
447 # endif
448 # ifndef YY_
449 #  define YY_(Msgid) Msgid
450 # endif
451 #endif
452
453
454 #ifndef YY_ATTRIBUTE_PURE
455 # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
456 #  define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
457 # else
458 #  define YY_ATTRIBUTE_PURE
459 # endif
460 #endif
461
462 #ifndef YY_ATTRIBUTE_UNUSED
463 # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
464 #  define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
465 # else
466 #  define YY_ATTRIBUTE_UNUSED
467 # endif
468 #endif
469
470 /* Suppress unused-variable warnings by "using" E.  */
471 #if ! defined lint || defined __GNUC__
472 # define YY_USE(E) ((void) (E))
473 #else
474 # define YY_USE(E) /* empty */
475 #endif
476
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\"")
483 # else
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\"")
488 # endif
489 # define YY_IGNORE_MAYBE_UNINITIALIZED_END      \
490     _Pragma ("GCC diagnostic pop")
491 #else
492 # define YY_INITIAL_VALUE(Value) Value
493 #endif
494 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
495 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
496 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
497 #endif
498 #ifndef YY_INITIAL_VALUE
499 # define YY_INITIAL_VALUE(Value) /* Nothing. */
500 #endif
501
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")
508 #endif
509 #ifndef YY_IGNORE_USELESS_CAST_BEGIN
510 # define YY_IGNORE_USELESS_CAST_BEGIN
511 # define YY_IGNORE_USELESS_CAST_END
512 #endif
513
514
515 #define YY_ASSERT(E) ((void) (0 && (E)))
516
517 #if !defined yyoverflow
518
519 /* The parser invokes alloca or malloc; define the necessary symbols.  */
520
521 # ifdef YYSTACK_USE_ALLOCA
522 #  if YYSTACK_USE_ALLOCA
523 #   ifdef __GNUC__
524 #    define YYSTACK_ALLOC __builtin_alloca
525 #   elif defined __BUILTIN_VA_ARG_INCR
526 #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
527 #   elif defined _AIX
528 #    define YYSTACK_ALLOC __alloca
529 #   elif defined _MSC_VER
530 #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
531 #    define alloca _alloca
532 #   else
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
539 #     endif
540 #    endif
541 #   endif
542 #  endif
543 # endif
544
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 */
554 #  endif
555 # else
556 #  define YYSTACK_ALLOC YYMALLOC
557 #  define YYSTACK_FREE YYFREE
558 #  ifndef YYSTACK_ALLOC_MAXIMUM
559 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
560 #  endif
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
567 #   endif
568 #  endif
569 #  ifndef YYMALLOC
570 #   define YYMALLOC malloc
571 #   if ! defined malloc && ! defined EXIT_SUCCESS
572 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
573 #   endif
574 #  endif
575 #  ifndef YYFREE
576 #   define YYFREE free
577 #   if ! defined free && ! defined EXIT_SUCCESS
578 void free (void *); /* INFRINGES ON USER NAME SPACE */
579 #   endif
580 #  endif
581 # endif
582 #endif /* !defined yyoverflow */
583
584 #if (! defined yyoverflow \
585      && (! defined __cplusplus \
586          || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
587
588 /* A type that is properly aligned for any stack member.  */
589 union yyalloc
590 {
591   yy_state_t yyss_alloc;
592   YYSTYPE yyvs_alloc;
593 };
594
595 /* The size of the maximum gap between one aligned stack and the next.  */
596 # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
597
598 /* The size of an array large to enough to hold all stacks, each with
599    N elements.  */
600 # define YYSTACK_BYTES(N) \
601      ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
602       + YYSTACK_GAP_MAXIMUM)
603
604 # define YYCOPY_NEEDED 1
605
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
610    stack.  */
611 # define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
612     do                                                                  \
613       {                                                                 \
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);                        \
619       }                                                                 \
620     while (0)
621
622 #endif
623
624 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
625 /* Copy COUNT objects from SRC to DST.  The source and destination do
626    not overlap.  */
627 # ifndef YYCOPY
628 #  if defined __GNUC__ && 1 < __GNUC__
629 #   define YYCOPY(Dst, Src, Count) \
630       __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
631 #  else
632 #   define YYCOPY(Dst, Src, Count)              \
633       do                                        \
634         {                                       \
635           YYPTRDIFF_T yyi;                      \
636           for (yyi = 0; yyi < (Count); yyi++)   \
637             (Dst)[yyi] = (Src)[yyi];            \
638         }                                       \
639       while (0)
640 #  endif
641 # endif
642 #endif /* !YYCOPY_NEEDED */
643
644 /* YYFINAL -- State number of the termination state.  */
645 #define YYFINAL  2
646 /* YYLAST -- Last index in YYTABLE.  */
647 #define YYLAST   571
648
649 /* YYNTOKENS -- Number of terminals.  */
650 #define YYNTOKENS  52
651 /* YYNNTS -- Number of nonterminals.  */
652 #define YYNNTS  17
653 /* YYNRULES -- Number of rules.  */
654 #define YYNRULES  76
655 /* YYNSTATES -- Number of states.  */
656 #define YYNSTATES  167
657
658 /* YYMAXUTOK -- Last valid token kind.  */
659 #define YYMAXUTOK   289
660
661
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])        \
667    : YYSYMBOL_YYUNDEF)
668
669 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
670    as returned by yylex.  */
671 static const yytype_int8 yytranslate[] =
672 {
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
702 };
703
704 #if YYDEBUG
705 /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
706 static const yytype_uint8 yyrline[] =
707 {
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
716 };
717 #endif
718
719 /** Accessing symbol of state STATE.  */
720 #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
721
722 #if YYDEBUG || 0
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;
726
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[] =
730 {
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
742 };
743
744 static const char *
745 yysymbol_name (yysymbol_kind_t yysymbol)
746 {
747   return yytname[yysymbol];
748 }
749 #endif
750
751 #define YYPACT_NINF (-41)
752
753 #define yypact_value_is_default(Yyn) \
754   ((Yyn) == YYPACT_NINF)
755
756 #define YYTABLE_NINF (-1)
757
758 #define yytable_value_is_error(Yyn) \
759   0
760
761 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
762    STATE-NUM.  */
763 static const yytype_int16 yypact[] =
764 {
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
782 };
783
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[] =
788 {
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
806 };
807
808 /* YYPGOTO[NTERM-NUM].  */
809 static const yytype_int8 yypgoto[] =
810 {
811      -41,   -41,   -41,    99,    19,   -41,   -41,   -41,   -41,   -41,
812      -23,   -32,    -1,   -12,     0,   -41,   -41
813 };
814
815 /* YYDEFGOTO[NTERM-NUM].  */
816 static const yytype_uint8 yydefgoto[] =
817 {
818        0,     1,    22,    75,   105,   124,   102,   103,   143,   152,
819      153,    46,    83,    24,    81,    69,    70
820 };
821
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[] =
826 {
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,
884        0,    61
885 };
886
887 static const yytype_int16 yycheck[] =
888 {
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,
946       -1,    44
947 };
948
949 /* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
950    state STATE-NUM.  */
951 static const yytype_int8 yystos[] =
952 {
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
970 };
971
972 /* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM.  */
973 static const yytype_int8 yyr1[] =
974 {
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
983 };
984
985 /* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM.  */
986 static const yytype_int8 yyr2[] =
987 {
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,
995        3,     0,     1,     0,     1,     1,     3
996 };
997
998
999 enum { YYENOMEM = -2 };
1000
1001 #define yyerrok         (yyerrstatus = 0)
1002 #define yyclearin       (yychar = YYEMPTY)
1003
1004 #define YYACCEPT        goto yyacceptlab
1005 #define YYABORT         goto yyabortlab
1006 #define YYERROR         goto yyerrorlab
1007 #define YYNOMEM         goto yyexhaustedlab
1008
1009
1010 #define YYRECOVERING()  (!!yyerrstatus)
1011
1012 #define YYBACKUP(Token, Value)                                    \
1013   do                                                              \
1014     if (yychar == YYEMPTY)                                        \
1015       {                                                           \
1016         yychar = (Token);                                         \
1017         yylval = (Value);                                         \
1018         YYPOPSTACK (yylen);                                       \
1019         yystate = *yyssp;                                         \
1020         goto yybackup;                                            \
1021       }                                                           \
1022     else                                                          \
1023       {                                                           \
1024         yyerror (YY_("syntax error: cannot back up")); \
1025         YYERROR;                                                  \
1026       }                                                           \
1027   while (0)
1028
1029 /* Backward compatibility with an undocumented macro.
1030    Use YYerror or YYUNDEF. */
1031 #define YYERRCODE YYUNDEF
1032
1033
1034 /* Enable debugging if requested.  */
1035 #if YYDEBUG
1036
1037 # ifndef YYFPRINTF
1038 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1039 #  define YYFPRINTF fprintf
1040 # endif
1041
1042 # define YYDPRINTF(Args)                        \
1043 do {                                            \
1044   if (yydebug)                                  \
1045     YYFPRINTF Args;                             \
1046 } while (0)
1047
1048
1049
1050
1051 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location)                    \
1052 do {                                                                      \
1053   if (yydebug)                                                            \
1054     {                                                                     \
1055       YYFPRINTF (stderr, "%s ", Title);                                   \
1056       yy_symbol_print (stderr,                                            \
1057                   Kind, Value); \
1058       YYFPRINTF (stderr, "\n");                                           \
1059     }                                                                     \
1060 } while (0)
1061
1062
1063 /*-----------------------------------.
1064 | Print this symbol's value on YYO.  |
1065 `-----------------------------------*/
1066
1067 static void
1068 yy_symbol_value_print (FILE *yyo,
1069                        yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
1070 {
1071   FILE *yyoutput = yyo;
1072   YY_USE (yyoutput);
1073   if (!yyvaluep)
1074     return;
1075   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1076   YY_USE (yykind);
1077   YY_IGNORE_MAYBE_UNINITIALIZED_END
1078 }
1079
1080
1081 /*---------------------------.
1082 | Print this symbol on YYO.  |
1083 `---------------------------*/
1084
1085 static void
1086 yy_symbol_print (FILE *yyo,
1087                  yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
1088 {
1089   YYFPRINTF (yyo, "%s %s (",
1090              yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
1091
1092   yy_symbol_value_print (yyo, yykind, yyvaluep);
1093   YYFPRINTF (yyo, ")");
1094 }
1095
1096 /*------------------------------------------------------------------.
1097 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1098 | TOP (included).                                                   |
1099 `------------------------------------------------------------------*/
1100
1101 static void
1102 yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
1103 {
1104   YYFPRINTF (stderr, "Stack now");
1105   for (; yybottom <= yytop; yybottom++)
1106     {
1107       int yybot = *yybottom;
1108       YYFPRINTF (stderr, " %d", yybot);
1109     }
1110   YYFPRINTF (stderr, "\n");
1111 }
1112
1113 # define YY_STACK_PRINT(Bottom, Top)                            \
1114 do {                                                            \
1115   if (yydebug)                                                  \
1116     yy_stack_print ((Bottom), (Top));                           \
1117 } while (0)
1118
1119
1120 /*------------------------------------------------.
1121 | Report that the YYRULE is going to be reduced.  |
1122 `------------------------------------------------*/
1123
1124 static void
1125 yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
1126                  int yyrule)
1127 {
1128   int yylno = yyrline[yyrule];
1129   int yynrhs = yyr2[yyrule];
1130   int yyi;
1131   YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
1132              yyrule - 1, yylno);
1133   /* The symbols being reduced.  */
1134   for (yyi = 0; yyi < yynrhs; yyi++)
1135     {
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");
1141     }
1142 }
1143
1144 # define YY_REDUCE_PRINT(Rule)          \
1145 do {                                    \
1146   if (yydebug)                          \
1147     yy_reduce_print (yyssp, yyvsp, Rule); \
1148 } while (0)
1149
1150 /* Nonzero means print parse trace.  It is left uninitialized so that
1151    multiple parsers can coexist.  */
1152 int yydebug;
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 */
1159
1160
1161 /* YYINITDEPTH -- initial size of the parser's stacks.  */
1162 #ifndef YYINITDEPTH
1163 # define YYINITDEPTH 200
1164 #endif
1165
1166 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1167    if the built-in stack extension method is used).
1168
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.  */
1172
1173 #ifndef YYMAXDEPTH
1174 # define YYMAXDEPTH 10000
1175 #endif
1176
1177
1178
1179
1180
1181
1182 /*-----------------------------------------------.
1183 | Release the memory associated to this symbol.  |
1184 `-----------------------------------------------*/
1185
1186 static void
1187 yydestruct (const char *yymsg,
1188             yysymbol_kind_t yykind, YYSTYPE *yyvaluep)
1189 {
1190   YY_USE (yyvaluep);
1191   if (!yymsg)
1192     yymsg = "Deleting";
1193   YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
1194
1195   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1196   YY_USE (yykind);
1197   YY_IGNORE_MAYBE_UNINITIALIZED_END
1198 }
1199
1200
1201 /* Lookahead token kind.  */
1202 int yychar;
1203
1204 /* The semantic value of the lookahead symbol.  */
1205 YYSTYPE yylval;
1206 /* Number of syntax errors so far.  */
1207 int yynerrs;
1208
1209
1210
1211
1212 /*----------.
1213 | yyparse.  |
1214 `----------*/
1215
1216 int
1217 yyparse (void)
1218 {
1219     yy_state_fast_t yystate = 0;
1220     /* Number of tokens to shift before error messages enabled.  */
1221     int yyerrstatus = 0;
1222
1223     /* Refer to the stacks through separate pointers, to allow yyoverflow
1224        to reallocate them elsewhere.  */
1225
1226     /* Their size.  */
1227     YYPTRDIFF_T yystacksize = YYINITDEPTH;
1228
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;
1233
1234     /* The semantic value stack: array, bottom, top.  */
1235     YYSTYPE yyvsa[YYINITDEPTH];
1236     YYSTYPE *yyvs = yyvsa;
1237     YYSTYPE *yyvsp = yyvs;
1238
1239   int yyn;
1240   /* The return value of yyparse.  */
1241   int yyresult;
1242   /* Lookahead symbol kind.  */
1243   yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
1244   /* The variables used to return semantic value and location from the
1245      action routines.  */
1246   YYSTYPE yyval;
1247
1248
1249
1250 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
1251
1252   /* The number of symbols on the RHS of the reduced rule.
1253      Keep to zero when no symbol should be popped.  */
1254   int yylen = 0;
1255
1256   YYDPRINTF ((stderr, "Starting parse\n"));
1257
1258   yychar = YYEMPTY; /* Cause a token to be read.  */
1259
1260   goto yysetstate;
1261
1262
1263 /*------------------------------------------------------------.
1264 | yynewstate -- push a new state, which is found in yystate.  |
1265 `------------------------------------------------------------*/
1266 yynewstate:
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.  */
1269   yyssp++;
1270
1271
1272 /*--------------------------------------------------------------------.
1273 | yysetstate -- set current state (the top of the stack) to yystate.  |
1274 `--------------------------------------------------------------------*/
1275 yysetstate:
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);
1282
1283   if (yyss + yystacksize - 1 <= yyssp)
1284 #if !defined yyoverflow && !defined YYSTACK_RELOCATE
1285     YYNOMEM;
1286 #else
1287     {
1288       /* Get the current used size of the three stacks, in elements.  */
1289       YYPTRDIFF_T yysize = yyssp - yyss + 1;
1290
1291 # if defined yyoverflow
1292       {
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
1295            memory.  */
1296         yy_state_t *yyss1 = yyss;
1297         YYSTYPE *yyvs1 = yyvs;
1298
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),
1306                     &yystacksize);
1307         yyss = yyss1;
1308         yyvs = yyvs1;
1309       }
1310 # else /* defined YYSTACK_RELOCATE */
1311       /* Extend the stack our own way.  */
1312       if (YYMAXDEPTH <= yystacksize)
1313         YYNOMEM;
1314       yystacksize *= 2;
1315       if (YYMAXDEPTH < yystacksize)
1316         yystacksize = YYMAXDEPTH;
1317
1318       {
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))));
1323         if (! yyptr)
1324           YYNOMEM;
1325         YYSTACK_RELOCATE (yyss_alloc, yyss);
1326         YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1327 #  undef YYSTACK_RELOCATE
1328         if (yyss1 != yyssa)
1329           YYSTACK_FREE (yyss1);
1330       }
1331 # endif
1332
1333       yyssp = yyss + yysize - 1;
1334       yyvsp = yyvs + yysize - 1;
1335
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
1340
1341       if (yyss + yystacksize - 1 <= yyssp)
1342         YYABORT;
1343     }
1344 #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1345
1346
1347   if (yystate == YYFINAL)
1348     YYACCEPT;
1349
1350   goto yybackup;
1351
1352
1353 /*-----------.
1354 | yybackup.  |
1355 `-----------*/
1356 yybackup:
1357   /* Do appropriate processing given the current state.  Read a
1358      lookahead token if we need one and don't already have one.  */
1359
1360   /* First try to decide what to do without reference to lookahead token.  */
1361   yyn = yypact[yystate];
1362   if (yypact_value_is_default (yyn))
1363     goto yydefault;
1364
1365   /* Not known => get a lookahead token if don't already have one.  */
1366
1367   /* YYCHAR is either empty, or end-of-input, or a valid lookahead.  */
1368   if (yychar == YYEMPTY)
1369     {
1370       YYDPRINTF ((stderr, "Reading a token\n"));
1371       yychar = yylex ();
1372     }
1373
1374   if (yychar <= YYEOF)
1375     {
1376       yychar = YYEOF;
1377       yytoken = YYSYMBOL_YYEOF;
1378       YYDPRINTF ((stderr, "Now at end of input.\n"));
1379     }
1380   else if (yychar == YYerror)
1381     {
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. */
1386       yychar = YYUNDEF;
1387       yytoken = YYSYMBOL_YYerror;
1388       goto yyerrlab1;
1389     }
1390   else
1391     {
1392       yytoken = YYTRANSLATE (yychar);
1393       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1394     }
1395
1396   /* If the proper action on seeing token YYTOKEN is to reduce or to
1397      detect an error, take that action.  */
1398   yyn += yytoken;
1399   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1400     goto yydefault;
1401   yyn = yytable[yyn];
1402   if (yyn <= 0)
1403     {
1404       if (yytable_value_is_error (yyn))
1405         goto yyerrlab;
1406       yyn = -yyn;
1407       goto yyreduce;
1408     }
1409
1410   /* Count tokens shifted since error; after three, turn off error
1411      status.  */
1412   if (yyerrstatus)
1413     yyerrstatus--;
1414
1415   /* Shift the lookahead token.  */
1416   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1417   yystate = yyn;
1418   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1419   *++yyvsp = yylval;
1420   YY_IGNORE_MAYBE_UNINITIALIZED_END
1421
1422   /* Discard the shifted token.  */
1423   yychar = YYEMPTY;
1424   goto yynewstate;
1425
1426
1427 /*-----------------------------------------------------------.
1428 | yydefault -- do the default action for the current state.  |
1429 `-----------------------------------------------------------*/
1430 yydefault:
1431   yyn = yydefact[yystate];
1432   if (yyn == 0)
1433     goto yyerrlab;
1434   goto yyreduce;
1435
1436
1437 /*-----------------------------.
1438 | yyreduce -- do a reduction.  |
1439 `-----------------------------*/
1440 yyreduce:
1441   /* yyn is the number of a rule to reduce with.  */
1442   yylen = yyr2[yyn];
1443
1444   /* If YYLEN is nonzero, implement the default value of the action:
1445      '$$ = $1'.
1446
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];
1453
1454
1455   YY_REDUCE_PRINT (yyn);
1456   switch (yyn)
1457     {
1458   case 4: /* toplevel: tSTART '{' stmt_list '}'  */
1459 #line 69 "gram.y"
1460                                         { start_stmts = (yyvsp[-1].lst); }
1461 #line 1462 "gram.c"
1462     break;
1463
1464   case 5: /* toplevel: tSTARTRULES '{' regexp_sym_list '}'  */
1465 #line 71 "gram.y"
1466                                         { startrules = (yyvsp[-1].lst); }
1467 #line 1468 "gram.c"
1468     break;
1469
1470   case 6: /* toplevel: tNAMERULES '{' regexp_sym_list '}'  */
1471 #line 73 "gram.y"
1472                                         { namerules = (yyvsp[-1].lst); }
1473 #line 1474 "gram.c"
1474     break;
1475
1476   case 7: /* toplevel: tSTATE tSYMBOL '{' staterules '}'  */
1477 #line 75 "gram.y"
1478                                         { define_state ((yyvsp[-3].node), NULL, (yyvsp[-1].lst)); }
1479 #line 1480 "gram.c"
1480     break;
1481
1482   case 8: /* toplevel: tSTATE tSYMBOL tEXTENDS tSYMBOL '{' staterules '}'  */
1483 #line 77 "gram.y"
1484                                         { define_state ((yyvsp[-5].node), (yyvsp[-3].node), (yyvsp[-1].lst)); }
1485 #line 1486 "gram.c"
1486     break;
1487
1488   case 9: /* toplevel: stmt  */
1489 #line 78 "gram.y"
1490                                         { list_append (global_stmts, (yyvsp[0].stmt)); }
1491 #line 1492 "gram.c"
1492     break;
1493
1494   case 10: /* regexp_sym_list: %empty  */
1495 #line 81 "gram.y"
1496                                         { (yyval.lst) = list (); }
1497 #line 1498 "gram.c"
1498     break;
1499
1500   case 11: /* regexp_sym_list: regexp_sym_list tREGEXP tSYMBOL ';'  */
1501 #line 83 "gram.y"
1502                                         { list_append ((yyvsp[-3].lst), cons ((yyvsp[-2].node), (yyvsp[-1].node))); }
1503 #line 1504 "gram.c"
1504     break;
1505
1506   case 12: /* staterules: %empty  */
1507 #line 86 "gram.y"
1508                                         { (yyval.lst) = list (); }
1509 #line 1510 "gram.c"
1510     break;
1511
1512   case 13: /* staterules: staterules staterule  */
1513 #line 87 "gram.y"
1514                                         { list_append ((yyvsp[-1].lst), (yyvsp[0].cons)); }
1515 #line 1516 "gram.c"
1516     break;
1517
1518   case 14: /* staterule: tBEGIN '{' stmt_list '}'  */
1519 #line 89 "gram.y"
1520                                         { (yyval.cons) = cons (RULE_BEGIN, (yyvsp[-1].lst)); }
1521 #line 1522 "gram.c"
1522     break;
1523
1524   case 15: /* staterule: tEND '{' stmt_list '}'  */
1525 #line 90 "gram.y"
1526                                         { (yyval.cons) = cons (RULE_END, (yyvsp[-1].lst)); }
1527 #line 1528 "gram.c"
1528     break;
1529
1530   case 16: /* staterule: tREGEXP '{' stmt_list '}'  */
1531 #line 91 "gram.y"
1532                                         { (yyval.cons) = cons ((yyvsp[-3].node), (yyvsp[-1].lst)); }
1533 #line 1534 "gram.c"
1534     break;
1535
1536   case 17: /* staterule: tSYMBOL '{' stmt_list '}'  */
1537 #line 92 "gram.y"
1538                                         { (yyval.cons) = cons ((yyvsp[-3].node), (yyvsp[-1].lst)); }
1539 #line 1540 "gram.c"
1540     break;
1541
1542   case 18: /* symbol_list: %empty  */
1543 #line 95 "gram.y"
1544                                         { (yyval.lst) = list (); }
1545 #line 1546 "gram.c"
1546     break;
1547
1548   case 19: /* symbol_list: rest_symbol_list  */
1549 #line 96 "gram.y"
1550                                         { (yyval.lst) = (yyvsp[0].lst); }
1551 #line 1552 "gram.c"
1552     break;
1553
1554   case 20: /* rest_symbol_list: tSYMBOL  */
1555 #line 99 "gram.y"
1556                                         { (yyval.lst) = list (); list_append ((yyval.lst), (yyvsp[0].node)); }
1557 #line 1558 "gram.c"
1558     break;
1559
1560   case 21: /* rest_symbol_list: rest_symbol_list ',' tSYMBOL  */
1561 #line 100 "gram.y"
1562                                         { list_append ((yyvsp[-2].lst), (yyvsp[0].node)); }
1563 #line 1564 "gram.c"
1564     break;
1565
1566   case 22: /* locals: %empty  */
1567 #line 103 "gram.y"
1568                                         { (yyval.lst) = list (); }
1569 #line 1570 "gram.c"
1570     break;
1571
1572   case 23: /* locals: tLOCAL locals_rest ';'  */
1573 #line 104 "gram.y"
1574                                         { (yyval.lst) = (yyvsp[-1].lst); }
1575 #line 1576 "gram.c"
1576     break;
1577
1578   case 24: /* locals_rest: local_def  */
1579 #line 107 "gram.y"
1580                                         { (yyval.lst) = list (); list_append ((yyval.lst), (yyvsp[0].cons)); }
1581 #line 1582 "gram.c"
1582     break;
1583
1584   case 25: /* locals_rest: locals_rest ',' local_def  */
1585 #line 108 "gram.y"
1586                                         { list_append ((yyvsp[-2].lst), (yyvsp[0].cons)); }
1587 #line 1588 "gram.c"
1588     break;
1589
1590   case 26: /* local_def: tSYMBOL  */
1591 #line 111 "gram.y"
1592                                         { (yyval.cons) = cons ((yyvsp[0].node), NULL); }
1593 #line 1594 "gram.c"
1594     break;
1595
1596   case 27: /* local_def: tSYMBOL '=' expr  */
1597 #line 112 "gram.y"
1598                                         { (yyval.cons) = cons ((yyvsp[-2].node), (yyvsp[0].expr)); }
1599 #line 1600 "gram.c"
1600     break;
1601
1602   case 28: /* stmt_list: %empty  */
1603 #line 115 "gram.y"
1604                                         { (yyval.lst) = list (); }
1605 #line 1606 "gram.c"
1606     break;
1607
1608   case 29: /* stmt_list: stmt_list stmt  */
1609 #line 116 "gram.y"
1610                                         { list_append ((yyvsp[-1].lst), (yyvsp[0].stmt)); }
1611 #line 1612 "gram.c"
1612     break;
1613
1614   case 30: /* stmt: tRETURN ';'  */
1615 #line 119 "gram.y"
1616                                         { (yyval.stmt) = mk_stmt (sRETURN, NULL, NULL,
1617                                                         NULL, NULL); }
1618 #line 1619 "gram.c"
1619     break;
1620
1621   case 31: /* stmt: tRETURN expr ';'  */
1622 #line 121 "gram.y"
1623                                         { (yyval.stmt) = mk_stmt (sRETURN, (yyvsp[-1].expr), NULL,
1624                                                         NULL, NULL); }
1625 #line 1626 "gram.c"
1626     break;
1627
1628   case 32: /* stmt: tSUB tSYMBOL '(' symbol_list ')' '{' locals stmt_list '}'  */
1629 #line 124 "gram.y"
1630                                         { (yyval.stmt) = mk_stmt (sDEFSUB, (yyvsp[-7].node),
1631                                                         cons (cons ((yyvsp[-5].lst), (yyvsp[-2].lst)),
1632                                                               (yyvsp[-1].lst)),
1633                                                         NULL, NULL); }
1634 #line 1635 "gram.c"
1635     break;
1636
1637   case 33: /* stmt: '{' stmt_list '}'  */
1638 #line 128 "gram.y"
1639                                         { (yyval.stmt) = mk_stmt (sBLOCK, (yyvsp[-1].lst), NULL,
1640                                                         NULL, NULL); }
1641 #line 1642 "gram.c"
1642     break;
1643
1644   case 34: /* stmt: tIF '(' expr ')' stmt  */
1645 #line 130 "gram.y"
1646                                         { (yyval.stmt) = mk_stmt (sIF, (yyvsp[-2].expr), (yyvsp[0].stmt), NULL,
1647                                                         NULL); }
1648 #line 1649 "gram.c"
1649     break;
1650
1651   case 35: /* stmt: tIF '(' expr ')' stmt tELSE stmt  */
1652 #line 133 "gram.y"
1653                                         { (yyval.stmt) = mk_stmt (sIF, (yyvsp[-4].expr), (yyvsp[-2].stmt), (yyvsp[0].stmt),
1654                                                         NULL); }
1655 #line 1656 "gram.c"
1656     break;
1657
1658   case 36: /* stmt: tWHILE '(' expr ')' stmt  */
1659 #line 135 "gram.y"
1660                                         { (yyval.stmt) = mk_stmt (sWHILE, (yyvsp[-2].expr), (yyvsp[0].stmt),
1661                                                         NULL, NULL); }
1662 #line 1663 "gram.c"
1663     break;
1664
1665   case 37: /* stmt: tFOR '(' cond_expr ';' expr ';' cond_expr ')' stmt  */
1666 #line 138 "gram.y"
1667                                         { (yyval.stmt) = mk_stmt (sFOR, (yyvsp[-6].expr), (yyvsp[-4].expr), (yyvsp[-2].expr),
1668                                                         (yyvsp[0].stmt)); }
1669 #line 1670 "gram.c"
1670     break;
1671
1672   case 38: /* stmt: expr ';'  */
1673 #line 140 "gram.y"
1674                                         { (yyval.stmt) = mk_stmt (sEXPR, (yyvsp[-1].expr), NULL,
1675                                                         NULL, NULL); }
1676 #line 1677 "gram.c"
1677     break;
1678
1679   case 39: /* expr: tSTRING  */
1680 #line 144 "gram.y"
1681                                         { (yyval.expr) = mk_expr (eSTRING, (yyvsp[0].node), NULL,
1682                                                         NULL); }
1683 #line 1684 "gram.c"
1684     break;
1685
1686   case 40: /* expr: tREGEXP  */
1687 #line 146 "gram.y"
1688                                         { (yyval.expr) = mk_expr (eREGEXP, (yyvsp[0].node), NULL,
1689                                                         NULL); }
1690 #line 1691 "gram.c"
1691     break;
1692
1693   case 41: /* expr: tINTEGER  */
1694 #line 148 "gram.y"
1695                                         { (yyval.expr) = mk_expr (eINTEGER, (yyvsp[0].node), NULL,
1696                                                         NULL); }
1697 #line 1698 "gram.c"
1698     break;
1699
1700   case 42: /* expr: tREAL  */
1701 #line 150 "gram.y"
1702                                         { (yyval.expr) = mk_expr (eREAL, (yyvsp[0].node), NULL,
1703                                                         NULL); }
1704 #line 1705 "gram.c"
1705     break;
1706
1707   case 43: /* expr: tSYMBOL  */
1708 #line 152 "gram.y"
1709                                         { (yyval.expr) = mk_expr (eSYMBOL, (yyvsp[0].node), NULL,
1710                                                         NULL); }
1711 #line 1712 "gram.c"
1712     break;
1713
1714   case 44: /* expr: '!' expr  */
1715 #line 154 "gram.y"
1716                                         { (yyval.expr) = mk_expr (eNOT, (yyvsp[0].expr), NULL,
1717                                                         NULL); }
1718 #line 1719 "gram.c"
1719     break;
1720
1721   case 45: /* expr: expr tAND expr  */
1722 #line 156 "gram.y"
1723                                         { (yyval.expr) = mk_expr (eAND, (yyvsp[-2].expr), (yyvsp[0].expr), NULL); }
1724 #line 1725 "gram.c"
1725     break;
1726
1727   case 46: /* expr: expr tOR expr  */
1728 #line 157 "gram.y"
1729                                         { (yyval.expr) = mk_expr (eOR, (yyvsp[-2].expr), (yyvsp[0].expr), NULL); }
1730 #line 1731 "gram.c"
1731     break;
1732
1733   case 47: /* expr: tSYMBOL '(' expr_list ')'  */
1734 #line 158 "gram.y"
1735                                         { (yyval.expr) = mk_expr (eFCALL, (yyvsp[-3].node), (yyvsp[-1].lst),
1736                                                         NULL); }
1737 #line 1738 "gram.c"
1738     break;
1739
1740   case 48: /* expr: tSYMBOL '=' expr  */
1741 #line 160 "gram.y"
1742                                         { (yyval.expr) = mk_expr (eASSIGN, (yyvsp[-2].node), (yyvsp[0].expr),
1743                                                         NULL); }
1744 #line 1745 "gram.c"
1745     break;
1746
1747   case 49: /* expr: tSYMBOL tADDASSIGN expr  */
1748 #line 162 "gram.y"
1749                                         { (yyval.expr) = mk_expr (eADDASSIGN, (yyvsp[-2].node), (yyvsp[0].expr),
1750                                                         NULL); }
1751 #line 1752 "gram.c"
1752     break;
1753
1754   case 50: /* expr: tSYMBOL tSUBASSIGN expr  */
1755 #line 164 "gram.y"
1756                                         { (yyval.expr) = mk_expr (eSUBASSIGN, (yyvsp[-2].node), (yyvsp[0].expr),
1757                                                         NULL); }
1758 #line 1759 "gram.c"
1759     break;
1760
1761   case 51: /* expr: tSYMBOL tMULASSIGN expr  */
1762 #line 166 "gram.y"
1763                                         { (yyval.expr) = mk_expr (eMULASSIGN, (yyvsp[-2].node), (yyvsp[0].expr),
1764                                                         NULL); }
1765 #line 1766 "gram.c"
1766     break;
1767
1768   case 52: /* expr: tSYMBOL tDIVASSIGN expr  */
1769 #line 168 "gram.y"
1770                                         { (yyval.expr) = mk_expr (eDIVASSIGN, (yyvsp[-2].node), (yyvsp[0].expr),
1771                                                         NULL); }
1772 #line 1773 "gram.c"
1773     break;
1774
1775   case 53: /* expr: tSYMBOL tPLUSPLUS  */
1776 #line 170 "gram.y"
1777                                         { (yyval.expr) = mk_expr (ePOSTFIXADD, (yyvsp[-1].node), NULL,
1778                                                         NULL); }
1779 #line 1780 "gram.c"
1780     break;
1781
1782   case 54: /* expr: tSYMBOL tMINUSMINUS  */
1783 #line 172 "gram.y"
1784                                         { (yyval.expr) = mk_expr (ePOSTFIXSUB, (yyvsp[-1].node), NULL,
1785                                                         NULL); }
1786 #line 1787 "gram.c"
1787     break;
1788
1789   case 55: /* expr: tPLUSPLUS tSYMBOL  */
1790 #line 174 "gram.y"
1791                                         { (yyval.expr) = mk_expr (ePREFIXADD, (yyvsp[0].node), NULL,
1792                                                         NULL); }
1793 #line 1794 "gram.c"
1794     break;
1795
1796   case 56: /* expr: tMINUSMINUS tSYMBOL  */
1797 #line 176 "gram.y"
1798                                         { (yyval.expr) = mk_expr (ePREFIXSUB, (yyvsp[0].node), NULL,
1799                                                         NULL); }
1800 #line 1801 "gram.c"
1801     break;
1802
1803   case 57: /* expr: expr '[' expr ']' '=' expr  */
1804 #line 178 "gram.y"
1805                                         { (yyval.expr) = mk_expr (eARRAYASSIGN, (yyvsp[-5].expr), (yyvsp[-3].expr),
1806                                                         (yyvsp[0].expr)); }
1807 #line 1808 "gram.c"
1808     break;
1809
1810   case 58: /* expr: '(' expr ')'  */
1811 #line 180 "gram.y"
1812                                         { (yyval.expr) = (yyvsp[-1].expr); }
1813 #line 1814 "gram.c"
1814     break;
1815
1816   case 59: /* expr: expr '[' expr ']'  */
1817 #line 181 "gram.y"
1818                                         { (yyval.expr) = mk_expr (eARRAYREF, (yyvsp[-3].expr), (yyvsp[-1].expr),
1819                                                         NULL); }
1820 #line 1821 "gram.c"
1821     break;
1822
1823   case 60: /* expr: expr '?' expr ':' expr  */
1824 #line 183 "gram.y"
1825                                         { (yyval.expr) = mk_expr (eQUESTCOLON, (yyvsp[-4].expr), (yyvsp[-2].expr),
1826                                                         (yyvsp[0].expr)); }
1827 #line 1828 "gram.c"
1828     break;
1829
1830   case 61: /* expr: expr '*' expr  */
1831 #line 185 "gram.y"
1832                                         { (yyval.expr) = mk_expr (eMULT, (yyvsp[-2].expr), (yyvsp[0].expr), NULL); }
1833 #line 1834 "gram.c"
1834     break;
1835
1836   case 62: /* expr: expr tDIV expr  */
1837 #line 186 "gram.y"
1838                                         { (yyval.expr) = mk_expr (eDIV, (yyvsp[-2].expr), (yyvsp[0].expr), NULL); }
1839 #line 1840 "gram.c"
1840     break;
1841
1842   case 63: /* expr: expr '+' expr  */
1843 #line 187 "gram.y"
1844                                         { (yyval.expr) = mk_expr (ePLUS, (yyvsp[-2].expr), (yyvsp[0].expr), NULL); }
1845 #line 1846 "gram.c"
1846     break;
1847
1848   case 64: /* expr: expr '-' expr  */
1849 #line 188 "gram.y"
1850                                         { (yyval.expr) = mk_expr (eMINUS, (yyvsp[-2].expr), (yyvsp[0].expr),
1851                                                         NULL); }
1852 #line 1853 "gram.c"
1853     break;
1854
1855   case 65: /* expr: expr '<' expr  */
1856 #line 190 "gram.y"
1857                                         { (yyval.expr) = mk_expr (eLT, (yyvsp[-2].expr), (yyvsp[0].expr), NULL); }
1858 #line 1859 "gram.c"
1859     break;
1860
1861   case 66: /* expr: expr '>' expr  */
1862 #line 191 "gram.y"
1863                                         { (yyval.expr) = mk_expr (eGT, (yyvsp[-2].expr), (yyvsp[0].expr), NULL); }
1864 #line 1865 "gram.c"
1865     break;
1866
1867   case 67: /* expr: expr tEQ expr  */
1868 #line 192 "gram.y"
1869                                         { (yyval.expr) = mk_expr (eEQ, (yyvsp[-2].expr), (yyvsp[0].expr), NULL); }
1870 #line 1871 "gram.c"
1871     break;
1872
1873   case 68: /* expr: expr tNE expr  */
1874 #line 193 "gram.y"
1875                                         { (yyval.expr) = mk_expr (eNE, (yyvsp[-2].expr), (yyvsp[0].expr), NULL); }
1876 #line 1877 "gram.c"
1877     break;
1878
1879   case 69: /* expr: expr tGE expr  */
1880 #line 194 "gram.y"
1881                                         { (yyval.expr) = mk_expr (eGE, (yyvsp[-2].expr), (yyvsp[0].expr), NULL); }
1882 #line 1883 "gram.c"
1883     break;
1884
1885   case 70: /* expr: expr tLE expr  */
1886 #line 195 "gram.y"
1887                                         { (yyval.expr) = mk_expr (eLE, (yyvsp[-2].expr), (yyvsp[0].expr), NULL); }
1888 #line 1889 "gram.c"
1889     break;
1890
1891   case 71: /* cond_expr: %empty  */
1892 #line 198 "gram.y"
1893                                         { (yyval.expr) = NULL; }
1894 #line 1895 "gram.c"
1895     break;
1896
1897   case 72: /* cond_expr: expr  */
1898 #line 199 "gram.y"
1899                                         { (yyval.expr) = (yyvsp[0].expr); }
1900 #line 1901 "gram.c"
1901     break;
1902
1903   case 73: /* expr_list: %empty  */
1904 #line 202 "gram.y"
1905                                         { (yyval.lst) = list (); }
1906 #line 1907 "gram.c"
1907     break;
1908
1909   case 74: /* expr_list: rest_expr_list  */
1910 #line 203 "gram.y"
1911                                         { (yyval.lst) = (yyvsp[0].lst); }
1912 #line 1913 "gram.c"
1913     break;
1914
1915   case 75: /* rest_expr_list: expr  */
1916 #line 206 "gram.y"
1917                                         { (yyval.lst) = list (); list_append ((yyval.lst), (yyvsp[0].expr)); }
1918 #line 1919 "gram.c"
1919     break;
1920
1921   case 76: /* rest_expr_list: rest_expr_list ',' expr  */
1922 #line 207 "gram.y"
1923                                         { list_append ((yyvsp[-2].lst), (yyvsp[0].expr)); }
1924 #line 1925 "gram.c"
1925     break;
1926
1927
1928 #line 1929 "gram.c"
1929
1930       default: break;
1931     }
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);
1944
1945   YYPOPSTACK (yylen);
1946   yylen = 0;
1947
1948   *++yyvsp = yyval;
1949
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.  */
1953   {
1954     const int yylhs = yyr1[yyn] - YYNTOKENS;
1955     const int yyi = yypgoto[yylhs] + *yyssp;
1956     yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
1957                ? yytable[yyi]
1958                : yydefgoto[yylhs]);
1959   }
1960
1961   goto yynewstate;
1962
1963
1964 /*--------------------------------------.
1965 | yyerrlab -- here on detecting error.  |
1966 `--------------------------------------*/
1967 yyerrlab:
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.  */
1972   if (!yyerrstatus)
1973     {
1974       ++yynerrs;
1975       yyerror (YY_("syntax error"));
1976     }
1977
1978   if (yyerrstatus == 3)
1979     {
1980       /* If just tried and failed to reuse lookahead token after an
1981          error, discard it.  */
1982
1983       if (yychar <= YYEOF)
1984         {
1985           /* Return failure if at end of input.  */
1986           if (yychar == YYEOF)
1987             YYABORT;
1988         }
1989       else
1990         {
1991           yydestruct ("Error: discarding",
1992                       yytoken, &yylval);
1993           yychar = YYEMPTY;
1994         }
1995     }
1996
1997   /* Else will try to reuse lookahead token after shifting the error
1998      token.  */
1999   goto yyerrlab1;
2000
2001
2002 /*---------------------------------------------------.
2003 | yyerrorlab -- error raised explicitly by YYERROR.  |
2004 `---------------------------------------------------*/
2005 yyerrorlab:
2006   /* Pacify compilers when the user code never invokes YYERROR and the
2007      label yyerrorlab therefore never appears in user code.  */
2008   if (0)
2009     YYERROR;
2010   ++yynerrs;
2011
2012   /* Do not reclaim the symbols of the rule whose action triggered
2013      this YYERROR.  */
2014   YYPOPSTACK (yylen);
2015   yylen = 0;
2016   YY_STACK_PRINT (yyss, yyssp);
2017   yystate = *yyssp;
2018   goto yyerrlab1;
2019
2020
2021 /*-------------------------------------------------------------.
2022 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
2023 `-------------------------------------------------------------*/
2024 yyerrlab1:
2025   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
2026
2027   /* Pop stack until we find a state that shifts the error token.  */
2028   for (;;)
2029     {
2030       yyn = yypact[yystate];
2031       if (!yypact_value_is_default (yyn))
2032         {
2033           yyn += YYSYMBOL_YYerror;
2034           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
2035             {
2036               yyn = yytable[yyn];
2037               if (0 < yyn)
2038                 break;
2039             }
2040         }
2041
2042       /* Pop the current state because it cannot handle the error token.  */
2043       if (yyssp == yyss)
2044         YYABORT;
2045
2046
2047       yydestruct ("Error: popping",
2048                   YY_ACCESSING_SYMBOL (yystate), yyvsp);
2049       YYPOPSTACK (1);
2050       yystate = *yyssp;
2051       YY_STACK_PRINT (yyss, yyssp);
2052     }
2053
2054   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2055   *++yyvsp = yylval;
2056   YY_IGNORE_MAYBE_UNINITIALIZED_END
2057
2058
2059   /* Shift the error token.  */
2060   YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
2061
2062   yystate = yyn;
2063   goto yynewstate;
2064
2065
2066 /*-------------------------------------.
2067 | yyacceptlab -- YYACCEPT comes here.  |
2068 `-------------------------------------*/
2069 yyacceptlab:
2070   yyresult = 0;
2071   goto yyreturnlab;
2072
2073
2074 /*-----------------------------------.
2075 | yyabortlab -- YYABORT comes here.  |
2076 `-----------------------------------*/
2077 yyabortlab:
2078   yyresult = 1;
2079   goto yyreturnlab;
2080
2081
2082 /*-----------------------------------------------------------.
2083 | yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here.  |
2084 `-----------------------------------------------------------*/
2085 yyexhaustedlab:
2086   yyerror (YY_("memory exhausted"));
2087   yyresult = 2;
2088   goto yyreturnlab;
2089
2090
2091 /*----------------------------------------------------------.
2092 | yyreturnlab -- parsing is finished, clean up and return.  |
2093 `----------------------------------------------------------*/
2094 yyreturnlab:
2095   if (yychar != YYEMPTY)
2096     {
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",
2101                   yytoken, &yylval);
2102     }
2103   /* Do not reclaim the symbols of the rule whose action triggered
2104      this YYABORT or YYACCEPT.  */
2105   YYPOPSTACK (yylen);
2106   YY_STACK_PRINT (yyss, yyssp);
2107   while (yyssp != yyss)
2108     {
2109       yydestruct ("Cleanup: popping",
2110                   YY_ACCESSING_SYMBOL (+*yyssp), yyvsp);
2111       YYPOPSTACK (1);
2112     }
2113 #ifndef yyoverflow
2114   if (yyss != yyssa)
2115     YYSTACK_FREE (yyss);
2116 #endif
2117
2118   return yyresult;
2119 }
2120
2121 #line 210 "gram.y"
2122
2123
2124 void
2125 yyerror (msg)
2126      char *msg;
2127 {
2128   fprintf (stderr, "%s:%d: %s\n", yyin_name, linenum, msg);
2129 }