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