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