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