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