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