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