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