1 m4_divert(-1) -*- C
-*-
4 # Yacc compatible skeleton for Bison
5 # Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
22 # b4_lhs_value([TYPE])
23 # --------------------
24 # Expansion of $<TYPE>$.
25 m4_define([b4_lhs_value
],
26 [yyval
[]m4_ifval([$
1], [.$
1])])
29 # b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
30 # --------------------------------------
31 # Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
33 m4_define([b4_rhs_value
],
34 [yyvsp@
<:@
m4_eval([$
2 - $
1])@
:>@
m4_ifval([$
3], [.$
3])])
42 # b4_location_if(IF-TRUE, IF-FALSE)
43 # ---------------------------------
44 # Expand IF-TRUE, if locations are used, IF-FALSE otherwise.
45 m4_define([b4_location_if
],
46 [m4_if(b4_locations_flag
, [1],
54 m4_define([b4_lhs_location
],
58 # b4_rhs_location(RULE-LENGTH, NUM)
59 # ---------------------------------
60 # Expansion of @NUM, where the current rule has RULE-LENGTH symbols
62 m4_define([b4_rhs_location
],
63 [yylsp@
<:@
m4_eval([$
2 - $
1])@
:>@
])
71 # b4_pure_if(IF-TRUE, IF-FALSE)
72 # -----------------------------
73 # Expand IF-TRUE, if %pure-parser, IF-FALSE otherwise.
74 m4_define([b4_pure_if
],
80 ## ------------------- ##
81 ## Output file names. ##
82 ## ------------------- ##
84 m4_define_default([b4_input_suffix
], [.y
])
86 m4_define_default([b4_output_parser_suffix
],
87 [m4_translit(b4_input_suffix
, [yY
], [cC
])])
89 m4_define_default([b4_output_parser_name
],
90 [b4_output_prefix
[]b4_output_infix
[]b4_output_parser_suffix
[]])
93 m4_define_default([b4_output_header_suffix
],
94 [m4_translit(b4_input_suffix
, [yY
], [hH
])])
96 m4_define_default([b4_output_header_name
],
97 [b4_output_prefix
[]b4_output_infix
[]b4_output_header_suffix
[]])
99 m4_define_default([b4_header_guard
],
100 [m4_bpatsubst(m4_toupper([BISON_
]b4_output_header_name
),
101 [[^ABCDEFGHIJKLMNOPQRSTUVWXYZ
]], [_
])])
105 ## --------------------------------------------------------- ##
106 ## Defining symbol actions, e.g., printers and destructors. ##
107 ## --------------------------------------------------------- ##
109 # b4_symbol_actions(FILENAME, LINENO,
110 # SYMBOL-TAG, SYMBOL-NUM,
111 # SYMBOL-ACTION, SYMBOL-TYPENAME)
112 # -------------------------------------------------
113 m4_define([b4_symbol_actions
],
114 [m4_pushdef([b4_dollar_dollar
], [yyvalue
.$
6])dnl
115 m4_pushdef([b4_at_dollar
], [yylocation
])dnl
119 #line __oline__ "__ofile__"
121 m4_popdef([b4_at_dollar
])dnl
122 m4_popdef([b4_dollar_dollar
])dnl
128 #output "b4_output_parser_name"
129 b4_copyright([Skeleton parser
for Yacc
-like parsing with Bison
],
130 [1984, 1989, 1990, 2000, 2001, 2002])
132 /* Written by Richard Stallman by simplifying the original so called
133 ``semantic'' parser. */
135 /* All symbols defined below should begin with yy or YY, to avoid
136 infringing on user name space. This should be done even for local
137 variables, as they might otherwise be expanded by user macros.
138 There are some unavoidable exceptions within include files to
139 define necessary library symbols; they are noted "INFRINGES ON
140 USER NAME SPACE" below. */
142 /* Identify Bison output. */
146 #define YYPURE b4_pure
148 /* Using locations. */
149 #define YYLSP_NEEDED b4_locations_flag
151 m4_if(b4_prefix
[], [yy
], [],
152 [/* If NAME_PREFIX is specified substitute the variables and functions
154 #define yyparse b4_prefix[]parse
155 #define yylex b4_prefix[]lex
156 #define yyerror b4_prefix[]error
157 #define yylval b4_prefix[]lval
158 #define yychar b4_prefix[]char
159 #define yydebug b4_prefix[]debug
160 #define yynerrs b4_prefix[]nerrs
161 b4_location_if([#define yylloc b4_prefix[]lloc])])
163 /* Copy the first part of user declarations. */
166 b4_token_defines(b4_tokens
)
168 /* Enabling traces. */
170 # define YYDEBUG b4_debug
173 /* Enabling verbose error messages. */
174 #ifdef YYERROR_VERBOSE
175 # undef YYERROR_VERBOSE
176 # define YYERROR_VERBOSE 1
178 # define YYERROR_VERBOSE b4_error_verbose
183 [#line b4_stype_line "b4_filename"
184 typedef union b4_stype yystype
;
185 /* Line __line__ of __file__. */
186 #line __oline__ "__ofile__"],
187 [typedef int yystype
;])
188 # define YYSTYPE yystype
189 # define YYSTYPE_IS_TRIVIAL 1
193 typedef struct yyltype
200 # define YYLTYPE b4_ltype
201 # define YYLTYPE_IS_TRIVIAL 1
204 /* Copy the second part of user declarations. */
207 /* Line __line__ of __file__. */
208 #line __oline__ "__ofile__"
210 #if ! defined (yyoverflow) || YYERROR_VERBOSE
212 /* The parser invokes alloca or malloc; define the necessary symbols. */
214 # if YYSTACK_USE_ALLOCA
215 # define YYSTACK_ALLOC alloca
217 # ifndef YYSTACK_USE_ALLOCA
218 # if defined (alloca) || defined (_ALLOCA_H)
219 # define YYSTACK_ALLOC alloca
222 # define YYSTACK_ALLOC __builtin_alloca
228 # ifdef YYSTACK_ALLOC
229 /* Pacify GCC's `empty if-body' warning. */
230 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
232 # if defined (__STDC__) || defined (__cplusplus)
233 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
234 # define YYSIZE_T size_t
236 # define YYSTACK_ALLOC malloc
237 # define YYSTACK_FREE free
239 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
242 #if (! defined (yyoverflow) \
243 && (! defined (__cplusplus) \
244 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
246 /* A type that is properly aligned for any stack member. */
251 b4_location_if([ YYLTYPE yyls
;
255 /* The size of the maximum gap between one aligned stack and the next. */
256 # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
258 /* The size of an array large to enough to hold all stacks, each with
261 [# define YYSTACK_BYTES(N) \
262 ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
263 + 2 * YYSTACK_GAP_MAX)],
264 [# define YYSTACK_BYTES(N) \
265 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
268 /* Copy COUNT objects from FROM to TO. The source and destination do
272 # define YYCOPY(To, From, Count) \
273 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
275 # define YYCOPY(To, From, Count) \
278 register YYSIZE_T yyi; \
279 for (yyi = 0; yyi < (Count); yyi++) \
280 (To)[[yyi]] = (From)[[yyi]]; \
286 /* Relocate STACK from its old location to the new one. The
287 local variables YYSIZE and YYSTACKSIZE give the old and new number of
288 elements in the stack, and YYPTR gives the new location of the
289 stack. Advance YYPTR to a properly aligned location for the next
291 # define YYSTACK_RELOCATE(Stack) \
294 YYSIZE_T yynewbytes; \
295 YYCOPY (&yyptr->Stack, Stack, yysize); \
296 Stack = &yyptr->Stack; \
297 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
298 yyptr += yynewbytes / sizeof (*yyptr); \
304 /* YYFINAL -- State number of the termination state. */
305 #define YYFINAL b4_final
306 #define YYFLAG b4_flag
307 #define YYLAST b4_last
309 /* YYNTOKENS -- Number of terminals. */
310 #define YYNTOKENS b4_ntokens
311 /* YYNNTS -- Number of nonterminals. */
312 #define YYNNTS b4_nnts
313 /* YYNRULES -- Number of rules. */
314 #define YYNRULES b4_nrules
315 /* YYNRULES -- Number of states. */
316 #define YYNSTATES b4_nstates
318 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
319 #define YYUNDEFTOK b4_undef_token_number
320 #define YYMAXUTOK b4_user_token_number_max
322 #define YYTRANSLATE(X) \
323 ((unsigned)(X) <= YYMAXUTOK ? yytranslate[[X]] : YYUNDEFTOK)
325 /* YYTRANSLATE[[YYLEX]] -- Bison symbol number corresponding to YYLEX. */
326 static const b4_uint_type(b4_translate_max
) yytranslate
[[]] =
332 /* YYPRHS[[YYN]] -- Index of the first RHS symbol of rule number YYN in
334 static const b4_uint_type(b4_prhs_max
) yyprhs
[[]] =
339 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
340 static const b4_sint_type(b4_rhs_max
) yyrhs
[[]] =
345 /* YYRLINE[[YYN]] -- source line where rule number YYN was defined. */
346 static const b4_uint_type(b4_rline_max
) yyrline
[[]] =
352 #if YYDEBUG || YYERROR_VERBOSE
353 /* YYTNME[[SYMBOL-NUM]] -- String name of the symbol SYMBOL-NUM.
354 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
355 static const char *const yytname
[[]] =
361 /* YYTOKNUM[[YYLEX-NUM]] -- Internal token number corresponding to
363 static const short yytoknum
[[]] =
368 /* YYR1[[YYN]] -- Symbol number of symbol that rule YYN derives. */
369 static const b4_uint_type(b4_r1_max
) yyr1
[[]] =
374 /* YYR2[[YYN]] -- Number of symbols composing right hand side of rule YYN. */
375 static const b4_uint_type(b4_r2_max
) yyr2
[[]] =
380 /* YYDEFACT[[STATE-NAME]] -- Default rule to reduce with in state
381 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
382 means the default is an error. */
383 static const short yydefact
[[]] =
388 /* YYPGOTO[[NTERM-NUM]]. */
389 static const short yydefgoto
[[]] =
394 /* YYPACT[[STATE-NUM]] -- Index in YYTABLE of the portion describing
396 static const short yypact
[[]] =
401 /* YYPGOTO[[NTERM-NUM]]. */
402 static const short yypgoto
[[]] =
407 /* YYTABLE[[YYPACT[STATE-NUM]]]. What to do in state STATE-NUM. If
408 positive, shift that token. If negative, reduce the rule which
409 number is the opposite. If zero, do what YYDEFACT says. */
410 static const short yytable
[[]] =
415 static const short yycheck
[[]] =
420 /* YYSTOS[[STATE-NUM]] -- The (internal number of the) accessing
421 symbol of state STATE-NUM. */
422 static const b4_uint_type(b4_stos_max
) yystos
[[]] =
427 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
428 # define YYSIZE_T __SIZE_TYPE__
430 #if ! defined (YYSIZE_T) && defined (size_t)
431 # define YYSIZE_T size_t
433 #if ! defined (YYSIZE_T)
434 # if defined (__STDC__) || defined (__cplusplus)
435 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
436 # define YYSIZE_T size_t
439 #if ! defined (YYSIZE_T)
440 # define YYSIZE_T unsigned int
443 #define yyerrok (yyerrstatus = 0)
444 #define yyclearin (yychar = YYEMPTY)
448 #define YYACCEPT goto yyacceptlab
449 #define YYABORT goto yyabortlab
450 #define YYERROR goto yyerrlab1
452 /* Like YYERROR except do call yyerror. This remains here temporarily
453 to ease the transition to the new meaning of YYERROR, for GCC.
454 Once GCC version 2 has supplanted version 1, this can go. */
456 #define YYFAIL goto yyerrlab
458 #define YYRECOVERING() (!!yyerrstatus)
460 #define YYBACKUP(Token, Value) \
462 if (yychar == YYEMPTY && yylen == 1) \
466 yychar1 = YYTRANSLATE (yychar); \
472 yyerror ("syntax error: cannot back up"); \
478 #define YYERRCODE 256
480 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
483 #ifndef YYLLOC_DEFAULT
484 # define YYLLOC_DEFAULT(Current, Rhs, N) \
485 Current.first_line = Rhs[[1]].first_line; \
486 Current.first_column = Rhs[[1]].first_column; \
487 Current.last_line = Rhs[[N]].last_line; \
488 Current.last_column = Rhs[[N]].last_column;
491 /* YYLEX -- calling `yylex' with the right arguments. */
495 # define YYLEX yylex (&yylval[]b4_location_if([, &yylloc]), YYLEX_PARAM)
497 # define YYLEX yylex (&yylval[]b4_location_if([, &yylloc]))
499 [#define YYLEX yylex ()])
501 /* Enable debugging if requested. */
505 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
506 # define YYFPRINTF fprintf
509 # define YYDPRINTF(Args) \
514 # define YYDSYMPRINT(Args) \
519 /* Nonzero means print parse trace. It is left uninitialized so that
520 multiple parsers can coexist. */
523 # define YYDPRINTF(Args)
524 # define YYDSYMPRINT(Args)
525 #endif /* !YYDEBUG */
527 /* YYINITDEPTH -- initial size of the parser's stacks. */
529 # define YYINITDEPTH b4_initdepth
532 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
533 if the built-in stack extension method is used).
535 Do not make this value too large; the results are undefined if
536 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
537 evaluated with infinite-precision integer arithmetic. */
544 # define YYMAXDEPTH b4_maxdepth
552 # if defined (__GLIBC__) && defined (_STRING_H)
553 # define yystrlen strlen
555 /* Return the length of YYSTR. */
557 # if defined (__STDC__) || defined (__cplusplus)
558 yystrlen (const char *yystr
)
564 register const char *yys
= yystr
;
566 while (*yys
++ != '\0')
569 return yys
- yystr
- 1;
575 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
576 # define yystpcpy stpcpy
578 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
581 # if defined (__STDC__) || defined (__cplusplus)
582 yystpcpy (char *yydest
, const char *yysrc
)
584 yystpcpy (yydest
, yysrc
)
589 register char *yyd
= yydest
;
590 register const char *yys
= yysrc
;
592 while ((*yyd
++ = *yys
++) != '\0')
600 #endif /* !YYERROR_VERBOSE */
604 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
605 into yyparse. The argument should have type void *.
606 It should actually point to an object.
607 Grammar actions can access the variable by casting it
608 to the proper pointer type. */
611 # if defined (__STDC__) || defined (__cplusplus)
612 # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
613 # define YYPARSE_PARAM_DECL
615 # define YYPARSE_PARAM_ARG YYPARSE_PARAM
616 # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
618 #else /* !YYPARSE_PARAM */
619 # define YYPARSE_PARAM_ARG
620 # define YYPARSE_PARAM_DECL
621 #endif /* !YYPARSE_PARAM */
623 /* Prevent warning if -Wstrict-prototypes. */
625 # ifdef YYPARSE_PARAM
626 int yyparse (void *);
632 #if defined (__STDC__) || defined (__cplusplus)
633 static void yydestruct (int yytype
,
634 YYSTYPE yyvalue
[]b4_location_if([, YYLTYPE yylocation
]));
636 static void yysymprint (FILE* out
, int yytype
,
637 YYSTYPE yyvalue
[]b4_location_if([, YYLTYPE yylocation
]));
641 m4_divert_push([KILL
])# ======================== M4 code.
642 # b4_declare_parser_variables
643 # ---------------------------
644 # Declare the variables that are global, or local to YYPARSE if
646 m4_define([b4_declare_parser_variables
],
647 [/* The lookahead symbol. */
650 /* The semantic value of the lookahead symbol. */
653 /* Number of parse errors so far. */
654 int yynerrs
;b4_location_if([
655 /* Location data for the lookahead symbol. */
658 m4_divert_pop([KILL
])dnl
# ====================== End of M4 code.
661 [b4_declare_parser_variables
])
664 yyparse (YYPARSE_PARAM_ARG
)
667 ]b4_pure_if([b4_declare_parser_variables
])[
668 register int yystate
;
671 /* Number of tokens to shift before error messages enabled. */
673 /* Lookahead token as an internal (translated) token number. */
676 /* Three stacks and their tools:
677 `yyss': related to states,
678 `yyvs': related to semantic values,
679 `yyls': related to locations.
681 Refer to the stacks thru separate pointers, to allow yyoverflow
682 to reallocate them elsewhere. */
684 /* The state stack. */
685 short yyssa
[YYINITDEPTH
];
687 register short *yyssp
;
689 /* The semantic value stack. */
690 YYSTYPE yyvsa
[YYINITDEPTH
];
691 YYSTYPE
*yyvs
= yyvsa
;
692 register YYSTYPE
*yyvsp
;
695 [[ /* The location stack. */
696 YYLTYPE yylsa
[YYINITDEPTH
];
697 YYLTYPE
*yyls
= yylsa
;
700 #define YYPOPSTACK (yyvsp--, yyssp--]b4_location_if([, yylsp--])[)
702 YYSIZE_T yystacksize
= YYINITDEPTH
;
704 /* The variables used to return semantic value and location from the
707 ]b4_location_if([ YYLTYPE yyloc
;])[
709 /* When reducing, the number of symbols on the RHS of the reduced
713 YYDPRINTF ((stderr
, "Starting parse\n"));
718 yychar
= YYEMPTY
; /* Cause a token to be read. */
720 /* Initialize stack pointers.
721 Waste one element of value and location stack
722 so that they stay on the same level as the state stack.
723 The wasted elements are never initialized. */
727 ]b4_location_if([ yylsp
= yyls
;])[
730 /*------------------------------------------------------------.
731 | yynewstate -- Push a new state, which is found in yystate. |
732 `------------------------------------------------------------*/
734 /* In all cases, when you get here, the value and location stacks
735 have just been pushed. so pushing a state here evens the stacks.
742 if (yyssp
>= yyss
+ yystacksize
- 1)
744 /* Get the current used size of the three stacks, in elements. */
745 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
749 /* Give user a chance to reallocate the stack. Use copies of
750 these so that the &'s don't force the real ones into
752 YYSTYPE
*yyvs1
= yyvs
;
754 ]b4_location_if([ YYLTYPE
*yyls1
= yyls
;])[
756 /* Each stack pointer address is followed by the size of the
757 data in use in that stack, in bytes. This used to be a
758 conditional around just the two extra args, but that might
759 be undefined if yyoverflow is a macro. */
760 yyoverflow ("parser stack overflow",
761 &yyss1
, yysize
* sizeof (*yyssp
),
762 &yyvs1
, yysize
* sizeof (*yyvsp
),
763 ]b4_location_if([ &yyls1
, yysize
* sizeof (*yylsp
),])[
765 ]b4_location_if([ yyls
= yyls1
;])[
769 #else /* no yyoverflow */
770 # ifndef YYSTACK_RELOCATE
773 /* Extend the stack our own way. */
774 if (yystacksize
>= YYMAXDEPTH
)
777 if (yystacksize
> YYMAXDEPTH
)
778 yystacksize
= YYMAXDEPTH
;
782 union yyalloc
*yyptr
=
783 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
786 YYSTACK_RELOCATE (yyss
);
787 YYSTACK_RELOCATE (yyvs
);
788 ]b4_location_if([ YYSTACK_RELOCATE (yyls
);])[
789 # undef YYSTACK_RELOCATE
791 YYSTACK_FREE (yyss1
);
794 #endif /* no yyoverflow */
796 yyssp
= yyss
+ yysize
- 1;
797 yyvsp
= yyvs
+ yysize
- 1;
798 ]b4_location_if([ yylsp
= yyls
+ yysize
- 1;])[
800 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
801 (unsigned long int) yystacksize
));
803 if (yyssp
>= yyss
+ yystacksize
- 1)
807 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
816 /* Do appropriate processing given the current state. */
817 /* Read a lookahead token if we need one and don't already have one. */
820 /* First try to decide what to do without reference to lookahead token. */
822 yyn
= yypact
[yystate
];
826 /* Not known => get a lookahead token if don't already have one. */
828 /* yychar is either YYEMPTY or YYEOF
829 or a valid token in external form. */
831 if (yychar
== YYEMPTY
)
833 YYDPRINTF ((stderr
, "Reading a token: "));
837 /* Convert token to internal form (in yychar1) for indexing tables with. */
839 if (yychar
<= 0) /* This means end of input. */
842 yychar
= YYEOF
; /* Don't call YYLEX any more. */
844 YYDPRINTF ((stderr
, "Now at end of input.\n"));
848 yychar1
= YYTRANSLATE (yychar
);
850 /* We have to keep this `#if YYDEBUG', since we use variables
851 which are defined only if `YYDEBUG' is set. */
852 YYDPRINTF ((stderr
, "Next token is "));
853 YYDSYMPRINT ((stderr
, yychar1
, yylval
]b4_location_if([, yyloc
])[));
854 YYDPRINTF ((stderr
, "\n"));
858 if (yyn
< 0 || yyn
> YYLAST
|| yycheck
[yyn
] != yychar1
)
863 /* yyn is what to do for this token type in this state.
864 Negative => reduce, -yyn is rule number.
865 Positive => shift, yyn is new state.
866 New state is final state => don't bother to shift,
868 0, or most negative number => error. */
883 /* Shift the lookahead token. */
884 YYDPRINTF ((stderr
, "Shifting token %d (%s), ",
885 yychar
, yytname
[yychar1
]));
887 /* Discard the token being shifted unless it is eof. */
892 ]b4_location_if([ *++yylsp
= yylloc
;])[
894 /* Count tokens shifted since error; after three, turn off error
903 /*-----------------------------------------------------------.
904 | yydefault -- do the default action for the current state. |
905 `-----------------------------------------------------------*/
907 yyn
= yydefact
[yystate
];
913 /*-----------------------------.
914 | yyreduce -- Do a reduction. |
915 `-----------------------------*/
917 /* yyn is the number of a rule to reduce with. */
920 /* If YYLEN is nonzero, implement the default value of the action:
923 Otherwise, the following line sets YYVAL to the semantic value of
924 the lookahead token. This behavior is undocumented and Bison
925 users should not rely upon it. Assigning to YYVAL
926 unconditionally makes the parser a bit smaller, and it avoids a
927 GCC warning that YYVAL may be used uninitialized. */
928 yyval
= yyvsp
[1-yylen
];
931 [ /* Default location. */
932 YYLLOC_DEFAULT (yyloc
, (yylsp
- yylen
), yylen
);])[
935 /* We have to keep this `#if YYDEBUG', since we use variables which
936 are defined only if `YYDEBUG' is set. */
941 YYFPRINTF (stderr
, "Reducing via rule %d (line %d), ",
942 yyn
- 1, yyrline
[yyn
]);
944 /* Print the symbols being reduced, and their result. */
945 for (yyi
= yyprhs
[yyn
]; yyrhs
[yyi
] >= 0; yyi
++)
946 YYFPRINTF (stderr
, "%s ", yytname
[yyrhs
[yyi
]]);
947 YYFPRINTF (stderr
, " -> %s\n", yytname
[yyr1
[yyn
]]);
955 /* Line __line__ of __file__. */
956 #line __oline__ "__ofile__"
960 ]b4_location_if([ yylsp
-= yylen
;])[
965 short *yyssp1
= yyss
- 1;
966 YYFPRINTF (stderr
, "state stack now");
967 while (yyssp1
!= yyssp
)
968 YYFPRINTF (stderr
, " %d", *++yyssp1
);
969 YYFPRINTF (stderr
, "\n");
974 ]b4_location_if([ *++yylsp
= yyloc
;])[
976 /* Now `shift' the result of the reduction. Determine what state
977 that goes to, based on the state we popped back to and the rule
978 number reduced by. */
982 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
983 if (yystate
>= 0 && yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
984 yystate
= yytable
[yystate
];
986 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
991 /*------------------------------------.
992 | yyerrlab -- here on detecting error |
993 `------------------------------------*/
995 /* If not already recovering from an error, report this error. */
1001 yyn
= yypact
[yystate
];
1003 if (yyn
> YYFLAG
&& yyn
< YYLAST
)
1005 YYSIZE_T yysize
= 0;
1010 /* Start YYX at -YYN if negative to avoid negative indexes in
1012 for (yyx
= yyn
< 0 ? -yyn
: 0;
1013 yyx
< (int) (sizeof (yytname
) / sizeof (char *)); yyx
++)
1014 if (yycheck
[yyx
+ yyn
] == yyx
)
1015 yysize
+= yystrlen (yytname
[yyx
]) + 15, yycount
++;
1016 yysize
+= yystrlen ("parse error, unexpected ") + 1;
1017 yysize
+= yystrlen (yytname
[YYTRANSLATE (yychar
)]);
1018 yymsg
= (char *) YYSTACK_ALLOC (yysize
);
1021 char *yyp
= yystpcpy (yymsg
, "parse error, unexpected ");
1022 yyp
= yystpcpy (yyp
, yytname
[YYTRANSLATE (yychar
)]);
1027 for (yyx
= yyn
< 0 ? -yyn
: 0;
1028 yyx
< (int) (sizeof (yytname
) / sizeof (char *));
1030 if (yycheck
[yyx
+ yyn
] == yyx
)
1032 const char *yyq
= ! yycount
? ", expecting " : " or ";
1033 yyp
= yystpcpy (yyp
, yyq
);
1034 yyp
= yystpcpy (yyp
, yytname
[yyx
]);
1039 YYSTACK_FREE (yymsg
);
1042 yyerror ("parse error; also virtual memory exhausted");
1045 #endif /* YYERROR_VERBOSE */
1046 yyerror ("parse error");
1051 /*----------------------------------------------------.
1052 | yyerrlab1 -- error raised explicitly by an action. |
1053 `----------------------------------------------------*/
1055 if (yyerrstatus
== 3)
1057 /* If just tried and failed to reuse lookahead token after an
1058 error, discard it. */
1060 /* Return failure if at end of input. */
1061 if (yychar
== YYEOF
)
1063 /* Pop the error token. */
1065 /* Pop the rest of the stack. */
1066 while (yyssp
> yyss
)
1068 YYDPRINTF ((stderr
, "Error: popping "));
1069 YYDSYMPRINT ((stderr
,
1071 *yyvsp
]b4_location_if([, *yylsp
])[));
1072 YYDPRINTF ((stderr
, "\n"));
1073 yydestruct (yystos
[*yyssp
], *yyvsp
]b4_location_if([, *yylsp
])[);
1079 YYDPRINTF ((stderr
, "Discarding token %d (%s).\n",
1080 yychar
, yytname
[yychar1
]));
1081 yydestruct (yychar1
, yylval
]b4_location_if([, yylloc
])[);
1085 /* Else will try to reuse lookahead token after shifting the error
1088 yyerrstatus
= 3; /* Each real token shifted decrements this. */
1092 yyn
= yypact
[yystate
];
1096 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
1104 /* Pop the current state because it cannot handle the error token. */
1108 YYDPRINTF ((stderr
, "Error: popping "));
1109 YYDSYMPRINT ((stderr
,
1110 yystos
[*yyssp
], *yyvsp
]b4_location_if([, *yylsp
])[));
1111 YYDPRINTF ((stderr
, "\n"));
1113 yydestruct (yystos
[yystate
], *yyvsp
]b4_location_if([, *yylsp
])[);
1116 ]b4_location_if([ yylsp
--;])[
1121 short *yyssp1
= yyss
- 1;
1122 YYFPRINTF (stderr
, "Error: state stack now");
1123 while (yyssp1
!= yyssp
)
1124 YYFPRINTF (stderr
, " %d", *++yyssp1
);
1125 YYFPRINTF (stderr
, "\n");
1133 YYDPRINTF ((stderr
, "Shifting error token, "));
1136 ]b4_location_if([ *++yylsp
= yylloc
;])[
1142 /*-------------------------------------.
1143 | yyacceptlab -- YYACCEPT comes here. |
1144 `-------------------------------------*/
1149 /*-----------------------------------.
1150 | yyabortlab -- YYABORT comes here. |
1151 `-----------------------------------*/
1157 /*----------------------------------------------.
1158 | yyoverflowlab -- parser overflow comes here. |
1159 `----------------------------------------------*/
1161 yyerror ("parser stack overflow");
1169 YYSTACK_FREE (yyss
);
1175 /*-----------------------------------------------.
1176 | Release the memory associated to this symbol. |
1177 `-----------------------------------------------*/
1180 yydestruct (int yytype
,
1181 YYSTYPE yyvalue
[]b4_location_if([, YYLTYPE yylocation
]))
1183 /* Pacify ``unused variable'' warnings. */
1185 b4_location_if([ (void) yylocation
;
1190 m4_map([b4_symbol_actions
], m4_defn([b4_symbol_destructors
]))dnl
1198 /*-----------------------------.
1199 | Print this symbol on YYOUT. |
1200 `-----------------------------*/
1203 yysymprint (FILE* yyout
, int yytype
,
1204 YYSTYPE yyvalue
[]b4_location_if([, YYLTYPE yylocation
]))
1206 /* Pacify ``unused variable'' warnings. */
1208 b4_location_if([ (void) yylocation
;
1211 if (yytype
< YYNTOKENS
)
1213 YYFPRINTF (yyout
, "token %s (", yytname
[[yytype]]);
1215 YYPRINT (yyout
, yytoknum
[[yytype]], yyvalue
);
1219 YYFPRINTF (yyout
, "nterm %s (", yytname
[[yytype]]);
1223 m4_map([b4_symbol_actions
], m4_defn([b4_symbol_printers
]))dnl
1227 YYFPRINTF (yyout
, ")");
1229 #endif /* YYDEBUG. */
1232 m4_if(b4_defines_flag
, 0, [],
1233 [b4_copyright([Skeleton parser
for Yacc
-like parsing with Bison
],
1234 [1984, 1989, 1990, 2000, 2001, 2002])
1235 #output "b4_output_header_name"
1236 #ifndef b4_header_guard
1237 # define b4_header_guard
1239 b4_token_defines(b4_tokens
)
1242 m4_ifdef([b4_stype
],
1243 [#line b4_stype_line "b4_filename"
1244 typedef union b4_stype yystype
;
1245 /* Line __line__ of __file__. */
1246 #line __oline__ "__ofile__"],
1247 [typedef int yystype
;])
1248 # define YYSTYPE yystype
1252 [extern YYSTYPE b4_prefix
[]lval
;])
1256 typedef struct yyltype
1263 # define YYLTYPE yyltype
1267 [extern YYLTYPE b4_prefix
[]lloc
;])
1269 #endif /* not b4_header_guard */