2 /* A Bison parser, made by GNU Bison 2.4.1. */
4 /* Skeleton implementation for Bison's Yacc-like parsers in C
6 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
7 Free Software Foundation, Inc.
9 This program is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
22 /* As a special exception, you may create a larger work that contains
23 part or all of the Bison parser skeleton and distribute that work
24 under terms of your choice, so long as that work isn't itself a
25 parser generator using the skeleton or a modified version thereof
26 as a parser skeleton. Alternatively, if you modify or redistribute
27 the parser skeleton itself, you may (at your option) remove this
28 special exception, which will cause the skeleton and the resulting
29 Bison output files to be licensed under the GNU General Public
30 License without this special exception.
32 This special exception was added by the Free Software Foundation in
33 version 2.2 of Bison. */
35 /* C LALR(1) parser skeleton written by Richard Stallman, by
36 simplifying the original so-called "semantic" parser. */
38 /* All symbols defined below should begin with yy or YY, to avoid
39 infringing on user name space. This should be done even for local
40 variables, as they might otherwise be expanded by user macros.
41 There are some unavoidable exceptions within include files to
42 define necessary library symbols; they are noted "INFRINGES ON
43 USER NAME SPACE" below. */
45 /* Identify Bison output. */
49 #define YYBISON_VERSION "2.4.1"
52 #define YYSKELETON_NAME "yacc.c"
63 /* Using locations. */
64 #define YYLSP_NEEDED 0
68 /* Copy the first part of user declarations. */
70 /* Line 189 of yacc.c */
74 * Copyright (c) 1998 - 2000 Kungliga Tekniska Högskolan
75 * (Royal Institute of Technology, Stockholm, Sweden).
76 * All rights reserved.
78 * Redistribution and use in source and binary forms, with or without
79 * modification, are permitted provided that the following conditions
82 * 1. Redistributions of source code must retain the above copyright
83 * notice, this list of conditions and the following disclaimer.
85 * 2. Redistributions in binary form must reproduce the above copyright
86 * notice, this list of conditions and the following disclaimer in the
87 * documentation and/or other materials provided with the distribution.
89 * 3. Neither the name of the Institute nor the names of its contributors
90 * may be used to endorse or promote products derived from this software
91 * without specific prior written permission.
93 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
94 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
95 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
96 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
97 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
98 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
99 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
100 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
101 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
102 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
106 #include "compile_et.h"
109 void yyerror (char *s);
110 static long name2number(const char *str);
114 /* This is for bison */
116 #if !defined(alloca) && !defined(HAVE_ALLOCA)
117 #define alloca(x) malloc(x)
120 #define YYMALLOC malloc
125 /* Line 189 of yacc.c */
128 /* Enabling traces. */
133 /* Enabling verbose error messages. */
134 #ifdef YYERROR_VERBOSE
135 # undef YYERROR_VERBOSE
136 # define YYERROR_VERBOSE 1
138 # define YYERROR_VERBOSE 0
141 /* Enabling the token table. */
142 #ifndef YYTOKEN_TABLE
143 # define YYTOKEN_TABLE 0
150 /* Put the tokens into the symbol table, so that GDB and other debuggers
176 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
177 typedef union YYSTYPE
180 /* Line 214 of yacc.c */
188 /* Line 214 of yacc.c */
191 # define YYSTYPE_IS_TRIVIAL 1
192 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
193 # define YYSTYPE_IS_DECLARED 1
197 /* Copy the second part of user declarations. */
200 /* Line 264 of yacc.c */
208 typedef YYTYPE_UINT8 yytype_uint8;
210 typedef unsigned char yytype_uint8;
214 typedef YYTYPE_INT8 yytype_int8;
215 #elif (defined __STDC__ || defined __C99__FUNC__ \
216 || defined __cplusplus || defined _MSC_VER)
217 typedef signed char yytype_int8;
219 typedef short int yytype_int8;
223 typedef YYTYPE_UINT16 yytype_uint16;
225 typedef unsigned short int yytype_uint16;
229 typedef YYTYPE_INT16 yytype_int16;
231 typedef short int yytype_int16;
235 # ifdef __SIZE_TYPE__
236 # define YYSIZE_T __SIZE_TYPE__
237 # elif defined size_t
238 # define YYSIZE_T size_t
239 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
240 || defined __cplusplus || defined _MSC_VER)
241 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
242 # define YYSIZE_T size_t
244 # define YYSIZE_T unsigned int
248 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
253 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
254 # define YY_(msgid) dgettext ("bison-runtime", msgid)
258 # define YY_(msgid) msgid
262 /* Suppress unused-variable warnings by "using" E. */
263 #if ! defined lint || defined __GNUC__
264 # define YYUSE(e) ((void) (e))
266 # define YYUSE(e) /* empty */
269 /* Identity function, used to suppress warnings about constant conditions. */
273 #if (defined __STDC__ || defined __C99__FUNC__ \
274 || defined __cplusplus || defined _MSC_VER)
287 #if ! defined yyoverflow || YYERROR_VERBOSE
289 /* The parser invokes alloca or malloc; define the necessary symbols. */
291 # ifdef YYSTACK_USE_ALLOCA
292 # if YYSTACK_USE_ALLOCA
294 # define YYSTACK_ALLOC __builtin_alloca
295 # elif defined __BUILTIN_VA_ARG_INCR
296 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
298 # define YYSTACK_ALLOC __alloca
299 # elif defined _MSC_VER
300 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
301 # define alloca _alloca
303 # define YYSTACK_ALLOC alloca
304 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
305 || defined __cplusplus || defined _MSC_VER)
306 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
315 # ifdef YYSTACK_ALLOC
316 /* Pacify GCC's `empty if-body' warning. */
317 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
318 # ifndef YYSTACK_ALLOC_MAXIMUM
319 /* The OS might guarantee only one guard page at the bottom of the stack,
320 and a page size can be as small as 4096 bytes. So we cannot safely
321 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
322 to allow for a few compiler-allocated temporary stack slots. */
323 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
326 # define YYSTACK_ALLOC YYMALLOC
327 # define YYSTACK_FREE YYFREE
328 # ifndef YYSTACK_ALLOC_MAXIMUM
329 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
331 # if (defined __cplusplus && ! defined _STDLIB_H \
332 && ! ((defined YYMALLOC || defined malloc) \
333 && (defined YYFREE || defined free)))
334 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
340 # define YYMALLOC malloc
341 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
342 || defined __cplusplus || defined _MSC_VER)
343 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
348 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
349 || defined __cplusplus || defined _MSC_VER)
350 void free (void *); /* INFRINGES ON USER NAME SPACE */
354 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
357 #if (! defined yyoverflow \
358 && (! defined __cplusplus \
359 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
361 /* A type that is properly aligned for any stack member. */
364 yytype_int16 yyss_alloc;
368 /* The size of the maximum gap between one aligned stack and the next. */
369 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
371 /* The size of an array large to enough to hold all stacks, each with
373 # define YYSTACK_BYTES(N) \
374 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
375 + YYSTACK_GAP_MAXIMUM)
377 /* Copy COUNT objects from FROM to TO. The source and destination do
380 # if defined __GNUC__ && 1 < __GNUC__
381 # define YYCOPY(To, From, Count) \
382 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
384 # define YYCOPY(To, From, Count) \
388 for (yyi = 0; yyi < (Count); yyi++) \
389 (To)[yyi] = (From)[yyi]; \
395 /* Relocate STACK from its old location to the new one. The
396 local variables YYSIZE and YYSTACKSIZE give the old and new number of
397 elements in the stack, and YYPTR gives the new location of the
398 stack. Advance YYPTR to a properly aligned location for the next
400 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
403 YYSIZE_T yynewbytes; \
404 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
405 Stack = &yyptr->Stack_alloc; \
406 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
407 yyptr += yynewbytes / sizeof (*yyptr); \
413 /* YYFINAL -- State number of the termination state. */
415 /* YYLAST -- Last index in YYTABLE. */
418 /* YYNTOKENS -- Number of terminals. */
420 /* YYNNTS -- Number of nonterminals. */
422 /* YYNRULES -- Number of rules. */
424 /* YYNRULES -- Number of states. */
427 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
429 #define YYMAXUTOK 265
431 #define YYTRANSLATE(YYX) \
432 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
434 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
435 static const yytype_uint8 yytranslate[] =
437 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
438 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
439 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
440 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
441 2, 2, 2, 2, 11, 2, 2, 2, 2, 2,
442 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
443 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
444 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
445 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
446 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
447 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
448 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
449 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
450 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
451 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
452 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
453 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
454 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
455 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
456 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
457 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
458 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
459 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
460 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
461 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
462 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
467 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
469 static const yytype_uint8 yyprhs[] =
471 0, 0, 3, 4, 7, 10, 12, 15, 18, 22,
472 24, 27, 30, 33, 35, 40
475 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
476 static const yytype_int8 yyrhs[] =
478 13, 0, -1, -1, 14, 17, -1, 15, 16, -1,
479 16, -1, 7, 9, -1, 3, 9, -1, 3, 9,
480 9, -1, 18, -1, 17, 18, -1, 4, 10, -1,
481 5, 9, -1, 5, -1, 6, 9, 11, 9, -1,
485 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
486 static const yytype_uint8 yyrline[] =
488 0, 65, 65, 66, 69, 70, 73, 79, 85, 94,
489 95, 98, 102, 110, 117, 137
493 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
494 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
495 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
496 static const char *const yytname[] =
498 "$end", "error", "$undefined", "ET", "INDEX", "PREFIX", "EC", "ID",
499 "END", "STRING", "NUMBER", "','", "$accept", "file", "header", "id",
500 "et", "statements", "statement", 0
505 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
507 static const yytype_uint16 yytoknum[] =
509 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
514 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
515 static const yytype_uint8 yyr1[] =
517 0, 12, 13, 13, 14, 14, 15, 16, 16, 17,
518 17, 18, 18, 18, 18, 18
521 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
522 static const yytype_uint8 yyr2[] =
524 0, 2, 0, 2, 2, 1, 2, 2, 3, 1,
528 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
529 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
530 means the default is an error. */
531 static const yytype_uint8 yydefact[] =
533 2, 0, 0, 0, 0, 0, 5, 7, 6, 1,
534 0, 13, 0, 15, 3, 9, 4, 8, 11, 12,
538 /* YYDEFGOTO[NTERM-NUM]. */
539 static const yytype_int8 yydefgoto[] =
541 -1, 3, 4, 5, 6, 14, 15
544 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
546 #define YYPACT_NINF -5
547 static const yytype_int8 yypact[] =
549 0, -3, -1, 5, -4, 6, -5, 1, -5, -5,
550 2, 4, 7, -5, -4, -5, -5, -5, -5, -5,
554 /* YYPGOTO[NTERM-NUM]. */
555 static const yytype_int8 yypgoto[] =
557 -5, -5, -5, -5, 10, -5, 9
560 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
561 positive, shift that token. If negative, reduce the rule which
562 number is the opposite. If zero, do what YYDEFACT says.
563 If YYTABLE_NINF, syntax error. */
564 #define YYTABLE_NINF -1
565 static const yytype_uint8 yytable[] =
567 10, 11, 12, 1, 13, 9, 7, 2, 8, 1,
568 17, 0, 18, 19, 22, 16, 20, 23, 0, 0,
572 static const yytype_int8 yycheck[] =
574 4, 5, 6, 3, 8, 0, 9, 7, 9, 3,
575 9, -1, 10, 9, 11, 5, 9, 9, -1, -1,
579 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
580 symbol of state STATE-NUM. */
581 static const yytype_uint8 yystos[] =
583 0, 3, 7, 13, 14, 15, 16, 9, 9, 0,
584 4, 5, 6, 8, 17, 18, 16, 9, 10, 9,
588 #define yyerrok (yyerrstatus = 0)
589 #define yyclearin (yychar = YYEMPTY)
593 #define YYACCEPT goto yyacceptlab
594 #define YYABORT goto yyabortlab
595 #define YYERROR goto yyerrorlab
598 /* Like YYERROR except do call yyerror. This remains here temporarily
599 to ease the transition to the new meaning of YYERROR, for GCC.
600 Once GCC version 2 has supplanted version 1, this can go. */
602 #define YYFAIL goto yyerrlab
604 #define YYRECOVERING() (!!yyerrstatus)
606 #define YYBACKUP(Token, Value) \
608 if (yychar == YYEMPTY && yylen == 1) \
612 yytoken = YYTRANSLATE (yychar); \
618 yyerror (YY_("syntax error: cannot back up")); \
625 #define YYERRCODE 256
628 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
629 If N is 0, then set CURRENT to the empty location which ends
630 the previous symbol: RHS[0] (always defined). */
632 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
633 #ifndef YYLLOC_DEFAULT
634 # define YYLLOC_DEFAULT(Current, Rhs, N) \
638 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
639 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
640 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
641 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
645 (Current).first_line = (Current).last_line = \
646 YYRHSLOC (Rhs, 0).last_line; \
647 (Current).first_column = (Current).last_column = \
648 YYRHSLOC (Rhs, 0).last_column; \
654 /* YY_LOCATION_PRINT -- Print the location on the stream.
655 This macro was not mandated originally: define only if we know
656 we won't break user code: when these are the locations we know. */
658 #ifndef YY_LOCATION_PRINT
659 # if YYLTYPE_IS_TRIVIAL
660 # define YY_LOCATION_PRINT(File, Loc) \
661 fprintf (File, "%d.%d-%d.%d", \
662 (Loc).first_line, (Loc).first_column, \
663 (Loc).last_line, (Loc).last_column)
665 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
670 /* YYLEX -- calling `yylex' with the right arguments. */
673 # define YYLEX yylex (YYLEX_PARAM)
675 # define YYLEX yylex ()
678 /* Enable debugging if requested. */
682 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
683 # define YYFPRINTF fprintf
686 # define YYDPRINTF(Args) \
692 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
696 YYFPRINTF (stderr, "%s ", Title); \
697 yy_symbol_print (stderr, \
699 YYFPRINTF (stderr, "\n"); \
704 /*--------------------------------.
705 | Print this symbol on YYOUTPUT. |
706 `--------------------------------*/
709 #if (defined __STDC__ || defined __C99__FUNC__ \
710 || defined __cplusplus || defined _MSC_VER)
712 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
715 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
718 YYSTYPE const * const yyvaluep;
724 if (yytype < YYNTOKENS)
725 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
737 /*--------------------------------.
738 | Print this symbol on YYOUTPUT. |
739 `--------------------------------*/
741 #if (defined __STDC__ || defined __C99__FUNC__ \
742 || defined __cplusplus || defined _MSC_VER)
744 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
747 yy_symbol_print (yyoutput, yytype, yyvaluep)
750 YYSTYPE const * const yyvaluep;
753 if (yytype < YYNTOKENS)
754 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
756 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
758 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
759 YYFPRINTF (yyoutput, ")");
762 /*------------------------------------------------------------------.
763 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
765 `------------------------------------------------------------------*/
767 #if (defined __STDC__ || defined __C99__FUNC__ \
768 || defined __cplusplus || defined _MSC_VER)
770 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
773 yy_stack_print (yybottom, yytop)
774 yytype_int16 *yybottom;
778 YYFPRINTF (stderr, "Stack now");
779 for (; yybottom <= yytop; yybottom++)
781 int yybot = *yybottom;
782 YYFPRINTF (stderr, " %d", yybot);
784 YYFPRINTF (stderr, "\n");
787 # define YY_STACK_PRINT(Bottom, Top) \
790 yy_stack_print ((Bottom), (Top)); \
794 /*------------------------------------------------.
795 | Report that the YYRULE is going to be reduced. |
796 `------------------------------------------------*/
798 #if (defined __STDC__ || defined __C99__FUNC__ \
799 || defined __cplusplus || defined _MSC_VER)
801 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
804 yy_reduce_print (yyvsp, yyrule)
809 int yynrhs = yyr2[yyrule];
811 unsigned long int yylno = yyrline[yyrule];
812 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
814 /* The symbols being reduced. */
815 for (yyi = 0; yyi < yynrhs; yyi++)
817 YYFPRINTF (stderr, " $%d = ", yyi + 1);
818 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
819 &(yyvsp[(yyi + 1) - (yynrhs)])
821 YYFPRINTF (stderr, "\n");
825 # define YY_REDUCE_PRINT(Rule) \
828 yy_reduce_print (yyvsp, Rule); \
831 /* Nonzero means print parse trace. It is left uninitialized so that
832 multiple parsers can coexist. */
835 # define YYDPRINTF(Args)
836 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
837 # define YY_STACK_PRINT(Bottom, Top)
838 # define YY_REDUCE_PRINT(Rule)
839 #endif /* !YYDEBUG */
842 /* YYINITDEPTH -- initial size of the parser's stacks. */
844 # define YYINITDEPTH 200
847 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
848 if the built-in stack extension method is used).
850 Do not make this value too large; the results are undefined if
851 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
852 evaluated with infinite-precision integer arithmetic. */
855 # define YYMAXDEPTH 10000
863 # if defined __GLIBC__ && defined _STRING_H
864 # define yystrlen strlen
866 /* Return the length of YYSTR. */
867 #if (defined __STDC__ || defined __C99__FUNC__ \
868 || defined __cplusplus || defined _MSC_VER)
870 yystrlen (const char *yystr)
878 for (yylen = 0; yystr[yylen]; yylen++)
886 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
887 # define yystpcpy stpcpy
889 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
891 #if (defined __STDC__ || defined __C99__FUNC__ \
892 || defined __cplusplus || defined _MSC_VER)
894 yystpcpy (char *yydest, const char *yysrc)
897 yystpcpy (yydest, yysrc)
903 const char *yys = yysrc;
905 while ((*yyd++ = *yys++) != '\0')
914 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
915 quotes and backslashes, so that it's suitable for yyerror. The
916 heuristic is that double-quoting is unnecessary unless the string
917 contains an apostrophe, a comma, or backslash (other than
918 backslash-backslash). YYSTR is taken from yytname. If YYRES is
919 null, do not copy; instead, return the length of what the result
922 yytnamerr (char *yyres, const char *yystr)
927 char const *yyp = yystr;
934 goto do_not_strip_quotes;
938 goto do_not_strip_quotes;
951 do_not_strip_quotes: ;
955 return yystrlen (yystr);
957 return yystpcpy (yyres, yystr) - yyres;
961 /* Copy into YYRESULT an error message about the unexpected token
962 YYCHAR while in state YYSTATE. Return the number of bytes copied,
963 including the terminating null byte. If YYRESULT is null, do not
964 copy anything; just return the number of bytes that would be
965 copied. As a special case, return 0 if an ordinary "syntax error"
966 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
969 yysyntax_error (char *yyresult, int yystate, int yychar)
971 int yyn = yypact[yystate];
973 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
977 int yytype = YYTRANSLATE (yychar);
978 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
979 YYSIZE_T yysize = yysize0;
981 int yysize_overflow = 0;
982 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
983 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
987 /* This is so xgettext sees the translatable formats that are
988 constructed on the fly. */
989 YY_("syntax error, unexpected %s");
990 YY_("syntax error, unexpected %s, expecting %s");
991 YY_("syntax error, unexpected %s, expecting %s or %s");
992 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
993 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
997 static char const yyunexpected[] = "syntax error, unexpected %s";
998 static char const yyexpecting[] = ", expecting %s";
999 static char const yyor[] = " or %s";
1000 char yyformat[sizeof yyunexpected
1001 + sizeof yyexpecting - 1
1002 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1003 * (sizeof yyor - 1))];
1004 char const *yyprefix = yyexpecting;
1006 /* Start YYX at -YYN if negative to avoid negative indexes in
1008 int yyxbegin = yyn < 0 ? -yyn : 0;
1010 /* Stay within bounds of both yycheck and yytname. */
1011 int yychecklim = YYLAST - yyn + 1;
1012 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1015 yyarg[0] = yytname[yytype];
1016 yyfmt = yystpcpy (yyformat, yyunexpected);
1018 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1019 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1021 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1025 yyformat[sizeof yyunexpected - 1] = '\0';
1028 yyarg[yycount++] = yytname[yyx];
1029 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1030 yysize_overflow |= (yysize1 < yysize);
1032 yyfmt = yystpcpy (yyfmt, yyprefix);
1036 yyf = YY_(yyformat);
1037 yysize1 = yysize + yystrlen (yyf);
1038 yysize_overflow |= (yysize1 < yysize);
1041 if (yysize_overflow)
1042 return YYSIZE_MAXIMUM;
1046 /* Avoid sprintf, as that infringes on the user's name space.
1047 Don't have undefined behavior even if the translation
1048 produced a string with the wrong number of "%s"s. */
1049 char *yyp = yyresult;
1051 while ((*yyp = *yyf) != '\0')
1053 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1055 yyp += yytnamerr (yyp, yyarg[yyi++]);
1068 #endif /* YYERROR_VERBOSE */
1071 /*-----------------------------------------------.
1072 | Release the memory associated to this symbol. |
1073 `-----------------------------------------------*/
1076 #if (defined __STDC__ || defined __C99__FUNC__ \
1077 || defined __cplusplus || defined _MSC_VER)
1079 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1082 yydestruct (yymsg, yytype, yyvaluep)
1092 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1102 /* Prevent warnings from -Wmissing-prototypes. */
1103 #ifdef YYPARSE_PARAM
1104 #if defined __STDC__ || defined __cplusplus
1105 int yyparse (void *YYPARSE_PARAM);
1109 #else /* ! YYPARSE_PARAM */
1110 #if defined __STDC__ || defined __cplusplus
1115 #endif /* ! YYPARSE_PARAM */
1118 /* The lookahead symbol. */
1121 /* The semantic value of the lookahead symbol. */
1124 /* Number of syntax errors so far. */
1129 /*-------------------------.
1130 | yyparse or yypush_parse. |
1131 `-------------------------*/
1133 #ifdef YYPARSE_PARAM
1134 #if (defined __STDC__ || defined __C99__FUNC__ \
1135 || defined __cplusplus || defined _MSC_VER)
1137 yyparse (void *YYPARSE_PARAM)
1140 yyparse (YYPARSE_PARAM)
1141 void *YYPARSE_PARAM;
1143 #else /* ! YYPARSE_PARAM */
1144 #if (defined __STDC__ || defined __C99__FUNC__ \
1145 || defined __cplusplus || defined _MSC_VER)
1158 /* Number of tokens to shift before error messages enabled. */
1161 /* The stacks and their tools:
1162 `yyss': related to states.
1163 `yyvs': related to semantic values.
1165 Refer to the stacks thru separate pointers, to allow yyoverflow
1166 to reallocate them elsewhere. */
1168 /* The state stack. */
1169 yytype_int16 yyssa[YYINITDEPTH];
1171 yytype_int16 *yyssp;
1173 /* The semantic value stack. */
1174 YYSTYPE yyvsa[YYINITDEPTH];
1178 YYSIZE_T yystacksize;
1182 /* Lookahead token as an internal (translated) token number. */
1184 /* The variables used to return semantic value and location from the
1189 /* Buffer for error messages, and its allocated size. */
1191 char *yymsg = yymsgbuf;
1192 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1195 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1197 /* The number of symbols on the RHS of the reduced rule.
1198 Keep to zero when no symbol should be popped. */
1204 yystacksize = YYINITDEPTH;
1206 YYDPRINTF ((stderr, "Starting parse\n"));
1211 yychar = YYEMPTY; /* Cause a token to be read. */
1213 /* Initialize stack pointers.
1214 Waste one element of value and location stack
1215 so that they stay on the same level as the state stack.
1216 The wasted elements are never initialized. */
1222 /*------------------------------------------------------------.
1223 | yynewstate -- Push a new state, which is found in yystate. |
1224 `------------------------------------------------------------*/
1226 /* In all cases, when you get here, the value and location stacks
1227 have just been pushed. So pushing a state here evens the stacks. */
1233 if (yyss + yystacksize - 1 <= yyssp)
1235 /* Get the current used size of the three stacks, in elements. */
1236 YYSIZE_T yysize = yyssp - yyss + 1;
1240 /* Give user a chance to reallocate the stack. Use copies of
1241 these so that the &'s don't force the real ones into
1243 YYSTYPE *yyvs1 = yyvs;
1244 yytype_int16 *yyss1 = yyss;
1246 /* Each stack pointer address is followed by the size of the
1247 data in use in that stack, in bytes. This used to be a
1248 conditional around just the two extra args, but that might
1249 be undefined if yyoverflow is a macro. */
1250 yyoverflow (YY_("memory exhausted"),
1251 &yyss1, yysize * sizeof (*yyssp),
1252 &yyvs1, yysize * sizeof (*yyvsp),
1258 #else /* no yyoverflow */
1259 # ifndef YYSTACK_RELOCATE
1260 goto yyexhaustedlab;
1262 /* Extend the stack our own way. */
1263 if (YYMAXDEPTH <= yystacksize)
1264 goto yyexhaustedlab;
1266 if (YYMAXDEPTH < yystacksize)
1267 yystacksize = YYMAXDEPTH;
1270 yytype_int16 *yyss1 = yyss;
1271 union yyalloc *yyptr =
1272 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1274 goto yyexhaustedlab;
1275 YYSTACK_RELOCATE (yyss_alloc, yyss);
1276 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1277 # undef YYSTACK_RELOCATE
1279 YYSTACK_FREE (yyss1);
1282 #endif /* no yyoverflow */
1284 yyssp = yyss + yysize - 1;
1285 yyvsp = yyvs + yysize - 1;
1287 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1288 (unsigned long int) yystacksize));
1290 if (yyss + yystacksize - 1 <= yyssp)
1294 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1296 if (yystate == YYFINAL)
1306 /* Do appropriate processing given the current state. Read a
1307 lookahead token if we need one and don't already have one. */
1309 /* First try to decide what to do without reference to lookahead token. */
1310 yyn = yypact[yystate];
1311 if (yyn == YYPACT_NINF)
1314 /* Not known => get a lookahead token if don't already have one. */
1316 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1317 if (yychar == YYEMPTY)
1319 YYDPRINTF ((stderr, "Reading a token: "));
1323 if (yychar <= YYEOF)
1325 yychar = yytoken = YYEOF;
1326 YYDPRINTF ((stderr, "Now at end of input.\n"));
1330 yytoken = YYTRANSLATE (yychar);
1331 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1334 /* If the proper action on seeing token YYTOKEN is to reduce or to
1335 detect an error, take that action. */
1337 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1342 if (yyn == 0 || yyn == YYTABLE_NINF)
1348 /* Count tokens shifted since error; after three, turn off error
1353 /* Shift the lookahead token. */
1354 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1356 /* Discard the shifted token. */
1365 /*-----------------------------------------------------------.
1366 | yydefault -- do the default action for the current state. |
1367 `-----------------------------------------------------------*/
1369 yyn = yydefact[yystate];
1375 /*-----------------------------.
1376 | yyreduce -- Do a reduction. |
1377 `-----------------------------*/
1379 /* yyn is the number of a rule to reduce with. */
1382 /* If YYLEN is nonzero, implement the default value of the action:
1385 Otherwise, the following line sets YYVAL to garbage.
1386 This behavior is undocumented and Bison
1387 users should not rely upon it. Assigning to YYVAL
1388 unconditionally makes the parser a bit smaller, and it avoids a
1389 GCC warning that YYVAL may be used uninitialized. */
1390 yyval = yyvsp[1-yylen];
1393 YY_REDUCE_PRINT (yyn);
1398 /* Line 1455 of yacc.c */
1401 id_str = (yyvsp[(2) - (2)].string);
1407 /* Line 1455 of yacc.c */
1410 base_id = name2number((yyvsp[(2) - (2)].string));
1411 strlcpy(name, (yyvsp[(2) - (2)].string), sizeof(name));
1412 free((yyvsp[(2) - (2)].string));
1418 /* Line 1455 of yacc.c */
1421 base_id = name2number((yyvsp[(2) - (3)].string));
1422 strlcpy(name, (yyvsp[(3) - (3)].string), sizeof(name));
1423 free((yyvsp[(2) - (3)].string));
1424 free((yyvsp[(3) - (3)].string));
1430 /* Line 1455 of yacc.c */
1433 number = (yyvsp[(2) - (2)].number);
1439 /* Line 1455 of yacc.c */
1443 asprintf (&prefix, "%s_", (yyvsp[(2) - (2)].string));
1446 free((yyvsp[(2) - (2)].string));
1452 /* Line 1455 of yacc.c */
1455 prefix = realloc(prefix, 1);
1464 /* Line 1455 of yacc.c */
1467 struct error_code *ec = malloc(sizeof(*ec));
1473 ec->number = number;
1474 if(prefix && *prefix != '\0') {
1475 asprintf (&ec->name, "%s%s", prefix, (yyvsp[(2) - (4)].string));
1476 if (ec->name == NULL)
1478 free((yyvsp[(2) - (4)].string));
1480 ec->name = (yyvsp[(2) - (4)].string);
1481 ec->string = (yyvsp[(4) - (4)].string);
1489 /* Line 1455 of yacc.c */
1498 /* Line 1455 of yacc.c */
1499 #line 1500 "parse.c"
1502 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1506 YY_STACK_PRINT (yyss, yyssp);
1510 /* Now `shift' the result of the reduction. Determine what state
1511 that goes to, based on the state we popped back to and the rule
1512 number reduced by. */
1516 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1517 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1518 yystate = yytable[yystate];
1520 yystate = yydefgoto[yyn - YYNTOKENS];
1525 /*------------------------------------.
1526 | yyerrlab -- here on detecting error |
1527 `------------------------------------*/
1529 /* If not already recovering from an error, report this error. */
1533 #if ! YYERROR_VERBOSE
1534 yyerror (YY_("syntax error"));
1537 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1538 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1540 YYSIZE_T yyalloc = 2 * yysize;
1541 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
1542 yyalloc = YYSTACK_ALLOC_MAXIMUM;
1543 if (yymsg != yymsgbuf)
1544 YYSTACK_FREE (yymsg);
1545 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
1547 yymsg_alloc = yyalloc;
1551 yymsg_alloc = sizeof yymsgbuf;
1555 if (0 < yysize && yysize <= yymsg_alloc)
1557 (void) yysyntax_error (yymsg, yystate, yychar);
1562 yyerror (YY_("syntax error"));
1564 goto yyexhaustedlab;
1572 if (yyerrstatus == 3)
1574 /* If just tried and failed to reuse lookahead token after an
1575 error, discard it. */
1577 if (yychar <= YYEOF)
1579 /* Return failure if at end of input. */
1580 if (yychar == YYEOF)
1585 yydestruct ("Error: discarding",
1591 /* Else will try to reuse lookahead token after shifting the error
1596 /*---------------------------------------------------.
1597 | yyerrorlab -- error raised explicitly by YYERROR. |
1598 `---------------------------------------------------*/
1601 /* Pacify compilers like GCC when the user code never invokes
1602 YYERROR and the label yyerrorlab therefore never appears in user
1604 if (/*CONSTCOND*/ 0)
1607 /* Do not reclaim the symbols of the rule which action triggered
1611 YY_STACK_PRINT (yyss, yyssp);
1616 /*-------------------------------------------------------------.
1617 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1618 `-------------------------------------------------------------*/
1620 yyerrstatus = 3; /* Each real token shifted decrements this. */
1624 yyn = yypact[yystate];
1625 if (yyn != YYPACT_NINF)
1628 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1636 /* Pop the current state because it cannot handle the error token. */
1641 yydestruct ("Error: popping",
1642 yystos[yystate], yyvsp);
1645 YY_STACK_PRINT (yyss, yyssp);
1651 /* Shift the error token. */
1652 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1658 /*-------------------------------------.
1659 | yyacceptlab -- YYACCEPT comes here. |
1660 `-------------------------------------*/
1665 /*-----------------------------------.
1666 | yyabortlab -- YYABORT comes here. |
1667 `-----------------------------------*/
1672 #if !defined(yyoverflow) || YYERROR_VERBOSE
1673 /*-------------------------------------------------.
1674 | yyexhaustedlab -- memory exhaustion comes here. |
1675 `-------------------------------------------------*/
1677 yyerror (YY_("memory exhausted"));
1683 if (yychar != YYEMPTY)
1684 yydestruct ("Cleanup: discarding lookahead",
1686 /* Do not reclaim the symbols of the rule which action triggered
1687 this YYABORT or YYACCEPT. */
1689 YY_STACK_PRINT (yyss, yyssp);
1690 while (yyssp != yyss)
1692 yydestruct ("Cleanup: popping",
1693 yystos[*yyssp], yyvsp);
1698 YYSTACK_FREE (yyss);
1701 if (yymsg != yymsgbuf)
1702 YYSTACK_FREE (yymsg);
1704 /* Make sure YYID is used. */
1705 return YYID (yyresult);
1710 /* Line 1675 of yacc.c */
1715 name2number(const char *str)
1719 const char *x = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
1720 "abcdefghijklmnopqrstuvwxyz0123456789_";
1721 if(strlen(str) > 4) {
1722 yyerror("table name too long");
1725 for(p = str; *p; p++){
1726 char *q = strchr(x, *p);
1728 yyerror("invalid character in table name");
1731 num = (num << 6) + (q - x) + 1;
1734 if(num > 0x7fffffff)
1735 num = -(0xffffffff - num + 1);
1742 _lex_error_message ("%s\n", s);