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