]> git.saurik.com Git - bison.git/blob - src/parse-gram.c
c164276452cff4700fe2610a0ad5beaf6185ee4a
[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 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 "reader.h"
202 #include "symlist.h"
203
204 #define YYLLOC_DEFAULT(Current, Rhs, N) (Current) = lloc_default (Rhs, N)
205 static YYLTYPE lloc_default (YYLTYPE const *, int);
206
207 #define YY_LOCATION_PRINT(File, Loc) \
208 location_print (File, Loc)
209
210 /* Request detailed syntax error messages, and pass them to GRAM_ERROR.
211 FIXME: depends on the undocumented availability of YYLLOC. */
212 #undef yyerror
213 #define yyerror(Msg) \
214 gram_error (&yylloc, Msg)
215 static void gram_error (location const *, char const *);
216
217 #define YYPRINT(File, Type, Value) \
218 print_token_value (File, Type, &Value)
219 static void print_token_value (FILE *, int, YYSTYPE const *);
220
221 static void add_param (char const *, char *, location);
222
223 symbol_class current_class = unknown_sym;
224 uniqstr current_type = 0;
225 symbol *current_lhs;
226 location current_lhs_location;
227 assoc current_assoc;
228 int current_prec = 0;
229
230
231 /* Enabling traces. */
232 #ifndef YYDEBUG
233 # define YYDEBUG 1
234 #endif
235
236 /* Enabling verbose error messages. */
237 #ifdef YYERROR_VERBOSE
238 # undef YYERROR_VERBOSE
239 # define YYERROR_VERBOSE 1
240 #else
241 # define YYERROR_VERBOSE 1
242 #endif
243
244 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
245 #line 81 "parse-gram.y"
246 typedef union YYSTYPE {
247 symbol *symbol;
248 symbol_list *list;
249 int integer;
250 char *chars;
251 assoc assoc;
252 uniqstr uniqstr;
253 } YYSTYPE;
254 /* Line 191 of yacc.c. */
255 #line 256 "parse-gram.c"
256 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
257 # define YYSTYPE_IS_DECLARED 1
258 # define YYSTYPE_IS_TRIVIAL 1
259 #endif
260
261 #if ! defined (YYLTYPE) && ! defined (YYLTYPE_IS_DECLARED)
262 typedef struct YYLTYPE
263 {
264 int first_line;
265 int first_column;
266 int last_line;
267 int last_column;
268 } YYLTYPE;
269 # define yyltype YYLTYPE /* obsolescent; will be withdrawn */
270 # define YYLTYPE_IS_DECLARED 1
271 # define YYLTYPE_IS_TRIVIAL 1
272 #endif
273
274
275 /* Copy the second part of user declarations. */
276
277
278 /* Line 214 of yacc.c. */
279 #line 280 "parse-gram.c"
280
281 #if ! defined (yyoverflow) || YYERROR_VERBOSE
282
283 # ifndef YYFREE
284 # define YYFREE free
285 # endif
286 # ifndef YYMALLOC
287 # define YYMALLOC malloc
288 # endif
289
290 /* The parser invokes alloca or malloc; define the necessary symbols. */
291
292 # ifdef YYSTACK_USE_ALLOCA
293 # if YYSTACK_USE_ALLOCA
294 # ifdef __GNUC__
295 # define YYSTACK_ALLOC __builtin_alloca
296 # else
297 # define YYSTACK_ALLOC alloca
298 # endif
299 # endif
300 # endif
301
302 # ifdef YYSTACK_ALLOC
303 /* Pacify GCC's `empty if-body' warning. */
304 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
305 # else
306 # if defined (__STDC__) || defined (__cplusplus)
307 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
308 # define YYSIZE_T size_t
309 # endif
310 # define YYSTACK_ALLOC YYMALLOC
311 # define YYSTACK_FREE YYFREE
312 # endif
313 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
314
315
316 #if (! defined (yyoverflow) \
317 && (! defined (__cplusplus) \
318 || (defined (YYLTYPE_IS_TRIVIAL) && YYLTYPE_IS_TRIVIAL \
319 && defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
320
321 /* A type that is properly aligned for any stack member. */
322 union yyalloc
323 {
324 short int yyss;
325 YYSTYPE yyvs;
326 YYLTYPE yyls;
327 };
328
329 /* The size of the maximum gap between one aligned stack and the next. */
330 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
331
332 /* The size of an array large to enough to hold all stacks, each with
333 N elements. */
334 # define YYSTACK_BYTES(N) \
335 ((N) * (sizeof (short int) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
336 + 2 * YYSTACK_GAP_MAXIMUM)
337
338 /* Copy COUNT objects from FROM to TO. The source and destination do
339 not overlap. */
340 # ifndef YYCOPY
341 # if defined (__GNUC__) && 1 < __GNUC__
342 # define YYCOPY(To, From, Count) \
343 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
344 # else
345 # define YYCOPY(To, From, Count) \
346 do \
347 { \
348 YYSIZE_T yyi; \
349 for (yyi = 0; yyi < (Count); yyi++) \
350 (To)[yyi] = (From)[yyi]; \
351 } \
352 while (0)
353 # endif
354 # endif
355
356 /* Relocate STACK from its old location to the new one. The
357 local variables YYSIZE and YYSTACKSIZE give the old and new number of
358 elements in the stack, and YYPTR gives the new location of the
359 stack. Advance YYPTR to a properly aligned location for the next
360 stack. */
361 # define YYSTACK_RELOCATE(Stack) \
362 do \
363 { \
364 YYSIZE_T yynewbytes; \
365 YYCOPY (&yyptr->Stack, Stack, yysize); \
366 Stack = &yyptr->Stack; \
367 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
368 yyptr += yynewbytes / sizeof (*yyptr); \
369 } \
370 while (0)
371
372 #endif
373
374 #if defined (__STDC__) || defined (__cplusplus)
375 typedef signed char yysigned_char;
376 #else
377 typedef short int yysigned_char;
378 #endif
379
380 /* YYFINAL -- State number of the termination state. */
381 #define YYFINAL 3
382 /* YYLAST -- Last index in YYTABLE. */
383 #define YYLAST 158
384
385 /* YYNTOKENS -- Number of terminals. */
386 #define YYNTOKENS 51
387 /* YYNNTS -- Number of nonterminals. */
388 #define YYNNTS 25
389 /* YYNRULES -- Number of rules. */
390 #define YYNRULES 79
391 /* YYNRULES -- Number of states. */
392 #define YYNSTATES 108
393
394 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
395 #define YYUNDEFTOK 2
396 #define YYMAXUTOK 305
397
398 #define YYTRANSLATE(YYX) \
399 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
400
401 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
402 static const unsigned char yytranslate[] =
403 {
404 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
405 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
406 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
407 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
408 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
409 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
410 2, 2, 2, 2, 2, 2, 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, 1, 2, 3, 4,
430 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
431 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
432 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
433 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
434 45, 46, 47, 48, 49, 50
435 };
436
437 #if YYDEBUG
438 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
439 YYRHS. */
440 static const unsigned char yyprhs[] =
441 {
442 0, 0, 3, 8, 9, 12, 14, 16, 18, 22,
443 24, 26, 29, 32, 36, 38, 40, 42, 44, 48,
444 50, 52, 56, 58, 60, 63, 65, 67, 69, 71,
445 73, 75, 78, 80, 83, 86, 88, 90, 91, 95,
446 96, 100, 104, 108, 110, 112, 114, 115, 117, 119,
447 122, 124, 126, 129, 132, 136, 138, 141, 143, 146,
448 148, 151, 154, 155, 159, 161, 165, 168, 169, 172,
449 175, 179, 183, 187, 189, 191, 193, 195, 197, 198
450 };
451
452 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
453 static const yysigned_char yyrhs[] =
454 {
455 52, 0, -1, 53, 47, 65, 75, -1, -1, 53,
456 54, -1, 55, -1, 48, -1, 17, -1, 19, 74,
457 74, -1, 20, -1, 21, -1, 22, 4, -1, 23,
458 4, -1, 24, 42, 74, -1, 25, -1, 26, -1,
459 27, -1, 28, -1, 29, 42, 74, -1, 31, -1,
460 32, -1, 33, 42, 74, -1, 34, -1, 35, -1,
461 36, 74, -1, 38, -1, 39, -1, 40, -1, 43,
462 -1, 59, -1, 56, -1, 37, 71, -1, 10, -1,
463 8, 62, -1, 9, 62, -1, 18, -1, 30, -1,
464 -1, 6, 57, 64, -1, -1, 5, 58, 64, -1,
465 7, 41, 62, -1, 60, 61, 62, -1, 11, -1,
466 12, -1, 13, -1, -1, 41, -1, 71, -1, 62,
467 71, -1, 41, -1, 45, -1, 45, 4, -1, 45,
468 73, -1, 45, 4, 73, -1, 63, -1, 64, 63,
469 -1, 66, -1, 65, 66, -1, 67, -1, 55, 43,
470 -1, 1, 43, -1, -1, 46, 68, 69, -1, 70,
471 -1, 69, 44, 70, -1, 69, 43, -1, -1, 70,
472 71, -1, 70, 72, -1, 70, 14, 71, -1, 70,
473 15, 4, -1, 70, 16, 41, -1, 45, -1, 73,
474 -1, 50, -1, 3, -1, 3, -1, -1, 47, 49,
475 -1
476 };
477
478 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
479 static const unsigned short int yyrline[] =
480 {
481 0, 174, 174, 182, 184, 188, 189, 190, 191, 192,
482 193, 194, 195, 196, 197, 202, 206, 207, 208, 209,
483 210, 211, 212, 213, 214, 215, 216, 217, 218, 222,
484 223, 224, 228, 234, 241, 248, 252, 259, 259, 264,
485 264, 269, 279, 294, 295, 296, 300, 301, 307, 308,
486 313, 317, 322, 328, 334, 345, 346, 355, 356, 362,
487 363, 368, 375, 375, 379, 380, 381, 386, 387, 389,
488 391, 393, 395, 400, 401, 405, 411, 420, 427, 429
489 };
490 #endif
491
492 #if YYDEBUG || YYERROR_VERBOSE
493 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
494 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
495 static const char *const yytname[] =
496 {
497 "\"end of file\"", "error", "$undefined", "\"string\"", "\"integer\"",
498 "\"%token\"", "\"%nterm\"", "\"%type\"", "\"%destructor {...}\"",
499 "\"%printer {...}\"", "\"%union {...}\"", "\"%left\"", "\"%right\"",
500 "\"%nonassoc\"", "\"%prec\"", "\"%dprec\"", "\"%merge\"", "\"%debug\"",
501 "\"%default-prec\"", "\"%define\"", "\"%defines\"", "\"%error-verbose\"",
502 "\"%expect\"", "\"%expect-rr\"", "\"%file-prefix\"", "\"%glr-parser\"",
503 "\"%initial-action {...}\"", "\"%lex-param {...}\"", "\"%locations\"",
504 "\"%name-prefix\"", "\"%no-default-prec\"", "\"%no-lines\"",
505 "\"%nondeterministic-parser\"", "\"%output\"", "\"%parse-param {...}\"",
506 "\"%pure-parser\"", "\"%skeleton\"", "\"%start\"", "\"%token-table\"",
507 "\"%verbose\"", "\"%yacc\"", "\"type\"", "\"=\"", "\";\"", "\"|\"",
508 "\"identifier\"", "\"identifier:\"", "\"%%\"", "\"%{...%}\"",
509 "\"epilogue\"", "\"{...}\"", "$accept", "input", "declarations",
510 "declaration", "grammar_declaration", "symbol_declaration", "@1", "@2",
511 "precedence_declaration", "precedence_declarator", "type.opt",
512 "symbols.1", "symbol_def", "symbol_defs.1", "grammar",
513 "rules_or_grammar_declaration", "rules", "@3", "rhses.1", "rhs",
514 "symbol", "action", "string_as_id", "string_content", "epilogue.opt", 0
515 };
516 #endif
517
518 /* INFRINGES ON USER NAME SPACE */
519 #ifndef _
520 # define _(msgid) msgid
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 #ifndef YYMAXDEPTH
889 # define YYMAXDEPTH 10000
890 #endif
891
892 \f
893
894 #if YYERROR_VERBOSE
895
896 # ifndef yystrlen
897 # if defined (__GLIBC__) && defined (_STRING_H)
898 # define yystrlen strlen
899 # else
900 /* Return the length of YYSTR. */
901 static YYSIZE_T
902 # if defined (__STDC__) || defined (__cplusplus)
903 yystrlen (const char *yystr)
904 # else
905 yystrlen (yystr)
906 const char *yystr;
907 # endif
908 {
909 const char *yys = yystr;
910
911 while (*yys++ != '\0')
912 continue;
913
914 return yys - yystr - 1;
915 }
916 # endif
917 # endif
918
919 # ifndef yystpcpy
920 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
921 # define yystpcpy stpcpy
922 # else
923 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
924 YYDEST. */
925 static char *
926 # if defined (__STDC__) || defined (__cplusplus)
927 yystpcpy (char *yydest, const char *yysrc)
928 # else
929 yystpcpy (yydest, yysrc)
930 char *yydest;
931 const char *yysrc;
932 # endif
933 {
934 char *yyd = yydest;
935 const char *yys = yysrc;
936
937 while ((*yyd++ = *yys++) != '\0')
938 continue;
939
940 return yyd - 1;
941 }
942 # endif
943 # endif
944
945 #endif /* !YYERROR_VERBOSE */
946
947 \f
948
949 #if YYDEBUG
950 /*--------------------------------.
951 | Print this symbol on YYOUTPUT. |
952 `--------------------------------*/
953
954 #if defined (__STDC__) || defined (__cplusplus)
955 static void
956 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp)
957 #else
958 static void
959 yysymprint (yyoutput, yytype, yyvaluep, yylocationp)
960 FILE *yyoutput;
961 int yytype;
962 YYSTYPE *yyvaluep;
963 YYLTYPE *yylocationp;
964 #endif
965 {
966 /* Pacify ``unused variable'' warnings. */
967 (void) yyvaluep;
968 (void) yylocationp;
969
970 if (yytype < YYNTOKENS)
971 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
972 else
973 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
974
975 YY_LOCATION_PRINT (yyoutput, *yylocationp);
976 fprintf (yyoutput, ": ");
977
978 # ifdef YYPRINT
979 if (yytype < YYNTOKENS)
980 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
981 # endif
982 switch (yytype)
983 {
984 default:
985 break;
986 }
987 YYFPRINTF (yyoutput, ")");
988 }
989
990 #endif /* ! YYDEBUG */
991 /*-----------------------------------------------.
992 | Release the memory associated to this symbol. |
993 `-----------------------------------------------*/
994
995 #if defined (__STDC__) || defined (__cplusplus)
996 static void
997 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp)
998 #else
999 static void
1000 yydestruct (yymsg, yytype, yyvaluep, yylocationp)
1001 const char *yymsg;
1002 int yytype;
1003 YYSTYPE *yyvaluep;
1004 YYLTYPE *yylocationp;
1005 #endif
1006 {
1007 /* Pacify ``unused variable'' warnings. */
1008 (void) yyvaluep;
1009 (void) yylocationp;
1010
1011 if (!yymsg)
1012 yymsg = "Deleting";
1013 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1014
1015 switch (yytype)
1016 {
1017
1018 default:
1019 break;
1020 }
1021 }
1022 \f
1023
1024 /* Prevent warnings from -Wmissing-prototypes. */
1025
1026 #ifdef YYPARSE_PARAM
1027 # if defined (__STDC__) || defined (__cplusplus)
1028 int yyparse (void *YYPARSE_PARAM);
1029 # else
1030 int yyparse ();
1031 # endif
1032 #else /* ! YYPARSE_PARAM */
1033 #if defined (__STDC__) || defined (__cplusplus)
1034 int yyparse (void);
1035 #else
1036 int yyparse ();
1037 #endif
1038 #endif /* ! YYPARSE_PARAM */
1039
1040
1041
1042
1043
1044
1045 /*----------.
1046 | yyparse. |
1047 `----------*/
1048
1049 #ifdef YYPARSE_PARAM
1050 # if defined (__STDC__) || defined (__cplusplus)
1051 int yyparse (void *YYPARSE_PARAM)
1052 # else
1053 int yyparse (YYPARSE_PARAM)
1054 void *YYPARSE_PARAM;
1055 # endif
1056 #else /* ! YYPARSE_PARAM */
1057 #if defined (__STDC__) || defined (__cplusplus)
1058 int
1059 yyparse (void)
1060 #else
1061 int
1062 yyparse ()
1063
1064 #endif
1065 #endif
1066 {
1067 /* The look-ahead symbol. */
1068 int yychar;
1069
1070 /* The semantic value of the look-ahead symbol. */
1071 YYSTYPE yylval;
1072
1073 /* Number of syntax errors so far. */
1074 int yynerrs;
1075 /* Location data for the look-ahead symbol. */
1076 YYLTYPE yylloc;
1077
1078 int yystate;
1079 int yyn;
1080 int yyresult;
1081 /* Number of tokens to shift before error messages enabled. */
1082 int yyerrstatus;
1083 /* Look-ahead token as an internal (translated) token number. */
1084 int yytoken = 0;
1085
1086 /* Three stacks and their tools:
1087 `yyss': related to states,
1088 `yyvs': related to semantic values,
1089 `yyls': related to locations.
1090
1091 Refer to the stacks thru separate pointers, to allow yyoverflow
1092 to reallocate them elsewhere. */
1093
1094 /* The state stack. */
1095 short int yyssa[YYINITDEPTH];
1096 short int *yyss = yyssa;
1097 short int *yyssp;
1098
1099 /* The semantic value stack. */
1100 YYSTYPE yyvsa[YYINITDEPTH];
1101 YYSTYPE *yyvs = yyvsa;
1102 YYSTYPE *yyvsp;
1103
1104 /* The location stack. */
1105 YYLTYPE yylsa[YYINITDEPTH];
1106 YYLTYPE *yyls = yylsa;
1107 YYLTYPE *yylsp;
1108 /* The locations where the error started and ended. */
1109 YYLTYPE yyerror_range[2];
1110
1111 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
1112
1113 YYSIZE_T yystacksize = YYINITDEPTH;
1114
1115 /* The variables used to return semantic value and location from the
1116 action routines. */
1117 YYSTYPE yyval;
1118 YYLTYPE yyloc;
1119
1120 /* When reducing, the number of symbols on the RHS of the reduced
1121 rule. */
1122 int yylen;
1123
1124 YYDPRINTF ((stderr, "Starting parse\n"));
1125
1126 yystate = 0;
1127 yyerrstatus = 0;
1128 yynerrs = 0;
1129 yychar = YYEMPTY; /* Cause a token to be read. */
1130
1131 /* Initialize stack pointers.
1132 Waste one element of value and location stack
1133 so that they stay on the same level as the state stack.
1134 The wasted elements are never initialized. */
1135
1136 yyssp = yyss;
1137 yyvsp = yyvs;
1138 yylsp = yyls;
1139 #if YYLTYPE_IS_TRIVIAL
1140 /* Initialize the default location before parsing starts. */
1141 yylloc.first_line = yylloc.last_line = 1;
1142 yylloc.first_column = yylloc.last_column = 0;
1143 #endif
1144
1145
1146 /* User initialization code. */
1147 #line 71 "parse-gram.y"
1148 {
1149 /* Bison's grammar can initial empty locations, hence a default
1150 location is needed. */
1151 yylloc.start.file = yylloc.end.file = current_file;
1152 yylloc.start.line = yylloc.end.line = 1;
1153 yylloc.start.column = yylloc.end.column = 0;
1154 }
1155 /* Line 848 of yacc.c. */
1156 #line 1157 "parse-gram.c"
1157 yyvsp[0] = yylval;
1158 yylsp[0] = yylloc;
1159
1160 goto yysetstate;
1161
1162 /*------------------------------------------------------------.
1163 | yynewstate -- Push a new state, which is found in yystate. |
1164 `------------------------------------------------------------*/
1165 yynewstate:
1166 /* In all cases, when you get here, the value and location stacks
1167 have just been pushed. so pushing a state here evens the stacks.
1168 */
1169 yyssp++;
1170
1171 yysetstate:
1172 *yyssp = yystate;
1173
1174 if (yyss + yystacksize - 1 <= yyssp)
1175 {
1176 /* Get the current used size of the three stacks, in elements. */
1177 YYSIZE_T yysize = yyssp - yyss + 1;
1178
1179 #ifdef yyoverflow
1180 {
1181 /* Give user a chance to reallocate the stack. Use copies of
1182 these so that the &'s don't force the real ones into
1183 memory. */
1184 YYSTYPE *yyvs1 = yyvs;
1185 short int *yyss1 = yyss;
1186 YYLTYPE *yyls1 = yyls;
1187
1188 /* Each stack pointer address is followed by the size of the
1189 data in use in that stack, in bytes. This used to be a
1190 conditional around just the two extra args, but that might
1191 be undefined if yyoverflow is a macro. */
1192 yyoverflow (_("parser stack overflow"),
1193 &yyss1, yysize * sizeof (*yyssp),
1194 &yyvs1, yysize * sizeof (*yyvsp),
1195 &yyls1, yysize * sizeof (*yylsp),
1196 &yystacksize);
1197 yyls = yyls1;
1198 yyss = yyss1;
1199 yyvs = yyvs1;
1200 }
1201 #else /* no yyoverflow */
1202 # ifndef YYSTACK_RELOCATE
1203 goto yyoverflowlab;
1204 # else
1205 /* Extend the stack our own way. */
1206 if (YYMAXDEPTH <= yystacksize)
1207 goto yyoverflowlab;
1208 yystacksize *= 2;
1209 if (YYMAXDEPTH < yystacksize)
1210 yystacksize = YYMAXDEPTH;
1211
1212 {
1213 short int *yyss1 = yyss;
1214 union yyalloc *yyptr =
1215 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1216 if (! yyptr)
1217 goto yyoverflowlab;
1218 YYSTACK_RELOCATE (yyss);
1219 YYSTACK_RELOCATE (yyvs);
1220 YYSTACK_RELOCATE (yyls);
1221 # undef YYSTACK_RELOCATE
1222 if (yyss1 != yyssa)
1223 YYSTACK_FREE (yyss1);
1224 }
1225 # endif
1226 #endif /* no yyoverflow */
1227
1228 yyssp = yyss + yysize - 1;
1229 yyvsp = yyvs + yysize - 1;
1230 yylsp = yyls + yysize - 1;
1231
1232 YYDPRINTF ((stderr, _("Stack size increased to %lu\n"),
1233 (unsigned long int) yystacksize));
1234
1235 if (yyss + yystacksize - 1 <= yyssp)
1236 YYABORT;
1237 }
1238
1239 YYDPRINTF ((stderr, _("Entering state %d\n"), yystate));
1240
1241 goto yybackup;
1242
1243 /*-----------.
1244 | yybackup. |
1245 `-----------*/
1246 yybackup:
1247
1248 /* Do appropriate processing given the current state. */
1249 /* Read a look-ahead token if we need one and don't already have one. */
1250 /* yyresume: */
1251
1252 /* First try to decide what to do without reference to look-ahead token. */
1253
1254 yyn = yypact[yystate];
1255 if (yyn == YYPACT_NINF)
1256 goto yydefault;
1257
1258 /* Not known => get a look-ahead token if don't already have one. */
1259
1260 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1261 if (yychar == YYEMPTY)
1262 {
1263 YYDPRINTF ((stderr, _("Reading a token: ")));
1264 yychar = YYLEX;
1265 }
1266
1267 if (yychar <= YYEOF)
1268 {
1269 yychar = yytoken = YYEOF;
1270 YYDPRINTF ((stderr, _("Now at end of input.\n")));
1271 }
1272 else
1273 {
1274 yytoken = YYTRANSLATE (yychar);
1275 YY_SYMBOL_PRINT (_("Next token is"), yytoken, &yylval, &yylloc);
1276 }
1277
1278 /* If the proper action on seeing token YYTOKEN is to reduce or to
1279 detect an error, take that action. */
1280 yyn += yytoken;
1281 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1282 goto yydefault;
1283 yyn = yytable[yyn];
1284 if (yyn <= 0)
1285 {
1286 if (yyn == 0 || yyn == YYTABLE_NINF)
1287 goto yyerrlab;
1288 yyn = -yyn;
1289 goto yyreduce;
1290 }
1291
1292 if (yyn == YYFINAL)
1293 YYACCEPT;
1294
1295 /* Shift the look-ahead token. */
1296 YY_SYMBOL_PRINT (_("Shifting"), yytoken, &yylval, &yylloc);
1297
1298 /* Discard the token being shifted unless it is eof. */
1299 if (yychar != YYEOF)
1300 yychar = YYEMPTY;
1301
1302 *++yyvsp = yylval;
1303 *++yylsp = yylloc;
1304
1305 /* Count tokens shifted since error; after three, turn off error
1306 status. */
1307 if (yyerrstatus)
1308 yyerrstatus--;
1309
1310 yystate = yyn;
1311 goto yynewstate;
1312
1313
1314 /*-----------------------------------------------------------.
1315 | yydefault -- do the default action for the current state. |
1316 `-----------------------------------------------------------*/
1317 yydefault:
1318 yyn = yydefact[yystate];
1319 if (yyn == 0)
1320 goto yyerrlab;
1321 goto yyreduce;
1322
1323
1324 /*-----------------------------.
1325 | yyreduce -- Do a reduction. |
1326 `-----------------------------*/
1327 yyreduce:
1328 /* yyn is the number of a rule to reduce with. */
1329 yylen = yyr2[yyn];
1330
1331 /* If YYLEN is nonzero, implement the default value of the action:
1332 `$$ = $1'.
1333
1334 Otherwise, the following line sets YYVAL to garbage.
1335 This behavior is undocumented and Bison
1336 users should not rely upon it. Assigning to YYVAL
1337 unconditionally makes the parser a bit smaller, and it avoids a
1338 GCC warning that YYVAL may be used uninitialized. */
1339 yyval = yyvsp[1-yylen];
1340
1341 /* Default location. */
1342 YYLLOC_DEFAULT (yyloc, yylsp - yylen, yylen);
1343 YY_REDUCE_PRINT (yyn);
1344 switch (yyn)
1345 {
1346 case 6:
1347 #line 189 "parse-gram.y"
1348 { prologue_augment ((yyvsp[0].chars), (yylsp[0])); }
1349 break;
1350
1351 case 7:
1352 #line 190 "parse-gram.y"
1353 { debug_flag = true; }
1354 break;
1355
1356 case 8:
1357 #line 191 "parse-gram.y"
1358 { muscle_insert ((yyvsp[-1].chars), (yyvsp[0].chars)); }
1359 break;
1360
1361 case 9:
1362 #line 192 "parse-gram.y"
1363 { defines_flag = true; }
1364 break;
1365
1366 case 10:
1367 #line 193 "parse-gram.y"
1368 { error_verbose = true; }
1369 break;
1370
1371 case 11:
1372 #line 194 "parse-gram.y"
1373 { expected_sr_conflicts = (yyvsp[0].integer); }
1374 break;
1375
1376 case 12:
1377 #line 195 "parse-gram.y"
1378 { expected_rr_conflicts = (yyvsp[0].integer); }
1379 break;
1380
1381 case 13:
1382 #line 196 "parse-gram.y"
1383 { spec_file_prefix = (yyvsp[0].chars); }
1384 break;
1385
1386 case 14:
1387 #line 198 "parse-gram.y"
1388 {
1389 nondeterministic_parser = true;
1390 glr_parser = true;
1391 }
1392 break;
1393
1394 case 15:
1395 #line 203 "parse-gram.y"
1396 {
1397 muscle_code_grow ("initial_action", (yyvsp[0].chars), (yylsp[0]));
1398 }
1399 break;
1400
1401 case 16:
1402 #line 206 "parse-gram.y"
1403 { add_param ("lex_param", (yyvsp[0].chars), (yylsp[0])); }
1404 break;
1405
1406 case 17:
1407 #line 207 "parse-gram.y"
1408 { locations_flag = true; }
1409 break;
1410
1411 case 18:
1412 #line 208 "parse-gram.y"
1413 { spec_name_prefix = (yyvsp[0].chars); }
1414 break;
1415
1416 case 19:
1417 #line 209 "parse-gram.y"
1418 { no_lines_flag = true; }
1419 break;
1420
1421 case 20:
1422 #line 210 "parse-gram.y"
1423 { nondeterministic_parser = true; }
1424 break;
1425
1426 case 21:
1427 #line 211 "parse-gram.y"
1428 { spec_outfile = (yyvsp[0].chars); }
1429 break;
1430
1431 case 22:
1432 #line 212 "parse-gram.y"
1433 { add_param ("parse_param", (yyvsp[0].chars), (yylsp[0])); }
1434 break;
1435
1436 case 23:
1437 #line 213 "parse-gram.y"
1438 { pure_parser = true; }
1439 break;
1440
1441 case 24:
1442 #line 214 "parse-gram.y"
1443 { skeleton = (yyvsp[0].chars); }
1444 break;
1445
1446 case 25:
1447 #line 215 "parse-gram.y"
1448 { token_table_flag = true; }
1449 break;
1450
1451 case 26:
1452 #line 216 "parse-gram.y"
1453 { report_flag = report_states; }
1454 break;
1455
1456 case 27:
1457 #line 217 "parse-gram.y"
1458 { yacc_flag = true; }
1459 break;
1460
1461 case 31:
1462 #line 225 "parse-gram.y"
1463 {
1464 grammar_start_symbol_set ((yyvsp[0].symbol), (yylsp[0]));
1465 }
1466 break;
1467
1468 case 32:
1469 #line 229 "parse-gram.y"
1470 {
1471 typed = true;
1472 MUSCLE_INSERT_INT ("stype_line", (yylsp[0]).start.line);
1473 muscle_insert ("stype", (yyvsp[0].chars));
1474 }
1475 break;
1476
1477 case 33:
1478 #line 235 "parse-gram.y"
1479 {
1480 symbol_list *list;
1481 for (list = (yyvsp[0].list); list; list = list->next)
1482 symbol_destructor_set (list->sym, (yyvsp[-1].chars), (yylsp[-1]));
1483 symbol_list_free ((yyvsp[0].list));
1484 }
1485 break;
1486
1487 case 34:
1488 #line 242 "parse-gram.y"
1489 {
1490 symbol_list *list;
1491 for (list = (yyvsp[0].list); list; list = list->next)
1492 symbol_printer_set (list->sym, (yyvsp[-1].chars), list->location);
1493 symbol_list_free ((yyvsp[0].list));
1494 }
1495 break;
1496
1497 case 35:
1498 #line 249 "parse-gram.y"
1499 {
1500 default_prec = true;
1501 }
1502 break;
1503
1504 case 36:
1505 #line 253 "parse-gram.y"
1506 {
1507 default_prec = false;
1508 }
1509 break;
1510
1511 case 37:
1512 #line 259 "parse-gram.y"
1513 { current_class = nterm_sym; }
1514 break;
1515
1516 case 38:
1517 #line 260 "parse-gram.y"
1518 {
1519 current_class = unknown_sym;
1520 current_type = NULL;
1521 }
1522 break;
1523
1524 case 39:
1525 #line 264 "parse-gram.y"
1526 { current_class = token_sym; }
1527 break;
1528
1529 case 40:
1530 #line 265 "parse-gram.y"
1531 {
1532 current_class = unknown_sym;
1533 current_type = NULL;
1534 }
1535 break;
1536
1537 case 41:
1538 #line 270 "parse-gram.y"
1539 {
1540 symbol_list *list;
1541 for (list = (yyvsp[0].list); list; list = list->next)
1542 symbol_type_set (list->sym, (yyvsp[-1].uniqstr), (yylsp[-1]));
1543 symbol_list_free ((yyvsp[0].list));
1544 }
1545 break;
1546
1547 case 42:
1548 #line 280 "parse-gram.y"
1549 {
1550 symbol_list *list;
1551 ++current_prec;
1552 for (list = (yyvsp[0].list); list; list = list->next)
1553 {
1554 symbol_type_set (list->sym, current_type, (yylsp[-1]));
1555 symbol_precedence_set (list->sym, current_prec, (yyvsp[-2].assoc), (yylsp[-2]));
1556 }
1557 symbol_list_free ((yyvsp[0].list));
1558 current_type = NULL;
1559 }
1560 break;
1561
1562 case 43:
1563 #line 294 "parse-gram.y"
1564 { (yyval.assoc) = left_assoc; }
1565 break;
1566
1567 case 44:
1568 #line 295 "parse-gram.y"
1569 { (yyval.assoc) = right_assoc; }
1570 break;
1571
1572 case 45:
1573 #line 296 "parse-gram.y"
1574 { (yyval.assoc) = non_assoc; }
1575 break;
1576
1577 case 46:
1578 #line 300 "parse-gram.y"
1579 { current_type = NULL; }
1580 break;
1581
1582 case 47:
1583 #line 301 "parse-gram.y"
1584 { current_type = (yyvsp[0].uniqstr); }
1585 break;
1586
1587 case 48:
1588 #line 307 "parse-gram.y"
1589 { (yyval.list) = symbol_list_new ((yyvsp[0].symbol), (yylsp[0])); }
1590 break;
1591
1592 case 49:
1593 #line 308 "parse-gram.y"
1594 { (yyval.list) = symbol_list_prepend ((yyvsp[-1].list), (yyvsp[0].symbol), (yylsp[0])); }
1595 break;
1596
1597 case 50:
1598 #line 314 "parse-gram.y"
1599 {
1600 current_type = (yyvsp[0].uniqstr);
1601 }
1602 break;
1603
1604 case 51:
1605 #line 318 "parse-gram.y"
1606 {
1607 symbol_class_set ((yyvsp[0].symbol), current_class, (yylsp[0]));
1608 symbol_type_set ((yyvsp[0].symbol), current_type, (yylsp[0]));
1609 }
1610 break;
1611
1612 case 52:
1613 #line 323 "parse-gram.y"
1614 {
1615 symbol_class_set ((yyvsp[-1].symbol), current_class, (yylsp[-1]));
1616 symbol_type_set ((yyvsp[-1].symbol), current_type, (yylsp[-1]));
1617 symbol_user_token_number_set ((yyvsp[-1].symbol), (yyvsp[0].integer), (yylsp[0]));
1618 }
1619 break;
1620
1621 case 53:
1622 #line 329 "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_make_alias ((yyvsp[-1].symbol), (yyvsp[0].symbol), (yyloc));
1627 }
1628 break;
1629
1630 case 54:
1631 #line 335 "parse-gram.y"
1632 {
1633 symbol_class_set ((yyvsp[-2].symbol), current_class, (yylsp[-2]));
1634 symbol_type_set ((yyvsp[-2].symbol), current_type, (yylsp[-2]));
1635 symbol_user_token_number_set ((yyvsp[-2].symbol), (yyvsp[-1].integer), (yylsp[-1]));
1636 symbol_make_alias ((yyvsp[-2].symbol), (yyvsp[0].symbol), (yyloc));
1637 }
1638 break;
1639
1640 case 60:
1641 #line 364 "parse-gram.y"
1642 {
1643 if (yacc_flag)
1644 complain_at ((yyloc), _("POSIX forbids declarations in the grammar"));
1645 }
1646 break;
1647
1648 case 61:
1649 #line 369 "parse-gram.y"
1650 {
1651 yyerrok;
1652 }
1653 break;
1654
1655 case 62:
1656 #line 375 "parse-gram.y"
1657 { current_lhs = (yyvsp[0].symbol); current_lhs_location = (yylsp[0]); }
1658 break;
1659
1660 case 64:
1661 #line 379 "parse-gram.y"
1662 { grammar_rule_end ((yylsp[0])); }
1663 break;
1664
1665 case 65:
1666 #line 380 "parse-gram.y"
1667 { grammar_rule_end ((yylsp[0])); }
1668 break;
1669
1670 case 67:
1671 #line 386 "parse-gram.y"
1672 { grammar_rule_begin (current_lhs, current_lhs_location); }
1673 break;
1674
1675 case 68:
1676 #line 388 "parse-gram.y"
1677 { grammar_current_rule_symbol_append ((yyvsp[0].symbol), (yylsp[0])); }
1678 break;
1679
1680 case 69:
1681 #line 390 "parse-gram.y"
1682 { grammar_current_rule_action_append ((yyvsp[0].chars), (yylsp[0])); }
1683 break;
1684
1685 case 70:
1686 #line 392 "parse-gram.y"
1687 { grammar_current_rule_prec_set ((yyvsp[0].symbol), (yylsp[0])); }
1688 break;
1689
1690 case 71:
1691 #line 394 "parse-gram.y"
1692 { grammar_current_rule_dprec_set ((yyvsp[0].integer), (yylsp[0])); }
1693 break;
1694
1695 case 72:
1696 #line 396 "parse-gram.y"
1697 { grammar_current_rule_merge_set ((yyvsp[0].uniqstr), (yylsp[0])); }
1698 break;
1699
1700 case 73:
1701 #line 400 "parse-gram.y"
1702 { (yyval.symbol) = (yyvsp[0].symbol); }
1703 break;
1704
1705 case 74:
1706 #line 401 "parse-gram.y"
1707 { (yyval.symbol) = (yyvsp[0].symbol); }
1708 break;
1709
1710 case 75:
1711 #line 406 "parse-gram.y"
1712 { (yyval.chars) = (yyvsp[0].chars); }
1713 break;
1714
1715 case 76:
1716 #line 412 "parse-gram.y"
1717 {
1718 (yyval.symbol) = symbol_get ((yyvsp[0].chars), (yylsp[0]));
1719 symbol_class_set ((yyval.symbol), token_sym, (yylsp[0]));
1720 }
1721 break;
1722
1723 case 77:
1724 #line 421 "parse-gram.y"
1725 {
1726 (yyval.chars) = (yyvsp[0].chars) + 1;
1727 (yyval.chars)[strlen ((yyval.chars)) - 1] = '\0';
1728 }
1729 break;
1730
1731 case 79:
1732 #line 430 "parse-gram.y"
1733 {
1734 muscle_code_grow ("epilogue", (yyvsp[0].chars), (yylsp[0]));
1735 scanner_last_string_free ();
1736 }
1737 break;
1738
1739
1740 default: break;
1741 }
1742
1743 /* Line 1044 of yacc.c. */
1744 #line 1745 "parse-gram.c"
1745 \f
1746 yyvsp -= yylen;
1747 yyssp -= yylen;
1748 yylsp -= yylen;
1749
1750 YY_STACK_PRINT (yyss, yyssp);
1751
1752 *++yyvsp = yyval;
1753 *++yylsp = yyloc;
1754
1755 /* Now `shift' the result of the reduction. Determine what state
1756 that goes to, based on the state we popped back to and the rule
1757 number reduced by. */
1758
1759 yyn = yyr1[yyn];
1760
1761 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1762 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1763 yystate = yytable[yystate];
1764 else
1765 yystate = yydefgoto[yyn - YYNTOKENS];
1766
1767 goto yynewstate;
1768
1769
1770 /*------------------------------------.
1771 | yyerrlab -- here on detecting error |
1772 `------------------------------------*/
1773 yyerrlab:
1774 /* If not already recovering from an error, report this error. */
1775 if (!yyerrstatus)
1776 {
1777 ++yynerrs;
1778 #if YYERROR_VERBOSE
1779 yyn = yypact[yystate];
1780
1781 if (YYPACT_NINF < yyn && yyn < YYLAST)
1782 {
1783 YYSIZE_T yysize = 0;
1784 int yytype = YYTRANSLATE (yychar);
1785 const char* yyprefix;
1786 char *yymsg;
1787 int yyx;
1788
1789 /* Start YYX at -YYN if negative to avoid negative indexes in
1790 YYCHECK. */
1791 int yyxbegin = yyn < 0 ? -yyn : 0;
1792
1793 /* Stay within bounds of both yycheck and yytname. */
1794 int yychecklim = YYLAST - yyn;
1795 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1796 int yycount = 0;
1797
1798 yyprefix = _(", expecting ");
1799 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1800 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1801 {
1802 yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
1803 yycount += 1;
1804 if (yycount == 5)
1805 {
1806 yysize = 0;
1807 break;
1808 }
1809 }
1810 yysize += (strlen (_("syntax error, unexpected "))
1811 + yystrlen (yytname[yytype]) + 1);
1812 yymsg = (char *) YYSTACK_ALLOC (yysize);
1813 if (yymsg != 0)
1814 {
1815 char *yyp = yystpcpy (yymsg, _("syntax error, unexpected "));
1816 yyp = yystpcpy (yyp, yytname[yytype]);
1817
1818 if (yycount < 5)
1819 {
1820 yyprefix = _(", expecting ");
1821 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1822 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1823 {
1824 yyp = yystpcpy (yyp, yyprefix);
1825 yyp = yystpcpy (yyp, yytname[yyx]);
1826 yyprefix = _(" or ");
1827 }
1828 }
1829 yyerror (yymsg);
1830 YYSTACK_FREE (yymsg);
1831 }
1832 else
1833 yyerror (_("syntax error; also virtual memory exhausted"));
1834 }
1835 else
1836 #endif /* YYERROR_VERBOSE */
1837 yyerror (_("syntax error"));
1838 }
1839
1840 yyerror_range[0] = yylloc;
1841
1842 if (yyerrstatus == 3)
1843 {
1844 /* If just tried and failed to reuse look-ahead token after an
1845 error, discard it. */
1846
1847 if (yychar <= YYEOF)
1848 {
1849 /* If at end of input, pop the error token,
1850 then the rest of the stack, then return failure. */
1851 if (yychar == YYEOF)
1852 for (;;)
1853 {
1854 yyerror_range[0] = *yylsp;
1855 YYPOPSTACK;
1856 if (yyssp == yyss)
1857 YYABORT;
1858 yydestruct (_("Error: popping"),
1859 yystos[*yyssp], yyvsp, yylsp);
1860 }
1861 }
1862 else
1863 {
1864 yydestruct (_("Error: discarding"), yytoken, &yylval, &yylloc);
1865 yychar = YYEMPTY;
1866 }
1867 }
1868
1869 /* Else will try to reuse look-ahead token after shifting the error
1870 token. */
1871 goto yyerrlab1;
1872
1873
1874 /*---------------------------------------------------.
1875 | yyerrorlab -- error raised explicitly by YYERROR. |
1876 `---------------------------------------------------*/
1877 yyerrorlab:
1878
1879 /* Pacify compilers like GCC when the user code never invokes
1880 YYERROR and the label yyerrorlab therefore never appears in user
1881 code. */
1882 if (0)
1883 goto yyerrorlab;
1884
1885 yyerror_range[0] = yylsp[1-yylen];
1886 yylsp -= yylen;
1887 yyvsp -= yylen;
1888 yyssp -= yylen;
1889 yystate = *yyssp;
1890 goto yyerrlab1;
1891
1892
1893 /*-------------------------------------------------------------.
1894 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1895 `-------------------------------------------------------------*/
1896 yyerrlab1:
1897 yyerrstatus = 3; /* Each real token shifted decrements this. */
1898
1899 for (;;)
1900 {
1901 yyn = yypact[yystate];
1902 if (yyn != YYPACT_NINF)
1903 {
1904 yyn += YYTERROR;
1905 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1906 {
1907 yyn = yytable[yyn];
1908 if (0 < yyn)
1909 break;
1910 }
1911 }
1912
1913 /* Pop the current state because it cannot handle the error token. */
1914 if (yyssp == yyss)
1915 YYABORT;
1916
1917 yyerror_range[0] = *yylsp;
1918 yydestruct (_("Error: popping"), yystos[yystate], yyvsp, yylsp);
1919 YYPOPSTACK;
1920 yystate = *yyssp;
1921 YY_STACK_PRINT (yyss, yyssp);
1922 }
1923
1924 if (yyn == YYFINAL)
1925 YYACCEPT;
1926
1927 *++yyvsp = yylval;
1928
1929 yyerror_range[1] = yylloc;
1930 /* Using YYLLOC is tempting, but would change the location of
1931 the look-ahead. YYLOC is available though. */
1932 YYLLOC_DEFAULT (yyloc, yyerror_range - 1, 2);
1933 *++yylsp = yyloc;
1934
1935 /* Shift the error token. */
1936 YY_SYMBOL_PRINT (_("Shifting"), yystos[yyn], yyvsp, yylsp);
1937
1938 yystate = yyn;
1939 goto yynewstate;
1940
1941
1942 /*-------------------------------------.
1943 | yyacceptlab -- YYACCEPT comes here. |
1944 `-------------------------------------*/
1945 yyacceptlab:
1946 yyresult = 0;
1947 goto yyreturn;
1948
1949 /*-----------------------------------.
1950 | yyabortlab -- YYABORT comes here. |
1951 `-----------------------------------*/
1952 yyabortlab:
1953 yydestruct (_("Error: discarding lookahead"),
1954 yytoken, &yylval, &yylloc);
1955 yychar = YYEMPTY;
1956 yyresult = 1;
1957 goto yyreturn;
1958
1959 #ifndef yyoverflow
1960 /*----------------------------------------------.
1961 | yyoverflowlab -- parser overflow comes here. |
1962 `----------------------------------------------*/
1963 yyoverflowlab:
1964 yyerror (_("parser stack overflow"));
1965 yyresult = 2;
1966 /* Fall through. */
1967 #endif
1968
1969 yyreturn:
1970 #ifndef yyoverflow
1971 if (yyss != yyssa)
1972 YYSTACK_FREE (yyss);
1973 #endif
1974 return yyresult;
1975 }
1976
1977
1978 #line 436 "parse-gram.y"
1979
1980
1981
1982 /* Return the location of the left-hand side of a rule whose
1983 right-hand side is RHS[1] ... RHS[N]. Ignore empty nonterminals in
1984 the right-hand side, and return an empty location equal to the end
1985 boundary of RHS[0] if the right-hand side is empty. */
1986
1987 static YYLTYPE
1988 lloc_default (YYLTYPE const *rhs, int n)
1989 {
1990 int i;
1991 YYLTYPE loc;
1992
1993 /* SGI MIPSpro 7.4.1m miscompiles "loc.start = loc.end = rhs[n].end;".
1994 The bug is fixed in 7.4.2m, but play it safe for now. */
1995 loc.start = rhs[n].end;
1996 loc.end = rhs[n].end;
1997
1998 /* Ignore empty nonterminals the start of the the right-hand side.
1999 Do not bother to ignore them at the end of the right-hand side,
2000 since empty nonterminals have the same end as their predecessors. */
2001 for (i = 1; i <= n; i++)
2002 if (! equal_boundaries (rhs[i].start, rhs[i].end))
2003 {
2004 loc.start = rhs[i].start;
2005 break;
2006 }
2007
2008 return loc;
2009 }
2010
2011
2012 /* Add a lex-param or a parse-param (depending on TYPE) with
2013 declaration DECL and location LOC. */
2014
2015 static void
2016 add_param (char const *type, char *decl, location loc)
2017 {
2018 static char const alphanum[26 + 26 + 1 + 10] =
2019 "abcdefghijklmnopqrstuvwxyz"
2020 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
2021 "_"
2022 "0123456789";
2023 char const *name_start = NULL;
2024 char *p;
2025
2026 /* Stop on last actual character. */
2027 for (p = decl; p[1]; p++)
2028 if ((p == decl
2029 || ! memchr (alphanum, p[-1], sizeof alphanum))
2030 && memchr (alphanum, p[0], sizeof alphanum - 10))
2031 name_start = p;
2032
2033 /* Strip the surrounding '{' and '}', and any blanks just inside
2034 the braces. */
2035 while (*--p == ' ' || *p == '\t')
2036 continue;
2037 p[1] = '\0';
2038 while (*++decl == ' ' || *decl == '\t')
2039 continue;
2040
2041 if (! name_start)
2042 complain_at (loc, _("missing identifier in parameter declaration"));
2043 else
2044 {
2045 char *name;
2046 size_t name_len;
2047
2048 for (name_len = 1;
2049 memchr (alphanum, name_start[name_len], sizeof alphanum);
2050 name_len++)
2051 continue;
2052
2053 name = xmalloc (name_len + 1);
2054 memcpy (name, name_start, name_len);
2055 name[name_len] = '\0';
2056 muscle_pair_list_grow (type, decl, name);
2057 free (name);
2058 }
2059
2060 scanner_last_string_free ();
2061 }
2062
2063 /*----------------------------------------------------.
2064 | When debugging the parser, display tokens' values. |
2065 `----------------------------------------------------*/
2066
2067 static void
2068 print_token_value (FILE *file, int type, YYSTYPE const *value)
2069 {
2070 fputc (' ', file);
2071 switch (type)
2072 {
2073 case ID:
2074 fprintf (file, " = %s", value->symbol->tag);
2075 break;
2076
2077 case INT:
2078 fprintf (file, " = %d", value->integer);
2079 break;
2080
2081 case STRING:
2082 fprintf (file, " = \"%s\"", value->chars);
2083 break;
2084
2085 case TYPE:
2086 fprintf (file, " = <%s>", value->uniqstr);
2087 break;
2088
2089 case BRACED_CODE:
2090 case PERCENT_DESTRUCTOR:
2091 case PERCENT_LEX_PARAM:
2092 case PERCENT_PARSE_PARAM:
2093 case PERCENT_PRINTER:
2094 case PERCENT_UNION:
2095 case PROLOGUE:
2096 case EPILOGUE:
2097 fprintf (file, " = {{ %s }}", value->chars);
2098 break;
2099
2100 default:
2101 fprintf (file, "unknown token type");
2102 break;
2103 }
2104 }
2105
2106 static void
2107 gram_error (location const *loc, char const *msg)
2108 {
2109 complain_at (*loc, "%s", msg);
2110 }
2111
2112 char const *
2113 token_name (int type)
2114 {
2115 return yytname[type];
2116 }
2117