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