]> git.saurik.com Git - bison.git/blame_incremental - src/parse-gram.c
* src/output.c (prepare_tokens): Go up to ntokens, not ntokens + 1.
[bison.git] / src / parse-gram.c
... / ...
CommitLineData
1/* A Bison parser, made from parse-gram.y, by GNU bison 1.49b. */
2
3/* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 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., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, 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/* Pure parsers. */
40#define YYPURE 1
41
42/* Using locations. */
43#define YYLSP_NEEDED 1
44
45/* If NAME_PREFIX is specified substitute the variables and functions
46 names. */
47#define yyparse gram_parse
48#define yylex gram_lex
49#define yyerror gram_error
50#define yylval gram_lval
51#define yychar gram_char
52#define yydebug gram_debug
53#define yynerrs gram_nerrs
54#define yylloc gram_lloc
55
56/* Copy the first part of user declarations. */
57#line 31 "parse-gram.y"
58
59#include "system.h"
60#include "complain.h"
61#include "muscle_tab.h"
62#include "files.h"
63#include "getargs.h"
64#include "output.h"
65#include "symlist.h"
66#include "gram.h"
67#include "reader.h"
68#include "conflicts.h"
69
70/* Produce verbose parse errors. */
71#define YYERROR_VERBOSE 1
72#define YYLLOC_DEFAULT(Current, Rhs, N) \
73do { \
74 if (N) \
75 { \
76 Current.first_column = Rhs[1].first_column; \
77 Current.first_line = Rhs[1].first_line; \
78 Current.last_column = Rhs[N].last_column; \
79 Current.last_line = Rhs[N].last_line; \
80 } \
81 else \
82 { \
83 Current = Rhs[0]; \
84 } \
85} while (0)
86
87/* Pass the control structure to YYPARSE and YYLEX. */
88#define YYPARSE_PARAM gram_control
89#define YYLEX_PARAM gram_control
90/* YYPARSE receives GRAM_CONTROL as a void *. Provide a
91 correctly typed access to it. */
92#define yycontrol ((gram_control_t *) gram_control)
93
94/* Request detailed parse error messages, and pass them to
95 GRAM_ERROR. */
96#undef yyerror
97#define yyerror(Msg) \
98 gram_error (yycontrol, &yylloc, Msg)
99
100#define YYPRINT(File, Type, Value) \
101 yyprint (File, Type, &Value)
102static void yyprint (FILE *file, int type, const yystype *value);
103
104symbol_class current_class = unknown_sym;
105char *current_type = 0;
106symbol_t *current_lhs;
107location_t current_lhs_location;
108assoc_t current_assoc;
109int current_prec = 0;
110braced_code_t current_braced_code = action_braced_code;
111
112
113/* Tokens. */
114#ifndef YYTOKENTYPE
115# if defined (__STDC__) || defined (__cplusplus)
116 /* Put the tokens into the symbol table, so that GDB and other debuggers
117 know about them. */
118 enum yytokentype {
119 GRAM_EOF = 0,
120 STRING = 258,
121 CHARACTER = 259,
122 INT = 260,
123 PERCENT_TOKEN = 261,
124 PERCENT_NTERM = 262,
125 PERCENT_TYPE = 263,
126 PERCENT_DESTRUCTOR = 264,
127 PERCENT_PRINTER = 265,
128 PERCENT_UNION = 266,
129 PERCENT_LEFT = 267,
130 PERCENT_RIGHT = 268,
131 PERCENT_NONASSOC = 269,
132 PERCENT_EXPECT = 270,
133 PERCENT_START = 271,
134 PERCENT_PREC = 272,
135 PERCENT_DPREC = 273,
136 PERCENT_MERGE = 274,
137 PERCENT_VERBOSE = 275,
138 PERCENT_ERROR_VERBOSE = 276,
139 PERCENT_OUTPUT = 277,
140 PERCENT_FILE_PREFIX = 278,
141 PERCENT_NAME_PREFIX = 279,
142 PERCENT_DEFINE = 280,
143 PERCENT_PURE_PARSER = 281,
144 PERCENT_GLR_PARSER = 282,
145 PERCENT_DEFINES = 283,
146 PERCENT_YACC = 284,
147 PERCENT_DEBUG = 285,
148 PERCENT_LOCATIONS = 286,
149 PERCENT_NO_LINES = 287,
150 PERCENT_SKELETON = 288,
151 PERCENT_TOKEN_TABLE = 289,
152 TYPE = 290,
153 EQUAL = 291,
154 SEMICOLON = 292,
155 COLON = 293,
156 PIPE = 294,
157 ID = 295,
158 PERCENT_PERCENT = 296,
159 PROLOGUE = 297,
160 EPILOGUE = 298,
161 BRACED_CODE = 299
162 };
163# endif
164 /* POSIX requires `int' for tokens in interfaces. */
165# define YYTOKENTYPE int
166#endif /* !YYTOKENTYPE */
167#define GRAM_EOF 0
168#define STRING 258
169#define CHARACTER 259
170#define INT 260
171#define PERCENT_TOKEN 261
172#define PERCENT_NTERM 262
173#define PERCENT_TYPE 263
174#define PERCENT_DESTRUCTOR 264
175#define PERCENT_PRINTER 265
176#define PERCENT_UNION 266
177#define PERCENT_LEFT 267
178#define PERCENT_RIGHT 268
179#define PERCENT_NONASSOC 269
180#define PERCENT_EXPECT 270
181#define PERCENT_START 271
182#define PERCENT_PREC 272
183#define PERCENT_DPREC 273
184#define PERCENT_MERGE 274
185#define PERCENT_VERBOSE 275
186#define PERCENT_ERROR_VERBOSE 276
187#define PERCENT_OUTPUT 277
188#define PERCENT_FILE_PREFIX 278
189#define PERCENT_NAME_PREFIX 279
190#define PERCENT_DEFINE 280
191#define PERCENT_PURE_PARSER 281
192#define PERCENT_GLR_PARSER 282
193#define PERCENT_DEFINES 283
194#define PERCENT_YACC 284
195#define PERCENT_DEBUG 285
196#define PERCENT_LOCATIONS 286
197#define PERCENT_NO_LINES 287
198#define PERCENT_SKELETON 288
199#define PERCENT_TOKEN_TABLE 289
200#define TYPE 290
201#define EQUAL 291
202#define SEMICOLON 292
203#define COLON 293
204#define PIPE 294
205#define ID 295
206#define PERCENT_PERCENT 296
207#define PROLOGUE 297
208#define EPILOGUE 298
209#define BRACED_CODE 299
210
211
212
213
214/* Enabling traces. */
215#ifndef YYDEBUG
216# define YYDEBUG 1
217#endif
218
219/* Enabling verbose error messages. */
220#ifdef YYERROR_VERBOSE
221# undef YYERROR_VERBOSE
222# define YYERROR_VERBOSE 1
223#else
224# define YYERROR_VERBOSE 0
225#endif
226
227#ifndef YYSTYPE
228#line 89 "parse-gram.y"
229typedef union {
230 symbol_t *symbol;
231 symbol_list_t *list;
232 int integer;
233 char *string;
234 assoc_t assoc;
235} yystype;
236/* Line 187 of /usr/local/share/bison/yacc.c. */
237#line 238 "parse-gram.c"
238# define YYSTYPE yystype
239# define YYSTYPE_IS_TRIVIAL 1
240#endif
241
242#ifndef YYLTYPE
243typedef struct yyltype
244{
245 int first_line;
246 int first_column;
247 int last_line;
248 int last_column;
249} yyltype;
250# define YYLTYPE yyltype
251# define YYLTYPE_IS_TRIVIAL 1
252#endif
253
254/* Copy the second part of user declarations. */
255
256
257/* Line 207 of /usr/local/share/bison/yacc.c. */
258#line 259 "parse-gram.c"
259
260#if ! defined (yyoverflow) || YYERROR_VERBOSE
261
262/* The parser invokes alloca or malloc; define the necessary symbols. */
263
264# if YYSTACK_USE_ALLOCA
265# define YYSTACK_ALLOC alloca
266# else
267# ifndef YYSTACK_USE_ALLOCA
268# if defined (alloca) || defined (_ALLOCA_H)
269# define YYSTACK_ALLOC alloca
270# else
271# ifdef __GNUC__
272# define YYSTACK_ALLOC __builtin_alloca
273# endif
274# endif
275# endif
276# endif
277
278# ifdef YYSTACK_ALLOC
279 /* Pacify GCC's `empty if-body' warning. */
280# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
281# else
282# if defined (__STDC__) || defined (__cplusplus)
283# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
284# define YYSIZE_T size_t
285# endif
286# define YYSTACK_ALLOC malloc
287# define YYSTACK_FREE free
288# endif
289#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
290
291
292#if (! defined (yyoverflow) \
293 && (! defined (__cplusplus) \
294 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
295
296/* A type that is properly aligned for any stack member. */
297union yyalloc
298{
299 short yyss;
300 YYSTYPE yyvs;
301 YYLTYPE yyls;
302};
303
304/* The size of the maximum gap between one aligned stack and the next. */
305# define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
306
307/* The size of an array large to enough to hold all stacks, each with
308 N elements. */
309# define YYSTACK_BYTES(N) \
310 ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
311 + 2 * YYSTACK_GAP_MAX)
312
313/* Copy COUNT objects from FROM to TO. The source and destination do
314 not overlap. */
315# ifndef YYCOPY
316# if 1 < __GNUC__
317# define YYCOPY(To, From, Count) \
318 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
319# else
320# define YYCOPY(To, From, Count) \
321 do \
322 { \
323 register YYSIZE_T yyi; \
324 for (yyi = 0; yyi < (Count); yyi++) \
325 (To)[yyi] = (From)[yyi]; \
326 } \
327 while (0)
328# endif
329# endif
330
331/* Relocate STACK from its old location to the new one. The
332 local variables YYSIZE and YYSTACKSIZE give the old and new number of
333 elements in the stack, and YYPTR gives the new location of the
334 stack. Advance YYPTR to a properly aligned location for the next
335 stack. */
336# define YYSTACK_RELOCATE(Stack) \
337 do \
338 { \
339 YYSIZE_T yynewbytes; \
340 YYCOPY (&yyptr->Stack, Stack, yysize); \
341 Stack = &yyptr->Stack; \
342 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
343 yyptr += yynewbytes / sizeof (*yyptr); \
344 } \
345 while (0)
346
347#endif
348
349/* YYFINAL -- State number of the termination state. */
350#define YYFINAL 3
351#define YYFLAG -32768
352#define YYLAST 127
353
354/* YYNTOKENS -- Number of terminals. */
355#define YYNTOKENS 45
356/* YYNNTS -- Number of nonterminals. */
357#define YYNNTS 28
358/* YYNRULES -- Number of rules. */
359#define YYNRULES 75
360/* YYNRULES -- Number of states. */
361#define YYNSTATES 108
362
363/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
364#define YYUNDEFTOK 2
365#define YYMAXUTOK 299
366
367#define YYTRANSLATE(X) \
368 ((unsigned)(X) <= YYMAXUTOK ? yytranslate[X] : YYUNDEFTOK)
369
370/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
371static const unsigned char yytranslate[] =
372{
373 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
374 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
375 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
376 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
377 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
378 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
379 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
380 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
381 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
382 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
383 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
384 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
385 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
386 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
387 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
388 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
389 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
390 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
391 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
392 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
393 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
394 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
395 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
396 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
397 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
398 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
399 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
400 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
401 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
402 35, 36, 37, 38, 39, 40, 41, 42, 43, 44
403};
404
405#if YYDEBUG
406/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
407 YYRHS. */
408static const unsigned char yyprhs[] =
409{
410 0, 0, 3, 8, 9, 13, 15, 17, 19, 23,
411 25, 27, 30, 34, 36, 40, 42, 46, 48, 50,
412 53, 55, 57, 59, 61, 63, 66, 69, 70, 75,
413 76, 81, 82, 86, 87, 91, 95, 99, 101, 103,
414 105, 106, 108, 110, 113, 115, 117, 120, 123, 127,
415 129, 132, 134, 137, 139, 142, 145, 146, 152, 154,
416 158, 159, 162, 165, 169, 173, 177, 179, 181, 183,
417 185, 187, 189, 190, 193, 194
418};
419
420/* YYRHS -- A `-1'-separated list of the rules' RHS. */
421static const signed char yyrhs[] =
422{
423 46, 0, -1, 47, 41, 61, 71, -1, -1, 47,
424 48, 72, -1, 49, -1, 42, -1, 30, -1, 25,
425 70, 70, -1, 28, -1, 21, -1, 15, 5, -1,
426 23, 36, 70, -1, 31, -1, 24, 36, 70, -1,
427 32, -1, 22, 36, 70, -1, 26, -1, 27, -1,
428 33, 70, -1, 34, -1, 20, -1, 29, -1, 55,
429 -1, 52, -1, 16, 67, -1, 11, 44, -1, -1,
430 9, 50, 44, 58, -1, -1, 10, 51, 44, 58,
431 -1, -1, 7, 53, 60, -1, -1, 6, 54, 60,
432 -1, 8, 35, 58, -1, 56, 57, 58, -1, 12,
433 -1, 13, -1, 14, -1, -1, 35, -1, 67, -1,
434 58, 67, -1, 35, -1, 40, -1, 40, 5, -1,
435 40, 69, -1, 40, 5, 69, -1, 59, -1, 60,
436 59, -1, 62, -1, 61, 62, -1, 63, -1, 49,
437 37, -1, 1, 37, -1, -1, 40, 38, 64, 65,
438 37, -1, 66, -1, 65, 39, 66, -1, -1, 66,
439 67, -1, 66, 68, -1, 66, 17, 67, -1, 66,
440 18, 5, -1, 66, 19, 35, -1, 40, -1, 69,
441 -1, 4, -1, 44, -1, 3, -1, 3, -1, -1,
442 41, 43, -1, -1, 37, -1
443};
444
445/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
446static const unsigned short yyrline[] =
447{
448 0, 159, 159, 172, 174, 177, 179, 180, 181, 182,
449 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
450 193, 194, 195, 198, 200, 201, 205, 212, 211, 222,
451 221, 234, 233, 239, 239, 244, 253, 268, 270, 271,
452 274, 276, 281, 283, 287, 292, 297, 303, 309, 319,
453 322, 331, 333, 339, 341, 346, 353, 352, 357, 359,
454 362, 365, 367, 369, 371, 373, 377, 379, 380, 383,
455 389, 398, 406, 411, 417, 419
456};
457#endif
458
459#if YYDEBUG || YYERROR_VERBOSE
460/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
461 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
462static const char *const yytname[] =
463{
464 "\"end of string\"", "error", "$undefined.", "STRING", "CHARACTER", "INT",
465 "\"%token\"", "\"%nterm\"", "\"%type\"", "\"%destructor\"",
466 "\"%printer\"", "\"%union\"", "\"%left\"", "\"%right\"",
467 "\"%nonassoc\"", "\"%expect\"", "\"%start\"", "\"%prec\"", "\"%dprec\"",
468 "\"%merge\"", "\"%verbose\"", "\"%error-verbose\"", "\"%output\"",
469 "\"%file-prefix\"", "\"%name-prefix\"", "\"%define\"",
470 "\"%pure-parser\"", "\"%glr-parser\"", "\"%defines\"", "\"%yacc\"",
471 "\"%debug\"", "\"%locations\"", "\"%no-lines\"", "\"%skeleton\"",
472 "\"%token-table\"", "TYPE", "\"=\"", "\";\"", "\":\"", "\"|\"",
473 "\"identifier\"", "\"%%\"", "PROLOGUE", "EPILOGUE", "BRACED_CODE",
474 "$axiom", "input", "declarations", "declaration", "grammar_declaration",
475 "@1", "@2", "symbol_declaration", "@3", "@4", "precedence_declaration",
476 "precedence_declarator", "type.opt", "symbols.1", "symbol_def",
477 "symbol_defs.1", "grammar", "rules_or_grammar_declaration", "rules",
478 "@5", "rhses.1", "rhs", "symbol", "action", "string_as_id",
479 "string_content", "epilogue.opt", "semi_colon.opt", 0
480};
481#endif
482
483/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
484 token YYLEX-NUM. */
485static const short yytoknum[] =
486{
487 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
488 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
489 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
490 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
491 295, 296, 297, 298, 299, -1
492};
493
494/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
495static const unsigned char yyr1[] =
496{
497 0, 45, 46, 47, 47, 48, 48, 48, 48, 48,
498 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
499 48, 48, 48, 49, 49, 49, 49, 50, 49, 51,
500 49, 53, 52, 54, 52, 52, 55, 56, 56, 56,
501 57, 57, 58, 58, 59, 59, 59, 59, 59, 60,
502 60, 61, 61, 62, 62, 62, 64, 63, 65, 65,
503 66, 66, 66, 66, 66, 66, 67, 67, 67, 68,
504 69, 70, 71, 71, 72, 72
505};
506
507/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
508static const unsigned char yyr2[] =
509{
510 0, 2, 4, 0, 3, 1, 1, 1, 3, 1,
511 1, 2, 3, 1, 3, 1, 3, 1, 1, 2,
512 1, 1, 1, 1, 1, 2, 2, 0, 4, 0,
513 4, 0, 3, 0, 3, 3, 3, 1, 1, 1,
514 0, 1, 1, 2, 1, 1, 2, 2, 3, 1,
515 2, 1, 2, 1, 2, 2, 0, 5, 1, 3,
516 0, 2, 2, 3, 3, 3, 1, 1, 1, 1,
517 1, 1, 0, 2, 0, 1
518};
519
520/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
521 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
522 means the default is an error. */
523static const short yydefact[] =
524{
525 3, 0, 0, 0, 33, 31, 0, 27, 29, 0,
526 37, 38, 39, 0, 0, 21, 10, 0, 0, 0,
527 0, 17, 18, 9, 22, 7, 13, 15, 0, 20,
528 0, 6, 74, 5, 24, 23, 40, 0, 0, 0,
529 0, 0, 26, 11, 70, 68, 66, 25, 67, 0,
530 0, 0, 71, 0, 19, 0, 0, 0, 0, 51,
531 53, 75, 4, 41, 0, 44, 45, 49, 34, 32,
532 35, 42, 0, 0, 16, 12, 14, 8, 55, 56,
533 54, 0, 52, 2, 36, 46, 47, 50, 43, 28,
534 30, 60, 73, 48, 0, 58, 57, 60, 0, 0,
535 0, 69, 61, 62, 59, 63, 64, 65
536};
537
538/* YYPGOTO[NTERM-NUM]. */
539static const short yydefgoto[] =
540{
541 -1, 1, 2, 32, 57, 40, 41, 34, 38, 37,
542 35, 36, 64, 70, 67, 68, 58, 59, 60, 91,
543 94, 95, 71, 103, 48, 53, 83, 62
544};
545
546/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
547 STATE-NUM. */
548static const short yypact[] =
549{
550 -32768, 35, 85,-32768,-32768,-32768, 2,-32768,-32768, -5,
551 -32768,-32768,-32768, 31, 0,-32768,-32768, 18, 21, 22,
552 59,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 59,-32768,
553 37,-32768, 26,-32768,-32768,-32768, 29, -19, -19, 0,
554 23, 24,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 59,
555 59, 59,-32768, 59,-32768, 28, 33, 32, 1,-32768,
556 -32768,-32768,-32768,-32768, 0,-32768, 17,-32768, -19, -19,
557 0,-32768, 0, 0,-32768,-32768,-32768,-32768,-32768,-32768,
558 -32768, 30,-32768,-32768, 0, 63,-32768,-32768,-32768, 0,
559 0,-32768,-32768,-32768, -8, 15,-32768,-32768, 0, 67,
560 39,-32768,-32768,-32768, 15,-32768,-32768,-32768
561};
562
563/* YYPGOTO[NTERM-NUM]. */
564static const short yypgoto[] =
565{
566 -32768,-32768,-32768,-32768, 76,-32768,-32768,-32768,-32768,-32768,
567 -32768,-32768,-32768, -12, -45, 41,-32768, 25,-32768,-32768,
568 -32768, -17, -14,-32768, -60, -23,-32768,-32768
569};
570
571/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
572 positive, shift that token. If negative, reduce the rule which
573 number is the opposite. If zero, do what YYDEFACT says. */
574static const short yytable[] =
575{
576 47, -72, 55, 44, 45, 54, 86, 4, 5, 6,
577 7, 8, 9, 10, 11, 12, 65, 14, 44, 45,
578 44, 66, 85, 87, 87, 93, 74, 75, 76, 96,
579 77, 97, 98, 99, 100, 3, 43, 39, 55, 42,
580 46, 56, 81, 4, 5, 6, 7, 8, 9, 10,
581 11, 12, 84, 14, 49, 46, 88, 50, 51, 101,
582 89, 90, 52, 61, 63, 78, 44, 72, 73, 80,
583 88, 79, 106, 92, 107, 88, 88, 56, 33, 69,
584 104, 102, 0, 82, 105, 0, 0, 0, 0, 0,
585 102, 4, 5, 6, 7, 8, 9, 10, 11, 12,
586 13, 14, 0, 0, 0, 15, 16, 17, 18, 19,
587 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
588 0, 0, 0, 0, 0, 0, 30, 31
589};
590
591static const short yycheck[] =
592{
593 14, 0, 1, 3, 4, 28, 66, 6, 7, 8,
594 9, 10, 11, 12, 13, 14, 35, 16, 3, 4,
595 3, 40, 5, 68, 69, 85, 49, 50, 51, 37,
596 53, 39, 17, 18, 19, 0, 5, 35, 1, 44,
597 40, 40, 41, 6, 7, 8, 9, 10, 11, 12,
598 13, 14, 64, 16, 36, 40, 70, 36, 36, 44,
599 72, 73, 3, 37, 35, 37, 3, 44, 44, 37,
600 84, 38, 5, 43, 35, 89, 90, 40, 2, 38,
601 97, 95, -1, 58, 98, -1, -1, -1, -1, -1,
602 104, 6, 7, 8, 9, 10, 11, 12, 13, 14,
603 15, 16, -1, -1, -1, 20, 21, 22, 23, 24,
604 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
605 -1, -1, -1, -1, -1, -1, 41, 42
606};
607
608/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
609 symbol of state STATE-NUM. */
610static const unsigned char yystos[] =
611{
612 0, 46, 47, 0, 6, 7, 8, 9, 10, 11,
613 12, 13, 14, 15, 16, 20, 21, 22, 23, 24,
614 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
615 41, 42, 48, 49, 52, 55, 56, 54, 53, 35,
616 50, 51, 44, 5, 3, 4, 40, 67, 69, 36,
617 36, 36, 3, 70, 70, 1, 40, 49, 61, 62,
618 63, 37, 72, 35, 57, 35, 40, 59, 60, 60,
619 58, 67, 44, 44, 70, 70, 70, 70, 37, 38,
620 37, 41, 62, 71, 58, 5, 69, 59, 67, 58,
621 58, 64, 43, 69, 65, 66, 37, 39, 17, 18,
622 19, 44, 67, 68, 66, 67, 5, 35
623};
624
625#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
626# define YYSIZE_T __SIZE_TYPE__
627#endif
628#if ! defined (YYSIZE_T) && defined (size_t)
629# define YYSIZE_T size_t
630#endif
631#if ! defined (YYSIZE_T)
632# if defined (__STDC__) || defined (__cplusplus)
633# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
634# define YYSIZE_T size_t
635# endif
636#endif
637#if ! defined (YYSIZE_T)
638# define YYSIZE_T unsigned int
639#endif
640
641#define yyerrok (yyerrstatus = 0)
642#define yyclearin (yychar = YYEMPTY)
643#define YYEMPTY -2
644#define YYEOF 0
645
646#define YYACCEPT goto yyacceptlab
647#define YYABORT goto yyabortlab
648#define YYERROR goto yyerrlab1
649
650/* Like YYERROR except do call yyerror. This remains here temporarily
651 to ease the transition to the new meaning of YYERROR, for GCC.
652 Once GCC version 2 has supplanted version 1, this can go. */
653
654#define YYFAIL goto yyerrlab
655
656#define YYRECOVERING() (!!yyerrstatus)
657
658#define YYBACKUP(Token, Value) \
659do \
660 if (yychar == YYEMPTY && yylen == 1) \
661 { \
662 yychar = (Token); \
663 yylval = (Value); \
664 yychar1 = YYTRANSLATE (yychar); \
665 YYPOPSTACK; \
666 goto yybackup; \
667 } \
668 else \
669 { \
670 yyerror ("syntax error: cannot back up"); \
671 YYERROR; \
672 } \
673while (0)
674
675#define YYTERROR 1
676#define YYERRCODE 256
677
678/* YYLLOC_DEFAULT -- Compute the default location (before the actions
679 are run). */
680
681#ifndef YYLLOC_DEFAULT
682# define YYLLOC_DEFAULT(Current, Rhs, N) \
683 Current.first_line = Rhs[1].first_line; \
684 Current.first_column = Rhs[1].first_column; \
685 Current.last_line = Rhs[N].last_line; \
686 Current.last_column = Rhs[N].last_column;
687#endif
688
689/* YYLEX -- calling `yylex' with the right arguments. */
690
691#ifdef YYLEX_PARAM
692# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
693#else
694# define YYLEX yylex (&yylval, &yylloc)
695#endif
696
697/* Enable debugging if requested. */
698#if YYDEBUG
699
700# ifndef YYFPRINTF
701# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
702# define YYFPRINTF fprintf
703# endif
704
705# define YYDPRINTF(Args) \
706do { \
707 if (yydebug) \
708 YYFPRINTF Args; \
709} while (0)
710# define YYDSYMPRINT(Args) \
711do { \
712 if (yydebug) \
713 yysymprint Args; \
714} while (0)
715/* Nonzero means print parse trace. It is left uninitialized so that
716 multiple parsers can coexist. */
717int yydebug;
718#else /* !YYDEBUG */
719# define YYDPRINTF(Args)
720# define YYDSYMPRINT(Args)
721#endif /* !YYDEBUG */
722
723/* YYINITDEPTH -- initial size of the parser's stacks. */
724#ifndef YYINITDEPTH
725# define YYINITDEPTH 200
726#endif
727
728/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
729 if the built-in stack extension method is used).
730
731 Do not make this value too large; the results are undefined if
732 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
733 evaluated with infinite-precision integer arithmetic. */
734
735#if YYMAXDEPTH == 0
736# undef YYMAXDEPTH
737#endif
738
739#ifndef YYMAXDEPTH
740# define YYMAXDEPTH 10000
741#endif
742
743\f
744
745#if YYERROR_VERBOSE
746
747# ifndef yystrlen
748# if defined (__GLIBC__) && defined (_STRING_H)
749# define yystrlen strlen
750# else
751/* Return the length of YYSTR. */
752static YYSIZE_T
753# if defined (__STDC__) || defined (__cplusplus)
754yystrlen (const char *yystr)
755# else
756yystrlen (yystr)
757 const char *yystr;
758# endif
759{
760 register const char *yys = yystr;
761
762 while (*yys++ != '\0')
763 continue;
764
765 return yys - yystr - 1;
766}
767# endif
768# endif
769
770# ifndef yystpcpy
771# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
772# define yystpcpy stpcpy
773# else
774/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
775 YYDEST. */
776static char *
777# if defined (__STDC__) || defined (__cplusplus)
778yystpcpy (char *yydest, const char *yysrc)
779# else
780yystpcpy (yydest, yysrc)
781 char *yydest;
782 const char *yysrc;
783# endif
784{
785 register char *yyd = yydest;
786 register const char *yys = yysrc;
787
788 while ((*yyd++ = *yys++) != '\0')
789 continue;
790
791 return yyd - 1;
792}
793# endif
794# endif
795
796#endif /* !YYERROR_VERBOSE */
797
798\f
799
800/* The user can define YYPARSE_PARAM as the name of an argument to be passed
801 into yyparse. The argument should have type void *.
802 It should actually point to an object.
803 Grammar actions can access the variable by casting it
804 to the proper pointer type. */
805
806#ifdef YYPARSE_PARAM
807# if defined (__STDC__) || defined (__cplusplus)
808# define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
809# define YYPARSE_PARAM_DECL
810# else
811# define YYPARSE_PARAM_ARG YYPARSE_PARAM
812# define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
813# endif
814#else /* !YYPARSE_PARAM */
815# define YYPARSE_PARAM_ARG
816# define YYPARSE_PARAM_DECL
817#endif /* !YYPARSE_PARAM */
818
819/* Prevent warning if -Wstrict-prototypes. */
820#ifdef __GNUC__
821# ifdef YYPARSE_PARAM
822int yyparse (void *);
823# else
824int yyparse (void);
825# endif
826#endif
827
828#if defined (__STDC__) || defined (__cplusplus)
829static void yydestruct (int yytype,
830 YYSTYPE yyvalue, YYLTYPE yylocation);
831# if YYDEBUG
832static void yysymprint (FILE* out, int yytype,
833 YYSTYPE yyvalue, YYLTYPE yylocation);
834# endif
835#endif
836
837
838
839
840int
841yyparse (YYPARSE_PARAM_ARG)
842 YYPARSE_PARAM_DECL
843{
844 /* The lookahead symbol. */
845int yychar;
846
847/* The semantic value of the lookahead symbol. */
848YYSTYPE yylval;
849
850/* Number of parse errors so far. */
851int yynerrs;
852/* Location data for the lookahead symbol. */
853YYLTYPE yylloc;
854
855 register int yystate;
856 register int yyn;
857 int yyresult;
858 /* Number of tokens to shift before error messages enabled. */
859 int yyerrstatus;
860 /* Lookahead token as an internal (translated) token number. */
861 int yychar1 = 0;
862
863 /* Three stacks and their tools:
864 `yyss': related to states,
865 `yyvs': related to semantic values,
866 `yyls': related to locations.
867
868 Refer to the stacks thru separate pointers, to allow yyoverflow
869 to reallocate them elsewhere. */
870
871 /* The state stack. */
872 short yyssa[YYINITDEPTH];
873 short *yyss = yyssa;
874 register short *yyssp;
875
876 /* The semantic value stack. */
877 YYSTYPE yyvsa[YYINITDEPTH];
878 YYSTYPE *yyvs = yyvsa;
879 register YYSTYPE *yyvsp;
880
881 /* The location stack. */
882 YYLTYPE yylsa[YYINITDEPTH];
883 YYLTYPE *yyls = yylsa;
884 YYLTYPE *yylsp;
885
886#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
887
888 YYSIZE_T yystacksize = YYINITDEPTH;
889
890 /* The variables used to return semantic value and location from the
891 action routines. */
892 YYSTYPE yyval;
893 YYLTYPE yyloc;
894
895 /* When reducing, the number of symbols on the RHS of the reduced
896 rule. */
897 int yylen;
898
899 YYDPRINTF ((stderr, "Starting parse\n"));
900
901 yystate = 0;
902 yyerrstatus = 0;
903 yynerrs = 0;
904 yychar = YYEMPTY; /* Cause a token to be read. */
905
906 /* Initialize stack pointers.
907 Waste one element of value and location stack
908 so that they stay on the same level as the state stack.
909 The wasted elements are never initialized. */
910
911 yyssp = yyss;
912 yyvsp = yyvs;
913 yylsp = yyls;
914 goto yysetstate;
915
916/*------------------------------------------------------------.
917| yynewstate -- Push a new state, which is found in yystate. |
918`------------------------------------------------------------*/
919 yynewstate:
920 /* In all cases, when you get here, the value and location stacks
921 have just been pushed. so pushing a state here evens the stacks.
922 */
923 yyssp++;
924
925 yysetstate:
926 *yyssp = yystate;
927
928 if (yyssp >= yyss + yystacksize - 1)
929 {
930 /* Get the current used size of the three stacks, in elements. */
931 YYSIZE_T yysize = yyssp - yyss + 1;
932
933#ifdef yyoverflow
934 {
935 /* Give user a chance to reallocate the stack. Use copies of
936 these so that the &'s don't force the real ones into
937 memory. */
938 YYSTYPE *yyvs1 = yyvs;
939 short *yyss1 = yyss;
940 YYLTYPE *yyls1 = yyls;
941
942 /* Each stack pointer address is followed by the size of the
943 data in use in that stack, in bytes. This used to be a
944 conditional around just the two extra args, but that might
945 be undefined if yyoverflow is a macro. */
946 yyoverflow ("parser stack overflow",
947 &yyss1, yysize * sizeof (*yyssp),
948 &yyvs1, yysize * sizeof (*yyvsp),
949 &yyls1, yysize * sizeof (*yylsp),
950 &yystacksize);
951 yyls = yyls1;
952 yyss = yyss1;
953 yyvs = yyvs1;
954 }
955#else /* no yyoverflow */
956# ifndef YYSTACK_RELOCATE
957 goto yyoverflowlab;
958# else
959 /* Extend the stack our own way. */
960 if (yystacksize >= YYMAXDEPTH)
961 goto yyoverflowlab;
962 yystacksize *= 2;
963 if (yystacksize > YYMAXDEPTH)
964 yystacksize = YYMAXDEPTH;
965
966 {
967 short *yyss1 = yyss;
968 union yyalloc *yyptr =
969 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
970 if (! yyptr)
971 goto yyoverflowlab;
972 YYSTACK_RELOCATE (yyss);
973 YYSTACK_RELOCATE (yyvs);
974 YYSTACK_RELOCATE (yyls);
975# undef YYSTACK_RELOCATE
976 if (yyss1 != yyssa)
977 YYSTACK_FREE (yyss1);
978 }
979# endif
980#endif /* no yyoverflow */
981
982 yyssp = yyss + yysize - 1;
983 yyvsp = yyvs + yysize - 1;
984 yylsp = yyls + yysize - 1;
985
986 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
987 (unsigned long int) yystacksize));
988
989 if (yyssp >= yyss + yystacksize - 1)
990 YYABORT;
991 }
992
993 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
994
995 goto yybackup;
996
997/*-----------.
998| yybackup. |
999`-----------*/
1000yybackup:
1001
1002/* Do appropriate processing given the current state. */
1003/* Read a lookahead token if we need one and don't already have one. */
1004/* yyresume: */
1005
1006 /* First try to decide what to do without reference to lookahead token. */
1007
1008 yyn = yypact[yystate];
1009 if (yyn == YYFLAG)
1010 goto yydefault;
1011
1012 /* Not known => get a lookahead token if don't already have one. */
1013
1014 /* yychar is either YYEMPTY or YYEOF
1015 or a valid token in external form. */
1016
1017 if (yychar == YYEMPTY)
1018 {
1019 YYDPRINTF ((stderr, "Reading a token: "));
1020 yychar = YYLEX;
1021 }
1022
1023 /* Convert token to internal form (in yychar1) for indexing tables with. */
1024
1025 if (yychar <= 0) /* This means end of input. */
1026 {
1027 yychar1 = 0;
1028 yychar = YYEOF; /* Don't call YYLEX any more. */
1029
1030 YYDPRINTF ((stderr, "Now at end of input.\n"));
1031 }
1032 else
1033 {
1034 yychar1 = YYTRANSLATE (yychar);
1035
1036 /* We have to keep this `#if YYDEBUG', since we use variables
1037 which are defined only if `YYDEBUG' is set. */
1038 YYDPRINTF ((stderr, "Next token is "));
1039 YYDSYMPRINT ((stderr, yychar1, yylval, yyloc));
1040 YYDPRINTF ((stderr, "\n"));
1041 }
1042
1043 yyn += yychar1;
1044 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
1045 goto yydefault;
1046
1047 yyn = yytable[yyn];
1048
1049 /* yyn is what to do for this token type in this state.
1050 Negative => reduce, -yyn is rule number.
1051 Positive => shift, yyn is new state.
1052 New state is final state => don't bother to shift,
1053 just return success.
1054 0, or most negative number => error. */
1055
1056 if (yyn < 0)
1057 {
1058 if (yyn == YYFLAG)
1059 goto yyerrlab;
1060 yyn = -yyn;
1061 goto yyreduce;
1062 }
1063 else if (yyn == 0)
1064 goto yyerrlab;
1065
1066 if (yyn == YYFINAL)
1067 YYACCEPT;
1068
1069 /* Shift the lookahead token. */
1070 YYDPRINTF ((stderr, "Shifting token %d (%s), ",
1071 yychar, yytname[yychar1]));
1072
1073 /* Discard the token being shifted unless it is eof. */
1074 if (yychar != YYEOF)
1075 yychar = YYEMPTY;
1076
1077 *++yyvsp = yylval;
1078 *++yylsp = yylloc;
1079
1080 /* Count tokens shifted since error; after three, turn off error
1081 status. */
1082 if (yyerrstatus)
1083 yyerrstatus--;
1084
1085 yystate = yyn;
1086 goto yynewstate;
1087
1088
1089/*-----------------------------------------------------------.
1090| yydefault -- do the default action for the current state. |
1091`-----------------------------------------------------------*/
1092yydefault:
1093 yyn = yydefact[yystate];
1094 if (yyn == 0)
1095 goto yyerrlab;
1096 goto yyreduce;
1097
1098
1099/*-----------------------------.
1100| yyreduce -- Do a reduction. |
1101`-----------------------------*/
1102yyreduce:
1103 /* yyn is the number of a rule to reduce with. */
1104 yylen = yyr2[yyn];
1105
1106 /* If YYLEN is nonzero, implement the default value of the action:
1107 `$$ = $1'.
1108
1109 Otherwise, the following line sets YYVAL to the semantic value of
1110 the lookahead token. This behavior is undocumented and Bison
1111 users should not rely upon it. Assigning to YYVAL
1112 unconditionally makes the parser a bit smaller, and it avoids a
1113 GCC warning that YYVAL may be used uninitialized. */
1114 yyval = yyvsp[1-yylen];
1115
1116 /* Default location. */
1117 YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
1118
1119#if YYDEBUG
1120 /* We have to keep this `#if YYDEBUG', since we use variables which
1121 are defined only if `YYDEBUG' is set. */
1122 if (yydebug)
1123 {
1124 int yyi;
1125
1126 YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
1127 yyn - 1, yyrline[yyn]);
1128
1129 /* Print the symbols being reduced, and their result. */
1130 for (yyi = yyprhs[yyn]; yyrhs[yyi] >= 0; yyi++)
1131 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
1132 YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
1133 }
1134#endif
1135 switch (yyn)
1136 {
1137 case 2:
1138#line 161 "parse-gram.y"
1139 {
1140 yycontrol->errcode = 0;
1141 epilogue_set (yyvsp[0].string, yylsp[0]);
1142 }
1143 break;
1144
1145 case 6:
1146#line 179 "parse-gram.y"
1147 { prologue_augment (yyvsp[0].string, yylsp[0]); }
1148 break;
1149
1150 case 7:
1151#line 180 "parse-gram.y"
1152 { debug_flag = 1; }
1153 break;
1154
1155 case 8:
1156#line 181 "parse-gram.y"
1157 { muscle_insert (yyvsp[-1].string, yyvsp[0].string); }
1158 break;
1159
1160 case 9:
1161#line 182 "parse-gram.y"
1162 { defines_flag = 1; }
1163 break;
1164
1165 case 10:
1166#line 183 "parse-gram.y"
1167 { error_verbose = 1; }
1168 break;
1169
1170 case 11:
1171#line 184 "parse-gram.y"
1172 { expected_conflicts = yyvsp[0].integer; }
1173 break;
1174
1175 case 12:
1176#line 185 "parse-gram.y"
1177 { spec_file_prefix = yyvsp[0].string; }
1178 break;
1179
1180 case 13:
1181#line 186 "parse-gram.y"
1182 { locations_flag = 1; }
1183 break;
1184
1185 case 14:
1186#line 187 "parse-gram.y"
1187 { spec_name_prefix = yyvsp[0].string; }
1188 break;
1189
1190 case 15:
1191#line 188 "parse-gram.y"
1192 { no_lines_flag = 1; }
1193 break;
1194
1195 case 16:
1196#line 189 "parse-gram.y"
1197 { spec_outfile = yyvsp[0].string; }
1198 break;
1199
1200 case 17:
1201#line 190 "parse-gram.y"
1202 { pure_parser = 1; }
1203 break;
1204
1205 case 18:
1206#line 191 "parse-gram.y"
1207 { glr_parser = 1; }
1208 break;
1209
1210 case 19:
1211#line 192 "parse-gram.y"
1212 { skeleton = yyvsp[0].string; }
1213 break;
1214
1215 case 20:
1216#line 193 "parse-gram.y"
1217 { token_table_flag = 1; }
1218 break;
1219
1220 case 21:
1221#line 194 "parse-gram.y"
1222 { report_flag = 1; }
1223 break;
1224
1225 case 22:
1226#line 195 "parse-gram.y"
1227 { yacc_flag = 1; }
1228 break;
1229
1230 case 25:
1231#line 202 "parse-gram.y"
1232 {
1233 grammar_start_symbol_set (yyvsp[0].symbol, yylsp[0]);
1234 }
1235 break;
1236
1237 case 26:
1238#line 206 "parse-gram.y"
1239 {
1240 typed = 1;
1241 MUSCLE_INSERT_INT ("stype_line", yylsp[0].first_line);
1242 muscle_insert ("stype", yyvsp[0].string);
1243 }
1244 break;
1245
1246 case 27:
1247#line 212 "parse-gram.y"
1248 { current_braced_code = destructor_braced_code; }
1249 break;
1250
1251 case 28:
1252#line 214 "parse-gram.y"
1253 {
1254 symbol_list_t *list;
1255 for (list = yyvsp[0].list; list; list = list->next)
1256 symbol_destructor_set (list->sym, yyvsp[-1].string, yylsp[-1]);
1257 symbol_list_free (yyvsp[0].list);
1258 current_braced_code = action_braced_code;
1259 }
1260 break;
1261
1262 case 29:
1263#line 222 "parse-gram.y"
1264 { current_braced_code = printer_braced_code; }
1265 break;
1266
1267 case 30:
1268#line 224 "parse-gram.y"
1269 {
1270 symbol_list_t *list;
1271 for (list = yyvsp[0].list; list; list = list->next)
1272 symbol_printer_set (list->sym, yyvsp[-1].string, list->location);
1273 symbol_list_free (yyvsp[0].list);
1274 current_braced_code = action_braced_code;
1275 }
1276 break;
1277
1278 case 31:
1279#line 234 "parse-gram.y"
1280 { current_class = nterm_sym; }
1281 break;
1282
1283 case 32:
1284#line 235 "parse-gram.y"
1285 {
1286 current_class = unknown_sym;
1287 current_type = NULL;
1288 }
1289 break;
1290
1291 case 33:
1292#line 239 "parse-gram.y"
1293 { current_class = token_sym; }
1294 break;
1295
1296 case 34:
1297#line 240 "parse-gram.y"
1298 {
1299 current_class = unknown_sym;
1300 current_type = NULL;
1301 }
1302 break;
1303
1304 case 35:
1305#line 245 "parse-gram.y"
1306 {
1307 symbol_list_t *list;
1308 for (list = yyvsp[0].list; list; list = list->next)
1309 symbol_type_set (list->sym, yyvsp[-1].string, yylsp[-1]);
1310 symbol_list_free (yyvsp[0].list);
1311 }
1312 break;
1313
1314 case 36:
1315#line 255 "parse-gram.y"
1316 {
1317 symbol_list_t *list;
1318 ++current_prec;
1319 for (list = yyvsp[0].list; list; list = list->next)
1320 {
1321 symbol_type_set (list->sym, current_type, yylsp[-1]);
1322 symbol_precedence_set (list->sym, current_prec, yyvsp[-2].assoc, yylsp[-2]);
1323 }
1324 symbol_list_free (yyvsp[0].list);
1325 current_type = NULL;
1326 }
1327 break;
1328
1329 case 37:
1330#line 269 "parse-gram.y"
1331 { yyval.assoc = left_assoc; }
1332 break;
1333
1334 case 38:
1335#line 270 "parse-gram.y"
1336 { yyval.assoc = right_assoc; }
1337 break;
1338
1339 case 39:
1340#line 271 "parse-gram.y"
1341 { yyval.assoc = non_assoc; }
1342 break;
1343
1344 case 40:
1345#line 275 "parse-gram.y"
1346 { current_type = NULL;}
1347 break;
1348
1349 case 41:
1350#line 276 "parse-gram.y"
1351 { current_type = yyvsp[0].string; }
1352 break;
1353
1354 case 42:
1355#line 282 "parse-gram.y"
1356 { yyval.list = symbol_list_new (yyvsp[0].symbol, yylsp[0]); }
1357 break;
1358
1359 case 43:
1360#line 283 "parse-gram.y"
1361 { yyval.list = symbol_list_prepend (yyvsp[-1].list, yyvsp[0].symbol, yylsp[0]); }
1362 break;
1363
1364 case 44:
1365#line 289 "parse-gram.y"
1366 {
1367 current_type = yyvsp[0].string;
1368 }
1369 break;
1370
1371 case 45:
1372#line 293 "parse-gram.y"
1373 {
1374 symbol_class_set (yyvsp[0].symbol, current_class, yylsp[0]);
1375 symbol_type_set (yyvsp[0].symbol, current_type, yylsp[0]);
1376 }
1377 break;
1378
1379 case 46:
1380#line 298 "parse-gram.y"
1381 {
1382 symbol_class_set (yyvsp[-1].symbol, current_class, yylsp[-1]);
1383 symbol_type_set (yyvsp[-1].symbol, current_type, yylsp[-1]);
1384 symbol_user_token_number_set (yyvsp[-1].symbol, yyvsp[0].integer, yylsp[0]);
1385 }
1386 break;
1387
1388 case 47:
1389#line 304 "parse-gram.y"
1390 {
1391 symbol_class_set (yyvsp[-1].symbol, current_class, yylsp[-1]);
1392 symbol_type_set (yyvsp[-1].symbol, current_type, yylsp[-1]);
1393 symbol_make_alias (yyvsp[-1].symbol, yyvsp[0].symbol, yyloc);
1394 }
1395 break;
1396
1397 case 48:
1398#line 310 "parse-gram.y"
1399 {
1400 symbol_class_set (yyvsp[-2].symbol, current_class, yylsp[-2]);
1401 symbol_type_set (yyvsp[-2].symbol, current_type, yylsp[-2]);
1402 symbol_user_token_number_set (yyvsp[-2].symbol, yyvsp[-1].integer, yylsp[-1]);
1403 symbol_make_alias (yyvsp[-2].symbol, yyvsp[0].symbol, yyloc);
1404 }
1405 break;
1406
1407 case 49:
1408#line 321 "parse-gram.y"
1409 {;}
1410 break;
1411
1412 case 50:
1413#line 323 "parse-gram.y"
1414 {;}
1415 break;
1416
1417 case 54:
1418#line 342 "parse-gram.y"
1419 {
1420 if (yacc_flag)
1421 complain_at (yyloc, _("POSIX forbids declarations in the grammar"));
1422 }
1423 break;
1424
1425 case 55:
1426#line 347 "parse-gram.y"
1427 {
1428 yyerrok;
1429 }
1430 break;
1431
1432 case 56:
1433#line 353 "parse-gram.y"
1434 { current_lhs = yyvsp[-1].symbol; current_lhs_location = yylsp[-1]; }
1435 break;
1436
1437 case 57:
1438#line 354 "parse-gram.y"
1439 {;}
1440 break;
1441
1442 case 58:
1443#line 358 "parse-gram.y"
1444 { grammar_rule_end (yylsp[0]); }
1445 break;
1446
1447 case 59:
1448#line 359 "parse-gram.y"
1449 { grammar_rule_end (yylsp[0]); }
1450 break;
1451
1452 case 60:
1453#line 364 "parse-gram.y"
1454 { grammar_rule_begin (current_lhs, current_lhs_location); }
1455 break;
1456
1457 case 61:
1458#line 366 "parse-gram.y"
1459 { grammar_current_rule_symbol_append (yyvsp[0].symbol, yylsp[0]); }
1460 break;
1461
1462 case 62:
1463#line 368 "parse-gram.y"
1464 { grammar_current_rule_action_append (yyvsp[0].string, yylsp[0]); }
1465 break;
1466
1467 case 63:
1468#line 370 "parse-gram.y"
1469 { grammar_current_rule_prec_set (yyvsp[0].symbol, yylsp[0]); }
1470 break;
1471
1472 case 64:
1473#line 372 "parse-gram.y"
1474 { grammar_current_rule_dprec_set (yyvsp[0].integer, yylsp[0]); }
1475 break;
1476
1477 case 65:
1478#line 374 "parse-gram.y"
1479 { grammar_current_rule_merge_set (yyvsp[0].string, yylsp[0]); }
1480 break;
1481
1482 case 66:
1483#line 378 "parse-gram.y"
1484 { yyval.symbol = yyvsp[0].symbol; }
1485 break;
1486
1487 case 67:
1488#line 379 "parse-gram.y"
1489 { yyval.symbol = yyvsp[0].symbol; }
1490 break;
1491
1492 case 68:
1493#line 380 "parse-gram.y"
1494 { yyval.symbol = symbol_get (yyvsp[0].string, yylsp[0]); }
1495 break;
1496
1497 case 69:
1498#line 385 "parse-gram.y"
1499 { yyval.string = yyvsp[0].string; }
1500 break;
1501
1502 case 70:
1503#line 391 "parse-gram.y"
1504 {
1505 yyval.symbol = symbol_get (yyvsp[0].string, yylsp[0]);
1506 symbol_class_set (yyval.symbol, token_sym, yylsp[0]);
1507 }
1508 break;
1509
1510 case 71:
1511#line 400 "parse-gram.y"
1512 {
1513 yyval.string = yyvsp[0].string + 1;
1514 yyval.string[strlen (yyval.string) - 1] = '\0';
1515 }
1516 break;
1517
1518 case 72:
1519#line 408 "parse-gram.y"
1520 {
1521 yyval.string = xstrdup ("");
1522 }
1523 break;
1524
1525 case 73:
1526#line 412 "parse-gram.y"
1527 {
1528 yyval.string = yyvsp[0].string;
1529 }
1530 break;
1531
1532
1533 }
1534
1535/* Line 955 of /usr/local/share/bison/yacc.c. */
1536#line 1537 "parse-gram.c"
1537\f
1538 yyvsp -= yylen;
1539 yyssp -= yylen;
1540 yylsp -= yylen;
1541
1542#if YYDEBUG
1543 if (yydebug)
1544 {
1545 short *yyssp1 = yyss - 1;
1546 YYFPRINTF (stderr, "state stack now");
1547 while (yyssp1 != yyssp)
1548 YYFPRINTF (stderr, " %d", *++yyssp1);
1549 YYFPRINTF (stderr, "\n");
1550 }
1551#endif
1552
1553 *++yyvsp = yyval;
1554 *++yylsp = yyloc;
1555
1556 /* Now `shift' the result of the reduction. Determine what state
1557 that goes to, based on the state we popped back to and the rule
1558 number reduced by. */
1559
1560 yyn = yyr1[yyn];
1561
1562 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1563 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1564 yystate = yytable[yystate];
1565 else
1566 yystate = yydefgoto[yyn - YYNTOKENS];
1567
1568 goto yynewstate;
1569
1570
1571/*------------------------------------.
1572| yyerrlab -- here on detecting error |
1573`------------------------------------*/
1574yyerrlab:
1575 /* If not already recovering from an error, report this error. */
1576 if (!yyerrstatus)
1577 {
1578 ++yynerrs;
1579
1580#if YYERROR_VERBOSE
1581 yyn = yypact[yystate];
1582
1583 if (yyn > YYFLAG && yyn < YYLAST)
1584 {
1585 YYSIZE_T yysize = 0;
1586 char *yymsg;
1587 int yyx, yycount;
1588
1589 yycount = 0;
1590 /* Start YYX at -YYN if negative to avoid negative indexes in
1591 YYCHECK. */
1592 for (yyx = yyn < 0 ? -yyn : 0;
1593 yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
1594 if (yycheck[yyx + yyn] == yyx)
1595 yysize += yystrlen (yytname[yyx]) + 15, yycount++;
1596 yysize += yystrlen ("parse error, unexpected ") + 1;
1597 yysize += yystrlen (yytname[YYTRANSLATE (yychar)]);
1598 yymsg = (char *) YYSTACK_ALLOC (yysize);
1599 if (yymsg != 0)
1600 {
1601 char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
1602 yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]);
1603
1604 if (yycount < 5)
1605 {
1606 yycount = 0;
1607 for (yyx = yyn < 0 ? -yyn : 0;
1608 yyx < (int) (sizeof (yytname) / sizeof (char *));
1609 yyx++)
1610 if (yycheck[yyx + yyn] == yyx)
1611 {
1612 const char *yyq = ! yycount ? ", expecting " : " or ";
1613 yyp = yystpcpy (yyp, yyq);
1614 yyp = yystpcpy (yyp, yytname[yyx]);
1615 yycount++;
1616 }
1617 }
1618 yyerror (yymsg);
1619 YYSTACK_FREE (yymsg);
1620 }
1621 else
1622 yyerror ("parse error; also virtual memory exhausted");
1623 }
1624 else
1625#endif /* YYERROR_VERBOSE */
1626 yyerror ("parse error");
1627 }
1628 goto yyerrlab1;
1629
1630
1631/*----------------------------------------------------.
1632| yyerrlab1 -- error raised explicitly by an action. |
1633`----------------------------------------------------*/
1634yyerrlab1:
1635 if (yyerrstatus == 3)
1636 {
1637 /* If just tried and failed to reuse lookahead token after an
1638 error, discard it. */
1639
1640 /* Return failure if at end of input. */
1641 if (yychar == YYEOF)
1642 {
1643 /* Pop the error token. */
1644 YYPOPSTACK;
1645 /* Pop the rest of the stack. */
1646 while (yyssp > yyss)
1647 {
1648 YYDPRINTF ((stderr, "Error: popping "));
1649 YYDSYMPRINT ((stderr,
1650 yystos[*yyssp],
1651 *yyvsp, *yylsp));
1652 YYDPRINTF ((stderr, "\n"));
1653 yydestruct (yystos[*yyssp], *yyvsp, *yylsp);
1654 YYPOPSTACK;
1655 }
1656 YYABORT;
1657 }
1658
1659 YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
1660 yychar, yytname[yychar1]));
1661 yydestruct (yychar1, yylval, yylloc);
1662 yychar = YYEMPTY;
1663 }
1664
1665 /* Else will try to reuse lookahead token after shifting the error
1666 token. */
1667
1668 yyerrstatus = 3; /* Each real token shifted decrements this. */
1669
1670 for (;;)
1671 {
1672 yyn = yypact[yystate];
1673 if (yyn != YYFLAG)
1674 {
1675 yyn += YYTERROR;
1676 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1677 {
1678 yyn = yytable[yyn];
1679 if (0 < yyn)
1680 break;
1681 }
1682 }
1683
1684 /* Pop the current state because it cannot handle the error token. */
1685 if (yyssp == yyss)
1686 YYABORT;
1687
1688 YYDPRINTF ((stderr, "Error: popping "));
1689 YYDSYMPRINT ((stderr,
1690 yystos[*yyssp], *yyvsp, *yylsp));
1691 YYDPRINTF ((stderr, "\n"));
1692
1693 yydestruct (yystos[yystate], *yyvsp, *yylsp);
1694 yyvsp--;
1695 yystate = *--yyssp;
1696 yylsp--;
1697
1698#if YYDEBUG
1699 if (yydebug)
1700 {
1701 short *yyssp1 = yyss - 1;
1702 YYFPRINTF (stderr, "Error: state stack now");
1703 while (yyssp1 != yyssp)
1704 YYFPRINTF (stderr, " %d", *++yyssp1);
1705 YYFPRINTF (stderr, "\n");
1706 }
1707#endif
1708 }
1709
1710 if (yyn == YYFINAL)
1711 YYACCEPT;
1712
1713 YYDPRINTF ((stderr, "Shifting error token, "));
1714
1715 *++yyvsp = yylval;
1716 *++yylsp = yylloc;
1717
1718 yystate = yyn;
1719 goto yynewstate;
1720
1721
1722/*-------------------------------------.
1723| yyacceptlab -- YYACCEPT comes here. |
1724`-------------------------------------*/
1725yyacceptlab:
1726 yyresult = 0;
1727 goto yyreturn;
1728
1729/*-----------------------------------.
1730| yyabortlab -- YYABORT comes here. |
1731`-----------------------------------*/
1732yyabortlab:
1733 yyresult = 1;
1734 goto yyreturn;
1735
1736#ifndef yyoverflow
1737/*----------------------------------------------.
1738| yyoverflowlab -- parser overflow comes here. |
1739`----------------------------------------------*/
1740yyoverflowlab:
1741 yyerror ("parser stack overflow");
1742 yyresult = 2;
1743 /* Fall through. */
1744#endif
1745
1746yyreturn:
1747#ifndef yyoverflow
1748 if (yyss != yyssa)
1749 YYSTACK_FREE (yyss);
1750#endif
1751 return yyresult;
1752}
1753
1754
1755/*-----------------------------------------------.
1756| Release the memory associated to this symbol. |
1757`-----------------------------------------------*/
1758
1759static void
1760yydestruct (int yytype,
1761 YYSTYPE yyvalue, YYLTYPE yylocation)
1762{
1763 /* Pacify ``unused variable'' warnings. */
1764 (void) yyvalue;
1765 (void) yylocation;
1766
1767 switch (yytype)
1768 {
1769 default:
1770 break;
1771 }
1772}
1773
1774
1775#if YYDEBUG
1776/*-----------------------------.
1777| Print this symbol on YYOUT. |
1778`-----------------------------*/
1779
1780static void
1781yysymprint (FILE* yyout, int yytype,
1782 YYSTYPE yyvalue, YYLTYPE yylocation)
1783{
1784 /* Pacify ``unused variable'' warnings. */
1785 (void) yyvalue;
1786 (void) yylocation;
1787
1788 if (yytype < YYNTOKENS)
1789 {
1790 YYFPRINTF (yyout, "token %s (", yytname[yytype]);
1791# ifdef YYPRINT
1792 YYPRINT (yyout, yytoknum[yytype], yyvalue);
1793# endif
1794 }
1795 else
1796 YYFPRINTF (yyout, "nterm %s (", yytname[yytype]);
1797
1798 switch (yytype)
1799 {
1800 default:
1801 break;
1802 }
1803 YYFPRINTF (yyout, ")");
1804}
1805#endif /* YYDEBUG. */
1806
1807#line 421 "parse-gram.y"
1808
1809/*------------------------------------------------------------------.
1810| When debugging the parser, display tokens' locations and values. |
1811`------------------------------------------------------------------*/
1812
1813static void
1814yyprint (FILE *file,
1815 int type, const yystype *value)
1816{
1817 fputc (' ', file);
1818 switch (type)
1819 {
1820 case CHARACTER:
1821 fprintf (file, " = '%s'", value->string);
1822 break;
1823
1824 case ID:
1825 fprintf (file, " = %s", value->symbol->tag);
1826 break;
1827
1828 case INT:
1829 fprintf (file, " = %d", value->integer);
1830 break;
1831
1832 case STRING:
1833 fprintf (file, " = \"%s\"", value->string);
1834 break;
1835
1836 case TYPE:
1837 fprintf (file, " = <%s>", value->string);
1838 break;
1839
1840 case BRACED_CODE:
1841 case PROLOGUE:
1842 case EPILOGUE:
1843 fprintf (file, " = {{ %s }}", value->string);
1844 break;
1845 }
1846}
1847
1848void
1849gram_error (gram_control_t *control ATTRIBUTE_UNUSED,
1850 location_t *yylloc, const char *msg)
1851{
1852 complain_at (*yylloc, "%s", msg);
1853}
1854