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