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