source: heimdal/trunk/lib/com_err/parse.c

Last change on this file was 1, checked in by Paul Smedley, 10 years ago

Initial commit of Heimdal 1.5.3

File size: 44.5 KB
Line 
1/* A Bison parser, made by GNU Bison 2.3. */
2
3/* Skeleton implementation for Bison's Yacc-like parsers in C
4
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
22
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.
32
33 This special exception was added by the Free Software Foundation in
34 version 2.2 of Bison. */
35
36/* C LALR(1) parser skeleton written by Richard Stallman, by
37 simplifying the original so-called "semantic" parser. */
38
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. */
45
46/* Identify Bison output. */
47#define YYBISON 1
48
49/* Bison version. */
50#define YYBISON_VERSION "2.3"
51
52/* Skeleton name. */
53#define YYSKELETON_NAME "yacc.c"
54
55/* Pure parsers. */
56#define YYPURE 0
57
58/* Using locations. */
59#define YYLSP_NEEDED 0
60
61
62
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
77 };
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
88
89
90
91
92/* Copy the first part of user declarations. */
93#line 1 "parse.y"
94
95/*
96 * Copyright (c) 1998 - 2000 Kungliga Tekniska Högskolan
97 * (Royal Institute of Technology, Stockholm, Sweden).
98 * All rights reserved.
99 *
100 * Redistribution and use in source and binary forms, with or without
101 * modification, are permitted provided that the following conditions
102 * are met:
103 *
104 * 1. Redistributions of source code must retain the above copyright
105 * notice, this list of conditions and the following disclaimer.
106 *
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.
110 *
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.
114 *
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.
126 */
127
128#include "compile_et.h"
129#include "lex.h"
130
131void yyerror (char *s);
132static long name2number(const char *str);
133
134extern char *yytext;
135
136/* This is for bison */
137
138#if !defined(alloca) && !defined(HAVE_ALLOCA)
139#define alloca(x) malloc(x)
140#endif
141
142#define YYMALLOC malloc
143#define YYFREE free
144
145
146
147/* Enabling traces. */
148#ifndef YYDEBUG
149# define YYDEBUG 0
150#endif
151
152/* Enabling verbose error messages. */
153#ifdef YYERROR_VERBOSE
154# undef YYERROR_VERBOSE
155# define YYERROR_VERBOSE 1
156#else
157# define YYERROR_VERBOSE 0
158#endif
159
160/* Enabling the token table. */
161#ifndef YYTOKEN_TABLE
162# define YYTOKEN_TABLE 0
163#endif
164
165#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
166typedef union YYSTYPE
167#line 54 "parse.y"
168{
169 char *string;
170 int number;
171}
172/* Line 193 of yacc.c. */
173#line 174 "parse.c"
174 YYSTYPE;
175# define yystype YYSTYPE /* obsolescent; will be withdrawn */
176# define YYSTYPE_IS_DECLARED 1
177# define YYSTYPE_IS_TRIVIAL 1
178#endif
179
180
181
182/* Copy the second part of user declarations. */
183
184
185/* Line 216 of yacc.c. */
186#line 187 "parse.c"
187
188#ifdef short
189# undef short
190#endif
191
192#ifdef YYTYPE_UINT8
193typedef YYTYPE_UINT8 yytype_uint8;
194#else
195typedef unsigned char yytype_uint8;
196#endif
197
198#ifdef YYTYPE_INT8
199typedef YYTYPE_INT8 yytype_int8;
200#elif (defined __STDC__ || defined __C99__FUNC__ \
201 || defined __cplusplus || defined _MSC_VER)
202typedef signed char yytype_int8;
203#else
204typedef short int yytype_int8;
205#endif
206
207#ifdef YYTYPE_UINT16
208typedef YYTYPE_UINT16 yytype_uint16;
209#else
210typedef unsigned short int yytype_uint16;
211#endif
212
213#ifdef YYTYPE_INT16
214typedef YYTYPE_INT16 yytype_int16;
215#else
216typedef short int yytype_int16;
217#endif
218
219#ifndef YYSIZE_T
220# ifdef __SIZE_TYPE__
221# define YYSIZE_T __SIZE_TYPE__
222# elif defined size_t
223# define YYSIZE_T size_t
224# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
225 || defined __cplusplus || defined _MSC_VER)
226# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
227# define YYSIZE_T size_t
228# else
229# define YYSIZE_T unsigned int
230# endif
231#endif
232
233#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
234
235#ifndef YY_
236# if defined YYENABLE_NLS && YYENABLE_NLS
237# if ENABLE_NLS
238# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
239# define YY_(msgid) dgettext ("bison-runtime", msgid)
240# endif
241# endif
242# ifndef YY_
243# define YY_(msgid) msgid
244# endif
245#endif
246
247/* Suppress unused-variable warnings by "using" E. */
248#if ! defined lint || defined __GNUC__
249# define YYUSE(e) ((void) (e))
250#else
251# define YYUSE(e) /* empty */
252#endif
253
254/* Identity function, used to suppress warnings about constant conditions. */
255#ifndef lint
256# define YYID(n) (n)
257#else
258#if (defined __STDC__ || defined __C99__FUNC__ \
259 || defined __cplusplus || defined _MSC_VER)
260static int
261YYID (int i)
262#else
263static int
264YYID (i)
265 int i;
266#endif
267{
268 return i;
269}
270#endif
271
272#if ! defined yyoverflow || YYERROR_VERBOSE
273
274/* The parser invokes alloca or malloc; define the necessary symbols. */
275
276# ifdef YYSTACK_USE_ALLOCA
277# if YYSTACK_USE_ALLOCA
278# ifdef __GNUC__
279# define YYSTACK_ALLOC __builtin_alloca
280# elif defined __BUILTIN_VA_ARG_INCR
281# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
282# elif defined _AIX
283# define YYSTACK_ALLOC __alloca
284# elif defined _MSC_VER
285# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
286# define alloca _alloca
287# else
288# define YYSTACK_ALLOC alloca
289# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
290 || defined __cplusplus || defined _MSC_VER)
291# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
292# ifndef _STDLIB_H
293# define _STDLIB_H 1
294# endif
295# endif
296# endif
297# endif
298# endif
299
300# ifdef YYSTACK_ALLOC
301 /* Pacify GCC's `empty if-body' warning. */
302# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
303# ifndef YYSTACK_ALLOC_MAXIMUM
304 /* The OS might guarantee only one guard page at the bottom of the stack,
305 and a page size can be as small as 4096 bytes. So we cannot safely
306 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
307 to allow for a few compiler-allocated temporary stack slots. */
308# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
309# endif
310# else
311# define YYSTACK_ALLOC YYMALLOC
312# define YYSTACK_FREE YYFREE
313# ifndef YYSTACK_ALLOC_MAXIMUM
314# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
315# endif
316# if (defined __cplusplus && ! defined _STDLIB_H \
317 && ! ((defined YYMALLOC || defined malloc) \
318 && (defined YYFREE || defined free)))
319# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
320# ifndef _STDLIB_H
321# define _STDLIB_H 1
322# endif
323# endif
324# ifndef YYMALLOC
325# define YYMALLOC malloc
326# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
327 || defined __cplusplus || defined _MSC_VER)
328void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
329# endif
330# endif
331# ifndef YYFREE
332# define YYFREE free
333# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
334 || defined __cplusplus || defined _MSC_VER)
335void free (void *); /* INFRINGES ON USER NAME SPACE */
336# endif
337# endif
338# endif
339#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
340
341
342#if (! defined yyoverflow \
343 && (! defined __cplusplus \
344 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
345
346/* A type that is properly aligned for any stack member. */
347union yyalloc
348{
349 yytype_int16 yyss;
350 YYSTYPE yyvs;
351 };
352
353/* The size of the maximum gap between one aligned stack and the next. */
354# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
355
356/* The size of an array large to enough to hold all stacks, each with
357 N elements. */
358# define YYSTACK_BYTES(N) \
359 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
360 + YYSTACK_GAP_MAXIMUM)
361
362/* Copy COUNT objects from FROM to TO. The source and destination do
363 not overlap. */
364# ifndef YYCOPY
365# if defined __GNUC__ && 1 < __GNUC__
366# define YYCOPY(To, From, Count) \
367 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
368# else
369# define YYCOPY(To, From, Count) \
370 do \
371 { \
372 YYSIZE_T yyi; \
373 for (yyi = 0; yyi < (Count); yyi++) \
374 (To)[yyi] = (From)[yyi]; \
375 } \
376 while (YYID (0))
377# endif
378# endif
379
380/* Relocate STACK from its old location to the new one. The
381 local variables YYSIZE and YYSTACKSIZE give the old and new number of
382 elements in the stack, and YYPTR gives the new location of the
383 stack. Advance YYPTR to a properly aligned location for the next
384 stack. */
385# define YYSTACK_RELOCATE(Stack) \
386 do \
387 { \
388 YYSIZE_T yynewbytes; \
389 YYCOPY (&yyptr->Stack, Stack, yysize); \
390 Stack = &yyptr->Stack; \
391 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
392 yyptr += yynewbytes / sizeof (*yyptr); \
393 } \
394 while (YYID (0))
395
396#endif
397
398/* YYFINAL -- State number of the termination state. */
399#define YYFINAL 9
400/* YYLAST -- Last index in YYTABLE. */
401#define YYLAST 23
402
403/* YYNTOKENS -- Number of terminals. */
404#define YYNTOKENS 12
405/* YYNNTS -- Number of nonterminals. */
406#define YYNNTS 7
407/* YYNRULES -- Number of rules. */
408#define YYNRULES 15
409/* YYNRULES -- Number of states. */
410#define YYNSTATES 24
411
412/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
413#define YYUNDEFTOK 2
414#define YYMAXUTOK 265
415
416#define YYTRANSLATE(YYX) \
417 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
418
419/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
420static const yytype_uint8 yytranslate[] =
421{
422 0, 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, 2, 2, 2, 2, 2, 2,
426 2, 2, 2, 2, 11, 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, 2, 2, 2, 2,
447 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
448 5, 6, 7, 8, 9, 10
449};
450
451#if YYDEBUG
452/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
453 YYRHS. */
454static const yytype_uint8 yyprhs[] =
455{
456 0, 0, 3, 4, 7, 10, 12, 15, 18, 22,
457 24, 27, 30, 33, 35, 40
458};
459
460/* YYRHS -- A `-1'-separated list of the rules' RHS. */
461static const yytype_int8 yyrhs[] =
462{
463 13, 0, -1, -1, 14, 17, -1, 15, 16, -1,
464 16, -1, 7, 9, -1, 3, 9, -1, 3, 9,
465 9, -1, 18, -1, 17, 18, -1, 4, 10, -1,
466 5, 9, -1, 5, -1, 6, 9, 11, 9, -1,
467 8, -1
468};
469
470/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
471static const yytype_uint8 yyrline[] =
472{
473 0, 65, 65, 66, 69, 70, 73, 79, 85, 94,
474 95, 98, 102, 110, 117, 137
475};
476#endif
477
478#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
479/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
480 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
481static const char *const yytname[] =
482{
483 "$end", "error", "$undefined", "ET", "INDEX", "PREFIX", "EC", "ID",
484 "END", "STRING", "NUMBER", "','", "$accept", "file", "header", "id",
485 "et", "statements", "statement", 0
486};
487#endif
488
489# ifdef YYPRINT
490/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
491 token YYLEX-NUM. */
492static const yytype_uint16 yytoknum[] =
493{
494 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
495 265, 44
496};
497# endif
498
499/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
500static const yytype_uint8 yyr1[] =
501{
502 0, 12, 13, 13, 14, 14, 15, 16, 16, 17,
503 17, 18, 18, 18, 18, 18
504};
505
506/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
507static const yytype_uint8 yyr2[] =
508{
509 0, 2, 0, 2, 2, 1, 2, 2, 3, 1,
510 2, 2, 2, 1, 4, 1
511};
512
513/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
514 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
515 means the default is an error. */
516static const yytype_uint8 yydefact[] =
517{
518 2, 0, 0, 0, 0, 0, 5, 7, 6, 1,
519 0, 13, 0, 15, 3, 9, 4, 8, 11, 12,
520 0, 10, 0, 14
521};
522
523/* YYDEFGOTO[NTERM-NUM]. */
524static const yytype_int8 yydefgoto[] =
525{
526 -1, 3, 4, 5, 6, 14, 15
527};
528
529/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
530 STATE-NUM. */
531#define YYPACT_NINF -5
532static const yytype_int8 yypact[] =
533{
534 0, -3, -1, 5, -4, 6, -5, 1, -5, -5,
535 2, 4, 7, -5, -4, -5, -5, -5, -5, -5,
536 3, -5, 8, -5
537};
538
539/* YYPGOTO[NTERM-NUM]. */
540static const yytype_int8 yypgoto[] =
541{
542 -5, -5, -5, -5, 10, -5, 9
543};
544
545/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
546 positive, shift that token. If negative, reduce the rule which
547 number is the opposite. If zero, do what YYDEFACT says.
548 If YYTABLE_NINF, syntax error. */
549#define YYTABLE_NINF -1
550static const yytype_uint8 yytable[] =
551{
552 10, 11, 12, 1, 13, 9, 7, 2, 8, 1,
553 17, 0, 18, 19, 22, 16, 20, 23, 0, 0,
554 0, 0, 0, 21
555};
556
557static const yytype_int8 yycheck[] =
558{
559 4, 5, 6, 3, 8, 0, 9, 7, 9, 3,
560 9, -1, 10, 9, 11, 5, 9, 9, -1, -1,
561 -1, -1, -1, 14
562};
563
564/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
565 symbol of state STATE-NUM. */
566static const yytype_uint8 yystos[] =
567{
568 0, 3, 7, 13, 14, 15, 16, 9, 9, 0,
569 4, 5, 6, 8, 17, 18, 16, 9, 10, 9,
570 9, 18, 11, 9
571};
572
573#define yyerrok (yyerrstatus = 0)
574#define yyclearin (yychar = YYEMPTY)
575#define YYEMPTY (-2)
576#define YYEOF 0
577
578#define YYACCEPT goto yyacceptlab
579#define YYABORT goto yyabortlab
580#define YYERROR goto yyerrorlab
581
582
583/* Like YYERROR except do call yyerror. This remains here temporarily
584 to ease the transition to the new meaning of YYERROR, for GCC.
585 Once GCC version 2 has supplanted version 1, this can go. */
586
587#define YYFAIL goto yyerrlab
588
589#define YYRECOVERING() (!!yyerrstatus)
590
591#define YYBACKUP(Token, Value) \
592do \
593 if (yychar == YYEMPTY && yylen == 1) \
594 { \
595 yychar = (Token); \
596 yylval = (Value); \
597 yytoken = YYTRANSLATE (yychar); \
598 YYPOPSTACK (1); \
599 goto yybackup; \
600 } \
601 else \
602 { \
603 yyerror (YY_("syntax error: cannot back up")); \
604 YYERROR; \
605 } \
606while (YYID (0))
607
608
609#define YYTERROR 1
610#define YYERRCODE 256
611
612
613/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
614 If N is 0, then set CURRENT to the empty location which ends
615 the previous symbol: RHS[0] (always defined). */
616
617#define YYRHSLOC(Rhs, K) ((Rhs)[K])
618#ifndef YYLLOC_DEFAULT
619# define YYLLOC_DEFAULT(Current, Rhs, N) \
620 do \
621 if (YYID (N)) \
622 { \
623 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
624 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
625 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
626 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
627 } \
628 else \
629 { \
630 (Current).first_line = (Current).last_line = \
631 YYRHSLOC (Rhs, 0).last_line; \
632 (Current).first_column = (Current).last_column = \
633 YYRHSLOC (Rhs, 0).last_column; \
634 } \
635 while (YYID (0))
636#endif
637
638
639/* YY_LOCATION_PRINT -- Print the location on the stream.
640 This macro was not mandated originally: define only if we know
641 we won't break user code: when these are the locations we know. */
642
643#ifndef YY_LOCATION_PRINT
644# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
645# define YY_LOCATION_PRINT(File, Loc) \
646 fprintf (File, "%d.%d-%d.%d", \
647 (Loc).first_line, (Loc).first_column, \
648 (Loc).last_line, (Loc).last_column)
649# else
650# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
651# endif
652#endif
653
654
655/* YYLEX -- calling `yylex' with the right arguments. */
656
657#ifdef YYLEX_PARAM
658# define YYLEX yylex (YYLEX_PARAM)
659#else
660# define YYLEX yylex ()
661#endif
662
663/* Enable debugging if requested. */
664#if YYDEBUG
665
666# ifndef YYFPRINTF
667# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
668# define YYFPRINTF fprintf
669# endif
670
671# define YYDPRINTF(Args) \
672do { \
673 if (yydebug) \
674 YYFPRINTF Args; \
675} while (YYID (0))
676
677# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
678do { \
679 if (yydebug) \
680 { \
681 YYFPRINTF (stderr, "%s ", Title); \
682 yy_symbol_print (stderr, \
683 Type, Value); \
684 YYFPRINTF (stderr, "\n"); \
685 } \
686} while (YYID (0))
687
688
689/*--------------------------------.
690| Print this symbol on YYOUTPUT. |
691`--------------------------------*/
692
693/*ARGSUSED*/
694#if (defined __STDC__ || defined __C99__FUNC__ \
695 || defined __cplusplus || defined _MSC_VER)
696static void
697yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
698#else
699static void
700yy_symbol_value_print (yyoutput, yytype, yyvaluep)
701 FILE *yyoutput;
702 int yytype;
703 YYSTYPE const * const yyvaluep;
704#endif
705{
706 if (!yyvaluep)
707 return;
708# ifdef YYPRINT
709 if (yytype < YYNTOKENS)
710 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
711# else
712 YYUSE (yyoutput);
713# endif
714 switch (yytype)
715 {
716 default:
717 break;
718 }
719}
720
721
722/*--------------------------------.
723| Print this symbol on YYOUTPUT. |
724`--------------------------------*/
725
726#if (defined __STDC__ || defined __C99__FUNC__ \
727 || defined __cplusplus || defined _MSC_VER)
728static void
729yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
730#else
731static void
732yy_symbol_print (yyoutput, yytype, yyvaluep)
733 FILE *yyoutput;
734 int yytype;
735 YYSTYPE const * const yyvaluep;
736#endif
737{
738 if (yytype < YYNTOKENS)
739 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
740 else
741 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
742
743 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
744 YYFPRINTF (yyoutput, ")");
745}
746
747/*------------------------------------------------------------------.
748| yy_stack_print -- Print the state stack from its BOTTOM up to its |
749| TOP (included). |
750`------------------------------------------------------------------*/
751
752#if (defined __STDC__ || defined __C99__FUNC__ \
753 || defined __cplusplus || defined _MSC_VER)
754static void
755yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
756#else
757static void
758yy_stack_print (bottom, top)
759 yytype_int16 *bottom;
760 yytype_int16 *top;
761#endif
762{
763 YYFPRINTF (stderr, "Stack now");
764 for (; bottom <= top; ++bottom)
765 YYFPRINTF (stderr, " %d", *bottom);
766 YYFPRINTF (stderr, "\n");
767}
768
769# define YY_STACK_PRINT(Bottom, Top) \
770do { \
771 if (yydebug) \
772 yy_stack_print ((Bottom), (Top)); \
773} while (YYID (0))
774
775
776/*------------------------------------------------.
777| Report that the YYRULE is going to be reduced. |
778`------------------------------------------------*/
779
780#if (defined __STDC__ || defined __C99__FUNC__ \
781 || defined __cplusplus || defined _MSC_VER)
782static void
783yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
784#else
785static void
786yy_reduce_print (yyvsp, yyrule)
787 YYSTYPE *yyvsp;
788 int yyrule;
789#endif
790{
791 int yynrhs = yyr2[yyrule];
792 int yyi;
793 unsigned long int yylno = yyrline[yyrule];
794 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
795 yyrule - 1, yylno);
796 /* The symbols being reduced. */
797 for (yyi = 0; yyi < yynrhs; yyi++)
798 {
799 fprintf (stderr, " $%d = ", yyi + 1);
800 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
801 &(yyvsp[(yyi + 1) - (yynrhs)])
802 );
803 fprintf (stderr, "\n");
804 }
805}
806
807# define YY_REDUCE_PRINT(Rule) \
808do { \
809 if (yydebug) \
810 yy_reduce_print (yyvsp, Rule); \
811} while (YYID (0))
812
813/* Nonzero means print parse trace. It is left uninitialized so that
814 multiple parsers can coexist. */
815int yydebug;
816#else /* !YYDEBUG */
817# define YYDPRINTF(Args)
818# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
819# define YY_STACK_PRINT(Bottom, Top)
820# define YY_REDUCE_PRINT(Rule)
821#endif /* !YYDEBUG */
822
823
824/* YYINITDEPTH -- initial size of the parser's stacks. */
825#ifndef YYINITDEPTH
826# define YYINITDEPTH 200
827#endif
828
829/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
830 if the built-in stack extension method is used).
831
832 Do not make this value too large; the results are undefined if
833 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
834 evaluated with infinite-precision integer arithmetic. */
835
836#ifndef YYMAXDEPTH
837# define YYMAXDEPTH 10000
838#endif
839
840
841
842
843#if YYERROR_VERBOSE
844
845# ifndef yystrlen
846# if defined __GLIBC__ && defined _STRING_H
847# define yystrlen strlen
848# else
849/* Return the length of YYSTR. */
850#if (defined __STDC__ || defined __C99__FUNC__ \
851 || defined __cplusplus || defined _MSC_VER)
852static YYSIZE_T
853yystrlen (const char *yystr)
854#else
855static YYSIZE_T
856yystrlen (yystr)
857 const char *yystr;
858#endif
859{
860 YYSIZE_T yylen;
861 for (yylen = 0; yystr[yylen]; yylen++)
862 continue;
863 return yylen;
864}
865# endif
866# endif
867
868# ifndef yystpcpy
869# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
870# define yystpcpy stpcpy
871# else
872/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
873 YYDEST. */
874#if (defined __STDC__ || defined __C99__FUNC__ \
875 || defined __cplusplus || defined _MSC_VER)
876static char *
877yystpcpy (char *yydest, const char *yysrc)
878#else
879static char *
880yystpcpy (yydest, yysrc)
881 char *yydest;
882 const char *yysrc;
883#endif
884{
885 char *yyd = yydest;
886 const char *yys = yysrc;
887
888 while ((*yyd++ = *yys++) != '\0')
889 continue;
890
891 return yyd - 1;
892}
893# endif
894# endif
895
896# ifndef yytnamerr
897/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
898 quotes and backslashes, so that it's suitable for yyerror. The
899 heuristic is that double-quoting is unnecessary unless the string
900 contains an apostrophe, a comma, or backslash (other than
901 backslash-backslash). YYSTR is taken from yytname. If YYRES is
902 null, do not copy; instead, return the length of what the result
903 would have been. */
904static YYSIZE_T
905yytnamerr (char *yyres, const char *yystr)
906{
907 if (*yystr == '"')
908 {
909 YYSIZE_T yyn = 0;
910 char const *yyp = yystr;
911
912 for (;;)
913 switch (*++yyp)
914 {
915 case '\'':
916 case ',':
917 goto do_not_strip_quotes;
918
919 case '\\':
920 if (*++yyp != '\\')
921 goto do_not_strip_quotes;
922 /* Fall through. */
923 default:
924 if (yyres)
925 yyres[yyn] = *yyp;
926 yyn++;
927 break;
928
929 case '"':
930 if (yyres)
931 yyres[yyn] = '\0';
932 return yyn;
933 }
934 do_not_strip_quotes: ;
935 }
936
937 if (! yyres)
938 return yystrlen (yystr);
939
940 return yystpcpy (yyres, yystr) - yyres;
941}
942# endif
943
944/* Copy into YYRESULT an error message about the unexpected token
945 YYCHAR while in state YYSTATE. Return the number of bytes copied,
946 including the terminating null byte. If YYRESULT is null, do not
947 copy anything; just return the number of bytes that would be
948 copied. As a special case, return 0 if an ordinary "syntax error"
949 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
950 size calculation. */
951static YYSIZE_T
952yysyntax_error (char *yyresult, int yystate, int yychar)
953{
954 int yyn = yypact[yystate];
955
956 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
957 return 0;
958 else
959 {
960 int yytype = YYTRANSLATE (yychar);
961 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
962 YYSIZE_T yysize = yysize0;
963 YYSIZE_T yysize1;
964 int yysize_overflow = 0;
965 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
966 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
967 int yyx;
968
969# if 0
970 /* This is so xgettext sees the translatable formats that are
971 constructed on the fly. */
972 YY_("syntax error, unexpected %s");
973 YY_("syntax error, unexpected %s, expecting %s");
974 YY_("syntax error, unexpected %s, expecting %s or %s");
975 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
976 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
977# endif
978 char *yyfmt;
979 char const *yyf;
980 static char const yyunexpected[] = "syntax error, unexpected %s";
981 static char const yyexpecting[] = ", expecting %s";
982 static char const yyor[] = " or %s";
983 char yyformat[sizeof yyunexpected
984 + sizeof yyexpecting - 1
985 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
986 * (sizeof yyor - 1))];
987 char const *yyprefix = yyexpecting;
988
989 /* Start YYX at -YYN if negative to avoid negative indexes in
990 YYCHECK. */
991 int yyxbegin = yyn < 0 ? -yyn : 0;
992
993 /* Stay within bounds of both yycheck and yytname. */
994 int yychecklim = YYLAST - yyn + 1;
995 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
996 int yycount = 1;
997
998 yyarg[0] = yytname[yytype];
999 yyfmt = yystpcpy (yyformat, yyunexpected);
1000
1001 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1002 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1003 {
1004 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1005 {
1006 yycount = 1;
1007 yysize = yysize0;
1008 yyformat[sizeof yyunexpected - 1] = '\0';
1009 break;
1010 }
1011 yyarg[yycount++] = yytname[yyx];
1012 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1013 yysize_overflow |= (yysize1 < yysize);
1014 yysize = yysize1;
1015 yyfmt = yystpcpy (yyfmt, yyprefix);
1016 yyprefix = yyor;
1017 }
1018
1019 yyf = YY_(yyformat);
1020 yysize1 = yysize + yystrlen (yyf);
1021 yysize_overflow |= (yysize1 < yysize);
1022 yysize = yysize1;
1023
1024 if (yysize_overflow)
1025 return YYSIZE_MAXIMUM;
1026
1027 if (yyresult)
1028 {
1029 /* Avoid sprintf, as that infringes on the user's name space.
1030 Don't have undefined behavior even if the translation
1031 produced a string with the wrong number of "%s"s. */
1032 char *yyp = yyresult;
1033 int yyi = 0;
1034 while ((*yyp = *yyf) != '\0')
1035 {
1036 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1037 {
1038 yyp += yytnamerr (yyp, yyarg[yyi++]);
1039 yyf += 2;
1040 }
1041 else
1042 {
1043 yyp++;
1044 yyf++;
1045 }
1046 }
1047 }
1048 return yysize;
1049 }
1050}
1051#endif /* YYERROR_VERBOSE */
1052
1053
1054
1055/*-----------------------------------------------.
1056| Release the memory associated to this symbol. |
1057`-----------------------------------------------*/
1058
1059/*ARGSUSED*/
1060#if (defined __STDC__ || defined __C99__FUNC__ \
1061 || defined __cplusplus || defined _MSC_VER)
1062static void
1063yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1064#else
1065static void
1066yydestruct (yymsg, yytype, yyvaluep)
1067 const char *yymsg;
1068 int yytype;
1069 YYSTYPE *yyvaluep;
1070#endif
1071{
1072 YYUSE (yyvaluep);
1073
1074 if (!yymsg)
1075 yymsg = "Deleting";
1076 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1077
1078 switch (yytype)
1079 {
1080
1081 default:
1082 break;
1083 }
1084}
1085
1086
1087
1088/* Prevent warnings from -Wmissing-prototypes. */
1089
1090#ifdef YYPARSE_PARAM
1091#if defined __STDC__ || defined __cplusplus
1092int yyparse (void *YYPARSE_PARAM);
1093#else
1094int yyparse ();
1095#endif
1096#else /* ! YYPARSE_PARAM */
1097#if defined __STDC__ || defined __cplusplus
1098int yyparse (void);
1099#else
1100int yyparse ();
1101#endif
1102#endif /* ! YYPARSE_PARAM */
1103
1104
1105
1106/* The look-ahead symbol. */
1107int yychar;
1108
1109/* The semantic value of the look-ahead symbol. */
1110YYSTYPE yylval;
1111
1112/* Number of syntax errors so far. */
1113int yynerrs;
1114
1115
1116
1117/*----------.
1118| yyparse. |
1119`----------*/
1120
1121#ifdef YYPARSE_PARAM
1122#if (defined __STDC__ || defined __C99__FUNC__ \
1123 || defined __cplusplus || defined _MSC_VER)
1124int
1125yyparse (void *YYPARSE_PARAM)
1126#else
1127int
1128yyparse (YYPARSE_PARAM)
1129 void *YYPARSE_PARAM;
1130#endif
1131#else /* ! YYPARSE_PARAM */
1132#if (defined __STDC__ || defined __C99__FUNC__ \
1133 || defined __cplusplus || defined _MSC_VER)
1134int
1135yyparse (void)
1136#else
1137int
1138yyparse ()
1139
1140#endif
1141#endif
1142{
1143
1144 int yystate;
1145 int yyn;
1146 int yyresult;
1147 /* Number of tokens to shift before error messages enabled. */
1148 int yyerrstatus;
1149 /* Look-ahead token as an internal (translated) token number. */
1150 int yytoken = 0;
1151#if YYERROR_VERBOSE
1152 /* Buffer for error messages, and its allocated size. */
1153 char yymsgbuf[128];
1154 char *yymsg = yymsgbuf;
1155 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1156#endif
1157
1158 /* Three stacks and their tools:
1159 `yyss': related to states,
1160 `yyvs': related to semantic values,
1161 `yyls': related to locations.
1162
1163 Refer to the stacks thru separate pointers, to allow yyoverflow
1164 to reallocate them elsewhere. */
1165
1166 /* The state stack. */
1167 yytype_int16 yyssa[YYINITDEPTH];
1168 yytype_int16 *yyss = yyssa;
1169 yytype_int16 *yyssp;
1170
1171 /* The semantic value stack. */
1172 YYSTYPE yyvsa[YYINITDEPTH];
1173 YYSTYPE *yyvs = yyvsa;
1174 YYSTYPE *yyvsp;
1175
1176
1177
1178#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1179
1180 YYSIZE_T yystacksize = YYINITDEPTH;
1181
1182 /* The variables used to return semantic value and location from the
1183 action routines. */
1184 YYSTYPE yyval;
1185
1186
1187 /* The number of symbols on the RHS of the reduced rule.
1188 Keep to zero when no symbol should be popped. */
1189 int yylen = 0;
1190
1191 YYDPRINTF ((stderr, "Starting parse\n"));
1192
1193 yystate = 0;
1194 yyerrstatus = 0;
1195 yynerrs = 0;
1196 yychar = YYEMPTY; /* Cause a token to be read. */
1197
1198 /* Initialize stack pointers.
1199 Waste one element of value and location stack
1200 so that they stay on the same level as the state stack.
1201 The wasted elements are never initialized. */
1202
1203 yyssp = yyss;
1204 yyvsp = yyvs;
1205
1206 goto yysetstate;
1207
1208/*------------------------------------------------------------.
1209| yynewstate -- Push a new state, which is found in yystate. |
1210`------------------------------------------------------------*/
1211 yynewstate:
1212 /* In all cases, when you get here, the value and location stacks
1213 have just been pushed. So pushing a state here evens the stacks. */
1214 yyssp++;
1215
1216 yysetstate:
1217 *yyssp = yystate;
1218
1219 if (yyss + yystacksize - 1 <= yyssp)
1220 {
1221 /* Get the current used size of the three stacks, in elements. */
1222 YYSIZE_T yysize = yyssp - yyss + 1;
1223
1224#ifdef yyoverflow
1225 {
1226 /* Give user a chance to reallocate the stack. Use copies of
1227 these so that the &'s don't force the real ones into
1228 memory. */
1229 YYSTYPE *yyvs1 = yyvs;
1230 yytype_int16 *yyss1 = yyss;
1231
1232
1233 /* Each stack pointer address is followed by the size of the
1234 data in use in that stack, in bytes. This used to be a
1235 conditional around just the two extra args, but that might
1236 be undefined if yyoverflow is a macro. */
1237 yyoverflow (YY_("memory exhausted"),
1238 &yyss1, yysize * sizeof (*yyssp),
1239 &yyvs1, yysize * sizeof (*yyvsp),
1240
1241 &yystacksize);
1242
1243 yyss = yyss1;
1244 yyvs = yyvs1;
1245 }
1246#else /* no yyoverflow */
1247# ifndef YYSTACK_RELOCATE
1248 goto yyexhaustedlab;
1249# else
1250 /* Extend the stack our own way. */
1251 if (YYMAXDEPTH <= yystacksize)
1252 goto yyexhaustedlab;
1253 yystacksize *= 2;
1254 if (YYMAXDEPTH < yystacksize)
1255 yystacksize = YYMAXDEPTH;
1256
1257 {
1258 yytype_int16 *yyss1 = yyss;
1259 union yyalloc *yyptr =
1260 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1261 if (! yyptr)
1262 goto yyexhaustedlab;
1263 YYSTACK_RELOCATE (yyss);
1264 YYSTACK_RELOCATE (yyvs);
1265
1266# undef YYSTACK_RELOCATE
1267 if (yyss1 != yyssa)
1268 YYSTACK_FREE (yyss1);
1269 }
1270# endif
1271#endif /* no yyoverflow */
1272
1273 yyssp = yyss + yysize - 1;
1274 yyvsp = yyvs + yysize - 1;
1275
1276
1277 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1278 (unsigned long int) yystacksize));
1279
1280 if (yyss + yystacksize - 1 <= yyssp)
1281 YYABORT;
1282 }
1283
1284 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1285
1286 goto yybackup;
1287
1288/*-----------.
1289| yybackup. |
1290`-----------*/
1291yybackup:
1292
1293 /* Do appropriate processing given the current state. Read a
1294 look-ahead token if we need one and don't already have one. */
1295
1296 /* First try to decide what to do without reference to look-ahead token. */
1297 yyn = yypact[yystate];
1298 if (yyn == YYPACT_NINF)
1299 goto yydefault;
1300
1301 /* Not known => get a look-ahead token if don't already have one. */
1302
1303 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1304 if (yychar == YYEMPTY)
1305 {
1306 YYDPRINTF ((stderr, "Reading a token: "));
1307 yychar = YYLEX;
1308 }
1309
1310 if (yychar <= YYEOF)
1311 {
1312 yychar = yytoken = YYEOF;
1313 YYDPRINTF ((stderr, "Now at end of input.\n"));
1314 }
1315 else
1316 {
1317 yytoken = YYTRANSLATE (yychar);
1318 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1319 }
1320
1321 /* If the proper action on seeing token YYTOKEN is to reduce or to
1322 detect an error, take that action. */
1323 yyn += yytoken;
1324 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1325 goto yydefault;
1326 yyn = yytable[yyn];
1327 if (yyn <= 0)
1328 {
1329 if (yyn == 0 || yyn == YYTABLE_NINF)
1330 goto yyerrlab;
1331 yyn = -yyn;
1332 goto yyreduce;
1333 }
1334
1335 if (yyn == YYFINAL)
1336 YYACCEPT;
1337
1338 /* Count tokens shifted since error; after three, turn off error
1339 status. */
1340 if (yyerrstatus)
1341 yyerrstatus--;
1342
1343 /* Shift the look-ahead token. */
1344 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1345
1346 /* Discard the shifted token unless it is eof. */
1347 if (yychar != YYEOF)
1348 yychar = YYEMPTY;
1349
1350 yystate = yyn;
1351 *++yyvsp = yylval;
1352
1353 goto yynewstate;
1354
1355
1356/*-----------------------------------------------------------.
1357| yydefault -- do the default action for the current state. |
1358`-----------------------------------------------------------*/
1359yydefault:
1360 yyn = yydefact[yystate];
1361 if (yyn == 0)
1362 goto yyerrlab;
1363 goto yyreduce;
1364
1365
1366/*-----------------------------.
1367| yyreduce -- Do a reduction. |
1368`-----------------------------*/
1369yyreduce:
1370 /* yyn is the number of a rule to reduce with. */
1371 yylen = yyr2[yyn];
1372
1373 /* If YYLEN is nonzero, implement the default value of the action:
1374 `$$ = $1'.
1375
1376 Otherwise, the following line sets YYVAL to garbage.
1377 This behavior is undocumented and Bison
1378 users should not rely upon it. Assigning to YYVAL
1379 unconditionally makes the parser a bit smaller, and it avoids a
1380 GCC warning that YYVAL may be used uninitialized. */
1381 yyval = yyvsp[1-yylen];
1382
1383
1384 YY_REDUCE_PRINT (yyn);
1385 switch (yyn)
1386 {
1387 case 6:
1388#line 74 "parse.y"
1389 {
1390 id_str = (yyvsp[(2) - (2)].string);
1391 }
1392 break;
1393
1394 case 7:
1395#line 80 "parse.y"
1396 {
1397 base_id = name2number((yyvsp[(2) - (2)].string));
1398 strlcpy(name, (yyvsp[(2) - (2)].string), sizeof(name));
1399 free((yyvsp[(2) - (2)].string));
1400 }
1401 break;
1402
1403 case 8:
1404#line 86 "parse.y"
1405 {
1406 base_id = name2number((yyvsp[(2) - (3)].string));
1407 strlcpy(name, (yyvsp[(3) - (3)].string), sizeof(name));
1408 free((yyvsp[(2) - (3)].string));
1409 free((yyvsp[(3) - (3)].string));
1410 }
1411 break;
1412
1413 case 11:
1414#line 99 "parse.y"
1415 {
1416 number = (yyvsp[(2) - (2)].number);
1417 }
1418 break;
1419
1420 case 12:
1421#line 103 "parse.y"
1422 {
1423 free(prefix);
1424 asprintf (&prefix, "%s_", (yyvsp[(2) - (2)].string));
1425 if (prefix == NULL)
1426 errx(1, "malloc");
1427 free((yyvsp[(2) - (2)].string));
1428 }
1429 break;
1430
1431 case 13:
1432#line 111 "parse.y"
1433 {
1434 prefix = realloc(prefix, 1);
1435 if (prefix == NULL)
1436 errx(1, "malloc");
1437 *prefix = '\0';
1438 }
1439 break;
1440
1441 case 14:
1442#line 118 "parse.y"
1443 {
1444 struct error_code *ec = malloc(sizeof(*ec));
1445
1446 if (ec == NULL)
1447 errx(1, "malloc");
1448
1449 ec->next = NULL;
1450 ec->number = number;
1451 if(prefix && *prefix != '\0') {
1452 asprintf (&ec->name, "%s%s", prefix, (yyvsp[(2) - (4)].string));
1453 if (ec->name == NULL)
1454 errx(1, "malloc");
1455 free((yyvsp[(2) - (4)].string));
1456 } else
1457 ec->name = (yyvsp[(2) - (4)].string);
1458 ec->string = (yyvsp[(4) - (4)].string);
1459 APPEND(codes, ec);
1460 number++;
1461 }
1462 break;
1463
1464 case 15:
1465#line 138 "parse.y"
1466 {
1467 YYACCEPT;
1468 }
1469 break;
1470
1471
1472/* Line 1267 of yacc.c. */
1473#line 1471 "parse.c"
1474 default: break;
1475 }
1476 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1477
1478 YYPOPSTACK (yylen);
1479 yylen = 0;
1480 YY_STACK_PRINT (yyss, yyssp);
1481
1482 *++yyvsp = yyval;
1483
1484
1485 /* Now `shift' the result of the reduction. Determine what state
1486 that goes to, based on the state we popped back to and the rule
1487 number reduced by. */
1488
1489 yyn = yyr1[yyn];
1490
1491 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1492 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1493 yystate = yytable[yystate];
1494 else
1495 yystate = yydefgoto[yyn - YYNTOKENS];
1496
1497 goto yynewstate;
1498
1499
1500/*------------------------------------.
1501| yyerrlab -- here on detecting error |
1502`------------------------------------*/
1503yyerrlab:
1504 /* If not already recovering from an error, report this error. */
1505 if (!yyerrstatus)
1506 {
1507 ++yynerrs;
1508#if ! YYERROR_VERBOSE
1509 yyerror (YY_("syntax error"));
1510#else
1511 {
1512 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1513 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1514 {
1515 YYSIZE_T yyalloc = 2 * yysize;
1516 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
1517 yyalloc = YYSTACK_ALLOC_MAXIMUM;
1518 if (yymsg != yymsgbuf)
1519 YYSTACK_FREE (yymsg);
1520 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
1521 if (yymsg)
1522 yymsg_alloc = yyalloc;
1523 else
1524 {
1525 yymsg = yymsgbuf;
1526 yymsg_alloc = sizeof yymsgbuf;
1527 }
1528 }
1529
1530 if (0 < yysize && yysize <= yymsg_alloc)
1531 {
1532 (void) yysyntax_error (yymsg, yystate, yychar);
1533 yyerror (yymsg);
1534 }
1535 else
1536 {
1537 yyerror (YY_("syntax error"));
1538 if (yysize != 0)
1539 goto yyexhaustedlab;
1540 }
1541 }
1542#endif
1543 }
1544
1545
1546
1547 if (yyerrstatus == 3)
1548 {
1549 /* If just tried and failed to reuse look-ahead token after an
1550 error, discard it. */
1551
1552 if (yychar <= YYEOF)
1553 {
1554 /* Return failure if at end of input. */
1555 if (yychar == YYEOF)
1556 YYABORT;
1557 }
1558 else
1559 {
1560 yydestruct ("Error: discarding",
1561 yytoken, &yylval);
1562 yychar = YYEMPTY;
1563 }
1564 }
1565
1566 /* Else will try to reuse look-ahead token after shifting the error
1567 token. */
1568 goto yyerrlab1;
1569
1570
1571/*---------------------------------------------------.
1572| yyerrorlab -- error raised explicitly by YYERROR. |
1573`---------------------------------------------------*/
1574yyerrorlab:
1575
1576 /* Pacify compilers like GCC when the user code never invokes
1577 YYERROR and the label yyerrorlab therefore never appears in user
1578 code. */
1579 if (/*CONSTCOND*/ 0)
1580 goto yyerrorlab;
1581
1582 /* Do not reclaim the symbols of the rule which action triggered
1583 this YYERROR. */
1584 YYPOPSTACK (yylen);
1585 yylen = 0;
1586 YY_STACK_PRINT (yyss, yyssp);
1587 yystate = *yyssp;
1588 goto yyerrlab1;
1589
1590
1591/*-------------------------------------------------------------.
1592| yyerrlab1 -- common code for both syntax error and YYERROR. |
1593`-------------------------------------------------------------*/
1594yyerrlab1:
1595 yyerrstatus = 3; /* Each real token shifted decrements this. */
1596
1597 for (;;)
1598 {
1599 yyn = yypact[yystate];
1600 if (yyn != YYPACT_NINF)
1601 {
1602 yyn += YYTERROR;
1603 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1604 {
1605 yyn = yytable[yyn];
1606 if (0 < yyn)
1607 break;
1608 }
1609 }
1610
1611 /* Pop the current state because it cannot handle the error token. */
1612 if (yyssp == yyss)
1613 YYABORT;
1614
1615
1616 yydestruct ("Error: popping",
1617 yystos[yystate], yyvsp);
1618 YYPOPSTACK (1);
1619 yystate = *yyssp;
1620 YY_STACK_PRINT (yyss, yyssp);
1621 }
1622
1623 if (yyn == YYFINAL)
1624 YYACCEPT;
1625
1626 *++yyvsp = yylval;
1627
1628
1629 /* Shift the error token. */
1630 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1631
1632 yystate = yyn;
1633 goto yynewstate;
1634
1635
1636/*-------------------------------------.
1637| yyacceptlab -- YYACCEPT comes here. |
1638`-------------------------------------*/
1639yyacceptlab:
1640 yyresult = 0;
1641 goto yyreturn;
1642
1643/*-----------------------------------.
1644| yyabortlab -- YYABORT comes here. |
1645`-----------------------------------*/
1646yyabortlab:
1647 yyresult = 1;
1648 goto yyreturn;
1649
1650#ifndef yyoverflow
1651/*-------------------------------------------------.
1652| yyexhaustedlab -- memory exhaustion comes here. |
1653`-------------------------------------------------*/
1654yyexhaustedlab:
1655 yyerror (YY_("memory exhausted"));
1656 yyresult = 2;
1657 /* Fall through. */
1658#endif
1659
1660yyreturn:
1661 if (yychar != YYEOF && yychar != YYEMPTY)
1662 yydestruct ("Cleanup: discarding lookahead",
1663 yytoken, &yylval);
1664 /* Do not reclaim the symbols of the rule which action triggered
1665 this YYABORT or YYACCEPT. */
1666 YYPOPSTACK (yylen);
1667 YY_STACK_PRINT (yyss, yyssp);
1668 while (yyssp != yyss)
1669 {
1670 yydestruct ("Cleanup: popping",
1671 yystos[*yyssp], yyvsp);
1672 YYPOPSTACK (1);
1673 }
1674#ifndef yyoverflow
1675 if (yyss != yyssa)
1676 YYSTACK_FREE (yyss);
1677#endif
1678#if YYERROR_VERBOSE
1679 if (yymsg != yymsgbuf)
1680 YYSTACK_FREE (yymsg);
1681#endif
1682 /* Make sure YYID is used. */
1683 return YYID (yyresult);
1684}
1685
1686
1687#line 143 "parse.y"
1688
1689
1690static long
1691name2number(const char *str)
1692{
1693 const char *p;
1694 long num = 0;
1695 const char *x = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
1696 "abcdefghijklmnopqrstuvwxyz0123456789_";
1697 if(strlen(str) > 4) {
1698 yyerror("table name too long");
1699 return 0;
1700 }
1701 for(p = str; *p; p++){
1702 char *q = strchr(x, *p);
1703 if(q == NULL) {
1704 yyerror("invalid character in table name");
1705 return 0;
1706 }
1707 num = (num << 6) + (q - x) + 1;
1708 }
1709 num <<= 8;
1710 if(num > 0x7fffffff)
1711 num = -(0xffffffff - num + 1);
1712 return num;
1713}
1714
1715void
1716yyerror (char *s)
1717{
1718 _lex_error_message ("%s\n", s);
1719}
1720
Note: See TracBrowser for help on using the repository browser.