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