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