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