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