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 */
71 #line 1 "heimdal/lib/com_err/parse.y"
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)
122 /* Line 189 of yacc.c */
123 #line 124 "heimdal/lib/com_err/parse.y"
125 /* Enabling traces. */
130 /* Enabling verbose error messages. */
131 #ifdef YYERROR_VERBOSE
132 # undef YYERROR_VERBOSE
133 # define YYERROR_VERBOSE 1
135 # define YYERROR_VERBOSE 0
138 /* Enabling the token table. */
139 #ifndef YYTOKEN_TABLE
140 # define YYTOKEN_TABLE 0
147 /* Put the tokens into the symbol table, so that GDB and other debuggers
173 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
174 typedef union YYSTYPE
177 /* Line 214 of yacc.c */
178 #line 51 "heimdal/lib/com_err/parse.y"
185 /* Line 214 of yacc.c */
186 #line 187 "heimdal/lib/com_err/parse.y"
188 # define YYSTYPE_IS_TRIVIAL 1
189 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
190 # define YYSTYPE_IS_DECLARED 1
194 /* Copy the second part of user declarations. */
197 /* Line 264 of yacc.c */
198 #line 199 "heimdal/lib/com_err/parse.y"
205 typedef YYTYPE_UINT8 yytype_uint8;
207 typedef unsigned char yytype_uint8;
211 typedef YYTYPE_INT8 yytype_int8;
212 #elif (defined __STDC__ || defined __C99__FUNC__ \
213 || defined __cplusplus || defined _MSC_VER)
214 typedef signed char yytype_int8;
216 typedef short int yytype_int8;
220 typedef YYTYPE_UINT16 yytype_uint16;
222 typedef unsigned short int yytype_uint16;
226 typedef YYTYPE_INT16 yytype_int16;
228 typedef short int yytype_int16;
232 # ifdef __SIZE_TYPE__
233 # define YYSIZE_T __SIZE_TYPE__
234 # elif defined size_t
235 # define YYSIZE_T size_t
236 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
237 || defined __cplusplus || defined _MSC_VER)
238 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
239 # define YYSIZE_T size_t
241 # define YYSIZE_T unsigned int
245 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
250 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
251 # define YY_(msgid) dgettext ("bison-runtime", msgid)
255 # define YY_(msgid) msgid
259 /* Suppress unused-variable warnings by "using" E. */
260 #if ! defined lint || defined __GNUC__
261 # define YYUSE(e) ((void) (e))
263 # define YYUSE(e) /* empty */
266 /* Identity function, used to suppress warnings about constant conditions. */
270 #if (defined __STDC__ || defined __C99__FUNC__ \
271 || defined __cplusplus || defined _MSC_VER)
284 #if ! defined yyoverflow || YYERROR_VERBOSE
286 /* The parser invokes alloca or malloc; define the necessary symbols. */
288 # ifdef YYSTACK_USE_ALLOCA
289 # if YYSTACK_USE_ALLOCA
291 # define YYSTACK_ALLOC __builtin_alloca
292 # elif defined __BUILTIN_VA_ARG_INCR
293 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
295 # define YYSTACK_ALLOC __alloca
296 # elif defined _MSC_VER
297 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
298 # define alloca _alloca
300 # define YYSTACK_ALLOC alloca
301 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
302 || defined __cplusplus || defined _MSC_VER)
303 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
312 # ifdef YYSTACK_ALLOC
313 /* Pacify GCC's `empty if-body' warning. */
314 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
315 # ifndef YYSTACK_ALLOC_MAXIMUM
316 /* The OS might guarantee only one guard page at the bottom of the stack,
317 and a page size can be as small as 4096 bytes. So we cannot safely
318 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
319 to allow for a few compiler-allocated temporary stack slots. */
320 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
323 # define YYSTACK_ALLOC YYMALLOC
324 # define YYSTACK_FREE YYFREE
325 # ifndef YYSTACK_ALLOC_MAXIMUM
326 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
328 # if (defined __cplusplus && ! defined _STDLIB_H \
329 && ! ((defined YYMALLOC || defined malloc) \
330 && (defined YYFREE || defined free)))
331 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
337 # define YYMALLOC malloc
338 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
339 || defined __cplusplus || defined _MSC_VER)
340 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
345 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
346 || defined __cplusplus || defined _MSC_VER)
347 void free (void *); /* INFRINGES ON USER NAME SPACE */
351 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
354 #if (! defined yyoverflow \
355 && (! defined __cplusplus \
356 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
358 /* A type that is properly aligned for any stack member. */
361 yytype_int16 yyss_alloc;
365 /* The size of the maximum gap between one aligned stack and the next. */
366 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
368 /* The size of an array large to enough to hold all stacks, each with
370 # define YYSTACK_BYTES(N) \
371 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
372 + YYSTACK_GAP_MAXIMUM)
374 /* Copy COUNT objects from FROM to TO. The source and destination do
377 # if defined __GNUC__ && 1 < __GNUC__
378 # define YYCOPY(To, From, Count) \
379 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
381 # define YYCOPY(To, From, Count) \
385 for (yyi = 0; yyi < (Count); yyi++) \
386 (To)[yyi] = (From)[yyi]; \
392 /* Relocate STACK from its old location to the new one. The
393 local variables YYSIZE and YYSTACKSIZE give the old and new number of
394 elements in the stack, and YYPTR gives the new location of the
395 stack. Advance YYPTR to a properly aligned location for the next
397 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
400 YYSIZE_T yynewbytes; \
401 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
402 Stack = &yyptr->Stack_alloc; \
403 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
404 yyptr += yynewbytes / sizeof (*yyptr); \
410 /* YYFINAL -- State number of the termination state. */
412 /* YYLAST -- Last index in YYTABLE. */
415 /* YYNTOKENS -- Number of terminals. */
417 /* YYNNTS -- Number of nonterminals. */
419 /* YYNRULES -- Number of rules. */
421 /* YYNRULES -- Number of states. */
424 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
426 #define YYMAXUTOK 265
428 #define YYTRANSLATE(YYX) \
429 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
431 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
432 static const yytype_uint8 yytranslate[] =
434 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
435 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
436 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
437 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
438 2, 2, 2, 2, 11, 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, 2, 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, 1, 2, 3, 4,
464 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
466 static const yytype_uint8 yyprhs[] =
468 0, 0, 3, 4, 7, 10, 12, 15, 18, 22,
469 24, 27, 30, 33, 35, 40
472 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
473 static const yytype_int8 yyrhs[] =
475 13, 0, -1, -1, 14, 17, -1, 15, 16, -1,
476 16, -1, 7, 9, -1, 3, 9, -1, 3, 9,
477 9, -1, 18, -1, 17, 18, -1, 4, 10, -1,
478 5, 9, -1, 5, -1, 6, 9, 11, 9, -1,
482 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
483 static const yytype_uint8 yyrline[] =
485 0, 62, 62, 63, 66, 67, 70, 76, 82, 91,
486 92, 95, 99, 107, 114, 134
490 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
491 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
492 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
493 static const char *const yytname[] =
495 "$end", "error", "$undefined", "ET", "INDEX", "PREFIX", "EC", "ID",
496 "END", "STRING", "NUMBER", "','", "$accept", "file", "header", "id",
497 "et", "statements", "statement", 0
502 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
504 static const yytype_uint16 yytoknum[] =
506 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
511 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
512 static const yytype_uint8 yyr1[] =
514 0, 12, 13, 13, 14, 14, 15, 16, 16, 17,
515 17, 18, 18, 18, 18, 18
518 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
519 static const yytype_uint8 yyr2[] =
521 0, 2, 0, 2, 2, 1, 2, 2, 3, 1,
525 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
526 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
527 means the default is an error. */
528 static const yytype_uint8 yydefact[] =
530 2, 0, 0, 0, 0, 0, 5, 7, 6, 1,
531 0, 13, 0, 15, 3, 9, 4, 8, 11, 12,
535 /* YYDEFGOTO[NTERM-NUM]. */
536 static const yytype_int8 yydefgoto[] =
538 -1, 3, 4, 5, 6, 14, 15
541 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
543 #define YYPACT_NINF -5
544 static const yytype_int8 yypact[] =
546 0, -3, -1, 5, -4, 6, -5, 1, -5, -5,
547 2, 4, 7, -5, -4, -5, -5, -5, -5, -5,
551 /* YYPGOTO[NTERM-NUM]. */
552 static const yytype_int8 yypgoto[] =
554 -5, -5, -5, -5, 10, -5, 9
557 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
558 positive, shift that token. If negative, reduce the rule which
559 number is the opposite. If zero, do what YYDEFACT says.
560 If YYTABLE_NINF, syntax error. */
561 #define YYTABLE_NINF -1
562 static const yytype_uint8 yytable[] =
564 10, 11, 12, 1, 13, 9, 7, 2, 8, 1,
565 17, 0, 18, 19, 22, 16, 20, 23, 0, 0,
569 static const yytype_int8 yycheck[] =
571 4, 5, 6, 3, 8, 0, 9, 7, 9, 3,
572 9, -1, 10, 9, 11, 5, 9, 9, -1, -1,
576 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
577 symbol of state STATE-NUM. */
578 static const yytype_uint8 yystos[] =
580 0, 3, 7, 13, 14, 15, 16, 9, 9, 0,
581 4, 5, 6, 8, 17, 18, 16, 9, 10, 9,
585 #define yyerrok (yyerrstatus = 0)
586 #define yyclearin (yychar = YYEMPTY)
590 #define YYACCEPT goto yyacceptlab
591 #define YYABORT goto yyabortlab
592 #define YYERROR goto yyerrorlab
595 /* Like YYERROR except do call yyerror. This remains here temporarily
596 to ease the transition to the new meaning of YYERROR, for GCC.
597 Once GCC version 2 has supplanted version 1, this can go. */
599 #define YYFAIL goto yyerrlab
601 #define YYRECOVERING() (!!yyerrstatus)
603 #define YYBACKUP(Token, Value) \
605 if (yychar == YYEMPTY && yylen == 1) \
609 yytoken = YYTRANSLATE (yychar); \
615 yyerror (YY_("syntax error: cannot back up")); \
622 #define YYERRCODE 256
625 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
626 If N is 0, then set CURRENT to the empty location which ends
627 the previous symbol: RHS[0] (always defined). */
629 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
630 #ifndef YYLLOC_DEFAULT
631 # define YYLLOC_DEFAULT(Current, Rhs, N) \
635 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
636 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
637 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
638 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
642 (Current).first_line = (Current).last_line = \
643 YYRHSLOC (Rhs, 0).last_line; \
644 (Current).first_column = (Current).last_column = \
645 YYRHSLOC (Rhs, 0).last_column; \
651 /* YY_LOCATION_PRINT -- Print the location on the stream.
652 This macro was not mandated originally: define only if we know
653 we won't break user code: when these are the locations we know. */
655 #ifndef YY_LOCATION_PRINT
656 # if YYLTYPE_IS_TRIVIAL
657 # define YY_LOCATION_PRINT(File, Loc) \
658 fprintf (File, "%d.%d-%d.%d", \
659 (Loc).first_line, (Loc).first_column, \
660 (Loc).last_line, (Loc).last_column)
662 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
667 /* YYLEX -- calling `yylex' with the right arguments. */
670 # define YYLEX yylex (YYLEX_PARAM)
672 # define YYLEX yylex ()
675 /* Enable debugging if requested. */
679 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
680 # define YYFPRINTF fprintf
683 # define YYDPRINTF(Args) \
689 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
693 YYFPRINTF (stderr, "%s ", Title); \
694 yy_symbol_print (stderr, \
696 YYFPRINTF (stderr, "\n"); \
701 /*--------------------------------.
702 | Print this symbol on YYOUTPUT. |
703 `--------------------------------*/
706 #if (defined __STDC__ || defined __C99__FUNC__ \
707 || defined __cplusplus || defined _MSC_VER)
709 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
712 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
715 YYSTYPE const * const yyvaluep;
721 if (yytype < YYNTOKENS)
722 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
734 /*--------------------------------.
735 | Print this symbol on YYOUTPUT. |
736 `--------------------------------*/
738 #if (defined __STDC__ || defined __C99__FUNC__ \
739 || defined __cplusplus || defined _MSC_VER)
741 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
744 yy_symbol_print (yyoutput, yytype, yyvaluep)
747 YYSTYPE const * const yyvaluep;
750 if (yytype < YYNTOKENS)
751 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
753 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
755 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
756 YYFPRINTF (yyoutput, ")");
759 /*------------------------------------------------------------------.
760 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
762 `------------------------------------------------------------------*/
764 #if (defined __STDC__ || defined __C99__FUNC__ \
765 || defined __cplusplus || defined _MSC_VER)
767 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
770 yy_stack_print (yybottom, yytop)
771 yytype_int16 *yybottom;
775 YYFPRINTF (stderr, "Stack now");
776 for (; yybottom <= yytop; yybottom++)
778 int yybot = *yybottom;
779 YYFPRINTF (stderr, " %d", yybot);
781 YYFPRINTF (stderr, "\n");
784 # define YY_STACK_PRINT(Bottom, Top) \
787 yy_stack_print ((Bottom), (Top)); \
791 /*------------------------------------------------.
792 | Report that the YYRULE is going to be reduced. |
793 `------------------------------------------------*/
795 #if (defined __STDC__ || defined __C99__FUNC__ \
796 || defined __cplusplus || defined _MSC_VER)
798 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
801 yy_reduce_print (yyvsp, yyrule)
806 int yynrhs = yyr2[yyrule];
808 unsigned long int yylno = yyrline[yyrule];
809 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
811 /* The symbols being reduced. */
812 for (yyi = 0; yyi < yynrhs; yyi++)
814 YYFPRINTF (stderr, " $%d = ", yyi + 1);
815 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
816 &(yyvsp[(yyi + 1) - (yynrhs)])
818 YYFPRINTF (stderr, "\n");
822 # define YY_REDUCE_PRINT(Rule) \
825 yy_reduce_print (yyvsp, Rule); \
828 /* Nonzero means print parse trace. It is left uninitialized so that
829 multiple parsers can coexist. */
832 # define YYDPRINTF(Args)
833 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
834 # define YY_STACK_PRINT(Bottom, Top)
835 # define YY_REDUCE_PRINT(Rule)
836 #endif /* !YYDEBUG */
839 /* YYINITDEPTH -- initial size of the parser's stacks. */
841 # define YYINITDEPTH 200
844 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
845 if the built-in stack extension method is used).
847 Do not make this value too large; the results are undefined if
848 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
849 evaluated with infinite-precision integer arithmetic. */
852 # define YYMAXDEPTH 10000
860 # if defined __GLIBC__ && defined _STRING_H
861 # define yystrlen strlen
863 /* Return the length of YYSTR. */
864 #if (defined __STDC__ || defined __C99__FUNC__ \
865 || defined __cplusplus || defined _MSC_VER)
867 yystrlen (const char *yystr)
875 for (yylen = 0; yystr[yylen]; yylen++)
883 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
884 # define yystpcpy stpcpy
886 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
888 #if (defined __STDC__ || defined __C99__FUNC__ \
889 || defined __cplusplus || defined _MSC_VER)
891 yystpcpy (char *yydest, const char *yysrc)
894 yystpcpy (yydest, yysrc)
900 const char *yys = yysrc;
902 while ((*yyd++ = *yys++) != '\0')
911 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
912 quotes and backslashes, so that it's suitable for yyerror. The
913 heuristic is that double-quoting is unnecessary unless the string
914 contains an apostrophe, a comma, or backslash (other than
915 backslash-backslash). YYSTR is taken from yytname. If YYRES is
916 null, do not copy; instead, return the length of what the result
919 yytnamerr (char *yyres, const char *yystr)
924 char const *yyp = yystr;
931 goto do_not_strip_quotes;
935 goto do_not_strip_quotes;
948 do_not_strip_quotes: ;
952 return yystrlen (yystr);
954 return yystpcpy (yyres, yystr) - yyres;
958 /* Copy into YYRESULT an error message about the unexpected token
959 YYCHAR while in state YYSTATE. Return the number of bytes copied,
960 including the terminating null byte. If YYRESULT is null, do not
961 copy anything; just return the number of bytes that would be
962 copied. As a special case, return 0 if an ordinary "syntax error"
963 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
966 yysyntax_error (char *yyresult, int yystate, int yychar)
968 int yyn = yypact[yystate];
970 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
974 int yytype = YYTRANSLATE (yychar);
975 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
976 YYSIZE_T yysize = yysize0;
978 int yysize_overflow = 0;
979 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
980 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
984 /* This is so xgettext sees the translatable formats that are
985 constructed on the fly. */
986 YY_("syntax error, unexpected %s");
987 YY_("syntax error, unexpected %s, expecting %s");
988 YY_("syntax error, unexpected %s, expecting %s or %s");
989 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
990 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
994 static char const yyunexpected[] = "syntax error, unexpected %s";
995 static char const yyexpecting[] = ", expecting %s";
996 static char const yyor[] = " or %s";
997 char yyformat[sizeof yyunexpected
998 + sizeof yyexpecting - 1
999 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1000 * (sizeof yyor - 1))];
1001 char const *yyprefix = yyexpecting;
1003 /* Start YYX at -YYN if negative to avoid negative indexes in
1005 int yyxbegin = yyn < 0 ? -yyn : 0;
1007 /* Stay within bounds of both yycheck and yytname. */
1008 int yychecklim = YYLAST - yyn + 1;
1009 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1012 yyarg[0] = yytname[yytype];
1013 yyfmt = yystpcpy (yyformat, yyunexpected);
1015 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1016 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1018 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1022 yyformat[sizeof yyunexpected - 1] = '\0';
1025 yyarg[yycount++] = yytname[yyx];
1026 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1027 yysize_overflow |= (yysize1 < yysize);
1029 yyfmt = yystpcpy (yyfmt, yyprefix);
1033 yyf = YY_(yyformat);
1034 yysize1 = yysize + yystrlen (yyf);
1035 yysize_overflow |= (yysize1 < yysize);
1038 if (yysize_overflow)
1039 return YYSIZE_MAXIMUM;
1043 /* Avoid sprintf, as that infringes on the user's name space.
1044 Don't have undefined behavior even if the translation
1045 produced a string with the wrong number of "%s"s. */
1046 char *yyp = yyresult;
1048 while ((*yyp = *yyf) != '\0')
1050 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1052 yyp += yytnamerr (yyp, yyarg[yyi++]);
1065 #endif /* YYERROR_VERBOSE */
1068 /*-----------------------------------------------.
1069 | Release the memory associated to this symbol. |
1070 `-----------------------------------------------*/
1073 #if (defined __STDC__ || defined __C99__FUNC__ \
1074 || defined __cplusplus || defined _MSC_VER)
1076 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1079 yydestruct (yymsg, yytype, yyvaluep)
1089 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1099 /* Prevent warnings from -Wmissing-prototypes. */
1100 #ifdef YYPARSE_PARAM
1101 #if defined __STDC__ || defined __cplusplus
1102 int yyparse (void *YYPARSE_PARAM);
1106 #else /* ! YYPARSE_PARAM */
1107 #if defined __STDC__ || defined __cplusplus
1112 #endif /* ! YYPARSE_PARAM */
1115 /* The lookahead symbol. */
1118 /* The semantic value of the lookahead symbol. */
1121 /* Number of syntax errors so far. */
1126 /*-------------------------.
1127 | yyparse or yypush_parse. |
1128 `-------------------------*/
1130 #ifdef YYPARSE_PARAM
1131 #if (defined __STDC__ || defined __C99__FUNC__ \
1132 || defined __cplusplus || defined _MSC_VER)
1134 yyparse (void *YYPARSE_PARAM)
1137 yyparse (YYPARSE_PARAM)
1138 void *YYPARSE_PARAM;
1140 #else /* ! YYPARSE_PARAM */
1141 #if (defined __STDC__ || defined __C99__FUNC__ \
1142 || defined __cplusplus || defined _MSC_VER)
1155 /* Number of tokens to shift before error messages enabled. */
1158 /* The stacks and their tools:
1159 `yyss': related to states.
1160 `yyvs': related to semantic values.
1162 Refer to the stacks thru separate pointers, to allow yyoverflow
1163 to reallocate them elsewhere. */
1165 /* The state stack. */
1166 yytype_int16 yyssa[YYINITDEPTH];
1168 yytype_int16 *yyssp;
1170 /* The semantic value stack. */
1171 YYSTYPE yyvsa[YYINITDEPTH];
1175 YYSIZE_T yystacksize;
1179 /* Lookahead token as an internal (translated) token number. */
1181 /* The variables used to return semantic value and location from the
1186 /* Buffer for error messages, and its allocated size. */
1188 char *yymsg = yymsgbuf;
1189 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1192 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1194 /* The number of symbols on the RHS of the reduced rule.
1195 Keep to zero when no symbol should be popped. */
1201 yystacksize = YYINITDEPTH;
1203 YYDPRINTF ((stderr, "Starting parse\n"));
1208 yychar = YYEMPTY; /* Cause a token to be read. */
1210 /* Initialize stack pointers.
1211 Waste one element of value and location stack
1212 so that they stay on the same level as the state stack.
1213 The wasted elements are never initialized. */
1219 /*------------------------------------------------------------.
1220 | yynewstate -- Push a new state, which is found in yystate. |
1221 `------------------------------------------------------------*/
1223 /* In all cases, when you get here, the value and location stacks
1224 have just been pushed. So pushing a state here evens the stacks. */
1230 if (yyss + yystacksize - 1 <= yyssp)
1232 /* Get the current used size of the three stacks, in elements. */
1233 YYSIZE_T yysize = yyssp - yyss + 1;
1237 /* Give user a chance to reallocate the stack. Use copies of
1238 these so that the &'s don't force the real ones into
1240 YYSTYPE *yyvs1 = yyvs;
1241 yytype_int16 *yyss1 = yyss;
1243 /* Each stack pointer address is followed by the size of the
1244 data in use in that stack, in bytes. This used to be a
1245 conditional around just the two extra args, but that might
1246 be undefined if yyoverflow is a macro. */
1247 yyoverflow (YY_("memory exhausted"),
1248 &yyss1, yysize * sizeof (*yyssp),
1249 &yyvs1, yysize * sizeof (*yyvsp),
1255 #else /* no yyoverflow */
1256 # ifndef YYSTACK_RELOCATE
1257 goto yyexhaustedlab;
1259 /* Extend the stack our own way. */
1260 if (YYMAXDEPTH <= yystacksize)
1261 goto yyexhaustedlab;
1263 if (YYMAXDEPTH < yystacksize)
1264 yystacksize = YYMAXDEPTH;
1267 yytype_int16 *yyss1 = yyss;
1268 union yyalloc *yyptr =
1269 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1271 goto yyexhaustedlab;
1272 YYSTACK_RELOCATE (yyss_alloc, yyss);
1273 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1274 # undef YYSTACK_RELOCATE
1276 YYSTACK_FREE (yyss1);
1279 #endif /* no yyoverflow */
1281 yyssp = yyss + yysize - 1;
1282 yyvsp = yyvs + yysize - 1;
1284 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1285 (unsigned long int) yystacksize));
1287 if (yyss + yystacksize - 1 <= yyssp)
1291 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1293 if (yystate == YYFINAL)
1303 /* Do appropriate processing given the current state. Read a
1304 lookahead token if we need one and don't already have one. */
1306 /* First try to decide what to do without reference to lookahead token. */
1307 yyn = yypact[yystate];
1308 if (yyn == YYPACT_NINF)
1311 /* Not known => get a lookahead token if don't already have one. */
1313 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1314 if (yychar == YYEMPTY)
1316 YYDPRINTF ((stderr, "Reading a token: "));
1320 if (yychar <= YYEOF)
1322 yychar = yytoken = YYEOF;
1323 YYDPRINTF ((stderr, "Now at end of input.\n"));
1327 yytoken = YYTRANSLATE (yychar);
1328 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1331 /* If the proper action on seeing token YYTOKEN is to reduce or to
1332 detect an error, take that action. */
1334 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1339 if (yyn == 0 || yyn == YYTABLE_NINF)
1345 /* Count tokens shifted since error; after three, turn off error
1350 /* Shift the lookahead token. */
1351 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1353 /* Discard the shifted token. */
1362 /*-----------------------------------------------------------.
1363 | yydefault -- do the default action for the current state. |
1364 `-----------------------------------------------------------*/
1366 yyn = yydefact[yystate];
1372 /*-----------------------------.
1373 | yyreduce -- Do a reduction. |
1374 `-----------------------------*/
1376 /* yyn is the number of a rule to reduce with. */
1379 /* If YYLEN is nonzero, implement the default value of the action:
1382 Otherwise, the following line sets YYVAL to garbage.
1383 This behavior is undocumented and Bison
1384 users should not rely upon it. Assigning to YYVAL
1385 unconditionally makes the parser a bit smaller, and it avoids a
1386 GCC warning that YYVAL may be used uninitialized. */
1387 yyval = yyvsp[1-yylen];
1390 YY_REDUCE_PRINT (yyn);
1395 /* Line 1455 of yacc.c */
1396 #line 71 "heimdal/lib/com_err/parse.y"
1398 id_str = (yyvsp[(2) - (2)].string);
1404 /* Line 1455 of yacc.c */
1405 #line 77 "heimdal/lib/com_err/parse.y"
1407 base_id = name2number((yyvsp[(2) - (2)].string));
1408 strlcpy(name, (yyvsp[(2) - (2)].string), sizeof(name));
1409 free((yyvsp[(2) - (2)].string));
1415 /* Line 1455 of yacc.c */
1416 #line 83 "heimdal/lib/com_err/parse.y"
1418 base_id = name2number((yyvsp[(2) - (3)].string));
1419 strlcpy(name, (yyvsp[(3) - (3)].string), sizeof(name));
1420 free((yyvsp[(2) - (3)].string));
1421 free((yyvsp[(3) - (3)].string));
1427 /* Line 1455 of yacc.c */
1428 #line 96 "heimdal/lib/com_err/parse.y"
1430 number = (yyvsp[(2) - (2)].number);
1436 /* Line 1455 of yacc.c */
1437 #line 100 "heimdal/lib/com_err/parse.y"
1440 asprintf (&prefix, "%s_", (yyvsp[(2) - (2)].string));
1443 free((yyvsp[(2) - (2)].string));
1449 /* Line 1455 of yacc.c */
1450 #line 108 "heimdal/lib/com_err/parse.y"
1452 prefix = realloc(prefix, 1);
1461 /* Line 1455 of yacc.c */
1462 #line 115 "heimdal/lib/com_err/parse.y"
1464 struct error_code *ec = malloc(sizeof(*ec));
1470 ec->number = number;
1471 if(prefix && *prefix != '\0') {
1472 asprintf (&ec->name, "%s%s", prefix, (yyvsp[(2) - (4)].string));
1473 if (ec->name == NULL)
1475 free((yyvsp[(2) - (4)].string));
1477 ec->name = (yyvsp[(2) - (4)].string);
1478 ec->string = (yyvsp[(4) - (4)].string);
1486 /* Line 1455 of yacc.c */
1487 #line 135 "heimdal/lib/com_err/parse.y"
1495 /* Line 1455 of yacc.c */
1496 #line 1497 "heimdal/lib/com_err/parse.y"
1499 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1503 YY_STACK_PRINT (yyss, yyssp);
1507 /* Now `shift' the result of the reduction. Determine what state
1508 that goes to, based on the state we popped back to and the rule
1509 number reduced by. */
1513 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1514 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1515 yystate = yytable[yystate];
1517 yystate = yydefgoto[yyn - YYNTOKENS];
1522 /*------------------------------------.
1523 | yyerrlab -- here on detecting error |
1524 `------------------------------------*/
1526 /* If not already recovering from an error, report this error. */
1530 #if ! YYERROR_VERBOSE
1531 yyerror (YY_("syntax error"));
1534 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1535 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1537 YYSIZE_T yyalloc = 2 * yysize;
1538 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
1539 yyalloc = YYSTACK_ALLOC_MAXIMUM;
1540 if (yymsg != yymsgbuf)
1541 YYSTACK_FREE (yymsg);
1542 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
1544 yymsg_alloc = yyalloc;
1548 yymsg_alloc = sizeof yymsgbuf;
1552 if (0 < yysize && yysize <= yymsg_alloc)
1554 (void) yysyntax_error (yymsg, yystate, yychar);
1559 yyerror (YY_("syntax error"));
1561 goto yyexhaustedlab;
1569 if (yyerrstatus == 3)
1571 /* If just tried and failed to reuse lookahead token after an
1572 error, discard it. */
1574 if (yychar <= YYEOF)
1576 /* Return failure if at end of input. */
1577 if (yychar == YYEOF)
1582 yydestruct ("Error: discarding",
1588 /* Else will try to reuse lookahead token after shifting the error
1593 /*---------------------------------------------------.
1594 | yyerrorlab -- error raised explicitly by YYERROR. |
1595 `---------------------------------------------------*/
1598 /* Pacify compilers like GCC when the user code never invokes
1599 YYERROR and the label yyerrorlab therefore never appears in user
1601 if (/*CONSTCOND*/ 0)
1604 /* Do not reclaim the symbols of the rule which action triggered
1608 YY_STACK_PRINT (yyss, yyssp);
1613 /*-------------------------------------------------------------.
1614 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1615 `-------------------------------------------------------------*/
1617 yyerrstatus = 3; /* Each real token shifted decrements this. */
1621 yyn = yypact[yystate];
1622 if (yyn != YYPACT_NINF)
1625 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1633 /* Pop the current state because it cannot handle the error token. */
1638 yydestruct ("Error: popping",
1639 yystos[yystate], yyvsp);
1642 YY_STACK_PRINT (yyss, yyssp);
1648 /* Shift the error token. */
1649 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1655 /*-------------------------------------.
1656 | yyacceptlab -- YYACCEPT comes here. |
1657 `-------------------------------------*/
1662 /*-----------------------------------.
1663 | yyabortlab -- YYABORT comes here. |
1664 `-----------------------------------*/
1669 #if !defined(yyoverflow) || YYERROR_VERBOSE
1670 /*-------------------------------------------------.
1671 | yyexhaustedlab -- memory exhaustion comes here. |
1672 `-------------------------------------------------*/
1674 yyerror (YY_("memory exhausted"));
1680 if (yychar != YYEMPTY)
1681 yydestruct ("Cleanup: discarding lookahead",
1683 /* Do not reclaim the symbols of the rule which action triggered
1684 this YYABORT or YYACCEPT. */
1686 YY_STACK_PRINT (yyss, yyssp);
1687 while (yyssp != yyss)
1689 yydestruct ("Cleanup: popping",
1690 yystos[*yyssp], yyvsp);
1695 YYSTACK_FREE (yyss);
1698 if (yymsg != yymsgbuf)
1699 YYSTACK_FREE (yymsg);
1701 /* Make sure YYID is used. */
1702 return YYID (yyresult);
1707 /* Line 1675 of yacc.c */
1708 #line 140 "heimdal/lib/com_err/parse.y"
1712 name2number(const char *str)
1716 const char *x = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
1717 "abcdefghijklmnopqrstuvwxyz0123456789_";
1718 if(strlen(str) > 4) {
1719 yyerror("table name too long");
1722 for(p = str; *p; p++){
1723 char *q = strchr(x, *p);
1725 yyerror("invalid character in table name");
1728 num = (num << 6) + (q - x) + 1;
1731 if(num > 0x7fffffff)
1732 num = -(0xffffffff - num + 1);
1739 error_message ("%s\n", s);