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