]> git.saurik.com Git - bison.git/blame_incremental - src/parse-gram.c
* data/glr.c (yyreportSyntaxError): Fix off-by-one error in
[bison.git] / src / parse-gram.c
... / ...
CommitLineData
1/* A Bison parser, made by GNU Bison 2.1b. */
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.1b"
51
52/* Skeleton name. */
53#define YYSKELETON_NAME "yacc.c"
54
55/* Pure parsers. */
56#define YYPURE 1
57
58/* Using locations. */
59#define YYLSP_NEEDED 1
60
61/* Substitute the variable and function names. */
62#define yyparse gram_parse
63#define yylex gram_lex
64#define yyerror gram_error
65#define yylval gram_lval
66#define yychar gram_char
67#define yydebug gram_debug
68#define yynerrs gram_nerrs
69#define yylloc gram_lloc
70
71/* Tokens. */
72#ifndef YYTOKENTYPE
73# define YYTOKENTYPE
74 /* Put the tokens into the symbol table, so that GDB and other debuggers
75 know about them. */
76 enum yytokentype {
77 GRAM_EOF = 0,
78 STRING = 258,
79 INT = 259,
80 PERCENT_TOKEN = 260,
81 PERCENT_NTERM = 261,
82 PERCENT_TYPE = 262,
83 PERCENT_DESTRUCTOR = 263,
84 PERCENT_PRINTER = 264,
85 PERCENT_UNION = 265,
86 PERCENT_LEFT = 266,
87 PERCENT_RIGHT = 267,
88 PERCENT_NONASSOC = 268,
89 PERCENT_PREC = 269,
90 PERCENT_DPREC = 270,
91 PERCENT_MERGE = 271,
92 PERCENT_DEBUG = 272,
93 PERCENT_DEFAULT_PREC = 273,
94 PERCENT_DEFINE = 274,
95 PERCENT_DEFINES = 275,
96 PERCENT_ERROR_VERBOSE = 276,
97 PERCENT_EXPECT = 277,
98 PERCENT_EXPECT_RR = 278,
99 PERCENT_FILE_PREFIX = 279,
100 PERCENT_GLR_PARSER = 280,
101 PERCENT_INITIAL_ACTION = 281,
102 PERCENT_LEX_PARAM = 282,
103 PERCENT_LOCATIONS = 283,
104 PERCENT_NAME_PREFIX = 284,
105 PERCENT_NO_DEFAULT_PREC = 285,
106 PERCENT_NO_LINES = 286,
107 PERCENT_NONDETERMINISTIC_PARSER = 287,
108 PERCENT_OUTPUT = 288,
109 PERCENT_PARSE_PARAM = 289,
110 PERCENT_PURE_PARSER = 290,
111 PERCENT_REQUIRE = 291,
112 PERCENT_SKELETON = 292,
113 PERCENT_START = 293,
114 PERCENT_TOKEN_TABLE = 294,
115 PERCENT_VERBOSE = 295,
116 PERCENT_YACC = 296,
117 TYPE = 297,
118 EQUAL = 298,
119 SEMICOLON = 299,
120 PIPE = 300,
121 ID = 301,
122 ID_COLON = 302,
123 PERCENT_PERCENT = 303,
124 PROLOGUE = 304,
125 EPILOGUE = 305,
126 BRACED_CODE = 306
127 };
128#endif
129/* Tokens. */
130#define GRAM_EOF 0
131#define STRING 258
132#define INT 259
133#define PERCENT_TOKEN 260
134#define PERCENT_NTERM 261
135#define PERCENT_TYPE 262
136#define PERCENT_DESTRUCTOR 263
137#define PERCENT_PRINTER 264
138#define PERCENT_UNION 265
139#define PERCENT_LEFT 266
140#define PERCENT_RIGHT 267
141#define PERCENT_NONASSOC 268
142#define PERCENT_PREC 269
143#define PERCENT_DPREC 270
144#define PERCENT_MERGE 271
145#define PERCENT_DEBUG 272
146#define PERCENT_DEFAULT_PREC 273
147#define PERCENT_DEFINE 274
148#define PERCENT_DEFINES 275
149#define PERCENT_ERROR_VERBOSE 276
150#define PERCENT_EXPECT 277
151#define PERCENT_EXPECT_RR 278
152#define PERCENT_FILE_PREFIX 279
153#define PERCENT_GLR_PARSER 280
154#define PERCENT_INITIAL_ACTION 281
155#define PERCENT_LEX_PARAM 282
156#define PERCENT_LOCATIONS 283
157#define PERCENT_NAME_PREFIX 284
158#define PERCENT_NO_DEFAULT_PREC 285
159#define PERCENT_NO_LINES 286
160#define PERCENT_NONDETERMINISTIC_PARSER 287
161#define PERCENT_OUTPUT 288
162#define PERCENT_PARSE_PARAM 289
163#define PERCENT_PURE_PARSER 290
164#define PERCENT_REQUIRE 291
165#define PERCENT_SKELETON 292
166#define PERCENT_START 293
167#define PERCENT_TOKEN_TABLE 294
168#define PERCENT_VERBOSE 295
169#define PERCENT_YACC 296
170#define TYPE 297
171#define EQUAL 298
172#define SEMICOLON 299
173#define PIPE 300
174#define ID 301
175#define ID_COLON 302
176#define PERCENT_PERCENT 303
177#define PROLOGUE 304
178#define EPILOGUE 305
179#define BRACED_CODE 306
180
181
182
183
184/* Copy the first part of user declarations. */
185#line 1 "../../src/parse-gram.y"
186/* Bison Grammar Parser -*- C -*-
187
188 Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
189
190 This file is part of Bison, the GNU Compiler Compiler.
191
192 This program is free software; you can redistribute it and/or modify
193 it under the terms of the GNU General Public License as published by
194 the Free Software Foundation; either version 2 of the License, or
195 (at your option) any later version.
196
197 This program is distributed in the hope that it will be useful,
198 but WITHOUT ANY WARRANTY; without even the implied warranty of
199 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
200 GNU General Public License for more details.
201
202 You should have received a copy of the GNU General Public License
203 along with this program; if not, write to the Free Software
204 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
205 02110-1301 USA
206*/
207
208#include <config.h>
209#include "system.h"
210
211#include "complain.h"
212#include "conflicts.h"
213#include "files.h"
214#include "getargs.h"
215#include "gram.h"
216#include "muscle_tab.h"
217#include "quotearg.h"
218#include "reader.h"
219#include "symlist.h"
220#include "strverscmp.h"
221
222#define YYLLOC_DEFAULT(Current, Rhs, N) (Current) = lloc_default (Rhs, N)
223static YYLTYPE lloc_default (YYLTYPE const *, int);
224
225#define YY_LOCATION_PRINT(File, Loc) \
226 location_print (File, Loc)
227
228static void version_check (location const *loc, char const *version);
229
230/* Request detailed syntax error messages, and pass them to GRAM_ERROR.
231 FIXME: depends on the undocumented availability of YYLLOC. */
232#undef yyerror
233#define yyerror(Msg) \
234 gram_error (&yylloc, Msg)
235static void gram_error (location const *, char const *);
236
237static void add_param (char const *, char *, location);
238
239static symbol_class current_class = unknown_sym;
240static uniqstr current_type = 0;
241static symbol *current_lhs;
242static location current_lhs_location;
243static int current_prec = 0;
244
245#ifdef UINT_FAST8_MAX
246# define YYTYPE_UINT8 uint_fast8_t
247#endif
248#ifdef INT_FAST8_MAX
249# define YYTYPE_INT8 int_fast8_t
250#endif
251#ifdef UINT_FAST16_MAX
252# define YYTYPE_UINT16 uint_fast16_t
253#endif
254#ifdef INT_FAST16_MAX
255# define YYTYPE_INT16 int_fast16_t
256#endif
257
258
259/* Enabling traces. */
260#ifndef YYDEBUG
261# define YYDEBUG 1
262#endif
263
264/* Enabling verbose error messages. */
265#ifdef YYERROR_VERBOSE
266# undef YYERROR_VERBOSE
267# define YYERROR_VERBOSE 1
268#else
269# define YYERROR_VERBOSE 1
270#endif
271
272/* Enabling the token table. */
273#ifndef YYTOKEN_TABLE
274# define YYTOKEN_TABLE 0
275#endif
276
277#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
278typedef union YYSTYPE
279#line 94 "../../src/parse-gram.y"
280{
281 symbol *symbol;
282 symbol_list *list;
283 int integer;
284 char *chars;
285 assoc assoc;
286 uniqstr uniqstr;
287}
288/* Line 193 of yacc.c. */
289#line 290 "../../src/parse-gram.c"
290 YYSTYPE;
291# define yystype YYSTYPE /* obsolescent; will be withdrawn */
292# define YYSTYPE_IS_DECLARED 1
293# define YYSTYPE_IS_TRIVIAL 1
294#endif
295
296#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
297typedef struct YYLTYPE
298{
299 int first_line;
300 int first_column;
301 int last_line;
302 int last_column;
303} YYLTYPE;
304# define yyltype YYLTYPE /* obsolescent; will be withdrawn */
305# define YYLTYPE_IS_DECLARED 1
306# define YYLTYPE_IS_TRIVIAL 1
307#endif
308
309
310/* Copy the second part of user declarations. */
311
312
313/* Line 216 of yacc.c. */
314#line 315 "../../src/parse-gram.c"
315
316#ifdef short
317# undef short
318#endif
319
320#ifdef YYTYPE_UINT8
321typedef YYTYPE_UINT8 yytype_uint8;
322#else
323typedef unsigned char yytype_uint8;
324#endif
325
326#ifdef YYTYPE_INT8
327typedef YYTYPE_INT8 yytype_int8;
328#elif (defined __STDC__ || defined __C99__FUNC__ \
329 || defined __cplusplus || defined _MSC_VER)
330typedef signed char yytype_int8;
331#else
332typedef short int yytype_int8;
333#endif
334
335#ifdef YYTYPE_UINT16
336typedef YYTYPE_UINT16 yytype_uint16;
337#else
338typedef unsigned short int yytype_uint16;
339#endif
340
341#ifdef YYTYPE_INT16
342typedef YYTYPE_INT16 yytype_int16;
343#else
344typedef short int yytype_int16;
345#endif
346
347#ifndef YYSIZE_T
348# ifdef __SIZE_TYPE__
349# define YYSIZE_T __SIZE_TYPE__
350# elif defined size_t
351# define YYSIZE_T size_t
352# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
353 || defined __cplusplus || defined _MSC_VER)
354# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
355# define YYSIZE_T size_t
356# else
357# define YYSIZE_T unsigned int
358# endif
359#endif
360
361#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
362
363#ifndef YY_
364# if YYENABLE_NLS
365# if ENABLE_NLS
366# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
367# define YY_(msgid) dgettext ("bison-runtime", msgid)
368# endif
369# endif
370# ifndef YY_
371# define YY_(msgid) msgid
372# endif
373#endif
374
375/* Suppress unused-variable warnings by "using" E. */
376#if ! defined lint || defined __GNUC__
377# define YYUSE(e) ((void) (e))
378#else
379# define YYUSE(e) /* empty */
380#endif
381
382/* Identity function, used to suppress warnings about constant conditions. */
383#ifndef lint
384# define YYID(n) (n)
385#else
386#if (defined __STDC__ || defined __C99__FUNC__ \
387 || defined __cplusplus || defined _MSC_VER)
388static int
389YYID (int i)
390#else
391static int
392YYID (i)
393 int i;
394#endif
395{
396 return i;
397}
398#endif
399
400#if ! defined yyoverflow || YYERROR_VERBOSE
401
402/* The parser invokes alloca or malloc; define the necessary symbols. */
403
404# ifdef YYSTACK_USE_ALLOCA
405# if YYSTACK_USE_ALLOCA
406# ifdef __GNUC__
407# define YYSTACK_ALLOC __builtin_alloca
408# elif defined __BUILTIN_VA_ARG_INCR
409# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
410# elif defined _AIX
411# define YYSTACK_ALLOC __alloca
412# elif defined _MSC_VER
413# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
414# define alloca _alloca
415# else
416# define YYSTACK_ALLOC alloca
417# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
418 || defined __cplusplus || defined _MSC_VER)
419# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
420# ifndef _STDLIB_H
421# define _STDLIB_H 1
422# endif
423# endif
424# endif
425# endif
426# endif
427
428# ifdef YYSTACK_ALLOC
429 /* Pacify GCC's `empty if-body' warning. */
430# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
431# ifndef YYSTACK_ALLOC_MAXIMUM
432 /* The OS might guarantee only one guard page at the bottom of the stack,
433 and a page size can be as small as 4096 bytes. So we cannot safely
434 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
435 to allow for a few compiler-allocated temporary stack slots. */
436# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
437# endif
438# else
439# define YYSTACK_ALLOC YYMALLOC
440# define YYSTACK_FREE YYFREE
441# ifndef YYSTACK_ALLOC_MAXIMUM
442# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
443# endif
444# if (defined __cplusplus && ! defined _STDLIB_H \
445 && ! ((defined YYMALLOC || defined malloc) \
446 && (defined YYFREE || defined free)))
447# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
448# ifndef _STDLIB_H
449# define _STDLIB_H 1
450# endif
451# endif
452# ifndef YYMALLOC
453# define YYMALLOC malloc
454# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
455 || defined __cplusplus || defined _MSC_VER)
456void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
457# endif
458# endif
459# ifndef YYFREE
460# define YYFREE free
461# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
462 || defined __cplusplus || defined _MSC_VER)
463void free (void *); /* INFRINGES ON USER NAME SPACE */
464# endif
465# endif
466# endif
467#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
468
469
470#if (! defined yyoverflow \
471 && (! defined __cplusplus \
472 || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
473 && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
474
475/* A type that is properly aligned for any stack member. */
476union yyalloc
477{
478 yytype_int16 yyss;
479 YYSTYPE yyvs;
480 YYLTYPE yyls;
481};
482
483/* The size of the maximum gap between one aligned stack and the next. */
484# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
485
486/* The size of an array large to enough to hold all stacks, each with
487 N elements. */
488# define YYSTACK_BYTES(N) \
489 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
490 + 2 * YYSTACK_GAP_MAXIMUM)
491
492/* Copy COUNT objects from FROM to TO. The source and destination do
493 not overlap. */
494# ifndef YYCOPY
495# if defined __GNUC__ && 1 < __GNUC__
496# define YYCOPY(To, From, Count) \
497 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
498# else
499# define YYCOPY(To, From, Count) \
500 do \
501 { \
502 YYSIZE_T yyi; \
503 for (yyi = 0; yyi < (Count); yyi++) \
504 (To)[yyi] = (From)[yyi]; \
505 } \
506 while (YYID (0))
507# endif
508# endif
509
510/* Relocate STACK from its old location to the new one. The
511 local variables YYSIZE and YYSTACKSIZE give the old and new number of
512 elements in the stack, and YYPTR gives the new location of the
513 stack. Advance YYPTR to a properly aligned location for the next
514 stack. */
515# define YYSTACK_RELOCATE(Stack) \
516 do \
517 { \
518 YYSIZE_T yynewbytes; \
519 YYCOPY (&yyptr->Stack, Stack, yysize); \
520 Stack = &yyptr->Stack; \
521 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
522 yyptr += yynewbytes / sizeof (*yyptr); \
523 } \
524 while (YYID (0))
525
526#endif
527
528/* YYFINAL -- State number of the termination state. */
529#define YYFINAL 3
530/* YYLAST -- Last index in YYTABLE. */
531#define YYLAST 161
532
533/* YYNTOKENS -- Number of terminals. */
534#define YYNTOKENS 52
535/* YYNNTS -- Number of nonterminals. */
536#define YYNNTS 26
537/* YYNRULES -- Number of rules. */
538#define YYNRULES 82
539/* YYNRULES -- Number of states. */
540#define YYNSTATES 111
541
542/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
543#define YYUNDEFTOK 2
544#define YYMAXUTOK 306
545
546#define YYTRANSLATE(YYX) \
547 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
548
549/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
550static const yytype_uint8 yytranslate[] =
551{
552 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
553 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
554 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
555 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
556 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
557 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
558 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
559 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
560 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
561 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
562 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
563 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
564 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
565 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
566 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
567 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
568 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
569 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
570 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
571 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
572 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
573 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
574 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
575 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
576 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
577 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
578 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
579 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
580 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
581 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
582 45, 46, 47, 48, 49, 50, 51
583};
584
585#if YYDEBUG
586/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
587 YYRHS. */
588static const yytype_uint8 yyprhs[] =
589{
590 0, 0, 3, 8, 9, 12, 14, 16, 18, 21,
591 25, 27, 29, 32, 35, 39, 41, 43, 45, 47,
592 51, 53, 55, 59, 61, 63, 66, 69, 71, 73,
593 75, 77, 79, 81, 84, 86, 89, 92, 94, 96,
594 97, 101, 102, 106, 110, 114, 116, 118, 120, 121,
595 123, 125, 128, 130, 132, 135, 138, 142, 144, 147,
596 149, 152, 154, 157, 160, 161, 165, 167, 171, 174,
597 175, 178, 181, 185, 189, 193, 195, 197, 198, 201,
598 203, 205, 206
599};
600
601/* YYRHS -- A `-1'-separated list of the rules' RHS. */
602static const yytype_int8 yyrhs[] =
603{
604 53, 0, -1, 54, 48, 66, 77, -1, -1, 54,
605 55, -1, 56, -1, 49, -1, 17, -1, 19, 76,
606 -1, 19, 76, 76, -1, 20, -1, 21, -1, 22,
607 4, -1, 23, 4, -1, 24, 43, 76, -1, 25,
608 -1, 26, -1, 27, -1, 28, -1, 29, 43, 76,
609 -1, 31, -1, 32, -1, 33, 43, 76, -1, 34,
610 -1, 35, -1, 36, 76, -1, 37, 76, -1, 39,
611 -1, 40, -1, 41, -1, 44, -1, 60, -1, 57,
612 -1, 38, 72, -1, 10, -1, 8, 63, -1, 9,
613 63, -1, 18, -1, 30, -1, -1, 6, 58, 65,
614 -1, -1, 5, 59, 65, -1, 7, 42, 63, -1,
615 61, 62, 63, -1, 11, -1, 12, -1, 13, -1,
616 -1, 42, -1, 72, -1, 63, 72, -1, 42, -1,
617 46, -1, 46, 4, -1, 46, 75, -1, 46, 4,
618 75, -1, 64, -1, 65, 64, -1, 67, -1, 66,
619 67, -1, 68, -1, 56, 44, -1, 1, 44, -1,
620 -1, 47, 69, 70, -1, 71, -1, 70, 45, 71,
621 -1, 70, 44, -1, -1, 71, 72, -1, 71, 73,
622 -1, 71, 14, 72, -1, 71, 15, 4, -1, 71,
623 16, 42, -1, 46, -1, 75, -1, -1, 74, 51,
624 -1, 3, -1, 3, -1, -1, 48, 50, -1
625};
626
627/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
628static const yytype_uint16 yyrline[] =
629{
630 0, 202, 202, 210, 212, 216, 217, 218, 219, 224,
631 225, 226, 227, 228, 229, 230, 235, 239, 240, 241,
632 242, 243, 244, 245, 246, 247, 248, 249, 250, 251,
633 252, 256, 257, 258, 262, 278, 285, 292, 296, 303,
634 303, 308, 308, 313, 323, 338, 339, 340, 344, 345,
635 351, 352, 357, 361, 366, 372, 378, 389, 390, 399,
636 400, 406, 407, 408, 415, 415, 419, 420, 421, 426,
637 427, 429, 430, 432, 434, 439, 440, 456, 456, 462,
638 471, 476, 478
639};
640#endif
641
642#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
643/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
644 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
645static const char *const yytname[] =
646{
647 "\"end of file\"", "error", "$undefined", "\"string\"", "\"integer\"",
648 "\"%token\"", "\"%nterm\"", "\"%type\"", "\"%destructor {...}\"",
649 "\"%printer {...}\"", "\"%union {...}\"", "\"%left\"", "\"%right\"",
650 "\"%nonassoc\"", "\"%prec\"", "\"%dprec\"", "\"%merge\"", "\"%debug\"",
651 "\"%default-prec\"", "\"%define\"", "\"%defines\"", "\"%error-verbose\"",
652 "\"%expect\"", "\"%expect-rr\"", "\"%file-prefix\"", "\"%glr-parser\"",
653 "\"%initial-action {...}\"", "\"%lex-param {...}\"", "\"%locations\"",
654 "\"%name-prefix\"", "\"%no-default-prec\"", "\"%no-lines\"",
655 "\"%nondeterministic-parser\"", "\"%output\"", "\"%parse-param {...}\"",
656 "\"%pure-parser\"", "\"%require\"", "\"%skeleton\"", "\"%start\"",
657 "\"%token-table\"", "\"%verbose\"", "\"%yacc\"", "\"type\"", "\"=\"",
658 "\";\"", "\"|\"", "\"identifier\"", "\"identifier:\"", "\"%%\"",
659 "\"%{...%}\"", "\"epilogue\"", "\"{...}\"", "$accept", "input",
660 "declarations", "declaration", "grammar_declaration",
661 "symbol_declaration", "@1", "@2", "precedence_declaration",
662 "precedence_declarator", "type.opt", "symbols.1", "symbol_def",
663 "symbol_defs.1", "grammar", "rules_or_grammar_declaration", "rules",
664 "@3", "rhses.1", "rhs", "symbol", "action", "@4", "string_as_id",
665 "string_content", "epilogue.opt", 0
666};
667#endif
668
669# ifdef YYPRINT
670/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
671 token YYLEX-NUM. */
672static const yytype_uint16 yytoknum[] =
673{
674 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
675 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
676 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
677 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
678 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
679 305, 306
680};
681# endif
682
683/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
684static const yytype_uint8 yyr1[] =
685{
686 0, 52, 53, 54, 54, 55, 55, 55, 55, 55,
687 55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
688 55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
689 55, 56, 56, 56, 56, 56, 56, 56, 56, 58,
690 57, 59, 57, 57, 60, 61, 61, 61, 62, 62,
691 63, 63, 64, 64, 64, 64, 64, 65, 65, 66,
692 66, 67, 67, 67, 69, 68, 70, 70, 70, 71,
693 71, 71, 71, 71, 71, 72, 72, 74, 73, 75,
694 76, 77, 77
695};
696
697/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
698static const yytype_uint8 yyr2[] =
699{
700 0, 2, 4, 0, 2, 1, 1, 1, 2, 3,
701 1, 1, 2, 2, 3, 1, 1, 1, 1, 3,
702 1, 1, 3, 1, 1, 2, 2, 1, 1, 1,
703 1, 1, 1, 2, 1, 2, 2, 1, 1, 0,
704 3, 0, 3, 3, 3, 1, 1, 1, 0, 1,
705 1, 2, 1, 1, 2, 2, 3, 1, 2, 1,
706 2, 1, 2, 2, 0, 3, 1, 3, 2, 0,
707 2, 2, 3, 3, 3, 1, 1, 0, 2, 1,
708 1, 0, 2
709};
710
711/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
712 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
713 means the default is an error. */
714static const yytype_uint8 yydefact[] =
715{
716 3, 0, 0, 1, 41, 39, 0, 0, 0, 34,
717 45, 46, 47, 7, 37, 0, 10, 11, 0, 0,
718 0, 15, 16, 17, 18, 0, 38, 20, 21, 0,
719 23, 24, 0, 0, 0, 27, 28, 29, 30, 0,
720 6, 4, 5, 32, 31, 48, 0, 0, 0, 79,
721 75, 35, 50, 76, 36, 80, 8, 12, 13, 0,
722 0, 0, 25, 26, 33, 0, 64, 0, 0, 59,
723 61, 49, 0, 52, 53, 57, 42, 40, 43, 51,
724 9, 14, 19, 22, 63, 69, 62, 0, 60, 2,
725 44, 54, 55, 58, 65, 66, 82, 56, 68, 69,
726 0, 0, 0, 70, 71, 0, 67, 72, 73, 74,
727 78
728};
729
730/* YYDEFGOTO[NTERM-NUM]. */
731static const yytype_int8 yydefgoto[] =
732{
733 -1, 1, 2, 41, 67, 43, 47, 46, 44, 45,
734 72, 51, 75, 76, 68, 69, 70, 85, 94, 95,
735 52, 104, 105, 53, 56, 89
736};
737
738/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
739 STATE-NUM. */
740#define YYPACT_NINF -69
741static const yytype_int8 yypact[] =
742{
743 -69, 5, 112, -69, -69, -69, -35, 0, 0, -69,
744 -69, -69, -69, -69, -69, 13, -69, -69, 20, 31,
745 -18, -69, -69, -69, -69, -6, -69, -69, -69, -5,
746 -69, -69, 13, 13, 0, -69, -69, -69, -69, 69,
747 -69, -69, -69, -69, -69, -2, -38, -38, 0, -69,
748 -69, 0, -69, -69, 0, -69, 13, -69, -69, 13,
749 13, 13, -69, -69, -69, -8, -69, 3, 21, -69,
750 -69, -69, 0, -69, 6, -69, -38, -38, 0, -69,
751 -69, -69, -69, -69, -69, -69, -69, 2, -69, -69,
752 0, 39, -69, -69, -33, -1, -69, -69, -69, -69,
753 0, 44, 1, -69, -69, 4, -1, -69, -69, -69,
754 -69
755};
756
757/* YYPGOTO[NTERM-NUM]. */
758static const yytype_int8 yypgoto[] =
759{
760 -69, -69, -69, -69, 47, -69, -69, -69, -69, -69,
761 -69, -7, -58, 7, -69, -15, -69, -69, -69, -42,
762 -34, -69, -69, -68, 30, -69
763};
764
765/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
766 positive, shift that token. If negative, reduce the rule which
767 number is the opposite. If zero, do what YYDEFACT says.
768 If YYTABLE_NINF, syntax error. */
769#define YYTABLE_NINF -82
770static const yytype_int8 yytable[] =
771{
772 64, 54, 49, 49, 73, 3, 92, 48, 74, 49,
773 91, 98, 99, 100, 101, 102, 55, 79, 93, 93,
774 79, -81, 65, 97, 57, 59, 4, 5, 6, 7,
775 8, 9, 10, 11, 12, 58, 84, 60, 61, 14,
776 71, 78, 49, 109, 79, 50, 50, 86, 108, 42,
777 -77, 26, 96, 88, 77, 110, 79, 106, 0, 34,
778 0, 103, 62, 63, 0, 90, 107, 0, 66, 87,
779 65, 0, 103, 0, 4, 5, 6, 7, 8, 9,
780 10, 11, 12, 0, 0, 0, 80, 14, 0, 81,
781 82, 83, 0, 0, 0, 0, 0, 0, 0, 26,
782 0, 0, 0, 0, 0, 0, 0, 34, 0, 0,
783 0, 0, 0, 0, 0, 0, 66, 4, 5, 6,
784 7, 8, 9, 10, 11, 12, 0, 0, 0, 13,
785 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
786 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
787 34, 35, 36, 37, 0, 0, 38, 0, 0, 0,
788 39, 40
789};
790
791static const yytype_int8 yycheck[] =
792{
793 34, 8, 3, 3, 42, 0, 74, 42, 46, 3,
794 4, 44, 45, 14, 15, 16, 3, 51, 76, 77,
795 54, 0, 1, 91, 4, 43, 5, 6, 7, 8,
796 9, 10, 11, 12, 13, 4, 44, 43, 43, 18,
797 42, 48, 3, 42, 78, 46, 46, 44, 4, 2,
798 51, 30, 50, 68, 47, 51, 90, 99, -1, 38,
799 -1, 95, 32, 33, -1, 72, 100, -1, 47, 48,
800 1, -1, 106, -1, 5, 6, 7, 8, 9, 10,
801 11, 12, 13, -1, -1, -1, 56, 18, -1, 59,
802 60, 61, -1, -1, -1, -1, -1, -1, -1, 30,
803 -1, -1, -1, -1, -1, -1, -1, 38, -1, -1,
804 -1, -1, -1, -1, -1, -1, 47, 5, 6, 7,
805 8, 9, 10, 11, 12, 13, -1, -1, -1, 17,
806 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
807 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
808 38, 39, 40, 41, -1, -1, 44, -1, -1, -1,
809 48, 49
810};
811
812/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
813 symbol of state STATE-NUM. */
814static const yytype_uint8 yystos[] =
815{
816 0, 53, 54, 0, 5, 6, 7, 8, 9, 10,
817 11, 12, 13, 17, 18, 19, 20, 21, 22, 23,
818 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
819 34, 35, 36, 37, 38, 39, 40, 41, 44, 48,
820 49, 55, 56, 57, 60, 61, 59, 58, 42, 3,
821 46, 63, 72, 75, 63, 3, 76, 4, 4, 43,
822 43, 43, 76, 76, 72, 1, 47, 56, 66, 67,
823 68, 42, 62, 42, 46, 64, 65, 65, 63, 72,
824 76, 76, 76, 76, 44, 69, 44, 48, 67, 77,
825 63, 4, 75, 64, 70, 71, 50, 75, 44, 45,
826 14, 15, 16, 72, 73, 74, 71, 72, 4, 42,
827 51
828};
829
830#define yyerrok (yyerrstatus = 0)
831#define yyclearin (yychar = YYEMPTY)
832#define YYEMPTY (-2)
833#define YYEOF 0
834
835#define YYACCEPT goto yyacceptlab
836#define YYABORT goto yyabortlab
837#define YYERROR goto yyerrorlab
838
839
840/* Like YYERROR except do call yyerror. This remains here temporarily
841 to ease the transition to the new meaning of YYERROR, for GCC.
842 Once GCC version 2 has supplanted version 1, this can go. */
843
844#define YYFAIL goto yyerrlab
845
846#define YYRECOVERING() (!!yyerrstatus)
847
848#define YYBACKUP(Token, Value) \
849do \
850 if (yychar == YYEMPTY && yylen == 1) \
851 { \
852 yychar = (Token); \
853 yylval = (Value); \
854 yytoken = YYTRANSLATE (yychar); \
855 YYPOPSTACK (1); \
856 goto yybackup; \
857 } \
858 else \
859 { \
860 yyerror (YY_("syntax error: cannot back up")); \
861 YYERROR; \
862 } \
863while (YYID (0))
864
865
866#define YYTERROR 1
867#define YYERRCODE 256
868
869
870/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
871 If N is 0, then set CURRENT to the empty location which ends
872 the previous symbol: RHS[0] (always defined). */
873
874#define YYRHSLOC(Rhs, K) ((Rhs)[K])
875#ifndef YYLLOC_DEFAULT
876# define YYLLOC_DEFAULT(Current, Rhs, N) \
877 do \
878 if (YYID (N)) \
879 { \
880 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
881 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
882 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
883 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
884 } \
885 else \
886 { \
887 (Current).first_line = (Current).last_line = \
888 YYRHSLOC (Rhs, 0).last_line; \
889 (Current).first_column = (Current).last_column = \
890 YYRHSLOC (Rhs, 0).last_column; \
891 } \
892 while (YYID (0))
893#endif
894
895
896/* YY_LOCATION_PRINT -- Print the location on the stream.
897 This macro was not mandated originally: define only if we know
898 we won't break user code: when these are the locations we know. */
899
900#ifndef YY_LOCATION_PRINT
901# if YYLTYPE_IS_TRIVIAL
902# define YY_LOCATION_PRINT(File, Loc) \
903 fprintf (File, "%d.%d-%d.%d", \
904 (Loc).first_line, (Loc).first_column, \
905 (Loc).last_line, (Loc).last_column)
906# else
907# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
908# endif
909#endif
910
911
912/* YYLEX -- calling `yylex' with the right arguments. */
913
914#ifdef YYLEX_PARAM
915# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
916#else
917# define YYLEX yylex (&yylval, &yylloc)
918#endif
919
920/* Enable debugging if requested. */
921#if YYDEBUG
922
923# ifndef YYFPRINTF
924# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
925# define YYFPRINTF fprintf
926# endif
927
928# define YYDPRINTF(Args) \
929do { \
930 if (yydebug) \
931 YYFPRINTF Args; \
932} while (YYID (0))
933
934# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
935do { \
936 if (yydebug) \
937 { \
938 YYFPRINTF (stderr, "%s ", Title); \
939 yy_symbol_print (stderr, \
940 Type, Value, Location); \
941 YYFPRINTF (stderr, "\n"); \
942 } \
943} while (YYID (0))
944
945
946/*--------------------------------.
947| Print this symbol on YYOUTPUT. |
948`--------------------------------*/
949
950/*ARGSUSED*/
951#if (defined __STDC__ || defined __C99__FUNC__ \
952 || defined __cplusplus || defined _MSC_VER)
953static void
954yy_symbol_value_print (FILE *yyoutput, int yytype, const YYSTYPE * const yyvaluep, const YYLTYPE * const yylocationp)
955#else
956static void
957yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp)
958 FILE *yyoutput;
959 int yytype;
960 const YYSTYPE * const yyvaluep;
961 const YYLTYPE * const yylocationp;
962#endif
963{
964 if (!yyvaluep)
965 return;
966 YYUSE (yylocationp);
967# ifdef YYPRINT
968 if (yytype < YYNTOKENS)
969 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
970# else
971 YYUSE (yyoutput);
972# endif
973 switch (yytype)
974 {
975 case 3: /* "\"string\"" */
976#line 179 "../../src/parse-gram.y"
977 { fprintf (stderr, "\"%s\"", (yyvaluep->chars)); };
978#line 979 "../../src/parse-gram.c"
979 break;
980 case 4: /* "\"integer\"" */
981#line 192 "../../src/parse-gram.y"
982 { fprintf (stderr, "%d", (yyvaluep->integer)); };
983#line 984 "../../src/parse-gram.c"
984 break;
985 case 8: /* "\"%destructor {...}\"" */
986#line 181 "../../src/parse-gram.y"
987 { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); };
988#line 989 "../../src/parse-gram.c"
989 break;
990 case 9: /* "\"%printer {...}\"" */
991#line 181 "../../src/parse-gram.y"
992 { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); };
993#line 994 "../../src/parse-gram.c"
994 break;
995 case 10: /* "\"%union {...}\"" */
996#line 181 "../../src/parse-gram.y"
997 { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); };
998#line 999 "../../src/parse-gram.c"
999 break;
1000 case 26: /* "\"%initial-action {...}\"" */
1001#line 181 "../../src/parse-gram.y"
1002 { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); };
1003#line 1004 "../../src/parse-gram.c"
1004 break;
1005 case 27: /* "\"%lex-param {...}\"" */
1006#line 181 "../../src/parse-gram.y"
1007 { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); };
1008#line 1009 "../../src/parse-gram.c"
1009 break;
1010 case 34: /* "\"%parse-param {...}\"" */
1011#line 181 "../../src/parse-gram.y"
1012 { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); };
1013#line 1014 "../../src/parse-gram.c"
1014 break;
1015 case 42: /* "\"type\"" */
1016#line 190 "../../src/parse-gram.y"
1017 { fprintf (stderr, "<%s>", (yyvaluep->uniqstr)); };
1018#line 1019 "../../src/parse-gram.c"
1019 break;
1020 case 46: /* "\"identifier\"" */
1021#line 194 "../../src/parse-gram.y"
1022 { fprintf (stderr, "%s", (yyvaluep->symbol)->tag); };
1023#line 1024 "../../src/parse-gram.c"
1024 break;
1025 case 47: /* "\"identifier:\"" */
1026#line 196 "../../src/parse-gram.y"
1027 { fprintf (stderr, "%s:", (yyvaluep->symbol)->tag); };
1028#line 1029 "../../src/parse-gram.c"
1029 break;
1030 case 49: /* "\"%{...%}\"" */
1031#line 181 "../../src/parse-gram.y"
1032 { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); };
1033#line 1034 "../../src/parse-gram.c"
1034 break;
1035 case 50: /* "\"epilogue\"" */
1036#line 181 "../../src/parse-gram.y"
1037 { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); };
1038#line 1039 "../../src/parse-gram.c"
1039 break;
1040 case 72: /* "symbol" */
1041#line 194 "../../src/parse-gram.y"
1042 { fprintf (stderr, "%s", (yyvaluep->symbol)->tag); };
1043#line 1044 "../../src/parse-gram.c"
1044 break;
1045 case 75: /* "string_as_id" */
1046#line 194 "../../src/parse-gram.y"
1047 { fprintf (stderr, "%s", (yyvaluep->symbol)->tag); };
1048#line 1049 "../../src/parse-gram.c"
1049 break;
1050 case 76: /* "string_content" */
1051#line 179 "../../src/parse-gram.y"
1052 { fprintf (stderr, "\"%s\"", (yyvaluep->chars)); };
1053#line 1054 "../../src/parse-gram.c"
1054 break;
1055 default:
1056 break;
1057 }
1058}
1059
1060
1061/*--------------------------------.
1062| Print this symbol on YYOUTPUT. |
1063`--------------------------------*/
1064
1065#if (defined __STDC__ || defined __C99__FUNC__ \
1066 || defined __cplusplus || defined _MSC_VER)
1067static void
1068yy_symbol_print (FILE *yyoutput, int yytype, const YYSTYPE * const yyvaluep, const YYLTYPE * const yylocationp)
1069#else
1070static void
1071yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp)
1072 FILE *yyoutput;
1073 int yytype;
1074 const YYSTYPE * const yyvaluep;
1075 const YYLTYPE * const yylocationp;
1076#endif
1077{
1078 if (yytype < YYNTOKENS)
1079 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1080 else
1081 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1082
1083 YY_LOCATION_PRINT (yyoutput, *yylocationp);
1084 YYFPRINTF (yyoutput, ": ");
1085 yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp);
1086 YYFPRINTF (yyoutput, ")");
1087}
1088
1089/*------------------------------------------------------------------.
1090| yy_stack_print -- Print the state stack from its BOTTOM up to its |
1091| TOP (included). |
1092`------------------------------------------------------------------*/
1093
1094#if (defined __STDC__ || defined __C99__FUNC__ \
1095 || defined __cplusplus || defined _MSC_VER)
1096static void
1097yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
1098#else
1099static void
1100yy_stack_print (bottom, top)
1101 yytype_int16 *bottom;
1102 yytype_int16 *top;
1103#endif
1104{
1105 YYFPRINTF (stderr, "Stack now");
1106 for (; bottom <= top; ++bottom)
1107 YYFPRINTF (stderr, " %d", *bottom);
1108 YYFPRINTF (stderr, "\n");
1109}
1110
1111# define YY_STACK_PRINT(Bottom, Top) \
1112do { \
1113 if (yydebug) \
1114 yy_stack_print ((Bottom), (Top)); \
1115} while (YYID (0))
1116
1117
1118/*------------------------------------------------.
1119| Report that the YYRULE is going to be reduced. |
1120`------------------------------------------------*/
1121
1122#if (defined __STDC__ || defined __C99__FUNC__ \
1123 || defined __cplusplus || defined _MSC_VER)
1124static void
1125yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule)
1126#else
1127static void
1128yy_reduce_print (yyvsp, yylsp, yyrule
1129 )
1130 YYSTYPE *yyvsp;
1131 YYLTYPE *yylsp;
1132 int yyrule;
1133#endif
1134{
1135 int yynrhs = yyr2[yyrule];
1136 int yyi;
1137 unsigned long int yylno = yyrline[yyrule];
1138 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1139 yyrule - 1, yylno);
1140 /* The symbols being reduced. */
1141 for (yyi = 0; yyi < yynrhs; yyi++)
1142 {
1143 fprintf (stderr, " $%d = ", yyi + 1);
1144 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1145 &(yyvsp[(yyi + 1) - (yynrhs)])
1146 , &(yylsp[(yyi + 1) - (yynrhs)]) );
1147 fprintf (stderr, "\n");
1148 }
1149}
1150
1151# define YY_REDUCE_PRINT(Rule) \
1152do { \
1153 if (yydebug) \
1154 yy_reduce_print (yyvsp, yylsp, Rule); \
1155} while (YYID (0))
1156
1157/* Nonzero means print parse trace. It is left uninitialized so that
1158 multiple parsers can coexist. */
1159int yydebug;
1160#else /* !YYDEBUG */
1161# define YYDPRINTF(Args)
1162# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1163# define YY_STACK_PRINT(Bottom, Top)
1164# define YY_REDUCE_PRINT(Rule)
1165#endif /* !YYDEBUG */
1166
1167
1168/* YYINITDEPTH -- initial size of the parser's stacks. */
1169#ifndef YYINITDEPTH
1170# define YYINITDEPTH 200
1171#endif
1172
1173/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1174 if the built-in stack extension method is used).
1175
1176 Do not make this value too large; the results are undefined if
1177 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1178 evaluated with infinite-precision integer arithmetic. */
1179
1180#ifndef YYMAXDEPTH
1181# define YYMAXDEPTH 10000
1182#endif
1183
1184\f
1185
1186#if YYERROR_VERBOSE
1187
1188# ifndef yystrlen
1189# if defined __GLIBC__ && defined _STRING_H
1190# define yystrlen strlen
1191# else
1192/* Return the length of YYSTR. */
1193#if (defined __STDC__ || defined __C99__FUNC__ \
1194 || defined __cplusplus || defined _MSC_VER)
1195static YYSIZE_T
1196yystrlen (const char *yystr)
1197#else
1198static YYSIZE_T
1199yystrlen (yystr)
1200 const char *yystr;
1201#endif
1202{
1203 YYSIZE_T yylen;
1204 for (yylen = 0; yystr[yylen]; yylen++)
1205 continue;
1206 return yylen;
1207}
1208# endif
1209# endif
1210
1211# ifndef yystpcpy
1212# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1213# define yystpcpy stpcpy
1214# else
1215/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1216 YYDEST. */
1217#if (defined __STDC__ || defined __C99__FUNC__ \
1218 || defined __cplusplus || defined _MSC_VER)
1219static char *
1220yystpcpy (char *yydest, const char *yysrc)
1221#else
1222static char *
1223yystpcpy (yydest, yysrc)
1224 char *yydest;
1225 const char *yysrc;
1226#endif
1227{
1228 char *yyd = yydest;
1229 const char *yys = yysrc;
1230
1231 while ((*yyd++ = *yys++) != '\0')
1232 continue;
1233
1234 return yyd - 1;
1235}
1236# endif
1237# endif
1238
1239# ifndef yytnamerr
1240/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1241 quotes and backslashes, so that it's suitable for yyerror. The
1242 heuristic is that double-quoting is unnecessary unless the string
1243 contains an apostrophe, a comma, or backslash (other than
1244 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1245 null, do not copy; instead, return the length of what the result
1246 would have been. */
1247static YYSIZE_T
1248yytnamerr (char *yyres, const char *yystr)
1249{
1250 if (*yystr == '"')
1251 {
1252 size_t yyn = 0;
1253 char const *yyp = yystr;
1254
1255 for (;;)
1256 switch (*++yyp)
1257 {
1258 case '\'':
1259 case ',':
1260 goto do_not_strip_quotes;
1261
1262 case '\\':
1263 if (*++yyp != '\\')
1264 goto do_not_strip_quotes;
1265 /* Fall through. */
1266 default:
1267 if (yyres)
1268 yyres[yyn] = *yyp;
1269 yyn++;
1270 break;
1271
1272 case '"':
1273 if (yyres)
1274 yyres[yyn] = '\0';
1275 return yyn;
1276 }
1277 do_not_strip_quotes: ;
1278 }
1279
1280 if (! yyres)
1281 return yystrlen (yystr);
1282
1283 return yystpcpy (yyres, yystr) - yyres;
1284}
1285# endif
1286
1287/* Copy into YYRESULT an error message about the unexpected token
1288 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1289 including the terminating null byte. If YYRESULT is null, do not
1290 copy anything; just return the number of bytes that would be
1291 copied. As a special case, return 0 if an ordinary "syntax error"
1292 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1293 size calculation. */
1294static YYSIZE_T
1295yysyntax_error (char *yyresult, int yystate, int yychar)
1296{
1297 int yyn = yypact[yystate];
1298
1299 if (! (YYPACT_NINF < yyn && yyn < YYLAST))
1300 return 0;
1301 else
1302 {
1303 int yytype = YYTRANSLATE (yychar);
1304 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1305 YYSIZE_T yysize = yysize0;
1306 YYSIZE_T yysize1;
1307 int yysize_overflow = 0;
1308 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1309 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1310 int yyx;
1311
1312# if 0
1313 /* This is so xgettext sees the translatable formats that are
1314 constructed on the fly. */
1315 YY_("syntax error, unexpected %s");
1316 YY_("syntax error, unexpected %s, expecting %s");
1317 YY_("syntax error, unexpected %s, expecting %s or %s");
1318 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1319 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1320# endif
1321 char *yyfmt;
1322 char const *yyf;
1323 static char const yyunexpected[] = "syntax error, unexpected %s";
1324 static char const yyexpecting[] = ", expecting %s";
1325 static char const yyor[] = " or %s";
1326 char yyformat[sizeof yyunexpected
1327 + sizeof yyexpecting - 1
1328 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1329 * (sizeof yyor - 1))];
1330 char const *yyprefix = yyexpecting;
1331
1332 /* Start YYX at -YYN if negative to avoid negative indexes in
1333 YYCHECK. */
1334 int yyxbegin = yyn < 0 ? -yyn : 0;
1335
1336 /* Stay within bounds of both yycheck and yytname. */
1337 int yychecklim = YYLAST - yyn;
1338 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1339 int yycount = 1;
1340
1341 yyarg[0] = yytname[yytype];
1342 yyfmt = yystpcpy (yyformat, yyunexpected);
1343
1344 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1345 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1346 {
1347 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1348 {
1349 yycount = 1;
1350 yysize = yysize0;
1351 yyformat[sizeof yyunexpected - 1] = '\0';
1352 break;
1353 }
1354 yyarg[yycount++] = yytname[yyx];
1355 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1356 yysize_overflow |= (yysize1 < yysize);
1357 yysize = yysize1;
1358 yyfmt = yystpcpy (yyfmt, yyprefix);
1359 yyprefix = yyor;
1360 }
1361
1362 yyf = YY_(yyformat);
1363 yysize1 = yysize + yystrlen (yyf);
1364 yysize_overflow |= (yysize1 < yysize);
1365 yysize = yysize1;
1366
1367 if (yysize_overflow)
1368 return YYSIZE_MAXIMUM;
1369
1370 if (yyresult)
1371 {
1372 /* Avoid sprintf, as that infringes on the user's name space.
1373 Don't have undefined behavior even if the translation
1374 produced a string with the wrong number of "%s"s. */
1375 char *yyp = yyresult;
1376 int yyi = 0;
1377 while ((*yyp = *yyf) != '\0')
1378 {
1379 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1380 {
1381 yyp += yytnamerr (yyp, yyarg[yyi++]);
1382 yyf += 2;
1383 }
1384 else
1385 {
1386 yyp++;
1387 yyf++;
1388 }
1389 }
1390 }
1391 return yysize;
1392 }
1393}
1394#endif /* YYERROR_VERBOSE */
1395\f
1396
1397/*-----------------------------------------------.
1398| Release the memory associated to this symbol. |
1399`-----------------------------------------------*/
1400
1401/*ARGSUSED*/
1402#if (defined __STDC__ || defined __C99__FUNC__ \
1403 || defined __cplusplus || defined _MSC_VER)
1404static void
1405yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp)
1406#else
1407static void
1408yydestruct (yymsg, yytype, yyvaluep, yylocationp)
1409 const char *yymsg;
1410 int yytype;
1411 YYSTYPE *yyvaluep;
1412 YYLTYPE *yylocationp;
1413#endif
1414{
1415 YYUSE (yyvaluep);
1416 YYUSE (yylocationp);
1417
1418 if (!yymsg)
1419 yymsg = "Deleting";
1420 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1421
1422 switch (yytype)
1423 {
1424
1425 default:
1426 break;
1427 }
1428}
1429\f
1430
1431/* Prevent warnings from -Wmissing-prototypes. */
1432
1433#ifdef YYPARSE_PARAM
1434#if defined __STDC__ || defined __cplusplus
1435int yyparse (void *YYPARSE_PARAM);
1436#else
1437int yyparse ();
1438#endif
1439#else /* ! YYPARSE_PARAM */
1440#if defined __STDC__ || defined __cplusplus
1441int yyparse (void);
1442#else
1443int yyparse ();
1444#endif
1445#endif /* ! YYPARSE_PARAM */
1446
1447
1448
1449
1450
1451
1452/*----------.
1453| yyparse. |
1454`----------*/
1455
1456#ifdef YYPARSE_PARAM
1457#if (defined __STDC__ || defined __C99__FUNC__ \
1458 || defined __cplusplus || defined _MSC_VER)
1459int
1460yyparse (void *YYPARSE_PARAM)
1461#else
1462int
1463yyparse (YYPARSE_PARAM)
1464 void *YYPARSE_PARAM;
1465#endif
1466#else /* ! YYPARSE_PARAM */
1467#if (defined __STDC__ || defined __C99__FUNC__ \
1468 || defined __cplusplus || defined _MSC_VER)
1469int
1470yyparse (void)
1471#else
1472int
1473yyparse ()
1474
1475#endif
1476#endif
1477{
1478 /* The look-ahead symbol. */
1479int yychar;
1480
1481/* The semantic value of the look-ahead symbol. */
1482YYSTYPE yylval;
1483
1484/* Number of syntax errors so far. */
1485int yynerrs;
1486/* Location data for the look-ahead symbol. */
1487YYLTYPE yylloc;
1488
1489 int yystate;
1490 int yyn;
1491 int yyresult;
1492 /* Number of tokens to shift before error messages enabled. */
1493 int yyerrstatus;
1494 /* Look-ahead token as an internal (translated) token number. */
1495 int yytoken = 0;
1496#if YYERROR_VERBOSE
1497 /* Buffer for error messages, and its allocated size. */
1498 char yymsgbuf[128];
1499 char *yymsg = yymsgbuf;
1500 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1501#endif
1502
1503 /* Three stacks and their tools:
1504 `yyss': related to states,
1505 `yyvs': related to semantic values,
1506 `yyls': related to locations.
1507
1508 Refer to the stacks thru separate pointers, to allow yyoverflow
1509 to reallocate them elsewhere. */
1510
1511 /* The state stack. */
1512 yytype_int16 yyssa[YYINITDEPTH];
1513 yytype_int16 *yyss = yyssa;
1514 yytype_int16 *yyssp;
1515
1516 /* The semantic value stack. */
1517 YYSTYPE yyvsa[YYINITDEPTH];
1518 YYSTYPE *yyvs = yyvsa;
1519 YYSTYPE *yyvsp;
1520
1521 /* The location stack. */
1522 YYLTYPE yylsa[YYINITDEPTH];
1523 YYLTYPE *yyls = yylsa;
1524 YYLTYPE *yylsp;
1525 /* The locations where the error started and ended. */
1526 YYLTYPE yyerror_range[2];
1527
1528#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
1529
1530 YYSIZE_T yystacksize = YYINITDEPTH;
1531
1532 /* The variables used to return semantic value and location from the
1533 action routines. */
1534 YYSTYPE yyval;
1535 YYLTYPE yyloc;
1536
1537 /* The number of symbols on the RHS of the reduced rule.
1538 Keep to zero when no symbol should be popped. */
1539 int yylen = 0;
1540
1541 YYDPRINTF ((stderr, "Starting parse\n"));
1542
1543 yystate = 0;
1544 yyerrstatus = 0;
1545 yynerrs = 0;
1546 yychar = YYEMPTY; /* Cause a token to be read. */
1547
1548 /* Initialize stack pointers.
1549 Waste one element of value and location stack
1550 so that they stay on the same level as the state stack.
1551 The wasted elements are never initialized. */
1552
1553 yyssp = yyss;
1554 yyvsp = yyvs;
1555 yylsp = yyls;
1556#if YYLTYPE_IS_TRIVIAL
1557 /* Initialize the default location before parsing starts. */
1558 yylloc.first_line = yylloc.last_line = 1;
1559 yylloc.first_column = yylloc.last_column = 0;
1560#endif
1561
1562
1563 /* User initialization code. */
1564#line 84 "../../src/parse-gram.y"
1565{
1566 /* Bison's grammar can initial empty locations, hence a default
1567 location is needed. */
1568 yylloc.start.file = yylloc.end.file = current_file;
1569 yylloc.start.line = yylloc.end.line = 1;
1570 yylloc.start.column = yylloc.end.column = 0;
1571}
1572/* Line 1078 of yacc.c. */
1573#line 1574 "../../src/parse-gram.c"
1574 yylsp[0] = yylloc;
1575 goto yysetstate;
1576
1577/*------------------------------------------------------------.
1578| yynewstate -- Push a new state, which is found in yystate. |
1579`------------------------------------------------------------*/
1580 yynewstate:
1581 /* In all cases, when you get here, the value and location stacks
1582 have just been pushed. So pushing a state here evens the stacks. */
1583 yyssp++;
1584
1585 yysetstate:
1586 *yyssp = yystate;
1587
1588 if (yyss + yystacksize - 1 <= yyssp)
1589 {
1590 /* Get the current used size of the three stacks, in elements. */
1591 YYSIZE_T yysize = yyssp - yyss + 1;
1592
1593#ifdef yyoverflow
1594 {
1595 /* Give user a chance to reallocate the stack. Use copies of
1596 these so that the &'s don't force the real ones into
1597 memory. */
1598 YYSTYPE *yyvs1 = yyvs;
1599 yytype_int16 *yyss1 = yyss;
1600 YYLTYPE *yyls1 = yyls;
1601
1602 /* Each stack pointer address is followed by the size of the
1603 data in use in that stack, in bytes. This used to be a
1604 conditional around just the two extra args, but that might
1605 be undefined if yyoverflow is a macro. */
1606 yyoverflow (YY_("memory exhausted"),
1607 &yyss1, yysize * sizeof (*yyssp),
1608 &yyvs1, yysize * sizeof (*yyvsp),
1609 &yyls1, yysize * sizeof (*yylsp),
1610 &yystacksize);
1611 yyls = yyls1;
1612 yyss = yyss1;
1613 yyvs = yyvs1;
1614 }
1615#else /* no yyoverflow */
1616# ifndef YYSTACK_RELOCATE
1617 goto yyexhaustedlab;
1618# else
1619 /* Extend the stack our own way. */
1620 if (YYMAXDEPTH <= yystacksize)
1621 goto yyexhaustedlab;
1622 yystacksize *= 2;
1623 if (YYMAXDEPTH < yystacksize)
1624 yystacksize = YYMAXDEPTH;
1625
1626 {
1627 yytype_int16 *yyss1 = yyss;
1628 union yyalloc *yyptr =
1629 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1630 if (! yyptr)
1631 goto yyexhaustedlab;
1632 YYSTACK_RELOCATE (yyss);
1633 YYSTACK_RELOCATE (yyvs);
1634 YYSTACK_RELOCATE (yyls);
1635# undef YYSTACK_RELOCATE
1636 if (yyss1 != yyssa)
1637 YYSTACK_FREE (yyss1);
1638 }
1639# endif
1640#endif /* no yyoverflow */
1641
1642 yyssp = yyss + yysize - 1;
1643 yyvsp = yyvs + yysize - 1;
1644 yylsp = yyls + yysize - 1;
1645
1646 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1647 (unsigned long int) yystacksize));
1648
1649 if (yyss + yystacksize - 1 <= yyssp)
1650 YYABORT;
1651 }
1652
1653 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1654
1655 goto yybackup;
1656
1657/*-----------.
1658| yybackup. |
1659`-----------*/
1660yybackup:
1661
1662 /* Do appropriate processing given the current state. Read a
1663 look-ahead token if we need one and don't already have one. */
1664
1665 /* First try to decide what to do without reference to look-ahead token. */
1666 yyn = yypact[yystate];
1667 if (yyn == YYPACT_NINF)
1668 goto yydefault;
1669
1670 /* Not known => get a look-ahead token if don't already have one. */
1671
1672 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1673 if (yychar == YYEMPTY)
1674 {
1675 YYDPRINTF ((stderr, "Reading a token: "));
1676 yychar = YYLEX;
1677 }
1678
1679 if (yychar <= YYEOF)
1680 {
1681 yychar = yytoken = YYEOF;
1682 YYDPRINTF ((stderr, "Now at end of input.\n"));
1683 }
1684 else
1685 {
1686 yytoken = YYTRANSLATE (yychar);
1687 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1688 }
1689
1690 /* If the proper action on seeing token YYTOKEN is to reduce or to
1691 detect an error, take that action. */
1692 yyn += yytoken;
1693 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1694 goto yydefault;
1695 yyn = yytable[yyn];
1696 if (yyn <= 0)
1697 {
1698 if (yyn == 0 || yyn == YYTABLE_NINF)
1699 goto yyerrlab;
1700 yyn = -yyn;
1701 goto yyreduce;
1702 }
1703
1704 if (yyn == YYFINAL)
1705 YYACCEPT;
1706
1707 /* Count tokens shifted since error; after three, turn off error
1708 status. */
1709 if (yyerrstatus)
1710 yyerrstatus--;
1711
1712 /* Shift the look-ahead token. */
1713 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1714
1715 /* Discard the shifted token unless it is eof. */
1716 if (yychar != YYEOF)
1717 yychar = YYEMPTY;
1718
1719 yystate = yyn;
1720 *++yyvsp = yylval;
1721 *++yylsp = yylloc;
1722 goto yynewstate;
1723
1724
1725/*-----------------------------------------------------------.
1726| yydefault -- do the default action for the current state. |
1727`-----------------------------------------------------------*/
1728yydefault:
1729 yyn = yydefact[yystate];
1730 if (yyn == 0)
1731 goto yyerrlab;
1732 goto yyreduce;
1733
1734
1735/*-----------------------------.
1736| yyreduce -- Do a reduction. |
1737`-----------------------------*/
1738yyreduce:
1739 /* yyn is the number of a rule to reduce with. */
1740 yylen = yyr2[yyn];
1741
1742 /* If YYLEN is nonzero, implement the default value of the action:
1743 `$$ = $1'.
1744
1745 Otherwise, the following line sets YYVAL to garbage.
1746 This behavior is undocumented and Bison
1747 users should not rely upon it. Assigning to YYVAL
1748 unconditionally makes the parser a bit smaller, and it avoids a
1749 GCC warning that YYVAL may be used uninitialized. */
1750 yyval = yyvsp[1-yylen];
1751
1752 /* Default location. */
1753 YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
1754 YY_REDUCE_PRINT (yyn);
1755 switch (yyn)
1756 {
1757 case 6:
1758#line 217 "../../src/parse-gram.y"
1759 { prologue_augment ((yyvsp[(1) - (1)].chars), (yylsp[(1) - (1)])); }
1760 break;
1761
1762 case 7:
1763#line 218 "../../src/parse-gram.y"
1764 { debug_flag = true; }
1765 break;
1766
1767 case 8:
1768#line 220 "../../src/parse-gram.y"
1769 {
1770 static char one[] = "1";
1771 muscle_insert ((yyvsp[(2) - (2)].chars), one);
1772 }
1773 break;
1774
1775 case 9:
1776#line 224 "../../src/parse-gram.y"
1777 { muscle_insert ((yyvsp[(2) - (3)].chars), (yyvsp[(3) - (3)].chars)); }
1778 break;
1779
1780 case 10:
1781#line 225 "../../src/parse-gram.y"
1782 { defines_flag = true; }
1783 break;
1784
1785 case 11:
1786#line 226 "../../src/parse-gram.y"
1787 { error_verbose = true; }
1788 break;
1789
1790 case 12:
1791#line 227 "../../src/parse-gram.y"
1792 { expected_sr_conflicts = (yyvsp[(2) - (2)].integer); }
1793 break;
1794
1795 case 13:
1796#line 228 "../../src/parse-gram.y"
1797 { expected_rr_conflicts = (yyvsp[(2) - (2)].integer); }
1798 break;
1799
1800 case 14:
1801#line 229 "../../src/parse-gram.y"
1802 { spec_file_prefix = (yyvsp[(3) - (3)].chars); }
1803 break;
1804
1805 case 15:
1806#line 231 "../../src/parse-gram.y"
1807 {
1808 nondeterministic_parser = true;
1809 glr_parser = true;
1810 }
1811 break;
1812
1813 case 16:
1814#line 236 "../../src/parse-gram.y"
1815 {
1816 muscle_code_grow ("initial_action", (yyvsp[(1) - (1)].chars), (yylsp[(1) - (1)]));
1817 }
1818 break;
1819
1820 case 17:
1821#line 239 "../../src/parse-gram.y"
1822 { add_param ("lex_param", (yyvsp[(1) - (1)].chars), (yylsp[(1) - (1)])); }
1823 break;
1824
1825 case 18:
1826#line 240 "../../src/parse-gram.y"
1827 { locations_flag = true; }
1828 break;
1829
1830 case 19:
1831#line 241 "../../src/parse-gram.y"
1832 { spec_name_prefix = (yyvsp[(3) - (3)].chars); }
1833 break;
1834
1835 case 20:
1836#line 242 "../../src/parse-gram.y"
1837 { no_lines_flag = true; }
1838 break;
1839
1840 case 21:
1841#line 243 "../../src/parse-gram.y"
1842 { nondeterministic_parser = true; }
1843 break;
1844
1845 case 22:
1846#line 244 "../../src/parse-gram.y"
1847 { spec_outfile = (yyvsp[(3) - (3)].chars); }
1848 break;
1849
1850 case 23:
1851#line 245 "../../src/parse-gram.y"
1852 { add_param ("parse_param", (yyvsp[(1) - (1)].chars), (yylsp[(1) - (1)])); }
1853 break;
1854
1855 case 24:
1856#line 246 "../../src/parse-gram.y"
1857 { pure_parser = true; }
1858 break;
1859
1860 case 25:
1861#line 247 "../../src/parse-gram.y"
1862 { version_check (&(yylsp[(2) - (2)]), (yyvsp[(2) - (2)].chars)); }
1863 break;
1864
1865 case 26:
1866#line 248 "../../src/parse-gram.y"
1867 { skeleton = (yyvsp[(2) - (2)].chars); }
1868 break;
1869
1870 case 27:
1871#line 249 "../../src/parse-gram.y"
1872 { token_table_flag = true; }
1873 break;
1874
1875 case 28:
1876#line 250 "../../src/parse-gram.y"
1877 { report_flag = report_states; }
1878 break;
1879
1880 case 29:
1881#line 251 "../../src/parse-gram.y"
1882 { yacc_flag = true; }
1883 break;
1884
1885 case 33:
1886#line 259 "../../src/parse-gram.y"
1887 {
1888 grammar_start_symbol_set ((yyvsp[(2) - (2)].symbol), (yylsp[(2) - (2)]));
1889 }
1890 break;
1891
1892 case 34:
1893#line 263 "../../src/parse-gram.y"
1894 {
1895 char const *body = (yyvsp[(1) - (1)].chars);
1896
1897 if (typed)
1898 {
1899 /* Concatenate the union bodies, turning the first one's
1900 trailing '}' into '\n', and omitting the second one's '{'. */
1901 char *code = muscle_find ("stype");
1902 code[strlen (code) - 1] = '\n';
1903 body++;
1904 }
1905
1906 typed = true;
1907 muscle_code_grow ("stype", body, (yylsp[(1) - (1)]));
1908 }
1909 break;
1910
1911 case 35:
1912#line 279 "../../src/parse-gram.y"
1913 {
1914 symbol_list *list;
1915 for (list = (yyvsp[(2) - (2)].list); list; list = list->next)
1916 symbol_destructor_set (list->sym, (yyvsp[(1) - (2)].chars), (yylsp[(1) - (2)]));
1917 symbol_list_free ((yyvsp[(2) - (2)].list));
1918 }
1919 break;
1920
1921 case 36:
1922#line 286 "../../src/parse-gram.y"
1923 {
1924 symbol_list *list;
1925 for (list = (yyvsp[(2) - (2)].list); list; list = list->next)
1926 symbol_printer_set (list->sym, (yyvsp[(1) - (2)].chars), (yylsp[(1) - (2)]));
1927 symbol_list_free ((yyvsp[(2) - (2)].list));
1928 }
1929 break;
1930
1931 case 37:
1932#line 293 "../../src/parse-gram.y"
1933 {
1934 default_prec = true;
1935 }
1936 break;
1937
1938 case 38:
1939#line 297 "../../src/parse-gram.y"
1940 {
1941 default_prec = false;
1942 }
1943 break;
1944
1945 case 39:
1946#line 303 "../../src/parse-gram.y"
1947 { current_class = nterm_sym; }
1948 break;
1949
1950 case 40:
1951#line 304 "../../src/parse-gram.y"
1952 {
1953 current_class = unknown_sym;
1954 current_type = NULL;
1955 }
1956 break;
1957
1958 case 41:
1959#line 308 "../../src/parse-gram.y"
1960 { current_class = token_sym; }
1961 break;
1962
1963 case 42:
1964#line 309 "../../src/parse-gram.y"
1965 {
1966 current_class = unknown_sym;
1967 current_type = NULL;
1968 }
1969 break;
1970
1971 case 43:
1972#line 314 "../../src/parse-gram.y"
1973 {
1974 symbol_list *list;
1975 for (list = (yyvsp[(3) - (3)].list); list; list = list->next)
1976 symbol_type_set (list->sym, (yyvsp[(2) - (3)].uniqstr), (yylsp[(2) - (3)]));
1977 symbol_list_free ((yyvsp[(3) - (3)].list));
1978 }
1979 break;
1980
1981 case 44:
1982#line 324 "../../src/parse-gram.y"
1983 {
1984 symbol_list *list;
1985 ++current_prec;
1986 for (list = (yyvsp[(3) - (3)].list); list; list = list->next)
1987 {
1988 symbol_type_set (list->sym, current_type, (yylsp[(2) - (3)]));
1989 symbol_precedence_set (list->sym, current_prec, (yyvsp[(1) - (3)].assoc), (yylsp[(1) - (3)]));
1990 }
1991 symbol_list_free ((yyvsp[(3) - (3)].list));
1992 current_type = NULL;
1993 }
1994 break;
1995
1996 case 45:
1997#line 338 "../../src/parse-gram.y"
1998 { (yyval.assoc) = left_assoc; }
1999 break;
2000
2001 case 46:
2002#line 339 "../../src/parse-gram.y"
2003 { (yyval.assoc) = right_assoc; }
2004 break;
2005
2006 case 47:
2007#line 340 "../../src/parse-gram.y"
2008 { (yyval.assoc) = non_assoc; }
2009 break;
2010
2011 case 48:
2012#line 344 "../../src/parse-gram.y"
2013 { current_type = NULL; }
2014 break;
2015
2016 case 49:
2017#line 345 "../../src/parse-gram.y"
2018 { current_type = (yyvsp[(1) - (1)].uniqstr); }
2019 break;
2020
2021 case 50:
2022#line 351 "../../src/parse-gram.y"
2023 { (yyval.list) = symbol_list_new ((yyvsp[(1) - (1)].symbol), (yylsp[(1) - (1)])); }
2024 break;
2025
2026 case 51:
2027#line 352 "../../src/parse-gram.y"
2028 { (yyval.list) = symbol_list_prepend ((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].symbol), (yylsp[(2) - (2)])); }
2029 break;
2030
2031 case 52:
2032#line 358 "../../src/parse-gram.y"
2033 {
2034 current_type = (yyvsp[(1) - (1)].uniqstr);
2035 }
2036 break;
2037
2038 case 53:
2039#line 362 "../../src/parse-gram.y"
2040 {
2041 symbol_class_set ((yyvsp[(1) - (1)].symbol), current_class, (yylsp[(1) - (1)]), true);
2042 symbol_type_set ((yyvsp[(1) - (1)].symbol), current_type, (yylsp[(1) - (1)]));
2043 }
2044 break;
2045
2046 case 54:
2047#line 367 "../../src/parse-gram.y"
2048 {
2049 symbol_class_set ((yyvsp[(1) - (2)].symbol), current_class, (yylsp[(1) - (2)]), true);
2050 symbol_type_set ((yyvsp[(1) - (2)].symbol), current_type, (yylsp[(1) - (2)]));
2051 symbol_user_token_number_set ((yyvsp[(1) - (2)].symbol), (yyvsp[(2) - (2)].integer), (yylsp[(2) - (2)]));
2052 }
2053 break;
2054
2055 case 55:
2056#line 373 "../../src/parse-gram.y"
2057 {
2058 symbol_class_set ((yyvsp[(1) - (2)].symbol), current_class, (yylsp[(1) - (2)]), true);
2059 symbol_type_set ((yyvsp[(1) - (2)].symbol), current_type, (yylsp[(1) - (2)]));
2060 symbol_make_alias ((yyvsp[(1) - (2)].symbol), (yyvsp[(2) - (2)].symbol), (yyloc));
2061 }
2062 break;
2063
2064 case 56:
2065#line 379 "../../src/parse-gram.y"
2066 {
2067 symbol_class_set ((yyvsp[(1) - (3)].symbol), current_class, (yylsp[(1) - (3)]), true);
2068 symbol_type_set ((yyvsp[(1) - (3)].symbol), current_type, (yylsp[(1) - (3)]));
2069 symbol_user_token_number_set ((yyvsp[(1) - (3)].symbol), (yyvsp[(2) - (3)].integer), (yylsp[(2) - (3)]));
2070 symbol_make_alias ((yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol), (yyloc));
2071 }
2072 break;
2073
2074 case 63:
2075#line 409 "../../src/parse-gram.y"
2076 {
2077 yyerrok;
2078 }
2079 break;
2080
2081 case 64:
2082#line 415 "../../src/parse-gram.y"
2083 { current_lhs = (yyvsp[(1) - (1)].symbol); current_lhs_location = (yylsp[(1) - (1)]); }
2084 break;
2085
2086 case 66:
2087#line 419 "../../src/parse-gram.y"
2088 { grammar_current_rule_end ((yylsp[(1) - (1)])); }
2089 break;
2090
2091 case 67:
2092#line 420 "../../src/parse-gram.y"
2093 { grammar_current_rule_end ((yylsp[(3) - (3)])); }
2094 break;
2095
2096 case 69:
2097#line 426 "../../src/parse-gram.y"
2098 { grammar_current_rule_begin (current_lhs, current_lhs_location); }
2099 break;
2100
2101 case 70:
2102#line 428 "../../src/parse-gram.y"
2103 { grammar_current_rule_symbol_append ((yyvsp[(2) - (2)].symbol), (yylsp[(2) - (2)])); }
2104 break;
2105
2106 case 72:
2107#line 431 "../../src/parse-gram.y"
2108 { grammar_current_rule_prec_set ((yyvsp[(3) - (3)].symbol), (yylsp[(3) - (3)])); }
2109 break;
2110
2111 case 73:
2112#line 433 "../../src/parse-gram.y"
2113 { grammar_current_rule_dprec_set ((yyvsp[(3) - (3)].integer), (yylsp[(3) - (3)])); }
2114 break;
2115
2116 case 74:
2117#line 435 "../../src/parse-gram.y"
2118 { grammar_current_rule_merge_set ((yyvsp[(3) - (3)].uniqstr), (yylsp[(3) - (3)])); }
2119 break;
2120
2121 case 75:
2122#line 439 "../../src/parse-gram.y"
2123 { (yyval.symbol) = (yyvsp[(1) - (1)].symbol); }
2124 break;
2125
2126 case 76:
2127#line 440 "../../src/parse-gram.y"
2128 { (yyval.symbol) = (yyvsp[(1) - (1)].symbol); }
2129 break;
2130
2131 case 77:
2132#line 456 "../../src/parse-gram.y"
2133 { grammar_current_rule_action_append (last_string, last_braced_code_loc); }
2134 break;
2135
2136 case 79:
2137#line 463 "../../src/parse-gram.y"
2138 {
2139 (yyval.symbol) = symbol_get (quotearg_style (c_quoting_style, (yyvsp[(1) - (1)].chars)), (yylsp[(1) - (1)]));
2140 symbol_class_set ((yyval.symbol), token_sym, (yylsp[(1) - (1)]), false);
2141 }
2142 break;
2143
2144 case 80:
2145#line 472 "../../src/parse-gram.y"
2146 { (yyval.chars) = (yyvsp[(1) - (1)].chars); }
2147 break;
2148
2149 case 82:
2150#line 479 "../../src/parse-gram.y"
2151 {
2152 muscle_code_grow ("epilogue", (yyvsp[(2) - (2)].chars), (yylsp[(2) - (2)]));
2153 scanner_last_string_free ();
2154 }
2155 break;
2156
2157
2158/* Line 1267 of yacc.c. */
2159#line 2160 "../../src/parse-gram.c"
2160 default: break;
2161 }
2162 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2163
2164 YYPOPSTACK (yylen);
2165 yylen = 0;
2166 YY_STACK_PRINT (yyss, yyssp);
2167
2168 *++yyvsp = yyval;
2169 *++yylsp = yyloc;
2170
2171 /* Now `shift' the result of the reduction. Determine what state
2172 that goes to, based on the state we popped back to and the rule
2173 number reduced by. */
2174
2175 yyn = yyr1[yyn];
2176
2177 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2178 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2179 yystate = yytable[yystate];
2180 else
2181 yystate = yydefgoto[yyn - YYNTOKENS];
2182
2183 goto yynewstate;
2184
2185
2186/*------------------------------------.
2187| yyerrlab -- here on detecting error |
2188`------------------------------------*/
2189yyerrlab:
2190 /* If not already recovering from an error, report this error. */
2191 if (!yyerrstatus)
2192 {
2193 ++yynerrs;
2194#if ! YYERROR_VERBOSE
2195 yyerror (YY_("syntax error"));
2196#else
2197 {
2198 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
2199 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
2200 {
2201 YYSIZE_T yyalloc = 2 * yysize;
2202 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
2203 yyalloc = YYSTACK_ALLOC_MAXIMUM;
2204 if (yymsg != yymsgbuf)
2205 YYSTACK_FREE (yymsg);
2206 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
2207 if (yymsg)
2208 yymsg_alloc = yyalloc;
2209 else
2210 {
2211 yymsg = yymsgbuf;
2212 yymsg_alloc = sizeof yymsgbuf;
2213 }
2214 }
2215
2216 if (0 < yysize && yysize <= yymsg_alloc)
2217 {
2218 (void) yysyntax_error (yymsg, yystate, yychar);
2219 yyerror (yymsg);
2220 }
2221 else
2222 {
2223 yyerror (YY_("syntax error"));
2224 if (yysize != 0)
2225 goto yyexhaustedlab;
2226 }
2227 }
2228#endif
2229 }
2230
2231 yyerror_range[0] = yylloc;
2232
2233 if (yyerrstatus == 3)
2234 {
2235 /* If just tried and failed to reuse look-ahead token after an
2236 error, discard it. */
2237
2238 if (yychar <= YYEOF)
2239 {
2240 /* Return failure if at end of input. */
2241 if (yychar == YYEOF)
2242 YYABORT;
2243 }
2244 else
2245 {
2246 yydestruct ("Error: discarding",
2247 yytoken, &yylval, &yylloc);
2248 yychar = YYEMPTY;
2249 }
2250 }
2251
2252 /* Else will try to reuse look-ahead token after shifting the error
2253 token. */
2254 goto yyerrlab1;
2255
2256
2257/*---------------------------------------------------.
2258| yyerrorlab -- error raised explicitly by YYERROR. |
2259`---------------------------------------------------*/
2260yyerrorlab:
2261
2262 /* Pacify compilers like GCC when the user code never invokes
2263 YYERROR and the label yyerrorlab therefore never appears in user
2264 code. */
2265 if (/*CONSTCOND*/ 0)
2266 goto yyerrorlab;
2267
2268 yyerror_range[0] = yylsp[1-yylen];
2269 /* Do not reclaim the symbols of the rule which action triggered
2270 this YYERROR. */
2271 YYPOPSTACK (yylen);
2272 yylen = 0;
2273 YY_STACK_PRINT (yyss, yyssp);
2274 yystate = *yyssp;
2275 goto yyerrlab1;
2276
2277
2278/*-------------------------------------------------------------.
2279| yyerrlab1 -- common code for both syntax error and YYERROR. |
2280`-------------------------------------------------------------*/
2281yyerrlab1:
2282 yyerrstatus = 3; /* Each real token shifted decrements this. */
2283
2284 for (;;)
2285 {
2286 yyn = yypact[yystate];
2287 if (yyn != YYPACT_NINF)
2288 {
2289 yyn += YYTERROR;
2290 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2291 {
2292 yyn = yytable[yyn];
2293 if (0 < yyn)
2294 break;
2295 }
2296 }
2297
2298 /* Pop the current state because it cannot handle the error token. */
2299 if (yyssp == yyss)
2300 YYABORT;
2301
2302 yyerror_range[0] = *yylsp;
2303 yydestruct ("Error: popping",
2304 yystos[yystate], yyvsp, yylsp);
2305 YYPOPSTACK (1);
2306 yystate = *yyssp;
2307 YY_STACK_PRINT (yyss, yyssp);
2308 }
2309
2310 if (yyn == YYFINAL)
2311 YYACCEPT;
2312
2313 *++yyvsp = yylval;
2314
2315 yyerror_range[1] = yylloc;
2316 /* Using YYLLOC is tempting, but would change the location of
2317 the look-ahead. YYLOC is available though. */
2318 YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
2319 *++yylsp = yyloc;
2320
2321 /* Shift the error token. */
2322 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2323
2324 yystate = yyn;
2325 goto yynewstate;
2326
2327
2328/*-------------------------------------.
2329| yyacceptlab -- YYACCEPT comes here. |
2330`-------------------------------------*/
2331yyacceptlab:
2332 yyresult = 0;
2333 goto yyreturn;
2334
2335/*-----------------------------------.
2336| yyabortlab -- YYABORT comes here. |
2337`-----------------------------------*/
2338yyabortlab:
2339 yyresult = 1;
2340 goto yyreturn;
2341
2342#ifndef yyoverflow
2343/*-------------------------------------------------.
2344| yyexhaustedlab -- memory exhaustion comes here. |
2345`-------------------------------------------------*/
2346yyexhaustedlab:
2347 yyerror (YY_("memory exhausted"));
2348 yyresult = 2;
2349 /* Fall through. */
2350#endif
2351
2352yyreturn:
2353 if (yychar != YYEOF && yychar != YYEMPTY)
2354 yydestruct ("Cleanup: discarding lookahead",
2355 yytoken, &yylval, &yylloc);
2356 /* Do not reclaim the symbols of the rule which action triggered
2357 this YYABORT or YYACCEPT. */
2358 YYPOPSTACK (yylen);
2359 YY_STACK_PRINT (yyss, yyssp);
2360 while (yyssp != yyss)
2361 {
2362 yydestruct ("Cleanup: popping",
2363 yystos[*yyssp], yyvsp, yylsp);
2364 YYPOPSTACK (1);
2365 }
2366#ifndef yyoverflow
2367 if (yyss != yyssa)
2368 YYSTACK_FREE (yyss);
2369#endif
2370#if YYERROR_VERBOSE
2371 if (yymsg != yymsgbuf)
2372 YYSTACK_FREE (yymsg);
2373#endif
2374 return yyresult;
2375}
2376
2377
2378#line 485 "../../src/parse-gram.y"
2379
2380
2381
2382/* Return the location of the left-hand side of a rule whose
2383 right-hand side is RHS[1] ... RHS[N]. Ignore empty nonterminals in
2384 the right-hand side, and return an empty location equal to the end
2385 boundary of RHS[0] if the right-hand side is empty. */
2386
2387static YYLTYPE
2388lloc_default (YYLTYPE const *rhs, int n)
2389{
2390 int i;
2391 YYLTYPE loc;
2392
2393 /* SGI MIPSpro 7.4.1m miscompiles "loc.start = loc.end = rhs[n].end;".
2394 The bug is fixed in 7.4.2m, but play it safe for now. */
2395 loc.start = rhs[n].end;
2396 loc.end = rhs[n].end;
2397
2398 /* Ignore empty nonterminals the start of the the right-hand side.
2399 Do not bother to ignore them at the end of the right-hand side,
2400 since empty nonterminals have the same end as their predecessors. */
2401 for (i = 1; i <= n; i++)
2402 if (! equal_boundaries (rhs[i].start, rhs[i].end))
2403 {
2404 loc.start = rhs[i].start;
2405 break;
2406 }
2407
2408 return loc;
2409}
2410
2411
2412/* Add a lex-param or a parse-param (depending on TYPE) with
2413 declaration DECL and location LOC. */
2414
2415static void
2416add_param (char const *type, char *decl, location loc)
2417{
2418 static char const alphanum[26 + 26 + 1 + 10] =
2419 "abcdefghijklmnopqrstuvwxyz"
2420 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
2421 "_"
2422 "0123456789";
2423 char const *name_start = NULL;
2424 char *p;
2425
2426 /* Stop on last actual character. */
2427 for (p = decl; p[1]; p++)
2428 if ((p == decl
2429 || ! memchr (alphanum, p[-1], sizeof alphanum))
2430 && memchr (alphanum, p[0], sizeof alphanum - 10))
2431 name_start = p;
2432
2433 /* Strip the surrounding '{' and '}', and any blanks just inside
2434 the braces. */
2435 while (*--p == ' ' || *p == '\t')
2436 continue;
2437 p[1] = '\0';
2438 while (*++decl == ' ' || *decl == '\t')
2439 continue;
2440
2441 if (! name_start)
2442 complain_at (loc, _("missing identifier in parameter declaration"));
2443 else
2444 {
2445 char *name;
2446 size_t name_len;
2447
2448 for (name_len = 1;
2449 memchr (alphanum, name_start[name_len], sizeof alphanum);
2450 name_len++)
2451 continue;
2452
2453 name = xmalloc (name_len + 1);
2454 memcpy (name, name_start, name_len);
2455 name[name_len] = '\0';
2456 muscle_pair_list_grow (type, decl, name);
2457 free (name);
2458 }
2459
2460 scanner_last_string_free ();
2461}
2462
2463static void
2464version_check (location const *loc, char const *version)
2465{
2466 if (strverscmp (version, PACKAGE_VERSION) > 0)
2467 {
2468 complain_at (*loc, "require bison %s, but have %s",
2469 version, PACKAGE_VERSION);
2470 exit (63);
2471 }
2472}
2473
2474static void
2475gram_error (location const *loc, char const *msg)
2476{
2477 complain_at (*loc, "%s", msg);
2478}
2479
2480char const *
2481token_name (int type)
2482{
2483 return yytname[YYTRANSLATE (type)];
2484}
2485