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