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