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