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