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