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