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