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