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