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