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