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