]> git.saurik.com Git - bison.git/blob - src/parse-gram.c
a3a74d4e2e7acd36b9059f2395a8a9be1e63db55
[bison.git] / src / parse-gram.c
1 /* A Bison parser, made by GNU Bison 2.4.404-c6ab. */
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.404-c6ab"
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 191 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 191 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 211 of yacc.c */
154 #line 201 "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 211 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 CHAR = 296,
217 EPILOGUE = 297,
218 EQUAL = 298,
219 ID = 299,
220 ID_COLON = 300,
221 PERCENT_PERCENT = 301,
222 PIPE = 302,
223 PROLOGUE = 303,
224 SEMICOLON = 304,
225 TAG = 305,
226 TAG_ANY = 306,
227 TAG_NONE = 307,
228 BRACKETED_ID = 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 CHAR 296
274 #define EPILOGUE 297
275 #define EQUAL 298
276 #define ID 299
277 #define ID_COLON 300
278 #define PERCENT_PERCENT 301
279 #define PIPE 302
280 #define PROLOGUE 303
281 #define SEMICOLON 304
282 #define TAG 305
283 #define TAG_ANY 306
284 #define TAG_NONE 307
285 #define BRACKETED_ID 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 216 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 216 of yacc.c */
309 #line 225 "src/parse-gram.y"
310
311 param_type param;
312
313
314 /* Line 216 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 266 of yacc.c */
339 #line 340 "src/parse-gram.c"
340 /* Unqualified %code blocks. */
341 /* Line 267 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 267 of yacc.c */
357 #line 214 "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 267 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 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 190
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, 250, 250, 258, 260, 264, 265, 275, 279, 284,
649 285, 290, 295, 296, 297, 298, 299, 304, 313, 314,
650 315, 316, 317, 318, 319, 320, 320, 321, 322, 346,
651 347, 348, 349, 353, 354, 363, 364, 365, 369, 376,
652 383, 387, 391, 398, 413, 414, 418, 430, 430, 435,
653 435, 440, 451, 466, 467, 468, 469, 473, 474, 479,
654 481, 486, 487, 492, 494, 499, 500, 504, 505, 506,
655 507, 512, 517, 522, 528, 534, 545, 546, 555, 556,
656 562, 563, 564, 571, 571, 576, 577, 578, 583, 585,
657 587, 589, 591, 593, 598, 600, 611, 612, 617, 618,
658 619, 628, 648, 650, 659, 664, 665, 670, 677, 679
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\"", "\"{...}\"", "\"char\"", "\"epilogue\"", "\"=\"",
678 "\"identifier\"", "\"identifier:\"", "\"%%\"", "\"|\"", "\"%{...%}\"",
679 "\";\"", "\"<tag>\"", "\"<*>\"", "\"<>\"", "\"[identifier]\"",
680 "\"%param\"", "\"%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 -88
707
708 #define yypact_value_is_default(yystate) \
709 ((yystate) == (-88))
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 -88, 38, 109, -88, -88, -88, -8, 13, 41, -88,
721 -88, -88, -88, -17, -88, 14, 51, -88, 53, 78,
722 -88, 2, -88, 43, 81, 17, -88, -88, -88, 30,
723 82, 83, 36, -88, -88, -88, 58, -88, -88, -88,
724 45, -88, -88, -88, -88, 40, -1, -1, 36, 0,
725 0, -88, 52, -88, -88, -88, 18, -88, -88, -88,
726 -88, 88, -88, -88, -88, 90, -88, 92, -88, -88,
727 -88, -88, -88, -88, -88, -88, 47, -88, 48, 1,
728 -88, -88, 46, 60, -88, 52, -88, 36, -88, -88,
729 -1, 31, -1, 36, -88, -88, -88, -88, 0, -88,
730 -88, 0, -88, -88, -88, -88, -88, -88, -88, -88,
731 -88, 56, -88, -88, -88, -88, -88, 61, -88, 36,
732 -88, 100, -88, 103, -88, -88, -88, -88, -88, -88,
733 -88, -88, -88, -23, 146, -88, -88, 36, 104, 57,
734 46, 46, 146, -88, -88, -88, -88, -88
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_int8 yypgoto[] =
761 {
762 -88, -88, -88, -88, -88, -88, 107, -88, -88, -88,
763 -88, -88, -88, -88, -88, -7, -88, 73, -76, -60,
764 64, -88, 71, -88, -88, -88, -11, -62, -88, -88,
765 -37, -18, -88, -32, -87, -88
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, 70, 124, 60, 4, 5, 6, 7,
783 8, 9, 10, 11, 12, 102, 94, 54, 13, 14,
784 64, 103, 126, 51, 135, 126, 136, 52, 91, 91,
785 122, 26, 122, 66, 70, 123, 132, 32, 3, 70,
786 71, 71, 48, 72, 72, 61, 77, 111, 118, 88,
787 95, 96, 97, 49, 57, 121, 40, 58, 55, 76,
788 65, 125, 104, 4, 5, 6, 7, 8, 9, 10,
789 11, 12, 91, 67, 91, 13, 14, 71, 146, 147,
790 72, 50, 59, 62, 63, 68, 69, 121, 26, 84,
791 86, 106, 51, 107, 32, 108, 109, 110, 127, 114,
792 116, 129, 141, 77, 131, 143, 70, 145, 144, 42,
793 141, 92, 130, 40, 4, 5, 6, 7, 8, 9,
794 10, 11, 12, 101, 142, 0, 13, 14, 15, 16,
795 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
796 27, 28, 29, 30, 31, 32, 33, 34, 35, 70,
797 112, 0, 0, 0, 0, 36, 0, 37, 38, 0,
798 137, 138, 139, 39, 40, 0, 0, 0, 0, 0,
799 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
800 0, 0, 0, 0, 0, 0, 140, 71, 0, 0,
801 72
802 };
803
804 static const yytype_int16 yycheck[] =
805 {
806 32, 0, 1, 3, 91, 3, 5, 6, 7, 8,
807 9, 10, 11, 12, 13, 52, 48, 3, 17, 18,
808 3, 3, 98, 40, 47, 101, 49, 44, 46, 47,
809 90, 30, 92, 3, 3, 4, 123, 36, 0, 3,
810 41, 41, 50, 44, 44, 43, 45, 46, 85, 50,
811 50, 51, 52, 40, 3, 87, 55, 4, 44, 1,
812 43, 93, 44, 5, 6, 7, 8, 9, 10, 11,
813 12, 13, 90, 43, 92, 17, 18, 41, 140, 141,
814 44, 40, 4, 40, 3, 3, 3, 119, 30, 44,
815 50, 3, 40, 3, 36, 3, 49, 49, 42, 53,
816 40, 40, 134, 45, 4, 137, 3, 50, 4, 2,
817 142, 47, 119, 55, 5, 6, 7, 8, 9, 10,
818 11, 12, 13, 50, 135, -1, 17, 18, 19, 20,
819 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
820 31, 32, 33, 34, 35, 36, 37, 38, 39, 3,
821 79, -1, -1, -1, -1, 46, -1, 48, 49, -1,
822 14, 15, 16, 54, 55, -1, -1, -1, -1, -1,
823 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
824 -1, -1, -1, -1, -1, -1, 40, 41, -1, -1,
825 44
826 };
827
828 /* STOS_[STATE-NUM] -- The (internal number of the) accessing
829 symbol of state STATE-NUM. */
830 static const yytype_uint8 yystos[] =
831 {
832 0, 57, 58, 0, 5, 6, 7, 8, 9, 10,
833 11, 12, 13, 17, 18, 19, 20, 21, 22, 23,
834 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
835 34, 35, 36, 37, 38, 39, 46, 48, 49, 54,
836 55, 59, 62, 64, 67, 68, 66, 65, 50, 40,
837 40, 40, 44, 86, 3, 44, 84, 3, 4, 4,
838 3, 43, 40, 3, 3, 43, 3, 43, 3, 3,
839 3, 41, 44, 87, 89, 90, 1, 45, 62, 77,
840 78, 79, 88, 60, 44, 63, 50, 69, 50, 75,
841 76, 87, 76, 72, 89, 50, 51, 52, 73, 74,
842 89, 73, 86, 3, 44, 85, 3, 3, 3, 49,
843 49, 46, 78, 91, 53, 83, 40, 61, 86, 70,
844 71, 89, 75, 4, 90, 89, 74, 42, 80, 40,
845 71, 4, 90, 81, 82, 47, 49, 14, 15, 16,
846 40, 89, 82, 89, 4, 50, 83, 83
847 };
848
849 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
850 static const yytype_uint8 yyr1[] =
851 {
852 0, 56, 57, 58, 58, 59, 59, 59, 59, 59,
853 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
854 59, 59, 59, 59, 59, 60, 59, 59, 59, 59,
855 59, 59, 59, 61, 61, 62, 62, 62, 62, 62,
856 62, 62, 62, 62, 63, 63, 62, 65, 64, 66,
857 64, 64, 67, 68, 68, 68, 68, 69, 69, 70,
858 70, 71, 71, 72, 72, 73, 73, 74, 74, 74,
859 74, 75, 75, 75, 75, 75, 76, 76, 77, 77,
860 78, 78, 78, 80, 79, 81, 81, 81, 82, 82,
861 82, 82, 82, 82, 83, 83, 84, 84, 85, 85,
862 85, 86, 87, 87, 88, 89, 89, 90, 91, 91
863 };
864
865 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
866 static const yytype_uint8 yyr2[] =
867 {
868 0, 2, 4, 0, 2, 1, 1, 1, 3, 1,
869 2, 1, 2, 2, 2, 3, 1, 2, 2, 2,
870 3, 1, 1, 2, 3, 0, 3, 2, 2, 1,
871 1, 1, 1, 2, 1, 1, 1, 2, 3, 3,
872 1, 1, 2, 3, 0, 1, 3, 0, 3, 0,
873 3, 3, 3, 1, 1, 1, 1, 0, 1, 1,
874 2, 1, 2, 1, 2, 1, 2, 1, 1, 1,
875 1, 1, 1, 2, 2, 3, 1, 2, 1, 2,
876 1, 2, 2, 0, 4, 1, 3, 2, 0, 3,
877 3, 3, 3, 3, 0, 1, 1, 1, 0, 1,
878 1, 1, 1, 1, 1, 1, 1, 1, 0, 2
879 };
880
881
882 #define yyerrok (yyerrstatus = 0)
883 #define yyclearin (yychar = YYEMPTY)
884 #define YYEMPTY (-2)
885 #define YYEOF 0
886
887 #define YYACCEPT goto yyacceptlab
888 #define YYABORT goto yyabortlab
889 #define YYERROR goto yyerrorlab
890
891
892 /* Like YYERROR except do call yyerror. This remains here temporarily
893 to ease the transition to the new meaning of YYERROR, for GCC.
894 Once GCC version 2 has supplanted version 1, this can go. */
895
896 #define YYFAIL goto yyerrlab
897
898 #define YYRECOVERING() (!!yyerrstatus)
899
900 #define YYBACKUP(Token, Value) \
901 do \
902 if (yychar == YYEMPTY && yylen == 1) \
903 { \
904 yychar = (Token); \
905 yylval = (Value); \
906 yytoken = YYTRANSLATE (yychar); \
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 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 653 of yacc.c */
1030 #line 175 "src/parse-gram.y"
1031 { fputs (quotearg_style (c_quoting_style, ((*yyvaluep).chars)), stderr); }
1032 /* Line 653 of yacc.c */
1033 #line 1034 "src/parse-gram.c"
1034 break;
1035
1036 case 4: // "integer"
1037
1038 /* Line 653 of yacc.c */
1039 #line 188 "src/parse-gram.y"
1040 { fprintf (stderr, "%d", ((*yyvaluep).integer)); }
1041 /* Line 653 of yacc.c */
1042 #line 1043 "src/parse-gram.c"
1043 break;
1044
1045 case 24: // "%<flag>"
1046
1047 /* Line 653 of yacc.c */
1048 #line 184 "src/parse-gram.y"
1049 { fprintf (stderr, "%%%s", ((*yyvaluep).uniqstr)); }
1050 /* Line 653 of yacc.c */
1051 #line 1052 "src/parse-gram.c"
1052 break;
1053
1054 case 40: // "{...}"
1055
1056 /* Line 653 of yacc.c */
1057 #line 177 "src/parse-gram.y"
1058 { fprintf (stderr, "{\n%s\n}", ((*yyvaluep).code)); }
1059 /* Line 653 of yacc.c */
1060 #line 1061 "src/parse-gram.c"
1061 break;
1062
1063 case 41: // "char"
1064
1065 /* Line 653 of yacc.c */
1066 #line 169 "src/parse-gram.y"
1067 { fputs (char_name (((*yyvaluep).character)), stderr); }
1068 /* Line 653 of yacc.c */
1069 #line 1070 "src/parse-gram.c"
1070 break;
1071
1072 case 42: // "epilogue"
1073
1074 /* Line 653 of yacc.c */
1075 #line 177 "src/parse-gram.y"
1076 { fprintf (stderr, "{\n%s\n}", ((*yyvaluep).chars)); }
1077 /* Line 653 of yacc.c */
1078 #line 1079 "src/parse-gram.c"
1079 break;
1080
1081 case 44: // "identifier"
1082
1083 /* Line 653 of yacc.c */
1084 #line 182 "src/parse-gram.y"
1085 { fputs (((*yyvaluep).uniqstr), stderr); }
1086 /* Line 653 of yacc.c */
1087 #line 1088 "src/parse-gram.c"
1088 break;
1089
1090 case 45: // "identifier:"
1091
1092 /* Line 653 of yacc.c */
1093 #line 183 "src/parse-gram.y"
1094 { fprintf (stderr, "%s:", ((*yyvaluep).uniqstr)); }
1095 /* Line 653 of yacc.c */
1096 #line 1097 "src/parse-gram.c"
1097 break;
1098
1099 case 48: // "%{...%}"
1100
1101 /* Line 653 of yacc.c */
1102 #line 177 "src/parse-gram.y"
1103 { fprintf (stderr, "{\n%s\n}", ((*yyvaluep).chars)); }
1104 /* Line 653 of yacc.c */
1105 #line 1106 "src/parse-gram.c"
1106 break;
1107
1108 case 50: // "<tag>"
1109
1110 /* Line 653 of yacc.c */
1111 #line 185 "src/parse-gram.y"
1112 { fprintf (stderr, "<%s>", ((*yyvaluep).uniqstr)); }
1113 /* Line 653 of yacc.c */
1114 #line 1115 "src/parse-gram.c"
1115 break;
1116
1117 case 54: // "%param"
1118
1119 /* Line 653 of yacc.c */
1120 #line 230 "src/parse-gram.y"
1121 {
1122 switch (((*yyvaluep).param))
1123 {
1124 #define CASE(In, Out) \
1125 case param_ ## In: fputs ("%" #Out, stderr); break
1126 CASE(lex, lex-param);
1127 CASE(parse, parse-param);
1128 CASE(both, param);
1129 #undef CASE
1130 case param_none: aver (false); break;
1131 }
1132 }
1133 /* Line 653 of yacc.c */
1134 #line 1135 "src/parse-gram.c"
1135 break;
1136
1137 case 84: // variable
1138
1139 /* Line 653 of yacc.c */
1140 #line 182 "src/parse-gram.y"
1141 { fputs (((*yyvaluep).uniqstr), stderr); }
1142 /* Line 653 of yacc.c */
1143 #line 1144 "src/parse-gram.c"
1144 break;
1145
1146 case 85: // content.opt
1147
1148 /* Line 653 of yacc.c */
1149 #line 177 "src/parse-gram.y"
1150 { fprintf (stderr, "{\n%s\n}", ((*yyvaluep).chars)); }
1151 /* Line 653 of yacc.c */
1152 #line 1153 "src/parse-gram.c"
1153 break;
1154
1155 case 86: // braceless
1156
1157 /* Line 653 of yacc.c */
1158 #line 177 "src/parse-gram.y"
1159 { fprintf (stderr, "{\n%s\n}", ((*yyvaluep).chars)); }
1160 /* Line 653 of yacc.c */
1161 #line 1162 "src/parse-gram.c"
1162 break;
1163
1164 case 87: // id
1165
1166 /* Line 653 of yacc.c */
1167 #line 191 "src/parse-gram.y"
1168 { fprintf (stderr, "%s", ((*yyvaluep).symbol)->tag); }
1169 /* Line 653 of yacc.c */
1170 #line 1171 "src/parse-gram.c"
1171 break;
1172
1173 case 88: // id_colon
1174
1175 /* Line 653 of yacc.c */
1176 #line 192 "src/parse-gram.y"
1177 { fprintf (stderr, "%s:", ((*yyvaluep).symbol)->tag); }
1178 /* Line 653 of yacc.c */
1179 #line 1180 "src/parse-gram.c"
1180 break;
1181
1182 case 89: // symbol
1183
1184 /* Line 653 of yacc.c */
1185 #line 191 "src/parse-gram.y"
1186 { fprintf (stderr, "%s", ((*yyvaluep).symbol)->tag); }
1187 /* Line 653 of yacc.c */
1188 #line 1189 "src/parse-gram.c"
1189 break;
1190
1191 case 90: // string_as_id
1192
1193 /* Line 653 of yacc.c */
1194 #line 191 "src/parse-gram.y"
1195 { fprintf (stderr, "%s", ((*yyvaluep).symbol)->tag); }
1196 /* Line 653 of yacc.c */
1197 #line 1198 "src/parse-gram.c"
1198 break;
1199
1200 default:
1201 break;
1202 }
1203 }
1204
1205
1206 /*--------------------------------.
1207 | Print this symbol on YYOUTPUT. |
1208 `--------------------------------*/
1209
1210 #if (defined __STDC__ || defined __C99__FUNC__ \
1211 || defined __cplusplus || defined _MSC_VER)
1212 static void
1213 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
1214 #else
1215 static void
1216 yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp)
1217 FILE *yyoutput;
1218 int yytype;
1219 YYSTYPE const * const yyvaluep;
1220 YYLTYPE const * const yylocationp;
1221 #endif
1222 {
1223 if (yytype < YYNTOKENS)
1224 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1225 else
1226 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1227
1228 YY_LOCATION_PRINT (yyoutput, *yylocationp);
1229 YYFPRINTF (yyoutput, ": ");
1230 yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp);
1231 YYFPRINTF (yyoutput, ")");
1232 }
1233
1234 /*------------------------------------------------------------------.
1235 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1236 | TOP (included). |
1237 `------------------------------------------------------------------*/
1238
1239 #if (defined __STDC__ || defined __C99__FUNC__ \
1240 || defined __cplusplus || defined _MSC_VER)
1241 static void
1242 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
1243 #else
1244 static void
1245 yy_stack_print (yybottom, yytop)
1246 yytype_int16 *yybottom;
1247 yytype_int16 *yytop;
1248 #endif
1249 {
1250 YYFPRINTF (stderr, "Stack now");
1251 for (; yybottom <= yytop; yybottom++)
1252 {
1253 int yybot = *yybottom;
1254 YYFPRINTF (stderr, " %d", yybot);
1255 }
1256 YYFPRINTF (stderr, "\n");
1257 }
1258
1259 # define YY_STACK_PRINT(Bottom, Top) \
1260 do { \
1261 if (yydebug) \
1262 yy_stack_print ((Bottom), (Top)); \
1263 } while (YYID (0))
1264
1265
1266 /*------------------------------------------------.
1267 | Report that the YYRULE is going to be reduced. |
1268 `------------------------------------------------*/
1269
1270 #if (defined __STDC__ || defined __C99__FUNC__ \
1271 || defined __cplusplus || defined _MSC_VER)
1272 static void
1273 yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule)
1274 #else
1275 static void
1276 yy_reduce_print (yyssp, yyvsp, yylsp, yyrule)
1277 yytype_int16 *yyssp;
1278 YYSTYPE *yyvsp;
1279 YYLTYPE *yylsp;
1280 int yyrule;
1281 #endif
1282 {
1283 unsigned long int yylno = yyrline[yyrule];
1284 int yynrhs = yyr2[yyrule];
1285 int yyi;
1286 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1287 yyrule - 1, yylno);
1288 /* The symbols being reduced. */
1289 for (yyi = 0; yyi < yynrhs; yyi++)
1290 {
1291 YYFPRINTF (stderr, " $%d = ", yyi + 1);
1292 yy_symbol_print (stderr,
1293 yystos[yyssp[yyi + 1 - yynrhs]],
1294 &(yyvsp[(yyi + 1) - (yynrhs)])
1295 , &(yylsp[(yyi + 1) - (yynrhs)]) );
1296 YYFPRINTF (stderr, "\n");
1297 }
1298 }
1299
1300 # define YY_REDUCE_PRINT(Rule) \
1301 do { \
1302 if (yydebug) \
1303 yy_reduce_print (yyssp, yyvsp, yylsp, Rule); \
1304 } while (YYID (0))
1305
1306 /* Nonzero means print parse trace. It is left uninitialized so that
1307 multiple parsers can coexist. */
1308 int yydebug;
1309 #else /* !YYDEBUG */
1310 # define YYDPRINTF(Args)
1311 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1312 # define YY_STACK_PRINT(Bottom, Top)
1313 # define YY_REDUCE_PRINT(Rule)
1314 #endif /* !YYDEBUG */
1315
1316
1317 /* YYINITDEPTH -- initial size of the parser's stacks. */
1318 #ifndef YYINITDEPTH
1319 # define YYINITDEPTH 200
1320 #endif
1321
1322 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1323 if the built-in stack extension method is used).
1324
1325 Do not make this value too large; the results are undefined if
1326 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1327 evaluated with infinite-precision integer arithmetic. */
1328
1329 #ifndef YYMAXDEPTH
1330 # define YYMAXDEPTH 10000
1331 #endif
1332
1333 \f
1334
1335 #if YYERROR_VERBOSE
1336
1337 # ifndef yystrlen
1338 # if defined __GLIBC__ && defined _STRING_H
1339 # define yystrlen strlen
1340 # else
1341 /* Return the length of YYSTR. */
1342 #if (defined __STDC__ || defined __C99__FUNC__ \
1343 || defined __cplusplus || defined _MSC_VER)
1344 static YYSIZE_T
1345 yystrlen (const char *yystr)
1346 #else
1347 static YYSIZE_T
1348 yystrlen (yystr)
1349 const char *yystr;
1350 #endif
1351 {
1352 YYSIZE_T yylen;
1353 for (yylen = 0; yystr[yylen]; yylen++)
1354 continue;
1355 return yylen;
1356 }
1357 # endif
1358 # endif
1359
1360 # ifndef yystpcpy
1361 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1362 # define yystpcpy stpcpy
1363 # else
1364 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1365 YYDEST. */
1366 #if (defined __STDC__ || defined __C99__FUNC__ \
1367 || defined __cplusplus || defined _MSC_VER)
1368 static char *
1369 yystpcpy (char *yydest, const char *yysrc)
1370 #else
1371 static char *
1372 yystpcpy (yydest, yysrc)
1373 char *yydest;
1374 const char *yysrc;
1375 #endif
1376 {
1377 char *yyd = yydest;
1378 const char *yys = yysrc;
1379
1380 while ((*yyd++ = *yys++) != '\0')
1381 continue;
1382
1383 return yyd - 1;
1384 }
1385 # endif
1386 # endif
1387
1388 # ifndef yytnamerr
1389 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1390 quotes and backslashes, so that it's suitable for yyerror. The
1391 heuristic is that double-quoting is unnecessary unless the string
1392 contains an apostrophe, a comma, or backslash (other than
1393 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1394 null, do not copy; instead, return the length of what the result
1395 would have been. */
1396 static YYSIZE_T
1397 yytnamerr (char *yyres, const char *yystr)
1398 {
1399 if (*yystr == '"')
1400 {
1401 YYSIZE_T yyn = 0;
1402 char const *yyp = yystr;
1403
1404 for (;;)
1405 switch (*++yyp)
1406 {
1407 case '\'':
1408 case ',':
1409 goto do_not_strip_quotes;
1410
1411 case '\\':
1412 if (*++yyp != '\\')
1413 goto do_not_strip_quotes;
1414 /* Fall through. */
1415 default:
1416 if (yyres)
1417 yyres[yyn] = *yyp;
1418 yyn++;
1419 break;
1420
1421 case '"':
1422 if (yyres)
1423 yyres[yyn] = '\0';
1424 return yyn;
1425 }
1426 do_not_strip_quotes: ;
1427 }
1428
1429 if (! yyres)
1430 return yystrlen (yystr);
1431
1432 return yystpcpy (yyres, yystr) - yyres;
1433 }
1434 # endif
1435
1436 /* Copy into YYRESULT an error message about the unexpected token
1437 YYTOKEN while in state YYSTATE. Return the number of bytes copied,
1438 including the terminating null byte. If YYRESULT is null, do not
1439 copy anything; just return the number of bytes that would be
1440 copied. As a special case, return 0 if an ordinary "syntax error"
1441 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1442 size calculation. */
1443 static YYSIZE_T
1444 yysyntax_error (char *yyresult, int yystate, int yytoken)
1445 {
1446 int yyn = yypact[yystate];
1447
1448 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1449 return 0;
1450 else
1451 {
1452 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
1453 YYSIZE_T yysize = yysize0;
1454 YYSIZE_T yysize1;
1455 int yysize_overflow = 0;
1456 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1457 /* Internationalized format string. */
1458 const char *yyformat = 0;
1459 /* Arguments of yyformat. */
1460 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1461
1462 /* Start YYX at -YYN if negative to avoid negative indexes in
1463 YYCHECK. In other words, skip the first -YYN actions for this
1464 state because they are default actions. */
1465 int yyxbegin = yyn < 0 ? -yyn : 0;
1466
1467 /* Stay within bounds of both yycheck and yytname. */
1468 int yychecklim = YYLAST - yyn + 1;
1469 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1470 /* Number of reported tokens (one for the "unexpected", one per
1471 "expected"). */
1472 int yycount = 0;
1473 int yyx;
1474
1475 yyarg[yycount++] = yytname[yytoken];
1476
1477 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1478 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1479 && !yytable_value_is_error (yytable[yyx + yyn]))
1480 {
1481 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1482 {
1483 yycount = 1;
1484 yysize = yysize0;
1485 break;
1486 }
1487 yyarg[yycount++] = yytname[yyx];
1488 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1489 yysize_overflow |= (yysize1 < yysize);
1490 yysize = yysize1;
1491 }
1492
1493 switch (yycount)
1494 {
1495 #define YYCASE_(N, S) \
1496 case N: \
1497 yyformat = S; \
1498 break
1499 YYCASE_(1, YY_("syntax error, unexpected %s"));
1500 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1501 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1502 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1503 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1504 #undef YYCASE_
1505 }
1506
1507 yysize1 = yysize + yystrlen (yyformat);
1508 yysize_overflow |= (yysize1 < yysize);
1509 yysize = yysize1;
1510
1511 if (yysize_overflow)
1512 return YYSIZE_MAXIMUM;
1513
1514 if (yyresult)
1515 {
1516 /* Avoid sprintf, as that infringes on the user's name space.
1517 Don't have undefined behavior even if the translation
1518 produced a string with the wrong number of "%s"s. */
1519 char *yyp = yyresult;
1520 int yyi = 0;
1521 while ((*yyp = *yyformat) != '\0')
1522 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1523 {
1524 yyp += yytnamerr (yyp, yyarg[yyi++]);
1525 yyformat += 2;
1526 }
1527 else
1528 {
1529 yyp++;
1530 yyformat++;
1531 }
1532 }
1533 return yysize;
1534 }
1535 }
1536 #endif /* YYERROR_VERBOSE */
1537 \f
1538
1539 /*-----------------------------------------------.
1540 | Release the memory associated to this symbol. |
1541 `-----------------------------------------------*/
1542
1543 /*ARGSUSED*/
1544 #if (defined __STDC__ || defined __C99__FUNC__ \
1545 || defined __cplusplus || defined _MSC_VER)
1546 static void
1547 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp)
1548 #else
1549 static void
1550 yydestruct (yymsg, yytype, yyvaluep, yylocationp)
1551 const char *yymsg;
1552 int yytype;
1553 YYSTYPE *yyvaluep;
1554 YYLTYPE *yylocationp;
1555 #endif
1556 {
1557 YYUSE (yyvaluep);
1558 YYUSE (yylocationp);
1559
1560 if (!yymsg)
1561 yymsg = "Deleting";
1562 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1563
1564 switch (yytype)
1565 {
1566 default:
1567 break;
1568 }
1569 }
1570
1571 /* Prevent warnings from -Wmissing-prototypes. */
1572 #ifdef YYPARSE_PARAM
1573 #if (defined __STDC__ || defined __C99__FUNC__ \
1574 || defined __cplusplus || defined _MSC_VER)
1575 int yyparse (void *YYPARSE_PARAM);
1576 #else
1577 int yyparse ();
1578 #endif
1579 #else /* ! YYPARSE_PARAM */
1580 #if (defined __STDC__ || defined __C99__FUNC__ \
1581 || defined __cplusplus || defined _MSC_VER)
1582 int yyparse (void);
1583 #else
1584 int yyparse ();
1585 #endif
1586 #endif /* ! YYPARSE_PARAM */
1587
1588
1589
1590
1591
1592 /*-------------------------.
1593 | yyparse or yypush_parse. |
1594 `-------------------------*/
1595
1596 #ifdef YYPARSE_PARAM
1597 #if (defined __STDC__ || defined __C99__FUNC__ \
1598 || defined __cplusplus || defined _MSC_VER)
1599 int
1600 yyparse (void *YYPARSE_PARAM)
1601 #else
1602 int
1603 yyparse (YYPARSE_PARAM)
1604 void *YYPARSE_PARAM;
1605 #endif
1606 #else /* ! YYPARSE_PARAM */
1607 #if (defined __STDC__ || defined __C99__FUNC__ \
1608 || defined __cplusplus || defined _MSC_VER)
1609 int
1610 yyparse (void)
1611 #else
1612 int
1613 yyparse ()
1614
1615 #endif
1616 #endif
1617 {
1618 /* The lookahead symbol. */
1619 int yychar;
1620
1621 /* The semantic value of the lookahead symbol. */
1622 YYSTYPE yylval;
1623
1624 /* Location data for the lookahead symbol. */
1625 YYLTYPE yylloc;
1626
1627 /* Number of syntax errors so far. */
1628 int yynerrs;
1629
1630 int yystate;
1631 /* Number of tokens to shift before error messages enabled. */
1632 int yyerrstatus;
1633
1634 /* The stacks and their tools:
1635 `yyss': related to states.
1636 `yyvs': related to semantic values.
1637 `yyls': related to locations.
1638
1639 Refer to the stacks thru separate pointers, to allow yyoverflow
1640 to reallocate them elsewhere. */
1641
1642 /* The state stack. */
1643 yytype_int16 yyssa[YYINITDEPTH];
1644 yytype_int16 *yyss;
1645 yytype_int16 *yyssp;
1646
1647 /* The semantic value stack. */
1648 YYSTYPE yyvsa[YYINITDEPTH];
1649 YYSTYPE *yyvs;
1650 YYSTYPE *yyvsp;
1651
1652 /* The location stack. */
1653 YYLTYPE yylsa[YYINITDEPTH];
1654 YYLTYPE *yyls;
1655 YYLTYPE *yylsp;
1656
1657 /* The locations where the error started and ended. */
1658 YYLTYPE yyerror_range[2];
1659
1660 YYSIZE_T yystacksize;
1661
1662 int yyn;
1663 int yyresult;
1664 /* Lookahead token as an internal (translated) token number. */
1665 int yytoken;
1666 /* The variables used to return semantic value and location from the
1667 action routines. */
1668 YYSTYPE yyval;
1669 YYLTYPE yyloc;
1670
1671 #if YYERROR_VERBOSE
1672 /* Buffer for error messages, and its allocated size. */
1673 char yymsgbuf[128];
1674 char *yymsg = yymsgbuf;
1675 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1676 #endif
1677
1678 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
1679
1680 /* The number of symbols on the RHS of the reduced rule.
1681 Keep to zero when no symbol should be popped. */
1682 int yylen = 0;
1683
1684 yytoken = 0;
1685 yyss = yyssa;
1686 yyvs = yyvsa;
1687 yyls = yylsa;
1688 yystacksize = YYINITDEPTH;
1689
1690 YYDPRINTF ((stderr, "Starting parse\n"));
1691
1692 yystate = 0;
1693 yyerrstatus = 0;
1694 yynerrs = 0;
1695 yychar = YYEMPTY; /* Cause a token to be read. */
1696
1697 /* Initialize stack pointers.
1698 Waste one element of value and location stack
1699 so that they stay on the same level as the state stack.
1700 The wasted elements are never initialized. */
1701 yyssp = yyss;
1702 yyvsp = yyvs;
1703 yylsp = yyls;
1704
1705 #if YYLTYPE_IS_TRIVIAL
1706 /* Initialize the default location before parsing starts. */
1707 yylloc.first_line = yylloc.last_line = 1;
1708 yylloc.first_column = yylloc.last_column = 1;
1709 #endif
1710
1711 /* User initialization code. */
1712 /* Line 1175 of yacc.c */
1713 #line 80 "src/parse-gram.y"
1714 {
1715 /* Bison's grammar can initial empty locations, hence a default
1716 location is needed. */
1717 boundary_set (&yylloc.start, current_file, 1, 1);
1718 boundary_set (&yylloc.end, current_file, 1, 1);
1719 }
1720 /* Line 1175 of yacc.c */
1721 #line 1722 "src/parse-gram.c"
1722 yylsp[0] = yylloc;
1723
1724 goto yysetstate;
1725
1726 /*------------------------------------------------------------.
1727 | yynewstate -- Push a new state, which is found in yystate. |
1728 `------------------------------------------------------------*/
1729 yynewstate:
1730 /* In all cases, when you get here, the value and location stacks
1731 have just been pushed. So pushing a state here evens the stacks. */
1732 yyssp++;
1733
1734 yysetstate:
1735 *yyssp = yystate;
1736
1737 if (yyss + yystacksize - 1 <= yyssp)
1738 {
1739 /* Get the current used size of the three stacks, in elements. */
1740 YYSIZE_T yysize = yyssp - yyss + 1;
1741
1742 #ifdef yyoverflow
1743 {
1744 /* Give user a chance to reallocate the stack. Use copies of
1745 these so that the &'s don't force the real ones into
1746 memory. */
1747 YYSTYPE *yyvs1 = yyvs;
1748 yytype_int16 *yyss1 = yyss;
1749 YYLTYPE *yyls1 = yyls;
1750
1751 /* Each stack pointer address is followed by the size of the
1752 data in use in that stack, in bytes. This used to be a
1753 conditional around just the two extra args, but that might
1754 be undefined if yyoverflow is a macro. */
1755 yyoverflow (YY_("memory exhausted"),
1756 &yyss1, yysize * sizeof (*yyssp),
1757 &yyvs1, yysize * sizeof (*yyvsp),
1758 &yyls1, yysize * sizeof (*yylsp),
1759 &yystacksize);
1760
1761 yyls = yyls1;
1762 yyss = yyss1;
1763 yyvs = yyvs1;
1764 }
1765 #else /* no yyoverflow */
1766 # ifndef YYSTACK_RELOCATE
1767 goto yyexhaustedlab;
1768 # else
1769 /* Extend the stack our own way. */
1770 if (YYMAXDEPTH <= yystacksize)
1771 goto yyexhaustedlab;
1772 yystacksize *= 2;
1773 if (YYMAXDEPTH < yystacksize)
1774 yystacksize = YYMAXDEPTH;
1775
1776 {
1777 yytype_int16 *yyss1 = yyss;
1778 union yyalloc *yyptr =
1779 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1780 if (! yyptr)
1781 goto yyexhaustedlab;
1782 YYSTACK_RELOCATE (yyss_alloc, yyss);
1783 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1784 YYSTACK_RELOCATE (yyls_alloc, yyls);
1785 # undef YYSTACK_RELOCATE
1786 if (yyss1 != yyssa)
1787 YYSTACK_FREE (yyss1);
1788 }
1789 # endif
1790 #endif /* no yyoverflow */
1791
1792 yyssp = yyss + yysize - 1;
1793 yyvsp = yyvs + yysize - 1;
1794 yylsp = yyls + yysize - 1;
1795
1796 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1797 (unsigned long int) yystacksize));
1798
1799 if (yyss + yystacksize - 1 <= yyssp)
1800 YYABORT;
1801 }
1802
1803 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1804
1805 if (yystate == YYFINAL)
1806 YYACCEPT;
1807
1808 goto yybackup;
1809
1810 /*-----------.
1811 | yybackup. |
1812 `-----------*/
1813 yybackup:
1814
1815 /* Do appropriate processing given the current state. Read a
1816 lookahead token if we need one and don't already have one. */
1817
1818 /* First try to decide what to do without reference to lookahead token. */
1819 yyn = yypact[yystate];
1820 if (yypact_value_is_default (yyn))
1821 goto yydefault;
1822
1823 /* Not known => get a lookahead token if don't already have one. */
1824
1825 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1826 if (yychar == YYEMPTY)
1827 {
1828 YYDPRINTF ((stderr, "Reading a token: "));
1829 yychar = YYLEX;
1830 }
1831
1832 if (yychar <= YYEOF)
1833 {
1834 yychar = yytoken = YYEOF;
1835 YYDPRINTF ((stderr, "Now at end of input.\n"));
1836 }
1837 else
1838 {
1839 yytoken = YYTRANSLATE (yychar);
1840 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1841 }
1842
1843 /* If the proper action on seeing token YYTOKEN is to reduce or to
1844 detect an error, take that action. */
1845 yyn += yytoken;
1846 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1847 goto yydefault;
1848 yyn = yytable[yyn];
1849 if (yyn <= 0)
1850 {
1851 if (yytable_value_is_error (yyn))
1852 goto yyerrlab;
1853 yyn = -yyn;
1854 goto yyreduce;
1855 }
1856
1857 /* Count tokens shifted since error; after three, turn off error
1858 status. */
1859 if (yyerrstatus)
1860 yyerrstatus--;
1861
1862 /* Shift the lookahead token. */
1863 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1864
1865 /* Discard the shifted token. */
1866 yychar = YYEMPTY;
1867
1868 yystate = yyn;
1869 *++yyvsp = yylval;
1870 *++yylsp = yylloc;
1871 goto yynewstate;
1872
1873
1874 /*-----------------------------------------------------------.
1875 | yydefault -- do the default action for the current state. |
1876 `-----------------------------------------------------------*/
1877 yydefault:
1878 yyn = yydefact[yystate];
1879 if (yyn == 0)
1880 goto yyerrlab;
1881 goto yyreduce;
1882
1883
1884 /*-----------------------------.
1885 | yyreduce -- Do a reduction. |
1886 `-----------------------------*/
1887 yyreduce:
1888 /* yyn is the number of a rule to reduce with. */
1889 yylen = yyr2[yyn];
1890
1891 /* If YYLEN is nonzero, implement the default value of the action:
1892 `$$ = $1'.
1893
1894 Otherwise, the following line sets YYVAL to garbage.
1895 This behavior is undocumented and Bison
1896 users should not rely upon it. Assigning to YYVAL
1897 unconditionally makes the parser a bit smaller, and it avoids a
1898 GCC warning that YYVAL may be used uninitialized. */
1899 yyval = yyvsp[1-yylen];
1900
1901 /* Default location. */
1902 YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
1903 YY_REDUCE_PRINT (yyn);
1904 switch (yyn)
1905 {
1906 case 6:
1907 /* Line 1388 of yacc.c */
1908 #line 266 "src/parse-gram.y"
1909 {
1910 code_props plain_code;
1911 code_props_plain_init (&plain_code, (yyvsp[0].chars), (yylsp[0]));
1912 code_props_translate_code (&plain_code);
1913 gram_scanner_last_string_free ();
1914 muscle_code_grow (union_seen ? "post_prologue" : "pre_prologue",
1915 plain_code.code, (yylsp[0]));
1916 code_scanner_last_string_free ();
1917 }
1918 /* Line 1388 of yacc.c */
1919 #line 1920 "src/parse-gram.c"
1920 break;
1921
1922 case 7:
1923 /* Line 1388 of yacc.c */
1924 #line 276 "src/parse-gram.y"
1925 {
1926 muscle_percent_define_ensure ((yyvsp[0].uniqstr), (yylsp[0]), true);
1927 }
1928 /* Line 1388 of yacc.c */
1929 #line 1930 "src/parse-gram.c"
1930 break;
1931
1932 case 8:
1933 /* Line 1388 of yacc.c */
1934 #line 280 "src/parse-gram.y"
1935 {
1936 muscle_percent_define_insert ((yyvsp[-1].uniqstr), (yylsp[-1]), (yyvsp[0].chars),
1937 MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE);
1938 }
1939 /* Line 1388 of yacc.c */
1940 #line 1941 "src/parse-gram.c"
1941 break;
1942
1943 case 9:
1944 /* Line 1388 of yacc.c */
1945 #line 284 "src/parse-gram.y"
1946 { defines_flag = true; }
1947 /* Line 1388 of yacc.c */
1948 #line 1949 "src/parse-gram.c"
1949 break;
1950
1951 case 10:
1952 /* Line 1388 of yacc.c */
1953 #line 286 "src/parse-gram.y"
1954 {
1955 defines_flag = true;
1956 spec_defines_file = xstrdup ((yyvsp[0].chars));
1957 }
1958 /* Line 1388 of yacc.c */
1959 #line 1960 "src/parse-gram.c"
1960 break;
1961
1962 case 11:
1963 /* Line 1388 of yacc.c */
1964 #line 291 "src/parse-gram.y"
1965 {
1966 muscle_percent_define_insert ("parse.error", (yylsp[0]), "verbose",
1967 MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE);
1968 }
1969 /* Line 1388 of yacc.c */
1970 #line 1971 "src/parse-gram.c"
1971 break;
1972
1973 case 12:
1974 /* Line 1388 of yacc.c */
1975 #line 295 "src/parse-gram.y"
1976 { expected_sr_conflicts = (yyvsp[0].integer); }
1977 /* Line 1388 of yacc.c */
1978 #line 1979 "src/parse-gram.c"
1979 break;
1980
1981 case 13:
1982 /* Line 1388 of yacc.c */
1983 #line 296 "src/parse-gram.y"
1984 { expected_rr_conflicts = (yyvsp[0].integer); }
1985 /* Line 1388 of yacc.c */
1986 #line 1987 "src/parse-gram.c"
1987 break;
1988
1989 case 14:
1990 /* Line 1388 of yacc.c */
1991 #line 297 "src/parse-gram.y"
1992 { spec_file_prefix = (yyvsp[0].chars); }
1993 /* Line 1388 of yacc.c */
1994 #line 1995 "src/parse-gram.c"
1995 break;
1996
1997 case 15:
1998 /* Line 1388 of yacc.c */
1999 #line 298 "src/parse-gram.y"
2000 { spec_file_prefix = (yyvsp[0].chars); }
2001 /* Line 1388 of yacc.c */
2002 #line 2003 "src/parse-gram.c"
2003 break;
2004
2005 case 16:
2006 /* Line 1388 of yacc.c */
2007 #line 300 "src/parse-gram.y"
2008 {
2009 nondeterministic_parser = true;
2010 glr_parser = true;
2011 }
2012 /* Line 1388 of yacc.c */
2013 #line 2014 "src/parse-gram.c"
2014 break;
2015
2016 case 17:
2017 /* Line 1388 of yacc.c */
2018 #line 305 "src/parse-gram.y"
2019 {
2020 code_props action;
2021 code_props_symbol_action_init (&action, (yyvsp[0].code), (yylsp[0]));
2022 code_props_translate_code (&action);
2023 gram_scanner_last_string_free ();
2024 muscle_code_grow ("initial_action", action.code, (yylsp[0]));
2025 code_scanner_last_string_free ();
2026 }
2027 /* Line 1388 of yacc.c */
2028 #line 2029 "src/parse-gram.c"
2029 break;
2030
2031 case 18:
2032 /* Line 1388 of yacc.c */
2033 #line 313 "src/parse-gram.y"
2034 { language_argmatch ((yyvsp[0].chars), grammar_prio, (yylsp[-1])); }
2035 /* Line 1388 of yacc.c */
2036 #line 2037 "src/parse-gram.c"
2037 break;
2038
2039 case 19:
2040 /* Line 1388 of yacc.c */
2041 #line 314 "src/parse-gram.y"
2042 { spec_name_prefix = (yyvsp[0].chars); }
2043 /* Line 1388 of yacc.c */
2044 #line 2045 "src/parse-gram.c"
2045 break;
2046
2047 case 20:
2048 /* Line 1388 of yacc.c */
2049 #line 315 "src/parse-gram.y"
2050 { spec_name_prefix = (yyvsp[0].chars); }
2051 /* Line 1388 of yacc.c */
2052 #line 2053 "src/parse-gram.c"
2053 break;
2054
2055 case 21:
2056 /* Line 1388 of yacc.c */
2057 #line 316 "src/parse-gram.y"
2058 { no_lines_flag = true; }
2059 /* Line 1388 of yacc.c */
2060 #line 2061 "src/parse-gram.c"
2061 break;
2062
2063 case 22:
2064 /* Line 1388 of yacc.c */
2065 #line 317 "src/parse-gram.y"
2066 { nondeterministic_parser = true; }
2067 /* Line 1388 of yacc.c */
2068 #line 2069 "src/parse-gram.c"
2069 break;
2070
2071 case 23:
2072 /* Line 1388 of yacc.c */
2073 #line 318 "src/parse-gram.y"
2074 { spec_outfile = (yyvsp[0].chars); }
2075 /* Line 1388 of yacc.c */
2076 #line 2077 "src/parse-gram.c"
2077 break;
2078
2079 case 24:
2080 /* Line 1388 of yacc.c */
2081 #line 319 "src/parse-gram.y"
2082 { spec_outfile = (yyvsp[0].chars); }
2083 /* Line 1388 of yacc.c */
2084 #line 2085 "src/parse-gram.c"
2085 break;
2086
2087 case 25:
2088 /* Line 1388 of yacc.c */
2089 #line 320 "src/parse-gram.y"
2090 { current_param = (yyvsp[0].param); }
2091 /* Line 1388 of yacc.c */
2092 #line 2093 "src/parse-gram.c"
2093 break;
2094
2095 case 26:
2096 /* Line 1388 of yacc.c */
2097 #line 320 "src/parse-gram.y"
2098 { current_param = param_none; }
2099 /* Line 1388 of yacc.c */
2100 #line 2101 "src/parse-gram.c"
2101 break;
2102
2103 case 27:
2104 /* Line 1388 of yacc.c */
2105 #line 321 "src/parse-gram.y"
2106 { version_check (&(yylsp[0]), (yyvsp[0].chars)); }
2107 /* Line 1388 of yacc.c */
2108 #line 2109 "src/parse-gram.c"
2109 break;
2110
2111 case 28:
2112 /* Line 1388 of yacc.c */
2113 #line 323 "src/parse-gram.y"
2114 {
2115 char const *skeleton_user = (yyvsp[0].chars);
2116 if (strchr (skeleton_user, '/'))
2117 {
2118 size_t dir_length = strlen (current_file);
2119 char *skeleton_build;
2120 while (dir_length && current_file[dir_length - 1] != '/')
2121 --dir_length;
2122 while (dir_length && current_file[dir_length - 1] == '/')
2123 --dir_length;
2124 skeleton_build =
2125 xmalloc (dir_length + 1 + strlen (skeleton_user) + 1);
2126 if (dir_length > 0)
2127 {
2128 strncpy (skeleton_build, current_file, dir_length);
2129 skeleton_build[dir_length++] = '/';
2130 }
2131 strcpy (skeleton_build + dir_length, skeleton_user);
2132 skeleton_user = uniqstr_new (skeleton_build);
2133 free (skeleton_build);
2134 }
2135 skeleton_arg (skeleton_user, grammar_prio, (yylsp[-1]));
2136 }
2137 /* Line 1388 of yacc.c */
2138 #line 2139 "src/parse-gram.c"
2139 break;
2140
2141 case 29:
2142 /* Line 1388 of yacc.c */
2143 #line 346 "src/parse-gram.y"
2144 { token_table_flag = true; }
2145 /* Line 1388 of yacc.c */
2146 #line 2147 "src/parse-gram.c"
2147 break;
2148
2149 case 30:
2150 /* Line 1388 of yacc.c */
2151 #line 347 "src/parse-gram.y"
2152 { report_flag |= report_states; }
2153 /* Line 1388 of yacc.c */
2154 #line 2155 "src/parse-gram.c"
2155 break;
2156
2157 case 31:
2158 /* Line 1388 of yacc.c */
2159 #line 348 "src/parse-gram.y"
2160 { yacc_flag = true; }
2161 /* Line 1388 of yacc.c */
2162 #line 2163 "src/parse-gram.c"
2163 break;
2164
2165 case 33:
2166 /* Line 1388 of yacc.c */
2167 #line 353 "src/parse-gram.y"
2168 { add_param (current_param, (yyvsp[0].code), (yylsp[0])); }
2169 /* Line 1388 of yacc.c */
2170 #line 2171 "src/parse-gram.c"
2171 break;
2172
2173 case 34:
2174 /* Line 1388 of yacc.c */
2175 #line 354 "src/parse-gram.y"
2176 { add_param (current_param, (yyvsp[0].code), (yylsp[0])); }
2177 /* Line 1388 of yacc.c */
2178 #line 2179 "src/parse-gram.c"
2179 break;
2180
2181 case 37:
2182 /* Line 1388 of yacc.c */
2183 #line 366 "src/parse-gram.y"
2184 {
2185 grammar_start_symbol_set ((yyvsp[0].symbol), (yylsp[0]));
2186 }
2187 /* Line 1388 of yacc.c */
2188 #line 2189 "src/parse-gram.c"
2189 break;
2190
2191 case 38:
2192 /* Line 1388 of yacc.c */
2193 #line 370 "src/parse-gram.y"
2194 {
2195 symbol_list *list;
2196 for (list = (yyvsp[0].list); list; list = list->next)
2197 symbol_list_destructor_set (list, (yyvsp[-1].code), (yylsp[-1]));
2198 symbol_list_free ((yyvsp[0].list));
2199 }
2200 /* Line 1388 of yacc.c */
2201 #line 2202 "src/parse-gram.c"
2202 break;
2203
2204 case 39:
2205 /* Line 1388 of yacc.c */
2206 #line 377 "src/parse-gram.y"
2207 {
2208 symbol_list *list;
2209 for (list = (yyvsp[0].list); list; list = list->next)
2210 symbol_list_printer_set (list, (yyvsp[-1].code), (yylsp[-1]));
2211 symbol_list_free ((yyvsp[0].list));
2212 }
2213 /* Line 1388 of yacc.c */
2214 #line 2215 "src/parse-gram.c"
2215 break;
2216
2217 case 40:
2218 /* Line 1388 of yacc.c */
2219 #line 384 "src/parse-gram.y"
2220 {
2221 default_prec = true;
2222 }
2223 /* Line 1388 of yacc.c */
2224 #line 2225 "src/parse-gram.c"
2225 break;
2226
2227 case 41:
2228 /* Line 1388 of yacc.c */
2229 #line 388 "src/parse-gram.y"
2230 {
2231 default_prec = false;
2232 }
2233 /* Line 1388 of yacc.c */
2234 #line 2235 "src/parse-gram.c"
2235 break;
2236
2237 case 42:
2238 /* Line 1388 of yacc.c */
2239 #line 392 "src/parse-gram.y"
2240 {
2241 /* Do not invoke muscle_percent_code_grow here since it invokes
2242 muscle_user_name_list_grow. */
2243 muscle_code_grow ("percent_code()", (yyvsp[0].chars), (yylsp[0]));
2244 code_scanner_last_string_free ();
2245 }
2246 /* Line 1388 of yacc.c */
2247 #line 2248 "src/parse-gram.c"
2248 break;
2249
2250 case 43:
2251 /* Line 1388 of yacc.c */
2252 #line 399 "src/parse-gram.y"
2253 {
2254 muscle_percent_code_grow ((yyvsp[-1].uniqstr), (yylsp[-1]), (yyvsp[0].chars), (yylsp[0]));
2255 code_scanner_last_string_free ();
2256 }
2257 /* Line 1388 of yacc.c */
2258 #line 2259 "src/parse-gram.c"
2259 break;
2260
2261 case 44:
2262 /* Line 1388 of yacc.c */
2263 #line 413 "src/parse-gram.y"
2264 {}
2265 /* Line 1388 of yacc.c */
2266 #line 2267 "src/parse-gram.c"
2267 break;
2268
2269 case 45:
2270 /* Line 1388 of yacc.c */
2271 #line 414 "src/parse-gram.y"
2272 { muscle_code_grow ("union_name", (yyvsp[0].uniqstr), (yylsp[0])); }
2273 /* Line 1388 of yacc.c */
2274 #line 2275 "src/parse-gram.c"
2275 break;
2276
2277 case 46:
2278 /* Line 1388 of yacc.c */
2279 #line 419 "src/parse-gram.y"
2280 {
2281 union_seen = true;
2282 muscle_code_grow ("stype", (yyvsp[0].chars), (yylsp[0]));
2283 code_scanner_last_string_free ();
2284 }
2285 /* Line 1388 of yacc.c */
2286 #line 2287 "src/parse-gram.c"
2287 break;
2288
2289 case 47:
2290 /* Line 1388 of yacc.c */
2291 #line 430 "src/parse-gram.y"
2292 { current_class = nterm_sym; }
2293 /* Line 1388 of yacc.c */
2294 #line 2295 "src/parse-gram.c"
2295 break;
2296
2297 case 48:
2298 /* Line 1388 of yacc.c */
2299 #line 431 "src/parse-gram.y"
2300 {
2301 current_class = unknown_sym;
2302 current_type = NULL;
2303 }
2304 /* Line 1388 of yacc.c */
2305 #line 2306 "src/parse-gram.c"
2306 break;
2307
2308 case 49:
2309 /* Line 1388 of yacc.c */
2310 #line 435 "src/parse-gram.y"
2311 { current_class = token_sym; }
2312 /* Line 1388 of yacc.c */
2313 #line 2314 "src/parse-gram.c"
2314 break;
2315
2316 case 50:
2317 /* Line 1388 of yacc.c */
2318 #line 436 "src/parse-gram.y"
2319 {
2320 current_class = unknown_sym;
2321 current_type = NULL;
2322 }
2323 /* Line 1388 of yacc.c */
2324 #line 2325 "src/parse-gram.c"
2325 break;
2326
2327 case 51:
2328 /* Line 1388 of yacc.c */
2329 #line 441 "src/parse-gram.y"
2330 {
2331 symbol_list *list;
2332 tag_seen = true;
2333 for (list = (yyvsp[0].list); list; list = list->next)
2334 symbol_type_set (list->content.sym, (yyvsp[-1].uniqstr), (yylsp[-1]));
2335 symbol_list_free ((yyvsp[0].list));
2336 }
2337 /* Line 1388 of yacc.c */
2338 #line 2339 "src/parse-gram.c"
2339 break;
2340
2341 case 52:
2342 /* Line 1388 of yacc.c */
2343 #line 452 "src/parse-gram.y"
2344 {
2345 symbol_list *list;
2346 ++current_prec;
2347 for (list = (yyvsp[0].list); list; list = list->next)
2348 {
2349 symbol_type_set (list->content.sym, current_type, (yylsp[-1]));
2350 symbol_precedence_set (list->content.sym, current_prec, (yyvsp[-2].assoc), (yylsp[-2]));
2351 }
2352 symbol_list_free ((yyvsp[0].list));
2353 current_type = NULL;
2354 }
2355 /* Line 1388 of yacc.c */
2356 #line 2357 "src/parse-gram.c"
2357 break;
2358
2359 case 53:
2360 /* Line 1388 of yacc.c */
2361 #line 466 "src/parse-gram.y"
2362 { (yyval.assoc) = left_assoc; }
2363 /* Line 1388 of yacc.c */
2364 #line 2365 "src/parse-gram.c"
2365 break;
2366
2367 case 54:
2368 /* Line 1388 of yacc.c */
2369 #line 467 "src/parse-gram.y"
2370 { (yyval.assoc) = right_assoc; }
2371 /* Line 1388 of yacc.c */
2372 #line 2373 "src/parse-gram.c"
2373 break;
2374
2375 case 55:
2376 /* Line 1388 of yacc.c */
2377 #line 468 "src/parse-gram.y"
2378 { (yyval.assoc) = non_assoc; }
2379 /* Line 1388 of yacc.c */
2380 #line 2381 "src/parse-gram.c"
2381 break;
2382
2383 case 56:
2384 /* Line 1388 of yacc.c */
2385 #line 469 "src/parse-gram.y"
2386 { (yyval.assoc) = precedence_assoc; }
2387 /* Line 1388 of yacc.c */
2388 #line 2389 "src/parse-gram.c"
2389 break;
2390
2391 case 57:
2392 /* Line 1388 of yacc.c */
2393 #line 473 "src/parse-gram.y"
2394 { current_type = NULL; }
2395 /* Line 1388 of yacc.c */
2396 #line 2397 "src/parse-gram.c"
2397 break;
2398
2399 case 58:
2400 /* Line 1388 of yacc.c */
2401 #line 474 "src/parse-gram.y"
2402 { current_type = (yyvsp[0].uniqstr); tag_seen = true; }
2403 /* Line 1388 of yacc.c */
2404 #line 2405 "src/parse-gram.c"
2405 break;
2406
2407 case 59:
2408 /* Line 1388 of yacc.c */
2409 #line 480 "src/parse-gram.y"
2410 { (yyval.list) = symbol_list_sym_new ((yyvsp[0].symbol), (yylsp[0])); }
2411 /* Line 1388 of yacc.c */
2412 #line 2413 "src/parse-gram.c"
2413 break;
2414
2415 case 60:
2416 /* Line 1388 of yacc.c */
2417 #line 482 "src/parse-gram.y"
2418 { (yyval.list) = symbol_list_prepend ((yyvsp[-1].list), symbol_list_sym_new ((yyvsp[0].symbol), (yylsp[0]))); }
2419 /* Line 1388 of yacc.c */
2420 #line 2421 "src/parse-gram.c"
2421 break;
2422
2423 case 61:
2424 /* Line 1388 of yacc.c */
2425 #line 486 "src/parse-gram.y"
2426 { (yyval.symbol) = (yyvsp[0].symbol); }
2427 /* Line 1388 of yacc.c */
2428 #line 2429 "src/parse-gram.c"
2429 break;
2430
2431 case 62:
2432 /* Line 1388 of yacc.c */
2433 #line 487 "src/parse-gram.y"
2434 { (yyval.symbol) = (yyvsp[-1].symbol); symbol_user_token_number_set ((yyvsp[-1].symbol), (yyvsp[0].integer), (yylsp[0])); }
2435 /* Line 1388 of yacc.c */
2436 #line 2437 "src/parse-gram.c"
2437 break;
2438
2439 case 63:
2440 /* Line 1388 of yacc.c */
2441 #line 493 "src/parse-gram.y"
2442 { (yyval.list) = symbol_list_sym_new ((yyvsp[0].symbol), (yylsp[0])); }
2443 /* Line 1388 of yacc.c */
2444 #line 2445 "src/parse-gram.c"
2445 break;
2446
2447 case 64:
2448 /* Line 1388 of yacc.c */
2449 #line 495 "src/parse-gram.y"
2450 { (yyval.list) = symbol_list_prepend ((yyvsp[-1].list), symbol_list_sym_new ((yyvsp[0].symbol), (yylsp[0]))); }
2451 /* Line 1388 of yacc.c */
2452 #line 2453 "src/parse-gram.c"
2453 break;
2454
2455 case 65:
2456 /* Line 1388 of yacc.c */
2457 #line 499 "src/parse-gram.y"
2458 { (yyval.list) = (yyvsp[0].list); }
2459 /* Line 1388 of yacc.c */
2460 #line 2461 "src/parse-gram.c"
2461 break;
2462
2463 case 66:
2464 /* Line 1388 of yacc.c */
2465 #line 500 "src/parse-gram.y"
2466 { (yyval.list) = symbol_list_prepend ((yyvsp[-1].list), (yyvsp[0].list)); }
2467 /* Line 1388 of yacc.c */
2468 #line 2469 "src/parse-gram.c"
2469 break;
2470
2471 case 67:
2472 /* Line 1388 of yacc.c */
2473 #line 504 "src/parse-gram.y"
2474 { (yyval.list) = symbol_list_sym_new ((yyvsp[0].symbol), (yylsp[0])); }
2475 /* Line 1388 of yacc.c */
2476 #line 2477 "src/parse-gram.c"
2477 break;
2478
2479 case 68:
2480 /* Line 1388 of yacc.c */
2481 #line 505 "src/parse-gram.y"
2482 { (yyval.list) = symbol_list_type_new ((yyvsp[0].uniqstr), (yylsp[0])); }
2483 /* Line 1388 of yacc.c */
2484 #line 2485 "src/parse-gram.c"
2485 break;
2486
2487 case 69:
2488 /* Line 1388 of yacc.c */
2489 #line 506 "src/parse-gram.y"
2490 { (yyval.list) = symbol_list_default_tagged_new ((yylsp[0])); }
2491 /* Line 1388 of yacc.c */
2492 #line 2493 "src/parse-gram.c"
2493 break;
2494
2495 case 70:
2496 /* Line 1388 of yacc.c */
2497 #line 507 "src/parse-gram.y"
2498 { (yyval.list) = symbol_list_default_tagless_new ((yylsp[0])); }
2499 /* Line 1388 of yacc.c */
2500 #line 2501 "src/parse-gram.c"
2501 break;
2502
2503 case 71:
2504 /* Line 1388 of yacc.c */
2505 #line 513 "src/parse-gram.y"
2506 {
2507 current_type = (yyvsp[0].uniqstr);
2508 tag_seen = true;
2509 }
2510 /* Line 1388 of yacc.c */
2511 #line 2512 "src/parse-gram.c"
2512 break;
2513
2514 case 72:
2515 /* Line 1388 of yacc.c */
2516 #line 518 "src/parse-gram.y"
2517 {
2518 symbol_class_set ((yyvsp[0].symbol), current_class, (yylsp[0]), true);
2519 symbol_type_set ((yyvsp[0].symbol), current_type, (yylsp[0]));
2520 }
2521 /* Line 1388 of yacc.c */
2522 #line 2523 "src/parse-gram.c"
2523 break;
2524
2525 case 73:
2526 /* Line 1388 of yacc.c */
2527 #line 523 "src/parse-gram.y"
2528 {
2529 symbol_class_set ((yyvsp[-1].symbol), current_class, (yylsp[-1]), true);
2530 symbol_type_set ((yyvsp[-1].symbol), current_type, (yylsp[-1]));
2531 symbol_user_token_number_set ((yyvsp[-1].symbol), (yyvsp[0].integer), (yylsp[0]));
2532 }
2533 /* Line 1388 of yacc.c */
2534 #line 2535 "src/parse-gram.c"
2535 break;
2536
2537 case 74:
2538 /* Line 1388 of yacc.c */
2539 #line 529 "src/parse-gram.y"
2540 {
2541 symbol_class_set ((yyvsp[-1].symbol), current_class, (yylsp[-1]), true);
2542 symbol_type_set ((yyvsp[-1].symbol), current_type, (yylsp[-1]));
2543 symbol_make_alias ((yyvsp[-1].symbol), (yyvsp[0].symbol), (yyloc));
2544 }
2545 /* Line 1388 of yacc.c */
2546 #line 2547 "src/parse-gram.c"
2547 break;
2548
2549 case 75:
2550 /* Line 1388 of yacc.c */
2551 #line 535 "src/parse-gram.y"
2552 {
2553 symbol_class_set ((yyvsp[-2].symbol), current_class, (yylsp[-2]), true);
2554 symbol_type_set ((yyvsp[-2].symbol), current_type, (yylsp[-2]));
2555 symbol_user_token_number_set ((yyvsp[-2].symbol), (yyvsp[-1].integer), (yylsp[-1]));
2556 symbol_make_alias ((yyvsp[-2].symbol), (yyvsp[0].symbol), (yyloc));
2557 }
2558 /* Line 1388 of yacc.c */
2559 #line 2560 "src/parse-gram.c"
2560 break;
2561
2562 case 82:
2563 /* Line 1388 of yacc.c */
2564 #line 565 "src/parse-gram.y"
2565 {
2566 yyerrok;
2567 }
2568 /* Line 1388 of yacc.c */
2569 #line 2570 "src/parse-gram.c"
2570 break;
2571
2572 case 83:
2573 /* Line 1388 of yacc.c */
2574 #line 571 "src/parse-gram.y"
2575 { current_lhs = (yyvsp[-1].symbol); current_lhs_location = (yylsp[-1]);
2576 current_lhs_named_ref = (yyvsp[0].named_ref); }
2577 /* Line 1388 of yacc.c */
2578 #line 2579 "src/parse-gram.c"
2579 break;
2580
2581 case 85:
2582 /* Line 1388 of yacc.c */
2583 #line 576 "src/parse-gram.y"
2584 { grammar_current_rule_end ((yylsp[0])); }
2585 /* Line 1388 of yacc.c */
2586 #line 2587 "src/parse-gram.c"
2587 break;
2588
2589 case 86:
2590 /* Line 1388 of yacc.c */
2591 #line 577 "src/parse-gram.y"
2592 { grammar_current_rule_end ((yylsp[0])); }
2593 /* Line 1388 of yacc.c */
2594 #line 2595 "src/parse-gram.c"
2595 break;
2596
2597 case 88:
2598 /* Line 1388 of yacc.c */
2599 #line 583 "src/parse-gram.y"
2600 { grammar_current_rule_begin (current_lhs, current_lhs_location,
2601 current_lhs_named_ref); }
2602 /* Line 1388 of yacc.c */
2603 #line 2604 "src/parse-gram.c"
2604 break;
2605
2606 case 89:
2607 /* Line 1388 of yacc.c */
2608 #line 586 "src/parse-gram.y"
2609 { grammar_current_rule_symbol_append ((yyvsp[-1].symbol), (yylsp[-1]), (yyvsp[0].named_ref)); }
2610 /* Line 1388 of yacc.c */
2611 #line 2612 "src/parse-gram.c"
2612 break;
2613
2614 case 90:
2615 /* Line 1388 of yacc.c */
2616 #line 588 "src/parse-gram.y"
2617 { grammar_current_rule_action_append ((yyvsp[-1].code), (yylsp[-1]), (yyvsp[0].named_ref)); }
2618 /* Line 1388 of yacc.c */
2619 #line 2620 "src/parse-gram.c"
2620 break;
2621
2622 case 91:
2623 /* Line 1388 of yacc.c */
2624 #line 590 "src/parse-gram.y"
2625 { grammar_current_rule_prec_set ((yyvsp[0].symbol), (yylsp[0])); }
2626 /* Line 1388 of yacc.c */
2627 #line 2628 "src/parse-gram.c"
2628 break;
2629
2630 case 92:
2631 /* Line 1388 of yacc.c */
2632 #line 592 "src/parse-gram.y"
2633 { grammar_current_rule_dprec_set ((yyvsp[0].integer), (yylsp[0])); }
2634 /* Line 1388 of yacc.c */
2635 #line 2636 "src/parse-gram.c"
2636 break;
2637
2638 case 93:
2639 /* Line 1388 of yacc.c */
2640 #line 594 "src/parse-gram.y"
2641 { grammar_current_rule_merge_set ((yyvsp[0].uniqstr), (yylsp[0])); }
2642 /* Line 1388 of yacc.c */
2643 #line 2644 "src/parse-gram.c"
2644 break;
2645
2646 case 94:
2647 /* Line 1388 of yacc.c */
2648 #line 598 "src/parse-gram.y"
2649 { (yyval.named_ref) = 0; }
2650 /* Line 1388 of yacc.c */
2651 #line 2652 "src/parse-gram.c"
2652 break;
2653
2654 case 95:
2655 /* Line 1388 of yacc.c */
2656 #line 600 "src/parse-gram.y"
2657 { (yyval.named_ref) = named_ref_new((yyvsp[0].uniqstr), (yylsp[0])); }
2658 /* Line 1388 of yacc.c */
2659 #line 2660 "src/parse-gram.c"
2660 break;
2661
2662 case 97:
2663 /* Line 1388 of yacc.c */
2664 #line 612 "src/parse-gram.y"
2665 { (yyval.uniqstr) = uniqstr_new ((yyvsp[0].chars)); }
2666 /* Line 1388 of yacc.c */
2667 #line 2668 "src/parse-gram.c"
2668 break;
2669
2670 case 98:
2671 /* Line 1388 of yacc.c */
2672 #line 617 "src/parse-gram.y"
2673 { (yyval.chars) = ""; }
2674 /* Line 1388 of yacc.c */
2675 #line 2676 "src/parse-gram.c"
2676 break;
2677
2678 case 99:
2679 /* Line 1388 of yacc.c */
2680 #line 618 "src/parse-gram.y"
2681 { (yyval.chars) = (yyvsp[0].uniqstr); }
2682 /* Line 1388 of yacc.c */
2683 #line 2684 "src/parse-gram.c"
2684 break;
2685
2686 case 101:
2687 /* Line 1388 of yacc.c */
2688 #line 629 "src/parse-gram.y"
2689 {
2690 code_props plain_code;
2691 (yyvsp[0].code)[strlen ((yyvsp[0].code)) - 1] = '\n';
2692 code_props_plain_init (&plain_code, (yyvsp[0].code)+1, (yylsp[0]));
2693 code_props_translate_code (&plain_code);
2694 gram_scanner_last_string_free ();
2695 (yyval.chars) = plain_code.code;
2696 }
2697 /* Line 1388 of yacc.c */
2698 #line 2699 "src/parse-gram.c"
2699 break;
2700
2701 case 102:
2702 /* Line 1388 of yacc.c */
2703 #line 649 "src/parse-gram.y"
2704 { (yyval.symbol) = symbol_from_uniqstr ((yyvsp[0].uniqstr), (yylsp[0])); }
2705 /* Line 1388 of yacc.c */
2706 #line 2707 "src/parse-gram.c"
2707 break;
2708
2709 case 103:
2710 /* Line 1388 of yacc.c */
2711 #line 651 "src/parse-gram.y"
2712 {
2713 (yyval.symbol) = symbol_get (char_name ((yyvsp[0].character)), (yylsp[0]));
2714 symbol_class_set ((yyval.symbol), token_sym, (yylsp[0]), false);
2715 symbol_user_token_number_set ((yyval.symbol), (yyvsp[0].character), (yylsp[0]));
2716 }
2717 /* Line 1388 of yacc.c */
2718 #line 2719 "src/parse-gram.c"
2719 break;
2720
2721 case 104:
2722 /* Line 1388 of yacc.c */
2723 #line 659 "src/parse-gram.y"
2724 { (yyval.symbol) = symbol_from_uniqstr ((yyvsp[0].uniqstr), (yylsp[0])); }
2725 /* Line 1388 of yacc.c */
2726 #line 2727 "src/parse-gram.c"
2727 break;
2728
2729 case 107:
2730 /* Line 1388 of yacc.c */
2731 #line 671 "src/parse-gram.y"
2732 {
2733 (yyval.symbol) = symbol_get (quotearg_style (c_quoting_style, (yyvsp[0].chars)), (yylsp[0]));
2734 symbol_class_set ((yyval.symbol), token_sym, (yylsp[0]), false);
2735 }
2736 /* Line 1388 of yacc.c */
2737 #line 2738 "src/parse-gram.c"
2738 break;
2739
2740 case 109:
2741 /* Line 1388 of yacc.c */
2742 #line 680 "src/parse-gram.y"
2743 {
2744 code_props plain_code;
2745 code_props_plain_init (&plain_code, (yyvsp[0].chars), (yylsp[0]));
2746 code_props_translate_code (&plain_code);
2747 gram_scanner_last_string_free ();
2748 muscle_code_grow ("epilogue", plain_code.code, (yylsp[0]));
2749 code_scanner_last_string_free ();
2750 }
2751 /* Line 1388 of yacc.c */
2752 #line 2753 "src/parse-gram.c"
2753 break;
2754
2755
2756 /* Line 1388 of yacc.c */
2757 #line 2758 "src/parse-gram.c"
2758 default: break;
2759 }
2760 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2761
2762 YYPOPSTACK (yylen);
2763 yylen = 0;
2764 YY_STACK_PRINT (yyss, yyssp);
2765
2766 *++yyvsp = yyval;
2767 *++yylsp = yyloc;
2768
2769 /* Now `shift' the result of the reduction. Determine what state
2770 that goes to, based on the state we popped back to and the rule
2771 number reduced by. */
2772
2773 yyn = yyr1[yyn];
2774
2775 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2776 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2777 yystate = yytable[yystate];
2778 else
2779 yystate = yydefgoto[yyn - YYNTOKENS];
2780
2781 goto yynewstate;
2782
2783
2784 /*------------------------------------.
2785 | yyerrlab -- here on detecting error |
2786 `------------------------------------*/
2787 yyerrlab:
2788 /* If not already recovering from an error, report this error. */
2789 if (!yyerrstatus)
2790 {
2791 ++yynerrs;
2792 #if ! YYERROR_VERBOSE
2793 yyerror (YY_("syntax error"));
2794 #else
2795 {
2796 YYSIZE_T yysize = yysyntax_error (0, yystate, yytoken);
2797 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
2798 {
2799 YYSIZE_T yyalloc = 2 * yysize;
2800 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
2801 yyalloc = YYSTACK_ALLOC_MAXIMUM;
2802 if (yymsg != yymsgbuf)
2803 YYSTACK_FREE (yymsg);
2804 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
2805 if (yymsg)
2806 yymsg_alloc = yyalloc;
2807 else
2808 {
2809 yymsg = yymsgbuf;
2810 yymsg_alloc = sizeof yymsgbuf;
2811 }
2812 }
2813
2814 if (0 < yysize && yysize <= yymsg_alloc)
2815 {
2816 (void) yysyntax_error (yymsg, yystate, yytoken);
2817 yyerror (yymsg);
2818 }
2819 else
2820 {
2821 yyerror (YY_("syntax error"));
2822 if (yysize != 0)
2823 goto yyexhaustedlab;
2824 }
2825 }
2826 #endif
2827 }
2828
2829 yyerror_range[0] = yylloc;
2830
2831 if (yyerrstatus == 3)
2832 {
2833 /* If just tried and failed to reuse lookahead token after an
2834 error, discard it. */
2835
2836 if (yychar <= YYEOF)
2837 {
2838 /* Return failure if at end of input. */
2839 if (yychar == YYEOF)
2840 YYABORT;
2841 }
2842 else
2843 {
2844 yydestruct ("Error: discarding",
2845 yytoken, &yylval, &yylloc);
2846 yychar = YYEMPTY;
2847 }
2848 }
2849
2850 /* Else will try to reuse lookahead token after shifting the error
2851 token. */
2852 goto yyerrlab1;
2853
2854
2855 /*---------------------------------------------------.
2856 | yyerrorlab -- error raised explicitly by YYERROR. |
2857 `---------------------------------------------------*/
2858 yyerrorlab:
2859
2860 /* Pacify compilers like GCC when the user code never invokes
2861 YYERROR and the label yyerrorlab therefore never appears in user
2862 code. */
2863 if (/*CONSTCOND*/ 0)
2864 goto yyerrorlab;
2865
2866 yyerror_range[0] = yylsp[1-yylen];
2867 /* Do not reclaim the symbols of the rule which action triggered
2868 this YYERROR. */
2869 YYPOPSTACK (yylen);
2870 yylen = 0;
2871 YY_STACK_PRINT (yyss, yyssp);
2872 yystate = *yyssp;
2873 goto yyerrlab1;
2874
2875
2876 /*-------------------------------------------------------------.
2877 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2878 `-------------------------------------------------------------*/
2879 yyerrlab1:
2880 yyerrstatus = 3; /* Each real token shifted decrements this. */
2881
2882 for (;;)
2883 {
2884 yyn = yypact[yystate];
2885 if (!yypact_value_is_default (yyn))
2886 {
2887 yyn += YYTERROR;
2888 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2889 {
2890 yyn = yytable[yyn];
2891 if (0 < yyn)
2892 break;
2893 }
2894 }
2895
2896 /* Pop the current state because it cannot handle the error token. */
2897 if (yyssp == yyss)
2898 YYABORT;
2899
2900 yyerror_range[0] = *yylsp;
2901 yydestruct ("Error: popping",
2902 yystos[yystate], yyvsp, yylsp);
2903 YYPOPSTACK (1);
2904 yystate = *yyssp;
2905 YY_STACK_PRINT (yyss, yyssp);
2906 }
2907
2908 *++yyvsp = yylval;
2909
2910 yyerror_range[1] = yylloc;
2911 /* Using YYLLOC is tempting, but would change the location of
2912 the lookahead. YYLOC is available though. */
2913 YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
2914 *++yylsp = yyloc;
2915
2916 /* Shift the error token. */
2917 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2918
2919 yystate = yyn;
2920 goto yynewstate;
2921
2922
2923 /*-------------------------------------.
2924 | yyacceptlab -- YYACCEPT comes here. |
2925 `-------------------------------------*/
2926 yyacceptlab:
2927 yyresult = 0;
2928 goto yyreturn;
2929
2930 /*-----------------------------------.
2931 | yyabortlab -- YYABORT comes here. |
2932 `-----------------------------------*/
2933 yyabortlab:
2934 yyresult = 1;
2935 goto yyreturn;
2936
2937 #if !defined(yyoverflow) || YYERROR_VERBOSE
2938 /*-------------------------------------------------.
2939 | yyexhaustedlab -- memory exhaustion comes here. |
2940 `-------------------------------------------------*/
2941 yyexhaustedlab:
2942 yyerror (YY_("memory exhausted"));
2943 yyresult = 2;
2944 /* Fall through. */
2945 #endif
2946
2947 yyreturn:
2948 if (yychar != YYEMPTY)
2949 yydestruct ("Cleanup: discarding lookahead",
2950 yytoken, &yylval, &yylloc);
2951 /* Do not reclaim the symbols of the rule which action triggered
2952 this YYABORT or YYACCEPT. */
2953 YYPOPSTACK (yylen);
2954 YY_STACK_PRINT (yyss, yyssp);
2955 while (yyssp != yyss)
2956 {
2957 yydestruct ("Cleanup: popping",
2958 yystos[*yyssp], yyvsp, yylsp);
2959 YYPOPSTACK (1);
2960 }
2961 #ifndef yyoverflow
2962 if (yyss != yyssa)
2963 YYSTACK_FREE (yyss);
2964 #endif
2965 #if YYERROR_VERBOSE
2966 if (yymsg != yymsgbuf)
2967 YYSTACK_FREE (yymsg);
2968 #endif
2969 /* Make sure YYID is used. */
2970 return YYID (yyresult);
2971 }
2972
2973 /* Line 1607 of yacc.c */
2974 #line 690 "src/parse-gram.y"
2975
2976
2977
2978 /* Return the location of the left-hand side of a rule whose
2979 right-hand side is RHS[1] ... RHS[N]. Ignore empty nonterminals in
2980 the right-hand side, and return an empty location equal to the end
2981 boundary of RHS[0] if the right-hand side is empty. */
2982
2983 static YYLTYPE
2984 lloc_default (YYLTYPE const *rhs, int n)
2985 {
2986 int i;
2987 YYLTYPE loc;
2988
2989 /* SGI MIPSpro 7.4.1m miscompiles "loc.start = loc.end = rhs[n].end;".
2990 The bug is fixed in 7.4.2m, but play it safe for now. */
2991 loc.start = rhs[n].end;
2992 loc.end = rhs[n].end;
2993
2994 /* Ignore empty nonterminals the start of the the right-hand side.
2995 Do not bother to ignore them at the end of the right-hand side,
2996 since empty nonterminals have the same end as their predecessors. */
2997 for (i = 1; i <= n; i++)
2998 if (! equal_boundaries (rhs[i].start, rhs[i].end))
2999 {
3000 loc.start = rhs[i].start;
3001 break;
3002 }
3003
3004 return loc;
3005 }
3006
3007
3008 static void
3009 add_param (param_type type, char *decl, location loc)
3010 {
3011 static char const alphanum[26 + 26 + 1 + 10] =
3012 "abcdefghijklmnopqrstuvwxyz"
3013 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
3014 "_"
3015 "0123456789";
3016
3017 char const *name_start = NULL;
3018 {
3019 char *p;
3020 /* Stop on last actual character. */
3021 for (p = decl; p[1]; p++)
3022 if ((p == decl
3023 || ! memchr (alphanum, p[-1], sizeof alphanum))
3024 && memchr (alphanum, p[0], sizeof alphanum - 10))
3025 name_start = p;
3026
3027 /* Strip the surrounding '{' and '}', and any blanks just inside
3028 the braces. */
3029 while (*--p == ' ' || *p == '\t')
3030 continue;
3031 p[1] = '\0';
3032 while (*++decl == ' ' || *decl == '\t')
3033 continue;
3034 }
3035
3036 if (! name_start)
3037 complain_at (loc, _("missing identifier in parameter declaration"));
3038 else
3039 {
3040 char *name;
3041 size_t name_len;
3042
3043 for (name_len = 1;
3044 memchr (alphanum, name_start[name_len], sizeof alphanum);
3045 name_len++)
3046 continue;
3047
3048 name = xmalloc (name_len + 1);
3049 memcpy (name, name_start, name_len);
3050 name[name_len] = '\0';
3051 if (type & param_lex)
3052 muscle_pair_list_grow ("lex_param", decl, name);
3053 if (type & param_parse)
3054 muscle_pair_list_grow ("parse_param", decl, name);
3055 free (name);
3056 }
3057
3058 gram_scanner_last_string_free ();
3059 }
3060
3061
3062 static void
3063 version_check (location const *loc, char const *version)
3064 {
3065 if (strverscmp (version, PACKAGE_VERSION) > 0)
3066 {
3067 complain_at (*loc, "require bison %s, but have %s",
3068 version, PACKAGE_VERSION);
3069 exit (63);
3070 }
3071 }
3072
3073 static void
3074 gram_error (location const *loc, char const *msg)
3075 {
3076 complain_at (*loc, "%s", msg);
3077 }
3078
3079 char const *
3080 token_name (int type)
3081 {
3082 return yytname[YYTRANSLATE (type)];
3083 }
3084
3085 static char const *
3086 char_name (char c)
3087 {
3088 if (c == '\'')
3089 return "'\\''";
3090 else
3091 {
3092 char buf[4];
3093 buf[0] = '\''; buf[1] = c; buf[2] = '\''; buf[3] = '\0';
3094 return quotearg_style (escape_quoting_style, buf);
3095 }
3096 }