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