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