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