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