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