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