1 /* A Bison parser, made from parse-gram.y
4 #define YYBISON 1 /* Identify Bison output. */
6 #define yyparse gram_parse
8 #define yyerror gram_error
9 #define yylval gram_lval
10 #define yychar gram_char
11 #define yydebug gram_debug
12 #define yynerrs gram_nerrs
13 #define YYLSP_NEEDED 1
17 # define CHARACTER 258
19 # define PERCENT_TOKEN 260
20 # define PERCENT_NTERM 261
21 # define PERCENT_TYPE 262
22 # define PERCENT_UNION 263
23 # define PERCENT_EXPECT 264
24 # define PERCENT_START 265
25 # define PERCENT_LEFT 266
26 # define PERCENT_RIGHT 267
27 # define PERCENT_NONASSOC 268
28 # define PERCENT_PREC 269
29 # define PERCENT_VERBOSE 270
30 # define PERCENT_ERROR_VERBOSE 271
31 # define PERCENT_OUTPUT 272
32 # define PERCENT_FILE_PREFIX 273
33 # define PERCENT_NAME_PREFIX 274
34 # define PERCENT_DEFINE 275
35 # define PERCENT_PURE_PARSER 276
36 # define PERCENT_DEFINES 277
37 # define PERCENT_YACC 278
38 # define PERCENT_DEBUG 279
39 # define PERCENT_LOCATIONS 280
40 # define PERCENT_NO_LINES 281
41 # define PERCENT_SKELETON 282
42 # define PERCENT_TOKEN_TABLE 283
45 # define SEMICOLON 286
49 # define PERCENT_PERCENT 290
52 # define BRACED_CODE 293
54 #line 31 "parse-gram.y"
57 #include "muscle_tab.h"
63 #include "conflicts.h"
65 /* Produce verbose parse errors. */
66 #define YYERROR_VERBOSE 1
68 /* Pass the control structure to YYPARSE and YYLEX. */
69 #define YYPARSE_PARAM gram_control
70 #define YYLEX_PARAM gram_control
71 /* YYPARSE receives GRAM_CONTROL as a void *. Provide a
72 correctly typed access to it. */
73 #define yycontrol ((gram_control_t *) gram_control)
75 /* Request detailed parse error messages, and pass them to
78 #define yyerror(Msg) \
79 gram_error (yycontrol, &yylloc, Msg)
81 /* When debugging our pure parser, we want to see values and locations
83 #define YYPRINT(File, Type, Value) \
84 yyprint (File, &yylloc, Type, &Value)
85 static void yyprint (FILE *file
, const location_t
*loc
,
86 int type
, const yystype
*value
);
88 symbol_class current_class
= unknown_sym
;
89 char *current_type
= 0;
90 symbol_t
*current_lhs
;
91 associativity current_assoc
;
94 #line 73 "parse-gram.y"
103 # define YYSTYPE yystype
104 # define YYSTYPE_IS_TRIVIAL 1
108 typedef struct yyltype
117 # define YYLTYPE yyltype
118 # define YYLTYPE_IS_TRIVIAL 1
128 #define YYFLAG -32768
131 /* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
132 #define YYTRANSLATE(x) ((unsigned)(x) <= 293 ? yytranslate[x] : 68)
134 /* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
135 static const char yytranslate
[] =
137 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
138 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
139 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
140 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
141 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
142 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
143 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
144 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
145 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
146 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
147 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
148 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
149 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
150 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
151 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
152 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
153 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
154 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
155 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
156 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
157 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
158 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
159 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
160 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
161 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
162 2, 2, 2, 2, 2, 2, 1, 4, 5, 6,
163 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
164 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
165 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
170 static const short yyprhs
[] =
172 0, 0, 1, 7, 8, 11, 13, 15, 17, 21,
173 23, 25, 28, 32, 34, 38, 40, 44, 46, 49,
174 51, 53, 55, 57, 58, 62, 65, 66, 70, 71,
175 76, 80, 81, 86, 88, 90, 92, 93, 95, 97,
176 100, 102, 105, 107, 109, 112, 115, 119, 121, 124,
177 126, 129, 130, 136, 138, 142, 143, 146, 149, 153,
178 155, 157, 159, 161, 163, 165, 166, 169, 170
180 static const short yyrhs
[] =
182 -1, 42, 43, 37, 57, 66, 0, 0, 43, 44,
183 0, 45, 0, 38, 0, 26, 0, 22, 65, 65,
184 0, 24, 0, 18, 0, 11, 6, 0, 20, 32,
185 65, 0, 27, 0, 21, 32, 65, 0, 28, 0,
186 19, 32, 65, 0, 23, 0, 29, 65, 0, 30,
187 0, 17, 0, 25, 0, 49, 0, 0, 8, 46,
188 56, 0, 12, 62, 0, 0, 7, 47, 56, 0,
189 0, 9, 31, 48, 53, 0, 10, 40, 67, 0,
190 0, 51, 52, 50, 54, 0, 13, 0, 14, 0,
191 15, 0, 0, 31, 0, 36, 0, 53, 36, 0,
192 62, 0, 54, 62, 0, 31, 0, 36, 0, 36,
193 6, 0, 36, 64, 0, 36, 6, 64, 0, 55,
194 0, 56, 55, 0, 58, 0, 57, 58, 0, 0,
195 36, 34, 59, 60, 33, 0, 61, 0, 60, 35,
196 61, 0, 0, 61, 62, 0, 61, 63, 0, 61,
197 16, 62, 0, 36, 0, 64, 0, 5, 0, 40,
198 0, 4, 0, 4, 0, 0, 37, 39, 0, 0,
205 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
206 static const short yyrline
[] =
208 0, 132, 132, 140, 142, 145, 147, 151, 152, 153,
209 154, 155, 156, 157, 158, 159, 160, 161, 162, 163,
210 164, 165, 168, 170, 170, 175, 179, 179, 184, 184,
211 188, 196, 196, 203, 205, 206, 209, 211, 215, 217,
212 221, 227, 236, 241, 246, 252, 258, 268, 271, 275,
213 277, 280, 280, 285, 287, 290, 293, 295, 297, 301,
214 303, 304, 307, 313, 322, 330, 335, 341, 343
219 #if (YYDEBUG) || defined YYERROR_VERBOSE
221 /* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
222 static const char *const yytname
[] =
224 "$", "error", "$undefined.", "\"end of string\"", "STRING", "CHARACTER",
225 "INT", "\"%token\"", "\"%nterm\"", "\"%type\"", "\"%union\"",
226 "\"%expect\"", "\"%start\"", "\"%left\"", "\"%right\"", "\"%nonassoc\"",
227 "\"%prec\"", "\"%verbose\"", "\"%error-verbose\"", "\"%output\"",
228 "\"%file-prefix\"", "\"%name-prefix\"", "\"%define\"",
229 "\"%pure-parser\"", "\"%defines\"", "\"%yacc\"", "\"%debug\"",
230 "\"%locations\"", "\"%no-lines\"", "\"%skeleton\"", "\"%token-table\"",
231 "TYPE", "\"=\"", "\";\"", "\":\"", "\"|\"", "\"identifier\"", "\"%%\"",
232 "PROLOGUE", "EPILOGUE", "BRACED_CODE", "input", "@1", "directives",
233 "directive", "grammar_directives", "@2", "@3", "@4",
234 "precedence_directives", "@5", "precedence_directive", "type.opt",
235 "nterms_to_type.1", "terms_to_prec.1", "symbol_def", "symbol_defs.1",
236 "gram", "rules", "@6", "rhses.1", "rhs", "symbol", "action",
237 "string_as_id", "string_content", "epilogue.opt", "semi_colon_opt", 0
241 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
242 static const short yyr1
[] =
244 0, 42, 41, 43, 43, 44, 44, 44, 44, 44,
245 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
246 44, 44, 45, 46, 45, 45, 47, 45, 48, 45,
247 45, 50, 49, 51, 51, 51, 52, 52, 53, 53,
248 54, 54, 55, 55, 55, 55, 55, 56, 56, 57,
249 57, 59, 58, 60, 60, 61, 61, 61, 61, 62,
250 62, 62, 63, 64, 65, 66, 66, 67, 67
253 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
254 static const short yyr2
[] =
256 0, 0, 5, 0, 2, 1, 1, 1, 3, 1,
257 1, 2, 3, 1, 3, 1, 3, 1, 2, 1,
258 1, 1, 1, 0, 3, 2, 0, 3, 0, 4,
259 3, 0, 4, 1, 1, 1, 0, 1, 1, 2,
260 1, 2, 1, 1, 2, 2, 3, 1, 2, 1,
261 2, 0, 5, 1, 3, 0, 2, 2, 3, 1,
262 1, 1, 1, 1, 1, 0, 2, 0, 1
265 /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
266 doesn't specify something else to do. Zero means the default is an
268 static const short yydefact
[] =
270 1, 3, 0, 26, 23, 0, 0, 0, 0, 33,
271 34, 35, 20, 10, 0, 0, 0, 0, 17, 9,
272 21, 7, 13, 15, 0, 19, 0, 6, 4, 5,
273 22, 36, 0, 0, 28, 67, 11, 63, 61, 59,
274 25, 60, 0, 0, 0, 64, 0, 18, 0, 65,
275 49, 37, 31, 42, 43, 47, 27, 24, 0, 68,
276 30, 16, 12, 14, 8, 51, 0, 50, 2, 0,
277 44, 45, 48, 38, 29, 55, 66, 32, 40, 46,
278 39, 0, 53, 41, 52, 55, 0, 62, 56, 57,
282 static const short yydefgoto
[] =
284 92, 1, 2, 28, 29, 33, 32, 58, 30, 69,
285 31, 52, 74, 77, 55, 56, 49, 50, 75, 81,
286 82, 88, 89, 41, 46, 68, 60
289 static const short yypact
[] =
291 -32768,-32768, 72,-32768,-32768, -22, -29, 8, -1,-32768,
292 -32768,-32768,-32768,-32768, -16, -14, -11, 22,-32768,-32768,
293 -32768,-32768,-32768,-32768, 22,-32768, -6,-32768,-32768,-32768,
294 -32768, 0, -24, -24,-32768, 1,-32768,-32768,-32768,-32768,
295 -32768,-32768, 22, 22, 22,-32768, 22,-32768, -2, -17,
296 -32768,-32768,-32768,-32768, 4,-32768, -24, -24, 2,-32768,
297 -32768,-32768,-32768,-32768,-32768,-32768, 3,-32768,-32768, -1,
298 32,-32768,-32768,-32768, 5,-32768,-32768, -1,-32768,-32768,
299 -32768, -18, -3,-32768,-32768,-32768, -1,-32768,-32768,-32768,
300 -3,-32768, 39, 40,-32768
303 static const short yypgoto
[] =
305 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
306 -32768,-32768,-32768,-32768, -28, 10,-32768, -5,-32768,-32768,
307 -40, -8,-32768, -48, -19,-32768,-32768
314 static const short yytable
[] =
316 40, 37, 38, 37, 38, 47, 71, 53, 37, 34,
317 70, 35, 54, 86, 36, 84, 42, 85, 43, 48,
318 66, 44, 79, 61, 62, 63, 45, 64, 72, 72,
319 48, 51, 65, 39, 59, 39, 37, 87, 73, 93,
320 94, 80, 76, 57, 67, 90, 0, 0, 0, 0,
321 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
322 0, 78, 0, 0, 0, 0, 0, 0, 0, 83,
323 0, 0, 0, 0, 0, 0, 0, 0, 91, 3,
324 4, 5, 6, 7, 8, 9, 10, 11, 0, 12,
325 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
326 23, 24, 25, 0, 0, 0, 0, 0, 0, 26,
330 static const short yycheck
[] =
332 8, 4, 5, 4, 5, 24, 54, 31, 4, 31,
333 6, 40, 36, 16, 6, 33, 32, 35, 32, 36,
334 37, 32, 70, 42, 43, 44, 4, 46, 56, 57,
335 36, 31, 34, 36, 33, 36, 4, 40, 36, 0,
336 0, 36, 39, 33, 49, 85, -1, -1, -1, -1,
337 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
338 -1, 69, -1, -1, -1, -1, -1, -1, -1, 77,
339 -1, -1, -1, -1, -1, -1, -1, -1, 86, 7,
340 8, 9, 10, 11, 12, 13, 14, 15, -1, 17,
341 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
342 28, 29, 30, -1, -1, -1, -1, -1, -1, 37,
347 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
348 #line 3 "/usr/share/bison/bison.simple"
350 /* Skeleton output parser for bison,
352 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software
355 This program is free software; you can redistribute it and/or modify
356 it under the terms of the GNU General Public License as published by
357 the Free Software Foundation; either version 2, or (at your option)
360 This program is distributed in the hope that it will be useful,
361 but WITHOUT ANY WARRANTY; without even the implied warranty of
362 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
363 GNU General Public License for more details.
365 You should have received a copy of the GNU General Public License
366 along with this program; if not, write to the Free Software
367 Foundation, Inc., 59 Temple Place - Suite 330,
368 Boston, MA 02111-1307, USA. */
370 /* As a special exception, when this file is copied by Bison into a
371 Bison output file, you may use that output file without restriction.
372 This special exception was added by the Free Software Foundation
373 in version 1.24 of Bison. */
375 /* This is the parser code that is written into each bison parser when
376 the %semantic_parser declaration is not specified in the grammar.
377 It was written by Richard Stallman by simplifying the hairy parser
378 used when %semantic_parser is specified. */
380 /* All symbols defined below should begin with yy or YY, to avoid
381 infringing on user name space. This should be done even for local
382 variables, as they might otherwise be expanded by user macros.
383 There are some unavoidable exceptions within include files to
384 define necessary library symbols; they are noted "INFRINGES ON
385 USER NAME SPACE" below. */
387 #if ! defined (yyoverflow) || defined (YYERROR_VERBOSE)
389 /* The parser invokes alloca or malloc; define the necessary symbols. */
391 # if YYSTACK_USE_ALLOCA
392 # define YYSTACK_ALLOC alloca
394 # ifndef YYSTACK_USE_ALLOCA
395 # if defined (alloca) || defined (_ALLOCA_H)
396 # define YYSTACK_ALLOC alloca
399 # define YYSTACK_ALLOC __builtin_alloca
405 # ifdef YYSTACK_ALLOC
406 /* Pacify GCC's `empty if-body' warning. */
407 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
409 # if defined (__STDC__) || defined (__cplusplus)
410 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
411 # define YYSIZE_T size_t
413 # define YYSTACK_ALLOC malloc
414 # define YYSTACK_FREE free
416 #endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
419 #if (! defined (yyoverflow) \
420 && (! defined (__cplusplus) \
421 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
423 /* A type that is properly aligned for any stack member. */
433 /* The size of the maximum gap between one aligned stack and the next. */
434 # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
436 /* The size of an array large to enough to hold all stacks, each with
439 # define YYSTACK_BYTES(N) \
440 ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
441 + 2 * YYSTACK_GAP_MAX)
443 # define YYSTACK_BYTES(N) \
444 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
448 /* Copy COUNT objects from FROM to TO. The source and destination do
452 # define YYCOPY(To, From, Count) \
453 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
455 # define YYCOPY(To, From, Count) \
458 register YYSIZE_T yyi; \
459 for (yyi = 0; yyi < (Count); yyi++) \
460 (To)[yyi] = (From)[yyi]; \
466 /* Relocate STACK from its old location to the new one. The
467 local variables YYSIZE and YYSTACKSIZE give the old and new number of
468 elements in the stack, and YYPTR gives the new location of the
469 stack. Advance YYPTR to a properly aligned location for the next
471 # define YYSTACK_RELOCATE(Stack) \
474 YYSIZE_T yynewbytes; \
475 YYCOPY (&yyptr->Stack, Stack, yysize); \
476 Stack = &yyptr->Stack; \
477 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
478 yyptr += yynewbytes / sizeof (*yyptr); \
485 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
486 # define YYSIZE_T __SIZE_TYPE__
488 #if ! defined (YYSIZE_T) && defined (size_t)
489 # define YYSIZE_T size_t
491 #if ! defined (YYSIZE_T)
492 # if defined (__STDC__) || defined (__cplusplus)
493 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
494 # define YYSIZE_T size_t
497 #if ! defined (YYSIZE_T)
498 # define YYSIZE_T unsigned int
501 #define yyerrok (yyerrstatus = 0)
502 #define yyclearin (yychar = YYEMPTY)
505 #define YYACCEPT goto yyacceptlab
506 #define YYABORT goto yyabortlab
507 #define YYERROR goto yyerrlab1
508 /* Like YYERROR except do call yyerror. This remains here temporarily
509 to ease the transition to the new meaning of YYERROR, for GCC.
510 Once GCC version 2 has supplanted version 1, this can go. */
511 #define YYFAIL goto yyerrlab
512 #define YYRECOVERING() (!!yyerrstatus)
513 #define YYBACKUP(Token, Value) \
515 if (yychar == YYEMPTY && yylen == 1) \
519 yychar1 = YYTRANSLATE (yychar); \
525 yyerror ("syntax error: cannot back up"); \
531 #define YYERRCODE 256
534 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
537 When YYLLOC_DEFAULT is run, CURRENT is set the location of the
538 first token. By default, to implement support for ranges, extend
539 its range to the last symbol. */
541 #ifndef YYLLOC_DEFAULT
542 # define YYLLOC_DEFAULT(Current, Rhs, N) \
543 Current.last_line = Rhs[N].last_line; \
544 Current.last_column = Rhs[N].last_column;
548 /* YYLEX -- calling `yylex' with the right arguments. */
553 # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
555 # define YYLEX yylex (&yylval, &yylloc)
557 # else /* !YYLSP_NEEDED */
559 # define YYLEX yylex (&yylval, YYLEX_PARAM)
561 # define YYLEX yylex (&yylval)
563 # endif /* !YYLSP_NEEDED */
565 # define YYLEX yylex ()
569 /* Enable debugging if requested. */
573 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
574 # define YYFPRINTF fprintf
577 # define YYDPRINTF(Args) \
582 /* Nonzero means print parse trace. It is left uninitialized so that
583 multiple parsers can coexist. */
586 # define YYDPRINTF(Args)
587 #endif /* !YYDEBUG */
589 /* YYINITDEPTH -- initial size of the parser's stacks. */
591 # define YYINITDEPTH 200
594 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
595 if the built-in stack extension method is used).
597 Do not make this value too large; the results are undefined if
598 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
599 evaluated with infinite-precision integer arithmetic. */
606 # define YYMAXDEPTH 10000
609 #ifdef YYERROR_VERBOSE
612 # if defined (__GLIBC__) && defined (_STRING_H)
613 # define yystrlen strlen
615 /* Return the length of YYSTR. */
617 # if defined (__STDC__) || defined (__cplusplus)
618 yystrlen (const char *yystr
)
624 register const char *yys
= yystr
;
626 while (*yys
++ != '\0')
629 return yys
- yystr
- 1;
635 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
636 # define yystpcpy stpcpy
638 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
641 # if defined (__STDC__) || defined (__cplusplus)
642 yystpcpy (char *yydest
, const char *yysrc
)
644 yystpcpy (yydest
, yysrc
)
649 register char *yyd
= yydest
;
650 register const char *yys
= yysrc
;
652 while ((*yyd
++ = *yys
++) != '\0')
661 #line 315 "/usr/share/bison/bison.simple"
664 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
665 into yyparse. The argument should have type void *.
666 It should actually point to an object.
667 Grammar actions can access the variable by casting it
668 to the proper pointer type. */
671 # if defined (__STDC__) || defined (__cplusplus)
672 # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
673 # define YYPARSE_PARAM_DECL
675 # define YYPARSE_PARAM_ARG YYPARSE_PARAM
676 # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
678 #else /* !YYPARSE_PARAM */
679 # define YYPARSE_PARAM_ARG
680 # define YYPARSE_PARAM_DECL
681 #endif /* !YYPARSE_PARAM */
683 /* Prevent warning if -Wstrict-prototypes. */
685 # ifdef YYPARSE_PARAM
686 int yyparse (void *);
692 /* YY_DECL_VARIABLES -- depending whether we use a pure parser,
693 variables are global, or local to YYPARSE. */
695 #define YY_DECL_NON_LSP_VARIABLES \
696 /* The lookahead symbol. */ \
699 /* The semantic value of the lookahead symbol. */ \
702 /* Number of parse errors so far. */ \
706 # define YY_DECL_VARIABLES \
707 YY_DECL_NON_LSP_VARIABLES \
709 /* Location data for the lookahead symbol. */ \
712 # define YY_DECL_VARIABLES \
713 YY_DECL_NON_LSP_VARIABLES
717 /* If nonreentrant, generate the variables here. */
724 yyparse (YYPARSE_PARAM_ARG
)
727 /* If reentrant, generate the variables here. */
732 register int yystate
;
735 /* Number of tokens to shift before error messages enabled. */
737 /* Lookahead token as an internal (translated) token number. */
740 /* Three stacks and their tools:
741 `yyss': related to states,
742 `yyvs': related to semantic values,
743 `yyls': related to locations.
745 Refer to the stacks thru separate pointers, to allow yyoverflow
746 to reallocate them elsewhere. */
748 /* The state stack. */
749 short yyssa
[YYINITDEPTH
];
751 register short *yyssp
;
753 /* The semantic value stack. */
754 YYSTYPE yyvsa
[YYINITDEPTH
];
755 YYSTYPE
*yyvs
= yyvsa
;
756 register YYSTYPE
*yyvsp
;
759 /* The location stack. */
760 YYLTYPE yylsa
[YYINITDEPTH
];
761 YYLTYPE
*yyls
= yylsa
;
766 # define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
768 # define YYPOPSTACK (yyvsp--, yyssp--)
771 YYSIZE_T yystacksize
= YYINITDEPTH
;
774 /* The variables used to return semantic value and location from the
781 /* When reducing, the number of symbols on the RHS of the reduced
785 YYDPRINTF ((stderr
, "Starting parse\n"));
790 yychar
= YYEMPTY
; /* Cause a token to be read. */
792 /* Initialize stack pointers.
793 Waste one element of value and location stack
794 so that they stay on the same level as the state stack.
795 The wasted elements are never initialized. */
804 /*------------------------------------------------------------.
805 | yynewstate -- Push a new state, which is found in yystate. |
806 `------------------------------------------------------------*/
808 /* In all cases, when you get here, the value and location stacks
809 have just been pushed. so pushing a state here evens the stacks.
816 if (yyssp
>= yyss
+ yystacksize
- 1)
818 /* Get the current used size of the three stacks, in elements. */
819 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
823 /* Give user a chance to reallocate the stack. Use copies of
824 these so that the &'s don't force the real ones into
826 YYSTYPE
*yyvs1
= yyvs
;
829 /* Each stack pointer address is followed by the size of the
830 data in use in that stack, in bytes. */
832 YYLTYPE
*yyls1
= yyls
;
833 /* This used to be a conditional around just the two extra args,
834 but that might be undefined if yyoverflow is a macro. */
835 yyoverflow ("parser stack overflow",
836 &yyss1
, yysize
* sizeof (*yyssp
),
837 &yyvs1
, yysize
* sizeof (*yyvsp
),
838 &yyls1
, yysize
* sizeof (*yylsp
),
842 yyoverflow ("parser stack overflow",
843 &yyss1
, yysize
* sizeof (*yyssp
),
844 &yyvs1
, yysize
* sizeof (*yyvsp
),
850 #else /* no yyoverflow */
851 # ifndef YYSTACK_RELOCATE
854 /* Extend the stack our own way. */
855 if (yystacksize
>= YYMAXDEPTH
)
858 if (yystacksize
> YYMAXDEPTH
)
859 yystacksize
= YYMAXDEPTH
;
863 union yyalloc
*yyptr
=
864 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
867 YYSTACK_RELOCATE (yyss
);
868 YYSTACK_RELOCATE (yyvs
);
870 YYSTACK_RELOCATE (yyls
);
872 # undef YYSTACK_RELOCATE
874 YYSTACK_FREE (yyss1
);
877 #endif /* no yyoverflow */
879 yyssp
= yyss
+ yysize
- 1;
880 yyvsp
= yyvs
+ yysize
- 1;
882 yylsp
= yyls
+ yysize
- 1;
885 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
886 (unsigned long int) yystacksize
));
888 if (yyssp
>= yyss
+ yystacksize
- 1)
892 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
902 /* Do appropriate processing given the current state. */
903 /* Read a lookahead token if we need one and don't already have one. */
906 /* First try to decide what to do without reference to lookahead token. */
908 yyn
= yypact
[yystate
];
912 /* Not known => get a lookahead token if don't already have one. */
914 /* yychar is either YYEMPTY or YYEOF
915 or a valid token in external form. */
917 if (yychar
== YYEMPTY
)
919 YYDPRINTF ((stderr
, "Reading a token: "));
923 /* Convert token to internal form (in yychar1) for indexing tables with */
925 if (yychar
<= 0) /* This means end of input. */
928 yychar
= YYEOF
; /* Don't call YYLEX any more */
930 YYDPRINTF ((stderr
, "Now at end of input.\n"));
934 yychar1
= YYTRANSLATE (yychar
);
937 /* We have to keep this `#if YYDEBUG', since we use variables
938 which are defined only if `YYDEBUG' is set. */
941 YYFPRINTF (stderr
, "Next token is %d (%s",
942 yychar
, yytname
[yychar1
]);
943 /* Give the individual parser a way to print the precise
944 meaning of a token, for further debugging info. */
946 YYPRINT (stderr
, yychar
, yylval
);
948 YYFPRINTF (stderr
, ")\n");
954 if (yyn
< 0 || yyn
> YYLAST
|| yycheck
[yyn
] != yychar1
)
959 /* yyn is what to do for this token type in this state.
960 Negative => reduce, -yyn is rule number.
961 Positive => shift, yyn is new state.
962 New state is final state => don't bother to shift,
964 0, or most negative number => error. */
979 /* Shift the lookahead token. */
980 YYDPRINTF ((stderr
, "Shifting token %d (%s), ",
981 yychar
, yytname
[yychar1
]));
983 /* Discard the token being shifted unless it is eof. */
992 /* Count tokens shifted since error; after three, turn off error
1001 /*-----------------------------------------------------------.
1002 | yydefault -- do the default action for the current state. |
1003 `-----------------------------------------------------------*/
1005 yyn
= yydefact
[yystate
];
1011 /*-----------------------------.
1012 | yyreduce -- Do a reduction. |
1013 `-----------------------------*/
1015 /* yyn is the number of a rule to reduce with. */
1018 /* If YYLEN is nonzero, implement the default value of the action:
1021 Otherwise, the following line sets YYVAL to the semantic value of
1022 the lookahead token. This behavior is undocumented and Bison
1023 users should not rely upon it. Assigning to YYVAL
1024 unconditionally makes the parser a bit smaller, and it avoids a
1025 GCC warning that YYVAL may be used uninitialized. */
1026 yyval
= yyvsp
[1-yylen
];
1029 /* Similarly for the default location. Let the user run additional
1030 commands if for instance locations are ranges. */
1031 yyloc
= yylsp
[1-yylen
];
1032 YYLLOC_DEFAULT (yyloc
, (yylsp
- yylen
), yylen
);
1036 /* We have to keep this `#if YYDEBUG', since we use variables which
1037 are defined only if `YYDEBUG' is set. */
1042 YYFPRINTF (stderr
, "Reducing via rule %d (line %d), ",
1045 /* Print the symbols being reduced, and their result. */
1046 for (yyi
= yyprhs
[yyn
]; yyrhs
[yyi
] > 0; yyi
++)
1047 YYFPRINTF (stderr
, "%s ", yytname
[yyrhs
[yyi
]]);
1048 YYFPRINTF (stderr
, " -> %s\n", yytname
[yyr1
[yyn
]]);
1055 #line 132 "parse-gram.y"
1056 { LOCATION_RESET (yylloc
); }
1059 #line 134 "parse-gram.y"
1061 yycontrol
->errcode
= 0;
1062 epilogue_set (yyvsp
[0].string
, yylsp
[0]);
1066 #line 148 "parse-gram.y"
1068 prologue_augment (yyvsp
[0].string
, yylsp
[0]);
1072 #line 151 "parse-gram.y"
1076 #line 152 "parse-gram.y"
1077 { muscle_insert (yyvsp
[-1].string
, yyvsp
[0].string
); }
1080 #line 153 "parse-gram.y"
1081 { defines_flag
= 1; }
1084 #line 154 "parse-gram.y"
1085 { error_verbose
= 1; }
1088 #line 155 "parse-gram.y"
1089 { expected_conflicts
= yyvsp
[0].integer
; }
1092 #line 156 "parse-gram.y"
1093 { spec_file_prefix
= yyvsp
[0].string
; }
1096 #line 157 "parse-gram.y"
1097 { locations_flag
= 1; }
1100 #line 158 "parse-gram.y"
1101 { spec_name_prefix
= yyvsp
[0].string
; }
1104 #line 159 "parse-gram.y"
1105 { no_lines_flag
= 1; }
1108 #line 160 "parse-gram.y"
1109 { spec_outfile
= yyvsp
[0].string
; }
1112 #line 161 "parse-gram.y"
1113 { pure_parser
= 1; }
1116 #line 162 "parse-gram.y"
1117 { skeleton
= yyvsp
[0].string
; }
1120 #line 163 "parse-gram.y"
1121 { token_table_flag
= 1; }
1124 #line 164 "parse-gram.y"
1125 { report_flag
= 1; }
1128 #line 165 "parse-gram.y"
1132 #line 170 "parse-gram.y"
1133 { current_class
= nterm_sym
; }
1136 #line 171 "parse-gram.y"
1138 current_class
= unknown_sym
;
1139 current_type
= NULL
;
1143 #line 176 "parse-gram.y"
1145 grammar_start_symbol_set (yyvsp
[0].symbol
);
1149 #line 179 "parse-gram.y"
1150 { current_class
= token_sym
; }
1153 #line 180 "parse-gram.y"
1155 current_class
= unknown_sym
;
1156 current_type
= NULL
;
1160 #line 184 "parse-gram.y"
1161 {current_type
= yyvsp
[0].string
; }
1164 #line 185 "parse-gram.y"
1166 current_type
= NULL
;
1170 #line 189 "parse-gram.y"
1173 MUSCLE_INSERT_INT ("stype_line", yylsp
[-1].first_line
);
1174 muscle_insert ("stype", yyvsp
[-1].string
);
1178 #line 198 "parse-gram.y"
1179 { current_assoc
= yyvsp
[-1].assoc
; ++current_prec
; }
1182 #line 200 "parse-gram.y"
1183 { current_assoc
= non_assoc
; current_type
= NULL
; }
1186 #line 204 "parse-gram.y"
1187 { yyval
.assoc
= left_assoc
; }
1190 #line 205 "parse-gram.y"
1191 { yyval
.assoc
= right_assoc
; }
1194 #line 206 "parse-gram.y"
1195 { yyval
.assoc
= non_assoc
; }
1198 #line 210 "parse-gram.y"
1199 { current_type
= NULL
;}
1202 #line 211 "parse-gram.y"
1203 { current_type
= yyvsp
[0].string
; }
1206 #line 216 "parse-gram.y"
1207 { symbol_type_set (yyvsp
[0].symbol
, current_type
); }
1210 #line 217 "parse-gram.y"
1211 { symbol_type_set (yyvsp
[0].symbol
, current_type
); }
1214 #line 223 "parse-gram.y"
1216 symbol_type_set (yyvsp
[0].symbol
, current_type
);
1217 symbol_precedence_set (yyvsp
[0].symbol
, current_prec
, current_assoc
);
1221 #line 228 "parse-gram.y"
1223 symbol_type_set (yyvsp
[0].symbol
, current_type
);
1224 symbol_precedence_set (yyvsp
[0].symbol
, current_prec
, current_assoc
);
1228 #line 238 "parse-gram.y"
1230 current_type
= yyvsp
[0].string
;
1234 #line 242 "parse-gram.y"
1236 symbol_class_set (yyvsp
[0].symbol
, current_class
);
1237 symbol_type_set (yyvsp
[0].symbol
, current_type
);
1241 #line 247 "parse-gram.y"
1243 symbol_class_set (yyvsp
[-1].symbol
, current_class
);
1244 symbol_type_set (yyvsp
[-1].symbol
, current_type
);
1245 symbol_user_token_number_set (yyvsp
[-1].symbol
, yyvsp
[0].integer
);
1249 #line 253 "parse-gram.y"
1251 symbol_class_set (yyvsp
[-1].symbol
, current_class
);
1252 symbol_type_set (yyvsp
[-1].symbol
, current_type
);
1253 symbol_make_alias (yyvsp
[-1].symbol
, yyvsp
[0].symbol
);
1257 #line 259 "parse-gram.y"
1259 symbol_class_set (yyvsp
[-2].symbol
, current_class
);
1260 symbol_type_set (yyvsp
[-2].symbol
, current_type
);
1261 symbol_user_token_number_set (yyvsp
[-2].symbol
, yyvsp
[-1].integer
);
1262 symbol_make_alias (yyvsp
[-2].symbol
, yyvsp
[0].symbol
);
1266 #line 270 "parse-gram.y"
1270 #line 272 "parse-gram.y"
1274 #line 281 "parse-gram.y"
1275 { current_lhs
= yyvsp
[-1].symbol
; }
1278 #line 282 "parse-gram.y"
1282 #line 286 "parse-gram.y"
1283 { grammar_rule_end (); }
1286 #line 287 "parse-gram.y"
1287 { grammar_rule_end (); }
1290 #line 292 "parse-gram.y"
1291 { grammar_rule_begin (current_lhs
); }
1294 #line 294 "parse-gram.y"
1295 { grammar_current_rule_symbol_append (yyvsp
[0].symbol
); }
1298 #line 296 "parse-gram.y"
1299 { grammar_current_rule_action_append (yyvsp
[0].string
, yylsp
[0].first_line
); }
1302 #line 298 "parse-gram.y"
1303 { grammar_current_rule_prec_set (yyvsp
[0].symbol
); }
1306 #line 302 "parse-gram.y"
1307 { yyval
.symbol
= yyvsp
[0].symbol
; }
1310 #line 303 "parse-gram.y"
1311 { yyval
.symbol
= yyvsp
[0].symbol
; }
1314 #line 304 "parse-gram.y"
1315 { yyval
.symbol
= getsym (yyvsp
[0].string
); }
1318 #line 309 "parse-gram.y"
1319 { yyval
.string
= yyvsp
[0].string
; }
1322 #line 315 "parse-gram.y"
1324 yyval
.symbol
= getsym (yyvsp
[0].string
);
1325 symbol_class_set (yyval
.symbol
, token_sym
);
1329 #line 324 "parse-gram.y"
1331 yyval
.string
= yyvsp
[0].string
+ 1;
1332 yyval
.string
[strlen (yyval
.string
) - 1] = '\0';
1336 #line 332 "parse-gram.y"
1338 yyval
.string
= xstrdup ("");
1342 #line 336 "parse-gram.y"
1344 yyval
.string
= yyvsp
[0].string
;
1349 #line 705 "/usr/share/bison/bison.simple"
1361 short *yyssp1
= yyss
- 1;
1362 YYFPRINTF (stderr
, "state stack now");
1363 while (yyssp1
!= yyssp
)
1364 YYFPRINTF (stderr
, " %d", *++yyssp1
);
1365 YYFPRINTF (stderr
, "\n");
1374 /* Now `shift' the result of the reduction. Determine what state
1375 that goes to, based on the state we popped back to and the rule
1376 number reduced by. */
1380 yystate
= yypgoto
[yyn
- YYNTBASE
] + *yyssp
;
1381 if (yystate
>= 0 && yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
1382 yystate
= yytable
[yystate
];
1384 yystate
= yydefgoto
[yyn
- YYNTBASE
];
1389 /*------------------------------------.
1390 | yyerrlab -- here on detecting error |
1391 `------------------------------------*/
1393 /* If not already recovering from an error, report this error. */
1398 #ifdef YYERROR_VERBOSE
1399 yyn
= yypact
[yystate
];
1401 if (yyn
> YYFLAG
&& yyn
< YYLAST
)
1403 YYSIZE_T yysize
= 0;
1408 /* Start YYX at -YYN if negative to avoid negative indexes in
1410 for (yyx
= yyn
< 0 ? -yyn
: 0;
1411 yyx
< (int) (sizeof (yytname
) / sizeof (char *)); yyx
++)
1412 if (yycheck
[yyx
+ yyn
] == yyx
)
1413 yysize
+= yystrlen (yytname
[yyx
]) + 15, yycount
++;
1414 yysize
+= yystrlen ("parse error, unexpected ") + 1;
1415 yysize
+= yystrlen (yytname
[YYTRANSLATE (yychar
)]);
1416 yymsg
= (char *) YYSTACK_ALLOC (yysize
);
1419 char *yyp
= yystpcpy (yymsg
, "parse error, unexpected ");
1420 yyp
= yystpcpy (yyp
, yytname
[YYTRANSLATE (yychar
)]);
1425 for (yyx
= yyn
< 0 ? -yyn
: 0;
1426 yyx
< (int) (sizeof (yytname
) / sizeof (char *));
1428 if (yycheck
[yyx
+ yyn
] == yyx
)
1430 const char *yyq
= ! yycount
? ", expecting " : " or ";
1431 yyp
= yystpcpy (yyp
, yyq
);
1432 yyp
= yystpcpy (yyp
, yytname
[yyx
]);
1437 YYSTACK_FREE (yymsg
);
1440 yyerror ("parse error; also virtual memory exhausted");
1443 #endif /* defined (YYERROR_VERBOSE) */
1444 yyerror ("parse error");
1449 /*--------------------------------------------------.
1450 | yyerrlab1 -- error raised explicitly by an action |
1451 `--------------------------------------------------*/
1453 if (yyerrstatus
== 3)
1455 /* If just tried and failed to reuse lookahead token after an
1456 error, discard it. */
1458 /* return failure if at end of input */
1459 if (yychar
== YYEOF
)
1461 YYDPRINTF ((stderr
, "Discarding token %d (%s).\n",
1462 yychar
, yytname
[yychar1
]));
1466 /* Else will try to reuse lookahead token after shifting the error
1469 yyerrstatus
= 3; /* Each real token shifted decrements this */
1474 /*-------------------------------------------------------------------.
1475 | yyerrdefault -- current state does not do anything special for the |
1477 `-------------------------------------------------------------------*/
1480 /* This is wrong; only states that explicitly want error tokens
1481 should shift them. */
1483 /* If its default is to accept any token, ok. Otherwise pop it. */
1484 yyn
= yydefact
[yystate
];
1490 /*---------------------------------------------------------------.
1491 | yyerrpop -- pop the current state because it cannot handle the |
1493 `---------------------------------------------------------------*/
1506 short *yyssp1
= yyss
- 1;
1507 YYFPRINTF (stderr
, "Error: state stack now");
1508 while (yyssp1
!= yyssp
)
1509 YYFPRINTF (stderr
, " %d", *++yyssp1
);
1510 YYFPRINTF (stderr
, "\n");
1518 yyn
= yypact
[yystate
];
1523 if (yyn
< 0 || yyn
> YYLAST
|| yycheck
[yyn
] != YYTERROR
)
1540 YYDPRINTF ((stderr
, "Shifting error token, "));
1551 /*-------------------------------------.
1552 | yyacceptlab -- YYACCEPT comes here. |
1553 `-------------------------------------*/
1558 /*-----------------------------------.
1559 | yyabortlab -- YYABORT comes here. |
1560 `-----------------------------------*/
1565 /*---------------------------------------------.
1566 | yyoverflowab -- parser overflow comes here. |
1567 `---------------------------------------------*/
1569 yyerror ("parser stack overflow");
1576 YYSTACK_FREE (yyss
);
1580 #line 345 "parse-gram.y"
1582 /*------------------------------------------------------------------.
1583 | When debugging the parser, display tokens' locations and values. |
1584 `------------------------------------------------------------------*/
1587 yyprint (FILE *file
,
1588 const location_t
*loc
, int type
, const yystype
*value
)
1591 LOCATION_PRINT (file
, *loc
);
1596 fprintf (file
, " = '%s'", value
->string
);
1600 fprintf (file
, " = %s", value
->symbol
->tag
);
1604 fprintf (file
, " = %d", value
->integer
);
1608 fprintf (file
, " = \"%s\"", value
->string
);
1612 fprintf (file
, " = <%s>", value
->string
);
1618 fprintf (file
, " = {{ %s }}", value
->string
);
1624 gram_error (gram_control_t
*control ATTRIBUTE_UNUSED
,
1625 location_t
*yylloc
, const char *msg
)
1627 LOCATION_PRINT (stderr
, *yylloc
);
1628 fprintf (stderr
, ": %s\n", msg
);