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