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