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