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