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