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