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