heimdal: import heimdal's trunk svn rev 23697 + lorikeet-heimdal patches
[Samba/vfs_proxy.git] / source4 / heimdal / lib / com_err / parse.c
blob868e3f39f3fa151dada1d203a8951dbc59e49a95
1 /* A Bison parser, made by GNU Bison 2.3. */
3 /* Skeleton implementation for Bison's Yacc-like parsers in C
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
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 2, or (at your option)
11 any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
23 /* As a special exception, you may create a larger work that contains
24 part or all of the Bison parser skeleton and distribute that work
25 under terms of your choice, so long as that work isn't itself a
26 parser generator using the skeleton or a modified version thereof
27 as a parser skeleton. Alternatively, if you modify or redistribute
28 the parser skeleton itself, you may (at your option) remove this
29 special exception, which will cause the skeleton and the resulting
30 Bison output files to be licensed under the GNU General Public
31 License without this special exception.
33 This special exception was added by the Free Software Foundation in
34 version 2.2 of Bison. */
36 /* C LALR(1) parser skeleton written by Richard Stallman, by
37 simplifying the original so-called "semantic" parser. */
39 /* All symbols defined below should begin with yy or YY, to avoid
40 infringing on user name space. This should be done even for local
41 variables, as they might otherwise be expanded by user macros.
42 There are some unavoidable exceptions within include files to
43 define necessary library symbols; they are noted "INFRINGES ON
44 USER NAME SPACE" below. */
46 /* Identify Bison output. */
47 #define YYBISON 1
49 /* Bison version. */
50 #define YYBISON_VERSION "2.3"
52 /* Skeleton name. */
53 #define YYSKELETON_NAME "yacc.c"
55 /* Pure parsers. */
56 #define YYPURE 0
58 /* Using locations. */
59 #define YYLSP_NEEDED 0
63 /* Tokens. */
64 #ifndef YYTOKENTYPE
65 # define YYTOKENTYPE
66 /* Put the tokens into the symbol table, so that GDB and other debuggers
67 know about them. */
68 enum yytokentype {
69 ET = 258,
70 INDEX = 259,
71 PREFIX = 260,
72 EC = 261,
73 ID = 262,
74 END = 263,
75 STRING = 264,
76 NUMBER = 265
78 #endif
79 /* Tokens. */
80 #define ET 258
81 #define INDEX 259
82 #define PREFIX 260
83 #define EC 261
84 #define ID 262
85 #define END 263
86 #define STRING 264
87 #define NUMBER 265
92 /* Copy the first part of user declarations. */
93 #line 1 "heimdal/lib/com_err/parse.y"
96 * Copyright (c) 1998 - 2000 Kungliga Tekniska Högskolan
97 * (Royal Institute of Technology, Stockholm, Sweden).
98 * All rights reserved.
100 * Redistribution and use in source and binary forms, with or without
101 * modification, are permitted provided that the following conditions
102 * are met:
104 * 1. Redistributions of source code must retain the above copyright
105 * notice, this list of conditions and the following disclaimer.
107 * 2. Redistributions in binary form must reproduce the above copyright
108 * notice, this list of conditions and the following disclaimer in the
109 * documentation and/or other materials provided with the distribution.
111 * 3. Neither the name of the Institute nor the names of its contributors
112 * may be used to endorse or promote products derived from this software
113 * without specific prior written permission.
115 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
116 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
117 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
118 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
119 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
120 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
121 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
122 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
123 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
124 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
125 * SUCH DAMAGE.
128 #include "compile_et.h"
129 #include "lex.h"
131 RCSID("$Id$");
133 void yyerror (char *s);
134 static long name2number(const char *str);
136 extern char *yytext;
138 /* This is for bison */
140 #if !defined(alloca) && !defined(HAVE_ALLOCA)
141 #define alloca(x) malloc(x)
142 #endif
146 /* Enabling traces. */
147 #ifndef YYDEBUG
148 # define YYDEBUG 0
149 #endif
151 /* Enabling verbose error messages. */
152 #ifdef YYERROR_VERBOSE
153 # undef YYERROR_VERBOSE
154 # define YYERROR_VERBOSE 1
155 #else
156 # define YYERROR_VERBOSE 0
157 #endif
159 /* Enabling the token table. */
160 #ifndef YYTOKEN_TABLE
161 # define YYTOKEN_TABLE 0
162 #endif
164 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
165 typedef union YYSTYPE
166 #line 53 "heimdal/lib/com_err/parse.y"
168 char *string;
169 int number;
171 /* Line 187 of yacc.c. */
172 #line 173 "heimdal/lib/com_err/parse.y"
173 YYSTYPE;
174 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
175 # define YYSTYPE_IS_DECLARED 1
176 # define YYSTYPE_IS_TRIVIAL 1
177 #endif
181 /* Copy the second part of user declarations. */
184 /* Line 216 of yacc.c. */
185 #line 186 "heimdal/lib/com_err/parse.y"
187 #ifdef short
188 # undef short
189 #endif
191 #ifdef YYTYPE_UINT8
192 typedef YYTYPE_UINT8 yytype_uint8;
193 #else
194 typedef unsigned char yytype_uint8;
195 #endif
197 #ifdef YYTYPE_INT8
198 typedef YYTYPE_INT8 yytype_int8;
199 #elif (defined __STDC__ || defined __C99__FUNC__ \
200 || defined __cplusplus || defined _MSC_VER)
201 typedef signed char yytype_int8;
202 #else
203 typedef short int yytype_int8;
204 #endif
206 #ifdef YYTYPE_UINT16
207 typedef YYTYPE_UINT16 yytype_uint16;
208 #else
209 typedef unsigned short int yytype_uint16;
210 #endif
212 #ifdef YYTYPE_INT16
213 typedef YYTYPE_INT16 yytype_int16;
214 #else
215 typedef short int yytype_int16;
216 #endif
218 #ifndef YYSIZE_T
219 # ifdef __SIZE_TYPE__
220 # define YYSIZE_T __SIZE_TYPE__
221 # elif defined size_t
222 # define YYSIZE_T size_t
223 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
224 || defined __cplusplus || defined _MSC_VER)
225 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
226 # define YYSIZE_T size_t
227 # else
228 # define YYSIZE_T unsigned int
229 # endif
230 #endif
232 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
234 #ifndef YY_
235 # if YYENABLE_NLS
236 # if ENABLE_NLS
237 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
238 # define YY_(msgid) dgettext ("bison-runtime", msgid)
239 # endif
240 # endif
241 # ifndef YY_
242 # define YY_(msgid) msgid
243 # endif
244 #endif
246 /* Suppress unused-variable warnings by "using" E. */
247 #if ! defined lint || defined __GNUC__
248 # define YYUSE(e) ((void) (e))
249 #else
250 # define YYUSE(e) /* empty */
251 #endif
253 /* Identity function, used to suppress warnings about constant conditions. */
254 #ifndef lint
255 # define YYID(n) (n)
256 #else
257 #if (defined __STDC__ || defined __C99__FUNC__ \
258 || defined __cplusplus || defined _MSC_VER)
259 static int
260 YYID (int i)
261 #else
262 static int
263 YYID (i)
264 int i;
265 #endif
267 return i;
269 #endif
271 #if ! defined yyoverflow || YYERROR_VERBOSE
273 /* The parser invokes alloca or malloc; define the necessary symbols. */
275 # ifdef YYSTACK_USE_ALLOCA
276 # if YYSTACK_USE_ALLOCA
277 # ifdef __GNUC__
278 # define YYSTACK_ALLOC __builtin_alloca
279 # elif defined __BUILTIN_VA_ARG_INCR
280 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
281 # elif defined _AIX
282 # define YYSTACK_ALLOC __alloca
283 # elif defined _MSC_VER
284 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
285 # define alloca _alloca
286 # else
287 # define YYSTACK_ALLOC alloca
288 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
289 || defined __cplusplus || defined _MSC_VER)
290 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
291 # ifndef _STDLIB_H
292 # define _STDLIB_H 1
293 # endif
294 # endif
295 # endif
296 # endif
297 # endif
299 # ifdef YYSTACK_ALLOC
300 /* Pacify GCC's `empty if-body' warning. */
301 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
302 # ifndef YYSTACK_ALLOC_MAXIMUM
303 /* The OS might guarantee only one guard page at the bottom of the stack,
304 and a page size can be as small as 4096 bytes. So we cannot safely
305 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
306 to allow for a few compiler-allocated temporary stack slots. */
307 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
308 # endif
309 # else
310 # define YYSTACK_ALLOC YYMALLOC
311 # define YYSTACK_FREE YYFREE
312 # ifndef YYSTACK_ALLOC_MAXIMUM
313 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
314 # endif
315 # if (defined __cplusplus && ! defined _STDLIB_H \
316 && ! ((defined YYMALLOC || defined malloc) \
317 && (defined YYFREE || defined free)))
318 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
319 # ifndef _STDLIB_H
320 # define _STDLIB_H 1
321 # endif
322 # endif
323 # ifndef YYMALLOC
324 # define YYMALLOC malloc
325 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
326 || defined __cplusplus || defined _MSC_VER)
327 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
328 # endif
329 # endif
330 # ifndef YYFREE
331 # define YYFREE free
332 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
333 || defined __cplusplus || defined _MSC_VER)
334 void free (void *); /* INFRINGES ON USER NAME SPACE */
335 # endif
336 # endif
337 # endif
338 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
341 #if (! defined yyoverflow \
342 && (! defined __cplusplus \
343 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
345 /* A type that is properly aligned for any stack member. */
346 union yyalloc
348 yytype_int16 yyss;
349 YYSTYPE yyvs;
352 /* The size of the maximum gap between one aligned stack and the next. */
353 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
355 /* The size of an array large to enough to hold all stacks, each with
356 N elements. */
357 # define YYSTACK_BYTES(N) \
358 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
359 + YYSTACK_GAP_MAXIMUM)
361 /* Copy COUNT objects from FROM to TO. The source and destination do
362 not overlap. */
363 # ifndef YYCOPY
364 # if defined __GNUC__ && 1 < __GNUC__
365 # define YYCOPY(To, From, Count) \
366 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
367 # else
368 # define YYCOPY(To, From, Count) \
369 do \
371 YYSIZE_T yyi; \
372 for (yyi = 0; yyi < (Count); yyi++) \
373 (To)[yyi] = (From)[yyi]; \
375 while (YYID (0))
376 # endif
377 # endif
379 /* Relocate STACK from its old location to the new one. The
380 local variables YYSIZE and YYSTACKSIZE give the old and new number of
381 elements in the stack, and YYPTR gives the new location of the
382 stack. Advance YYPTR to a properly aligned location for the next
383 stack. */
384 # define YYSTACK_RELOCATE(Stack) \
385 do \
387 YYSIZE_T yynewbytes; \
388 YYCOPY (&yyptr->Stack, Stack, yysize); \
389 Stack = &yyptr->Stack; \
390 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
391 yyptr += yynewbytes / sizeof (*yyptr); \
393 while (YYID (0))
395 #endif
397 /* YYFINAL -- State number of the termination state. */
398 #define YYFINAL 9
399 /* YYLAST -- Last index in YYTABLE. */
400 #define YYLAST 23
402 /* YYNTOKENS -- Number of terminals. */
403 #define YYNTOKENS 12
404 /* YYNNTS -- Number of nonterminals. */
405 #define YYNNTS 7
406 /* YYNRULES -- Number of rules. */
407 #define YYNRULES 15
408 /* YYNRULES -- Number of states. */
409 #define YYNSTATES 24
411 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
412 #define YYUNDEFTOK 2
413 #define YYMAXUTOK 265
415 #define YYTRANSLATE(YYX) \
416 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
418 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
419 static const yytype_uint8 yytranslate[] =
421 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
422 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
423 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
424 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
425 2, 2, 2, 2, 11, 2, 2, 2, 2, 2,
426 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
427 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
428 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
429 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
430 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
431 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
432 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
433 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
434 2, 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, 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, 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, 1, 2, 3, 4,
447 5, 6, 7, 8, 9, 10
450 #if YYDEBUG
451 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
452 YYRHS. */
453 static const yytype_uint8 yyprhs[] =
455 0, 0, 3, 4, 7, 10, 12, 15, 18, 22,
456 24, 27, 30, 33, 35, 40
459 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
460 static const yytype_int8 yyrhs[] =
462 13, 0, -1, -1, 14, 17, -1, 15, 16, -1,
463 16, -1, 7, 9, -1, 3, 9, -1, 3, 9,
464 9, -1, 18, -1, 17, 18, -1, 4, 10, -1,
465 5, 9, -1, 5, -1, 6, 9, 11, 9, -1,
466 8, -1
469 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
470 static const yytype_uint8 yyrline[] =
472 0, 64, 64, 65, 68, 69, 72, 78, 84, 93,
473 94, 97, 101, 109, 116, 136
475 #endif
477 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
478 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
479 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
480 static const char *const yytname[] =
482 "$end", "error", "$undefined", "ET", "INDEX", "PREFIX", "EC", "ID",
483 "END", "STRING", "NUMBER", "','", "$accept", "file", "header", "id",
484 "et", "statements", "statement", 0
486 #endif
488 # ifdef YYPRINT
489 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
490 token YYLEX-NUM. */
491 static const yytype_uint16 yytoknum[] =
493 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
494 265, 44
496 # endif
498 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
499 static const yytype_uint8 yyr1[] =
501 0, 12, 13, 13, 14, 14, 15, 16, 16, 17,
502 17, 18, 18, 18, 18, 18
505 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
506 static const yytype_uint8 yyr2[] =
508 0, 2, 0, 2, 2, 1, 2, 2, 3, 1,
509 2, 2, 2, 1, 4, 1
512 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
513 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
514 means the default is an error. */
515 static const yytype_uint8 yydefact[] =
517 2, 0, 0, 0, 0, 0, 5, 7, 6, 1,
518 0, 13, 0, 15, 3, 9, 4, 8, 11, 12,
519 0, 10, 0, 14
522 /* YYDEFGOTO[NTERM-NUM]. */
523 static const yytype_int8 yydefgoto[] =
525 -1, 3, 4, 5, 6, 14, 15
528 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
529 STATE-NUM. */
530 #define YYPACT_NINF -5
531 static const yytype_int8 yypact[] =
533 0, -3, -1, 5, -4, 6, -5, 1, -5, -5,
534 2, 4, 7, -5, -4, -5, -5, -5, -5, -5,
535 3, -5, 8, -5
538 /* YYPGOTO[NTERM-NUM]. */
539 static const yytype_int8 yypgoto[] =
541 -5, -5, -5, -5, 10, -5, 9
544 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
545 positive, shift that token. If negative, reduce the rule which
546 number is the opposite. If zero, do what YYDEFACT says.
547 If YYTABLE_NINF, syntax error. */
548 #define YYTABLE_NINF -1
549 static const yytype_uint8 yytable[] =
551 10, 11, 12, 1, 13, 9, 7, 2, 8, 1,
552 17, 0, 18, 19, 22, 16, 20, 23, 0, 0,
553 0, 0, 0, 21
556 static const yytype_int8 yycheck[] =
558 4, 5, 6, 3, 8, 0, 9, 7, 9, 3,
559 9, -1, 10, 9, 11, 5, 9, 9, -1, -1,
560 -1, -1, -1, 14
563 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
564 symbol of state STATE-NUM. */
565 static const yytype_uint8 yystos[] =
567 0, 3, 7, 13, 14, 15, 16, 9, 9, 0,
568 4, 5, 6, 8, 17, 18, 16, 9, 10, 9,
569 9, 18, 11, 9
572 #define yyerrok (yyerrstatus = 0)
573 #define yyclearin (yychar = YYEMPTY)
574 #define YYEMPTY (-2)
575 #define YYEOF 0
577 #define YYACCEPT goto yyacceptlab
578 #define YYABORT goto yyabortlab
579 #define YYERROR goto yyerrorlab
582 /* Like YYERROR except do call yyerror. This remains here temporarily
583 to ease the transition to the new meaning of YYERROR, for GCC.
584 Once GCC version 2 has supplanted version 1, this can go. */
586 #define YYFAIL goto yyerrlab
588 #define YYRECOVERING() (!!yyerrstatus)
590 #define YYBACKUP(Token, Value) \
591 do \
592 if (yychar == YYEMPTY && yylen == 1) \
594 yychar = (Token); \
595 yylval = (Value); \
596 yytoken = YYTRANSLATE (yychar); \
597 YYPOPSTACK (1); \
598 goto yybackup; \
600 else \
602 yyerror (YY_("syntax error: cannot back up")); \
603 YYERROR; \
605 while (YYID (0))
608 #define YYTERROR 1
609 #define YYERRCODE 256
612 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
613 If N is 0, then set CURRENT to the empty location which ends
614 the previous symbol: RHS[0] (always defined). */
616 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
617 #ifndef YYLLOC_DEFAULT
618 # define YYLLOC_DEFAULT(Current, Rhs, N) \
619 do \
620 if (YYID (N)) \
622 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
623 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
624 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
625 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
627 else \
629 (Current).first_line = (Current).last_line = \
630 YYRHSLOC (Rhs, 0).last_line; \
631 (Current).first_column = (Current).last_column = \
632 YYRHSLOC (Rhs, 0).last_column; \
634 while (YYID (0))
635 #endif
638 /* YY_LOCATION_PRINT -- Print the location on the stream.
639 This macro was not mandated originally: define only if we know
640 we won't break user code: when these are the locations we know. */
642 #ifndef YY_LOCATION_PRINT
643 # if YYLTYPE_IS_TRIVIAL
644 # define YY_LOCATION_PRINT(File, Loc) \
645 fprintf (File, "%d.%d-%d.%d", \
646 (Loc).first_line, (Loc).first_column, \
647 (Loc).last_line, (Loc).last_column)
648 # else
649 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
650 # endif
651 #endif
654 /* YYLEX -- calling `yylex' with the right arguments. */
656 #ifdef YYLEX_PARAM
657 # define YYLEX yylex (YYLEX_PARAM)
658 #else
659 # define YYLEX yylex ()
660 #endif
662 /* Enable debugging if requested. */
663 #if YYDEBUG
665 # ifndef YYFPRINTF
666 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
667 # define YYFPRINTF fprintf
668 # endif
670 # define YYDPRINTF(Args) \
671 do { \
672 if (yydebug) \
673 YYFPRINTF Args; \
674 } while (YYID (0))
676 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
677 do { \
678 if (yydebug) \
680 YYFPRINTF (stderr, "%s ", Title); \
681 yy_symbol_print (stderr, \
682 Type, Value); \
683 YYFPRINTF (stderr, "\n"); \
685 } while (YYID (0))
688 /*--------------------------------.
689 | Print this symbol on YYOUTPUT. |
690 `--------------------------------*/
692 /*ARGSUSED*/
693 #if (defined __STDC__ || defined __C99__FUNC__ \
694 || defined __cplusplus || defined _MSC_VER)
695 static void
696 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
697 #else
698 static void
699 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
700 FILE *yyoutput;
701 int yytype;
702 YYSTYPE const * const yyvaluep;
703 #endif
705 if (!yyvaluep)
706 return;
707 # ifdef YYPRINT
708 if (yytype < YYNTOKENS)
709 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
710 # else
711 YYUSE (yyoutput);
712 # endif
713 switch (yytype)
715 default:
716 break;
721 /*--------------------------------.
722 | Print this symbol on YYOUTPUT. |
723 `--------------------------------*/
725 #if (defined __STDC__ || defined __C99__FUNC__ \
726 || defined __cplusplus || defined _MSC_VER)
727 static void
728 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
729 #else
730 static void
731 yy_symbol_print (yyoutput, yytype, yyvaluep)
732 FILE *yyoutput;
733 int yytype;
734 YYSTYPE const * const yyvaluep;
735 #endif
737 if (yytype < YYNTOKENS)
738 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
739 else
740 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
742 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
743 YYFPRINTF (yyoutput, ")");
746 /*------------------------------------------------------------------.
747 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
748 | TOP (included). |
749 `------------------------------------------------------------------*/
751 #if (defined __STDC__ || defined __C99__FUNC__ \
752 || defined __cplusplus || defined _MSC_VER)
753 static void
754 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
755 #else
756 static void
757 yy_stack_print (bottom, top)
758 yytype_int16 *bottom;
759 yytype_int16 *top;
760 #endif
762 YYFPRINTF (stderr, "Stack now");
763 for (; bottom <= top; ++bottom)
764 YYFPRINTF (stderr, " %d", *bottom);
765 YYFPRINTF (stderr, "\n");
768 # define YY_STACK_PRINT(Bottom, Top) \
769 do { \
770 if (yydebug) \
771 yy_stack_print ((Bottom), (Top)); \
772 } while (YYID (0))
775 /*------------------------------------------------.
776 | Report that the YYRULE is going to be reduced. |
777 `------------------------------------------------*/
779 #if (defined __STDC__ || defined __C99__FUNC__ \
780 || defined __cplusplus || defined _MSC_VER)
781 static void
782 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
783 #else
784 static void
785 yy_reduce_print (yyvsp, yyrule)
786 YYSTYPE *yyvsp;
787 int yyrule;
788 #endif
790 int yynrhs = yyr2[yyrule];
791 int yyi;
792 unsigned long int yylno = yyrline[yyrule];
793 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
794 yyrule - 1, yylno);
795 /* The symbols being reduced. */
796 for (yyi = 0; yyi < yynrhs; yyi++)
798 fprintf (stderr, " $%d = ", yyi + 1);
799 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
800 &(yyvsp[(yyi + 1) - (yynrhs)])
802 fprintf (stderr, "\n");
806 # define YY_REDUCE_PRINT(Rule) \
807 do { \
808 if (yydebug) \
809 yy_reduce_print (yyvsp, Rule); \
810 } while (YYID (0))
812 /* Nonzero means print parse trace. It is left uninitialized so that
813 multiple parsers can coexist. */
814 int yydebug;
815 #else /* !YYDEBUG */
816 # define YYDPRINTF(Args)
817 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
818 # define YY_STACK_PRINT(Bottom, Top)
819 # define YY_REDUCE_PRINT(Rule)
820 #endif /* !YYDEBUG */
823 /* YYINITDEPTH -- initial size of the parser's stacks. */
824 #ifndef YYINITDEPTH
825 # define YYINITDEPTH 200
826 #endif
828 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
829 if the built-in stack extension method is used).
831 Do not make this value too large; the results are undefined if
832 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
833 evaluated with infinite-precision integer arithmetic. */
835 #ifndef YYMAXDEPTH
836 # define YYMAXDEPTH 10000
837 #endif
841 #if YYERROR_VERBOSE
843 # ifndef yystrlen
844 # if defined __GLIBC__ && defined _STRING_H
845 # define yystrlen strlen
846 # else
847 /* Return the length of YYSTR. */
848 #if (defined __STDC__ || defined __C99__FUNC__ \
849 || defined __cplusplus || defined _MSC_VER)
850 static YYSIZE_T
851 yystrlen (const char *yystr)
852 #else
853 static YYSIZE_T
854 yystrlen (yystr)
855 const char *yystr;
856 #endif
858 YYSIZE_T yylen;
859 for (yylen = 0; yystr[yylen]; yylen++)
860 continue;
861 return yylen;
863 # endif
864 # endif
866 # ifndef yystpcpy
867 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
868 # define yystpcpy stpcpy
869 # else
870 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
871 YYDEST. */
872 #if (defined __STDC__ || defined __C99__FUNC__ \
873 || defined __cplusplus || defined _MSC_VER)
874 static char *
875 yystpcpy (char *yydest, const char *yysrc)
876 #else
877 static char *
878 yystpcpy (yydest, yysrc)
879 char *yydest;
880 const char *yysrc;
881 #endif
883 char *yyd = yydest;
884 const char *yys = yysrc;
886 while ((*yyd++ = *yys++) != '\0')
887 continue;
889 return yyd - 1;
891 # endif
892 # endif
894 # ifndef yytnamerr
895 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
896 quotes and backslashes, so that it's suitable for yyerror. The
897 heuristic is that double-quoting is unnecessary unless the string
898 contains an apostrophe, a comma, or backslash (other than
899 backslash-backslash). YYSTR is taken from yytname. If YYRES is
900 null, do not copy; instead, return the length of what the result
901 would have been. */
902 static YYSIZE_T
903 yytnamerr (char *yyres, const char *yystr)
905 if (*yystr == '"')
907 YYSIZE_T yyn = 0;
908 char const *yyp = yystr;
910 for (;;)
911 switch (*++yyp)
913 case '\'':
914 case ',':
915 goto do_not_strip_quotes;
917 case '\\':
918 if (*++yyp != '\\')
919 goto do_not_strip_quotes;
920 /* Fall through. */
921 default:
922 if (yyres)
923 yyres[yyn] = *yyp;
924 yyn++;
925 break;
927 case '"':
928 if (yyres)
929 yyres[yyn] = '\0';
930 return yyn;
932 do_not_strip_quotes: ;
935 if (! yyres)
936 return yystrlen (yystr);
938 return yystpcpy (yyres, yystr) - yyres;
940 # endif
942 /* Copy into YYRESULT an error message about the unexpected token
943 YYCHAR while in state YYSTATE. Return the number of bytes copied,
944 including the terminating null byte. If YYRESULT is null, do not
945 copy anything; just return the number of bytes that would be
946 copied. As a special case, return 0 if an ordinary "syntax error"
947 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
948 size calculation. */
949 static YYSIZE_T
950 yysyntax_error (char *yyresult, int yystate, int yychar)
952 int yyn = yypact[yystate];
954 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
955 return 0;
956 else
958 int yytype = YYTRANSLATE (yychar);
959 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
960 YYSIZE_T yysize = yysize0;
961 YYSIZE_T yysize1;
962 int yysize_overflow = 0;
963 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
964 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
965 int yyx;
967 # if 0
968 /* This is so xgettext sees the translatable formats that are
969 constructed on the fly. */
970 YY_("syntax error, unexpected %s");
971 YY_("syntax error, unexpected %s, expecting %s");
972 YY_("syntax error, unexpected %s, expecting %s or %s");
973 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
974 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
975 # endif
976 char *yyfmt;
977 char const *yyf;
978 static char const yyunexpected[] = "syntax error, unexpected %s";
979 static char const yyexpecting[] = ", expecting %s";
980 static char const yyor[] = " or %s";
981 char yyformat[sizeof yyunexpected
982 + sizeof yyexpecting - 1
983 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
984 * (sizeof yyor - 1))];
985 char const *yyprefix = yyexpecting;
987 /* Start YYX at -YYN if negative to avoid negative indexes in
988 YYCHECK. */
989 int yyxbegin = yyn < 0 ? -yyn : 0;
991 /* Stay within bounds of both yycheck and yytname. */
992 int yychecklim = YYLAST - yyn + 1;
993 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
994 int yycount = 1;
996 yyarg[0] = yytname[yytype];
997 yyfmt = yystpcpy (yyformat, yyunexpected);
999 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1000 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1002 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1004 yycount = 1;
1005 yysize = yysize0;
1006 yyformat[sizeof yyunexpected - 1] = '\0';
1007 break;
1009 yyarg[yycount++] = yytname[yyx];
1010 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1011 yysize_overflow |= (yysize1 < yysize);
1012 yysize = yysize1;
1013 yyfmt = yystpcpy (yyfmt, yyprefix);
1014 yyprefix = yyor;
1017 yyf = YY_(yyformat);
1018 yysize1 = yysize + yystrlen (yyf);
1019 yysize_overflow |= (yysize1 < yysize);
1020 yysize = yysize1;
1022 if (yysize_overflow)
1023 return YYSIZE_MAXIMUM;
1025 if (yyresult)
1027 /* Avoid sprintf, as that infringes on the user's name space.
1028 Don't have undefined behavior even if the translation
1029 produced a string with the wrong number of "%s"s. */
1030 char *yyp = yyresult;
1031 int yyi = 0;
1032 while ((*yyp = *yyf) != '\0')
1034 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1036 yyp += yytnamerr (yyp, yyarg[yyi++]);
1037 yyf += 2;
1039 else
1041 yyp++;
1042 yyf++;
1046 return yysize;
1049 #endif /* YYERROR_VERBOSE */
1052 /*-----------------------------------------------.
1053 | Release the memory associated to this symbol. |
1054 `-----------------------------------------------*/
1056 /*ARGSUSED*/
1057 #if (defined __STDC__ || defined __C99__FUNC__ \
1058 || defined __cplusplus || defined _MSC_VER)
1059 static void
1060 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1061 #else
1062 static void
1063 yydestruct (yymsg, yytype, yyvaluep)
1064 const char *yymsg;
1065 int yytype;
1066 YYSTYPE *yyvaluep;
1067 #endif
1069 YYUSE (yyvaluep);
1071 if (!yymsg)
1072 yymsg = "Deleting";
1073 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1075 switch (yytype)
1078 default:
1079 break;
1084 /* Prevent warnings from -Wmissing-prototypes. */
1086 #ifdef YYPARSE_PARAM
1087 #if defined __STDC__ || defined __cplusplus
1088 int yyparse (void *YYPARSE_PARAM);
1089 #else
1090 int yyparse ();
1091 #endif
1092 #else /* ! YYPARSE_PARAM */
1093 #if defined __STDC__ || defined __cplusplus
1094 int yyparse (void);
1095 #else
1096 int yyparse ();
1097 #endif
1098 #endif /* ! YYPARSE_PARAM */
1102 /* The look-ahead symbol. */
1103 int yychar;
1105 /* The semantic value of the look-ahead symbol. */
1106 YYSTYPE yylval;
1108 /* Number of syntax errors so far. */
1109 int yynerrs;
1113 /*----------.
1114 | yyparse. |
1115 `----------*/
1117 #ifdef YYPARSE_PARAM
1118 #if (defined __STDC__ || defined __C99__FUNC__ \
1119 || defined __cplusplus || defined _MSC_VER)
1121 yyparse (void *YYPARSE_PARAM)
1122 #else
1124 yyparse (YYPARSE_PARAM)
1125 void *YYPARSE_PARAM;
1126 #endif
1127 #else /* ! YYPARSE_PARAM */
1128 #if (defined __STDC__ || defined __C99__FUNC__ \
1129 || defined __cplusplus || defined _MSC_VER)
1131 yyparse (void)
1132 #else
1134 yyparse ()
1136 #endif
1137 #endif
1140 int yystate;
1141 int yyn;
1142 int yyresult;
1143 /* Number of tokens to shift before error messages enabled. */
1144 int yyerrstatus;
1145 /* Look-ahead token as an internal (translated) token number. */
1146 int yytoken = 0;
1147 #if YYERROR_VERBOSE
1148 /* Buffer for error messages, and its allocated size. */
1149 char yymsgbuf[128];
1150 char *yymsg = yymsgbuf;
1151 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1152 #endif
1154 /* Three stacks and their tools:
1155 `yyss': related to states,
1156 `yyvs': related to semantic values,
1157 `yyls': related to locations.
1159 Refer to the stacks thru separate pointers, to allow yyoverflow
1160 to reallocate them elsewhere. */
1162 /* The state stack. */
1163 yytype_int16 yyssa[YYINITDEPTH];
1164 yytype_int16 *yyss = yyssa;
1165 yytype_int16 *yyssp;
1167 /* The semantic value stack. */
1168 YYSTYPE yyvsa[YYINITDEPTH];
1169 YYSTYPE *yyvs = yyvsa;
1170 YYSTYPE *yyvsp;
1174 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1176 YYSIZE_T yystacksize = YYINITDEPTH;
1178 /* The variables used to return semantic value and location from the
1179 action routines. */
1180 YYSTYPE yyval;
1183 /* The number of symbols on the RHS of the reduced rule.
1184 Keep to zero when no symbol should be popped. */
1185 int yylen = 0;
1187 YYDPRINTF ((stderr, "Starting parse\n"));
1189 yystate = 0;
1190 yyerrstatus = 0;
1191 yynerrs = 0;
1192 yychar = YYEMPTY; /* Cause a token to be read. */
1194 /* Initialize stack pointers.
1195 Waste one element of value and location stack
1196 so that they stay on the same level as the state stack.
1197 The wasted elements are never initialized. */
1199 yyssp = yyss;
1200 yyvsp = yyvs;
1202 goto yysetstate;
1204 /*------------------------------------------------------------.
1205 | yynewstate -- Push a new state, which is found in yystate. |
1206 `------------------------------------------------------------*/
1207 yynewstate:
1208 /* In all cases, when you get here, the value and location stacks
1209 have just been pushed. So pushing a state here evens the stacks. */
1210 yyssp++;
1212 yysetstate:
1213 *yyssp = yystate;
1215 if (yyss + yystacksize - 1 <= yyssp)
1217 /* Get the current used size of the three stacks, in elements. */
1218 YYSIZE_T yysize = yyssp - yyss + 1;
1220 #ifdef yyoverflow
1222 /* Give user a chance to reallocate the stack. Use copies of
1223 these so that the &'s don't force the real ones into
1224 memory. */
1225 YYSTYPE *yyvs1 = yyvs;
1226 yytype_int16 *yyss1 = yyss;
1229 /* Each stack pointer address is followed by the size of the
1230 data in use in that stack, in bytes. This used to be a
1231 conditional around just the two extra args, but that might
1232 be undefined if yyoverflow is a macro. */
1233 yyoverflow (YY_("memory exhausted"),
1234 &yyss1, yysize * sizeof (*yyssp),
1235 &yyvs1, yysize * sizeof (*yyvsp),
1237 &yystacksize);
1239 yyss = yyss1;
1240 yyvs = yyvs1;
1242 #else /* no yyoverflow */
1243 # ifndef YYSTACK_RELOCATE
1244 goto yyexhaustedlab;
1245 # else
1246 /* Extend the stack our own way. */
1247 if (YYMAXDEPTH <= yystacksize)
1248 goto yyexhaustedlab;
1249 yystacksize *= 2;
1250 if (YYMAXDEPTH < yystacksize)
1251 yystacksize = YYMAXDEPTH;
1254 yytype_int16 *yyss1 = yyss;
1255 union yyalloc *yyptr =
1256 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1257 if (! yyptr)
1258 goto yyexhaustedlab;
1259 YYSTACK_RELOCATE (yyss);
1260 YYSTACK_RELOCATE (yyvs);
1262 # undef YYSTACK_RELOCATE
1263 if (yyss1 != yyssa)
1264 YYSTACK_FREE (yyss1);
1266 # endif
1267 #endif /* no yyoverflow */
1269 yyssp = yyss + yysize - 1;
1270 yyvsp = yyvs + yysize - 1;
1273 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1274 (unsigned long int) yystacksize));
1276 if (yyss + yystacksize - 1 <= yyssp)
1277 YYABORT;
1280 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1282 goto yybackup;
1284 /*-----------.
1285 | yybackup. |
1286 `-----------*/
1287 yybackup:
1289 /* Do appropriate processing given the current state. Read a
1290 look-ahead token if we need one and don't already have one. */
1292 /* First try to decide what to do without reference to look-ahead token. */
1293 yyn = yypact[yystate];
1294 if (yyn == YYPACT_NINF)
1295 goto yydefault;
1297 /* Not known => get a look-ahead token if don't already have one. */
1299 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1300 if (yychar == YYEMPTY)
1302 YYDPRINTF ((stderr, "Reading a token: "));
1303 yychar = YYLEX;
1306 if (yychar <= YYEOF)
1308 yychar = yytoken = YYEOF;
1309 YYDPRINTF ((stderr, "Now at end of input.\n"));
1311 else
1313 yytoken = YYTRANSLATE (yychar);
1314 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1317 /* If the proper action on seeing token YYTOKEN is to reduce or to
1318 detect an error, take that action. */
1319 yyn += yytoken;
1320 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1321 goto yydefault;
1322 yyn = yytable[yyn];
1323 if (yyn <= 0)
1325 if (yyn == 0 || yyn == YYTABLE_NINF)
1326 goto yyerrlab;
1327 yyn = -yyn;
1328 goto yyreduce;
1331 if (yyn == YYFINAL)
1332 YYACCEPT;
1334 /* Count tokens shifted since error; after three, turn off error
1335 status. */
1336 if (yyerrstatus)
1337 yyerrstatus--;
1339 /* Shift the look-ahead token. */
1340 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1342 /* Discard the shifted token unless it is eof. */
1343 if (yychar != YYEOF)
1344 yychar = YYEMPTY;
1346 yystate = yyn;
1347 *++yyvsp = yylval;
1349 goto yynewstate;
1352 /*-----------------------------------------------------------.
1353 | yydefault -- do the default action for the current state. |
1354 `-----------------------------------------------------------*/
1355 yydefault:
1356 yyn = yydefact[yystate];
1357 if (yyn == 0)
1358 goto yyerrlab;
1359 goto yyreduce;
1362 /*-----------------------------.
1363 | yyreduce -- Do a reduction. |
1364 `-----------------------------*/
1365 yyreduce:
1366 /* yyn is the number of a rule to reduce with. */
1367 yylen = yyr2[yyn];
1369 /* If YYLEN is nonzero, implement the default value of the action:
1370 `$$ = $1'.
1372 Otherwise, the following line sets YYVAL to garbage.
1373 This behavior is undocumented and Bison
1374 users should not rely upon it. Assigning to YYVAL
1375 unconditionally makes the parser a bit smaller, and it avoids a
1376 GCC warning that YYVAL may be used uninitialized. */
1377 yyval = yyvsp[1-yylen];
1380 YY_REDUCE_PRINT (yyn);
1381 switch (yyn)
1383 case 6:
1384 #line 73 "heimdal/lib/com_err/parse.y"
1386 id_str = (yyvsp[(2) - (2)].string);
1388 break;
1390 case 7:
1391 #line 79 "heimdal/lib/com_err/parse.y"
1393 base_id = name2number((yyvsp[(2) - (2)].string));
1394 strlcpy(name, (yyvsp[(2) - (2)].string), sizeof(name));
1395 free((yyvsp[(2) - (2)].string));
1397 break;
1399 case 8:
1400 #line 85 "heimdal/lib/com_err/parse.y"
1402 base_id = name2number((yyvsp[(2) - (3)].string));
1403 strlcpy(name, (yyvsp[(3) - (3)].string), sizeof(name));
1404 free((yyvsp[(2) - (3)].string));
1405 free((yyvsp[(3) - (3)].string));
1407 break;
1409 case 11:
1410 #line 98 "heimdal/lib/com_err/parse.y"
1412 number = (yyvsp[(2) - (2)].number);
1414 break;
1416 case 12:
1417 #line 102 "heimdal/lib/com_err/parse.y"
1419 free(prefix);
1420 asprintf (&prefix, "%s_", (yyvsp[(2) - (2)].string));
1421 if (prefix == NULL)
1422 errx(1, "malloc");
1423 free((yyvsp[(2) - (2)].string));
1425 break;
1427 case 13:
1428 #line 110 "heimdal/lib/com_err/parse.y"
1430 prefix = realloc(prefix, 1);
1431 if (prefix == NULL)
1432 errx(1, "malloc");
1433 *prefix = '\0';
1435 break;
1437 case 14:
1438 #line 117 "heimdal/lib/com_err/parse.y"
1440 struct error_code *ec = malloc(sizeof(*ec));
1442 if (ec == NULL)
1443 errx(1, "malloc");
1445 ec->next = NULL;
1446 ec->number = number;
1447 if(prefix && *prefix != '\0') {
1448 asprintf (&ec->name, "%s%s", prefix, (yyvsp[(2) - (4)].string));
1449 if (ec->name == NULL)
1450 errx(1, "malloc");
1451 free((yyvsp[(2) - (4)].string));
1452 } else
1453 ec->name = (yyvsp[(2) - (4)].string);
1454 ec->string = (yyvsp[(4) - (4)].string);
1455 APPEND(codes, ec);
1456 number++;
1458 break;
1460 case 15:
1461 #line 137 "heimdal/lib/com_err/parse.y"
1463 YYACCEPT;
1465 break;
1468 /* Line 1267 of yacc.c. */
1469 #line 1470 "heimdal/lib/com_err/parse.y"
1470 default: break;
1472 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1474 YYPOPSTACK (yylen);
1475 yylen = 0;
1476 YY_STACK_PRINT (yyss, yyssp);
1478 *++yyvsp = yyval;
1481 /* Now `shift' the result of the reduction. Determine what state
1482 that goes to, based on the state we popped back to and the rule
1483 number reduced by. */
1485 yyn = yyr1[yyn];
1487 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1488 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1489 yystate = yytable[yystate];
1490 else
1491 yystate = yydefgoto[yyn - YYNTOKENS];
1493 goto yynewstate;
1496 /*------------------------------------.
1497 | yyerrlab -- here on detecting error |
1498 `------------------------------------*/
1499 yyerrlab:
1500 /* If not already recovering from an error, report this error. */
1501 if (!yyerrstatus)
1503 ++yynerrs;
1504 #if ! YYERROR_VERBOSE
1505 yyerror (YY_("syntax error"));
1506 #else
1508 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1509 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1511 YYSIZE_T yyalloc = 2 * yysize;
1512 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
1513 yyalloc = YYSTACK_ALLOC_MAXIMUM;
1514 if (yymsg != yymsgbuf)
1515 YYSTACK_FREE (yymsg);
1516 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
1517 if (yymsg)
1518 yymsg_alloc = yyalloc;
1519 else
1521 yymsg = yymsgbuf;
1522 yymsg_alloc = sizeof yymsgbuf;
1526 if (0 < yysize && yysize <= yymsg_alloc)
1528 (void) yysyntax_error (yymsg, yystate, yychar);
1529 yyerror (yymsg);
1531 else
1533 yyerror (YY_("syntax error"));
1534 if (yysize != 0)
1535 goto yyexhaustedlab;
1538 #endif
1543 if (yyerrstatus == 3)
1545 /* If just tried and failed to reuse look-ahead token after an
1546 error, discard it. */
1548 if (yychar <= YYEOF)
1550 /* Return failure if at end of input. */
1551 if (yychar == YYEOF)
1552 YYABORT;
1554 else
1556 yydestruct ("Error: discarding",
1557 yytoken, &yylval);
1558 yychar = YYEMPTY;
1562 /* Else will try to reuse look-ahead token after shifting the error
1563 token. */
1564 goto yyerrlab1;
1567 /*---------------------------------------------------.
1568 | yyerrorlab -- error raised explicitly by YYERROR. |
1569 `---------------------------------------------------*/
1570 yyerrorlab:
1572 /* Pacify compilers like GCC when the user code never invokes
1573 YYERROR and the label yyerrorlab therefore never appears in user
1574 code. */
1575 if (/*CONSTCOND*/ 0)
1576 goto yyerrorlab;
1578 /* Do not reclaim the symbols of the rule which action triggered
1579 this YYERROR. */
1580 YYPOPSTACK (yylen);
1581 yylen = 0;
1582 YY_STACK_PRINT (yyss, yyssp);
1583 yystate = *yyssp;
1584 goto yyerrlab1;
1587 /*-------------------------------------------------------------.
1588 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1589 `-------------------------------------------------------------*/
1590 yyerrlab1:
1591 yyerrstatus = 3; /* Each real token shifted decrements this. */
1593 for (;;)
1595 yyn = yypact[yystate];
1596 if (yyn != YYPACT_NINF)
1598 yyn += YYTERROR;
1599 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1601 yyn = yytable[yyn];
1602 if (0 < yyn)
1603 break;
1607 /* Pop the current state because it cannot handle the error token. */
1608 if (yyssp == yyss)
1609 YYABORT;
1612 yydestruct ("Error: popping",
1613 yystos[yystate], yyvsp);
1614 YYPOPSTACK (1);
1615 yystate = *yyssp;
1616 YY_STACK_PRINT (yyss, yyssp);
1619 if (yyn == YYFINAL)
1620 YYACCEPT;
1622 *++yyvsp = yylval;
1625 /* Shift the error token. */
1626 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1628 yystate = yyn;
1629 goto yynewstate;
1632 /*-------------------------------------.
1633 | yyacceptlab -- YYACCEPT comes here. |
1634 `-------------------------------------*/
1635 yyacceptlab:
1636 yyresult = 0;
1637 goto yyreturn;
1639 /*-----------------------------------.
1640 | yyabortlab -- YYABORT comes here. |
1641 `-----------------------------------*/
1642 yyabortlab:
1643 yyresult = 1;
1644 goto yyreturn;
1646 #ifndef yyoverflow
1647 /*-------------------------------------------------.
1648 | yyexhaustedlab -- memory exhaustion comes here. |
1649 `-------------------------------------------------*/
1650 yyexhaustedlab:
1651 yyerror (YY_("memory exhausted"));
1652 yyresult = 2;
1653 /* Fall through. */
1654 #endif
1656 yyreturn:
1657 if (yychar != YYEOF && yychar != YYEMPTY)
1658 yydestruct ("Cleanup: discarding lookahead",
1659 yytoken, &yylval);
1660 /* Do not reclaim the symbols of the rule which action triggered
1661 this YYABORT or YYACCEPT. */
1662 YYPOPSTACK (yylen);
1663 YY_STACK_PRINT (yyss, yyssp);
1664 while (yyssp != yyss)
1666 yydestruct ("Cleanup: popping",
1667 yystos[*yyssp], yyvsp);
1668 YYPOPSTACK (1);
1670 #ifndef yyoverflow
1671 if (yyss != yyssa)
1672 YYSTACK_FREE (yyss);
1673 #endif
1674 #if YYERROR_VERBOSE
1675 if (yymsg != yymsgbuf)
1676 YYSTACK_FREE (yymsg);
1677 #endif
1678 /* Make sure YYID is used. */
1679 return YYID (yyresult);
1683 #line 142 "heimdal/lib/com_err/parse.y"
1686 static long
1687 name2number(const char *str)
1689 const char *p;
1690 long num = 0;
1691 const char *x = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
1692 "abcdefghijklmnopqrstuvwxyz0123456789_";
1693 if(strlen(str) > 4) {
1694 yyerror("table name too long");
1695 return 0;
1697 for(p = str; *p; p++){
1698 char *q = strchr(x, *p);
1699 if(q == NULL) {
1700 yyerror("invalid character in table name");
1701 return 0;
1703 num = (num << 6) + (q - x) + 1;
1705 num <<= 8;
1706 if(num > 0x7fffffff)
1707 num = -(0xffffffff - num + 1);
1708 return num;
1711 void
1712 yyerror (char *s)
1714 error_message ("%s\n", s);