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