1 m4_divert(-1) -*- C
-*-
4 # Yacc compatible skeleton for Bison
5 # Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002
6 # Free Software Foundation, Inc.
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
23 # b4_lhs_value([TYPE])
24 # --------------------
25 # Expansion of $<TYPE>$.
26 m4_define([b4_lhs_value
],
27 [yyval
[]m4_ifval([$
1], [.$
1])])
30 # b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
31 # --------------------------------------
32 # Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
34 m4_define([b4_rhs_value
],
35 [yyvsp@
<:@
m4_eval([$
2 - $
1])@
:>@
m4_ifval([$
3], [.$
3])])
43 # b4_location_if(IF-TRUE, IF-FALSE)
44 # ---------------------------------
45 # Expand IF-TRUE, if locations are used, IF-FALSE otherwise.
46 m4_define([b4_location_if
],
47 [m4_if(b4_locations_flag
, [1],
55 m4_define([b4_lhs_location
],
59 # b4_rhs_location(RULE-LENGTH, NUM)
60 # ---------------------------------
61 # Expansion of @NUM, where the current rule has RULE-LENGTH symbols
63 m4_define([b4_rhs_location
],
64 [yylsp@
<:@
m4_eval([$
2 - $
1])@
:>@
])
72 # b4_pure_if(IF-TRUE, IF-FALSE)
73 # -----------------------------
74 # Expand IF-TRUE, if %pure-parser, IF-FALSE otherwise.
75 m4_define([b4_pure_if
],
81 ## ------------------- ##
82 ## Output file names. ##
83 ## ------------------- ##
85 m4_define_default([b4_input_suffix
], [.y
])
87 m4_define_default([b4_output_parser_suffix
],
88 [m4_translit(b4_input_suffix
, [yY
], [cC
])])
90 m4_define_default([b4_output_parser_name
],
91 [b4_output_prefix
[]b4_output_infix
[]b4_output_parser_suffix
[]])
94 m4_define_default([b4_output_header_suffix
],
95 [m4_translit(b4_input_suffix
, [yY
], [hH
])])
97 m4_define_default([b4_output_header_name
],
98 [b4_output_prefix
[]b4_output_infix
[]b4_output_header_suffix
[]])
100 m4_define_default([b4_header_guard
],
101 [m4_bpatsubst(m4_toupper([BISON_
]b4_output_header_name
),
102 [[^ABCDEFGHIJKLMNOPQRSTUVWXYZ
]], [_
])])
106 ## --------------------------------------------------------- ##
107 ## Defining symbol actions, e.g., printers and destructors. ##
108 ## --------------------------------------------------------- ##
110 # b4_symbol_actions(FILENAME, LINENO,
111 # SYMBOL-TAG, SYMBOL-NUM,
112 # SYMBOL-ACTION, SYMBOL-TYPENAME)
113 # -------------------------------------------------
114 m4_define([b4_symbol_actions
],
115 [m4_pushdef([b4_dollar_dollar
], [yyvalue
.$
6])dnl
116 m4_pushdef([b4_at_dollar
], [yylocation
])dnl
120 #line __oline__ "__ofile__"
122 m4_popdef([b4_at_dollar
])dnl
123 m4_popdef([b4_dollar_dollar
])dnl
129 #output "b4_output_parser_name"
130 b4_copyright([Skeleton parser
for Yacc
-like parsing with Bison
],
131 [1984, 1989, 1990, 2000, 2001, 2002])
133 /* Written by Richard Stallman by simplifying the original so called
134 ``semantic'' parser. */
136 /* All symbols defined below should begin with yy or YY, to avoid
137 infringing on user name space. This should be done even for local
138 variables, as they might otherwise be expanded by user macros.
139 There are some unavoidable exceptions within include files to
140 define necessary library symbols; they are noted "INFRINGES ON
141 USER NAME SPACE" below. */
143 /* Identify Bison output. */
147 #define YYPURE b4_pure
149 /* Using locations. */
150 #define YYLSP_NEEDED b4_locations_flag
152 m4_if(b4_prefix
[], [yy
], [],
153 [/* If NAME_PREFIX is specified substitute the variables and functions
155 #define yyparse b4_prefix[]parse
156 #define yylex b4_prefix[]lex
157 #define yyerror b4_prefix[]error
158 #define yylval b4_prefix[]lval
159 #define yychar b4_prefix[]char
160 #define yydebug b4_prefix[]debug
161 #define yynerrs b4_prefix[]nerrs
162 b4_location_if([#define yylloc b4_prefix[]lloc])])
164 /* Copy the first part of user declarations. */
167 b4_token_defines(b4_tokens
)
169 /* Enabling traces. */
171 # define YYDEBUG b4_debug
174 /* Enabling verbose error messages. */
175 #ifdef YYERROR_VERBOSE
176 # undef YYERROR_VERBOSE
177 # define YYERROR_VERBOSE 1
179 # define YYERROR_VERBOSE b4_error_verbose
184 [#line b4_stype_line "b4_filename"
185 typedef union b4_stype yystype
;
186 /* Line __line__ of __file__. */
187 #line __oline__ "__ofile__"],
188 [typedef int yystype
;])
189 # define YYSTYPE yystype
190 # define YYSTYPE_IS_TRIVIAL 1
194 typedef struct yyltype
201 # define YYLTYPE b4_ltype
202 # define YYLTYPE_IS_TRIVIAL 1
205 /* Copy the second part of user declarations. */
208 /* Line __line__ of __file__. */
209 #line __oline__ "__ofile__"
211 #if ! defined (yyoverflow) || YYERROR_VERBOSE
213 /* The parser invokes alloca or malloc; define the necessary symbols. */
215 # if YYSTACK_USE_ALLOCA
216 # define YYSTACK_ALLOC alloca
218 # ifndef YYSTACK_USE_ALLOCA
219 # if defined (alloca) || defined (_ALLOCA_H)
220 # define YYSTACK_ALLOC alloca
223 # define YYSTACK_ALLOC __builtin_alloca
229 # ifdef YYSTACK_ALLOC
230 /* Pacify GCC's `empty if-body' warning. */
231 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
233 # if defined (__STDC__) || defined (__cplusplus)
234 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
235 # define YYSIZE_T size_t
237 # define YYSTACK_ALLOC malloc
238 # define YYSTACK_FREE free
240 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
243 #if (! defined (yyoverflow) \
244 && (! defined (__cplusplus) \
245 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
247 /* A type that is properly aligned for any stack member. */
252 b4_location_if([ YYLTYPE yyls
;
256 /* The size of the maximum gap between one aligned stack and the next. */
257 # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
259 /* The size of an array large to enough to hold all stacks, each with
262 [# define YYSTACK_BYTES(N) \
263 ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
264 + 2 * YYSTACK_GAP_MAX)],
265 [# define YYSTACK_BYTES(N) \
266 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
269 /* Copy COUNT objects from FROM to TO. The source and destination do
273 # define YYCOPY(To, From, Count) \
274 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
276 # define YYCOPY(To, From, Count) \
279 register YYSIZE_T yyi; \
280 for (yyi = 0; yyi < (Count); yyi++) \
281 (To)[[yyi]] = (From)[[yyi]]; \
287 /* Relocate STACK from its old location to the new one. The
288 local variables YYSIZE and YYSTACKSIZE give the old and new number of
289 elements in the stack, and YYPTR gives the new location of the
290 stack. Advance YYPTR to a properly aligned location for the next
292 # define YYSTACK_RELOCATE(Stack) \
295 YYSIZE_T yynewbytes; \
296 YYCOPY (&yyptr->Stack, Stack, yysize); \
297 Stack = &yyptr->Stack; \
298 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
299 yyptr += yynewbytes / sizeof (*yyptr); \
305 /* YYFINAL -- State number of the termination state. */
306 #define YYFINAL b4_final_state_number
307 #define YYLAST b4_last
309 /* YYNTOKENS -- Number of terminals. */
310 #define YYNTOKENS b4_tokens_number
311 /* YYNNTS -- Number of nonterminals. */
312 #define YYNNTS b4_nterms_number
313 /* YYNRULES -- Number of rules. */
314 #define YYNRULES b4_rules_number
315 /* YYNRULES -- Number of states. */
316 #define YYNSTATES b4_states_number
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_int_type_for([b4_translate
]) yytranslate
[[]] =
332 /* YYPRHS[[YYN]] -- Index of the first RHS symbol of rule number YYN in
334 static const b4_int_type_for([b4_prhs
]) yyprhs
[[]] =
339 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
340 static const b4_int_type_for([b4_rhs
]) yyrhs
[[]] =
345 /* YYRLINE[[YYN]] -- source line where rule number YYN was defined. */
346 static const b4_int_type_for([b4_rline
]) 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 b4_int_type_for([b4_toknum
]) yytoknum
[[]] =
368 /* YYR1[[YYN]] -- Symbol number of symbol that rule YYN derives. */
369 static const b4_int_type_for([b4_r1
]) yyr1
[[]] =
374 /* YYR2[[YYN]] -- Number of symbols composing right hand side of rule YYN. */
375 static const b4_int_type_for([b4_r2
]) 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 b4_int_type_for([b4_defact
]) yydefact
[[]] =
388 /* YYDEFGOTO[[NTERM-NUM]]. */
389 static const b4_int_type_for([b4_defgoto
]) yydefgoto
[[]] =
394 /* YYPACT[[STATE-NUM]] -- Index in YYTABLE of the portion describing
396 #define YYPACT_NINF b4_pact_ninf
397 static const b4_int_type_for([b4_pact
]) yypact
[[]] =
402 /* YYPGOTO[[NTERM-NUM]]. */
403 static const b4_int_type_for([b4_pgoto
]) yypgoto
[[]] =
408 /* YYTABLE[[YYPACT[STATE-NUM]]]. What to do in state STATE-NUM. If
409 positive, shift that token. If negative, reduce the rule which
410 number is the opposite. If zero, do what YYDEFACT says. */
411 #define YYTABLE_NINF b4_table_ninf
412 static const b4_int_type_for([b4_table
]) yytable
[[]] =
417 static const b4_int_type_for([b4_check
]) yycheck
[[]] =
422 /* YYSTOS[[STATE-NUM]] -- The (internal number of the) accessing
423 symbol of state STATE-NUM. */
424 static const b4_int_type_for([b4_stos
]) yystos
[[]] =
429 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
430 # define YYSIZE_T __SIZE_TYPE__
432 #if ! defined (YYSIZE_T) && defined (size_t)
433 # define YYSIZE_T size_t
435 #if ! defined (YYSIZE_T)
436 # if defined (__STDC__) || defined (__cplusplus)
437 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
438 # define YYSIZE_T size_t
441 #if ! defined (YYSIZE_T)
442 # define YYSIZE_T unsigned int
445 #define yyerrok (yyerrstatus = 0)
446 #define yyclearin (yychar = YYEMPTY)
450 #define YYACCEPT goto yyacceptlab
451 #define YYABORT goto yyabortlab
452 #define YYERROR goto yyerrlab1
454 /* Like YYERROR except do call yyerror. This remains here temporarily
455 to ease the transition to the new meaning of YYERROR, for GCC.
456 Once GCC version 2 has supplanted version 1, this can go. */
458 #define YYFAIL goto yyerrlab
460 #define YYRECOVERING() (!!yyerrstatus)
462 #define YYBACKUP(Token, Value) \
464 if (yychar == YYEMPTY && yylen == 1) \
468 yychar1 = YYTRANSLATE (yychar); \
474 yyerror ("syntax error: cannot back up"); \
480 #define YYERRCODE 256
482 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
485 #ifndef YYLLOC_DEFAULT
486 # define YYLLOC_DEFAULT(Current, Rhs, N) \
487 Current.first_line = Rhs[[1]].first_line; \
488 Current.first_column = Rhs[[1]].first_column; \
489 Current.last_line = Rhs[[N]].last_line; \
490 Current.last_column = Rhs[[N]].last_column;
493 /* YYLEX -- calling `yylex' with the right arguments. */
497 # define YYLEX yylex (&yylval[]b4_location_if([, &yylloc]), YYLEX_PARAM)
499 # define YYLEX yylex (&yylval[]b4_location_if([, &yylloc]))
501 [#define YYLEX yylex ()])
503 /* Enable debugging if requested. */
507 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
508 # define YYFPRINTF fprintf
511 # define YYDPRINTF(Args) \
516 # define YYDSYMPRINT(Args) \
521 /* Nonzero means print parse trace. It is left uninitialized so that
522 multiple parsers can coexist. */
525 # define YYDPRINTF(Args)
526 # define YYDSYMPRINT(Args)
527 #endif /* !YYDEBUG */
529 /* YYINITDEPTH -- initial size of the parser's stacks. */
531 # define YYINITDEPTH b4_initdepth
534 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
535 if the built-in stack extension method is used).
537 Do not make this value too large; the results are undefined if
538 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
539 evaluated with infinite-precision integer arithmetic. */
546 # define YYMAXDEPTH b4_maxdepth
554 # if defined (__GLIBC__) && defined (_STRING_H)
555 # define yystrlen strlen
557 /* Return the length of YYSTR. */
559 # if defined (__STDC__) || defined (__cplusplus)
560 yystrlen (const char *yystr
)
566 register const char *yys
= yystr
;
568 while (*yys
++ != '\0')
571 return yys
- yystr
- 1;
577 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
578 # define yystpcpy stpcpy
580 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
583 # if defined (__STDC__) || defined (__cplusplus)
584 yystpcpy (char *yydest
, const char *yysrc
)
586 yystpcpy (yydest
, yysrc
)
591 register char *yyd
= yydest
;
592 register const char *yys
= yysrc
;
594 while ((*yyd
++ = *yys
++) != '\0')
602 #endif /* !YYERROR_VERBOSE */
606 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
607 into yyparse. The argument should have type void *.
608 It should actually point to an object.
609 Grammar actions can access the variable by casting it
610 to the proper pointer type. */
613 # if defined (__STDC__) || defined (__cplusplus)
614 # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
615 # define YYPARSE_PARAM_DECL
617 # define YYPARSE_PARAM_ARG YYPARSE_PARAM
618 # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
620 #else /* !YYPARSE_PARAM */
621 # define YYPARSE_PARAM_ARG
622 # define YYPARSE_PARAM_DECL
623 #endif /* !YYPARSE_PARAM */
625 /* Prevent warning if -Wstrict-prototypes. */
627 # ifdef YYPARSE_PARAM
628 int yyparse (void *);
636 /*-----------------------------.
637 | Print this symbol on YYOUT. |
638 `-----------------------------*/
641 #if defined (__STDC__) || defined (__cplusplus)
642 yysymprint (FILE* yyout
, int yytype
,
643 YYSTYPE yyvalue
[]b4_location_if([, YYLTYPE yylocation
]))
645 yysymprint (yyout
, yytype
,
646 yyvalue
[]b4_location_if([, yylocation
]))
650 b4_location_if([YYLTYPE yylocation
;])
653 /* Pacify ``unused variable'' warnings. */
655 b4_location_if([ (void) yylocation
;
658 if (yytype
< YYNTOKENS
)
660 YYFPRINTF (yyout
, "token %s (", yytname
[[yytype]]);
662 YYPRINT (yyout
, yytoknum
[[yytype]], yyvalue
);
666 YYFPRINTF (yyout
, "nterm %s (", yytname
[[yytype]]);
670 m4_map([b4_symbol_actions
], m4_defn([b4_symbol_printers
]))dnl
674 YYFPRINTF (yyout
, ")");
676 #endif /* YYDEBUG. */
679 /*----------------------------------------------------------.
680 | yyreport_parse_error -- report a parse error in YYSTATE. |
681 `----------------------------------------------------------*/
684 #if defined (__STDC__) || defined (__cplusplus)
685 yyreport_parse_error (int yystate
, int yychar
,
686 YYSTYPE yyvalue
[]b4_location_if([, YYLTYPE yylocation
]))
688 yyreport_parse_error (yystate
, yychar
,
689 yyvalue
[]b4_location_if([, yylocation
]))
693 b4_location_if([YYLTYPE yylocation
;])
697 int yyn
= yypact
[yystate
];
699 if (YYPACT_NINF
< yyn
&& yyn
< YYLAST
)
702 int yytype
= YYTRANSLATE (yychar
);
707 /* Start YYX at -YYN if negative to avoid negative indexes in
709 for (yyx
= yyn
< 0 ? -yyn
: 0;
710 yyx
< (int) (sizeof (yytname
) / sizeof (char *)); yyx
++)
711 if (yycheck
[yyx
+ yyn
] == yyx
)
712 yysize
+= yystrlen (yytname
[yyx
]) + 15, yycount
++;
713 yysize
+= yystrlen ("parse error, unexpected ") + 1;
714 yysize
+= yystrlen (yytname
[yytype
]);
715 yymsg
= (char *) YYSTACK_ALLOC (yysize
);
718 char *yyp
= yystpcpy (yymsg
, "parse error, unexpected ");
719 yyp
= yystpcpy (yyp
, yytname
[yytype
]);
724 for (yyx
= yyn
< 0 ? -yyn
: 0;
725 yyx
< (int) (sizeof (yytname
) / sizeof (char *));
727 if (yycheck
[yyx
+ yyn
] == yyx
)
729 const char *yyq
= ! yycount
? ", expecting " : " or ";
730 yyp
= yystpcpy (yyp
, yyq
);
731 yyp
= yystpcpy (yyp
, yytname
[yyx
]);
736 YYSTACK_FREE (yymsg
);
739 yyerror ("parse error; also virtual memory exhausted");
742 #endif /* YYERROR_VERBOSE */
743 yyerror ("parse error");
745 /* Pacify ``unused variable'' warnings. */
749 ]b4_location_if([(void) yylocation
;])[
753 /*-----------------------------------------------.
754 | Release the memory associated to this symbol. |
755 `-----------------------------------------------*/
758 #if defined (__STDC__) || defined (__cplusplus)
759 yydestruct (int yytype
,
760 YYSTYPE yyvalue
[]b4_location_if([, YYLTYPE yylocation
]))
763 yyvalue
[]b4_location_if([, yylocation
]))
766 b4_location_if([YYLTYPE yylocation
;])
769 /* Pacify ``unused variable'' warnings. */
771 b4_location_if([ (void) yylocation
;
776 m4_map([b4_symbol_actions
], m4_defn([b4_symbol_destructors
]))dnl
783 m4_divert_push([KILL
])# ======================== M4 code.
784 # b4_declare_parser_variables
785 # ---------------------------
786 # Declare the variables that are global, or local to YYPARSE if
788 m4_define([b4_declare_parser_variables
],
789 [/* The lookahead symbol. */
792 /* The semantic value of the lookahead symbol. */
795 /* Number of parse errors so far. */
796 int yynerrs
;b4_location_if([
797 /* Location data for the lookahead symbol. */
800 m4_divert_pop([KILL
])dnl
# ====================== End of M4 code.
803 [b4_declare_parser_variables
])
806 yyparse (YYPARSE_PARAM_ARG
)
809 ]b4_pure_if([b4_declare_parser_variables
])[
810 register int yystate
;
813 /* Number of tokens to shift before error messages enabled. */
815 /* Lookahead token as an internal (translated) token number. */
818 /* Three stacks and their tools:
819 `yyss': related to states,
820 `yyvs': related to semantic values,
821 `yyls': related to locations.
823 Refer to the stacks thru separate pointers, to allow yyoverflow
824 to reallocate them elsewhere. */
826 /* The state stack. */
827 short yyssa
[YYINITDEPTH
];
829 register short *yyssp
;
831 /* The semantic value stack. */
832 YYSTYPE yyvsa
[YYINITDEPTH
];
833 YYSTYPE
*yyvs
= yyvsa
;
834 register YYSTYPE
*yyvsp
;
837 [[ /* The location stack. */
838 YYLTYPE yylsa
[YYINITDEPTH
];
839 YYLTYPE
*yyls
= yylsa
;
842 #define YYPOPSTACK (yyvsp--, yyssp--]b4_location_if([, yylsp--])[)
844 YYSIZE_T yystacksize
= YYINITDEPTH
;
846 /* The variables used to return semantic value and location from the
849 ]b4_location_if([ YYLTYPE yyloc
;])[
851 /* When reducing, the number of symbols on the RHS of the reduced
855 YYDPRINTF ((stderr
, "Starting parse\n"));
860 yychar
= YYEMPTY
; /* Cause a token to be read. */
862 /* Initialize stack pointers.
863 Waste one element of value and location stack
864 so that they stay on the same level as the state stack.
865 The wasted elements are never initialized. */
869 ]b4_location_if([ yylsp
= yyls
;])[
872 /*------------------------------------------------------------.
873 | yynewstate -- Push a new state, which is found in yystate. |
874 `------------------------------------------------------------*/
876 /* In all cases, when you get here, the value and location stacks
877 have just been pushed. so pushing a state here evens the stacks.
884 if (yyssp
>= yyss
+ yystacksize
- 1)
886 /* Get the current used size of the three stacks, in elements. */
887 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
891 /* Give user a chance to reallocate the stack. Use copies of
892 these so that the &'s don't force the real ones into
894 YYSTYPE
*yyvs1
= yyvs
;
896 ]b4_location_if([ YYLTYPE
*yyls1
= yyls
;])[
898 /* Each stack pointer address is followed by the size of the
899 data in use in that stack, in bytes. This used to be a
900 conditional around just the two extra args, but that might
901 be undefined if yyoverflow is a macro. */
902 yyoverflow ("parser stack overflow",
903 &yyss1
, yysize
* sizeof (*yyssp
),
904 &yyvs1
, yysize
* sizeof (*yyvsp
),
905 ]b4_location_if([ &yyls1
, yysize
* sizeof (*yylsp
),])[
907 ]b4_location_if([ yyls
= yyls1
;])[
911 #else /* no yyoverflow */
912 # ifndef YYSTACK_RELOCATE
915 /* Extend the stack our own way. */
916 if (yystacksize
>= YYMAXDEPTH
)
919 if (yystacksize
> YYMAXDEPTH
)
920 yystacksize
= YYMAXDEPTH
;
924 union yyalloc
*yyptr
=
925 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
928 YYSTACK_RELOCATE (yyss
);
929 YYSTACK_RELOCATE (yyvs
);
930 ]b4_location_if([ YYSTACK_RELOCATE (yyls
);])[
931 # undef YYSTACK_RELOCATE
933 YYSTACK_FREE (yyss1
);
936 #endif /* no yyoverflow */
938 yyssp
= yyss
+ yysize
- 1;
939 yyvsp
= yyvs
+ yysize
- 1;
940 ]b4_location_if([ yylsp
= yyls
+ yysize
- 1;])[
942 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
943 (unsigned long int) yystacksize
));
945 if (yyssp
>= yyss
+ yystacksize
- 1)
949 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
958 /* Do appropriate processing given the current state. */
959 /* Read a lookahead token if we need one and don't already have one. */
962 /* First try to decide what to do without reference to lookahead token. */
964 yyn
= yypact
[yystate
];
965 if (yyn
== YYPACT_NINF
)
968 /* Not known => get a lookahead token if don't already have one. */
970 /* yychar is either YYEMPTY or YYEOF
971 or a valid token in external form. */
973 if (yychar
== YYEMPTY
)
975 YYDPRINTF ((stderr
, "Reading a token: "));
979 /* Convert token to internal form (in yychar1) for indexing tables with. */
981 if (yychar
<= 0) /* This means end of input. */
984 yychar
= YYEOF
; /* Don't call YYLEX any more. */
986 YYDPRINTF ((stderr
, "Now at end of input.\n"));
990 yychar1
= YYTRANSLATE (yychar
);
992 /* We have to keep this `#if YYDEBUG', since we use variables
993 which are defined only if `YYDEBUG' is set. */
994 YYDPRINTF ((stderr
, "Next token is "));
995 YYDSYMPRINT ((stderr
, yychar1
, yylval
]b4_location_if([, yyloc
])[));
996 YYDPRINTF ((stderr
, "\n"));
1000 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yychar1
)
1005 /* yyn is what to do for this token type in this state.
1006 Negative => reduce, -yyn is rule number.
1007 Positive => shift, yyn is new state.
1008 New state is final state => don't bother to shift,
1009 just return success.
1010 0, or most negative number => error. */
1014 if (yyn
== YYTABLE_NINF
)
1025 /* Shift the lookahead token. */
1026 YYDPRINTF ((stderr
, "Shifting token %d (%s), ",
1027 yychar
, yytname
[yychar1
]));
1029 /* Discard the token being shifted unless it is eof. */
1030 if (yychar
!= YYEOF
)
1034 ]b4_location_if([ *++yylsp
= yylloc
;])[
1036 /* Count tokens shifted since error; after three, turn off error
1045 /*-----------------------------------------------------------.
1046 | yydefault -- do the default action for the current state. |
1047 `-----------------------------------------------------------*/
1049 yyn
= yydefact
[yystate
];
1055 /*-----------------------------.
1056 | yyreduce -- Do a reduction. |
1057 `-----------------------------*/
1059 /* yyn is the number of a rule to reduce with. */
1062 /* If YYLEN is nonzero, implement the default value of the action:
1065 Otherwise, the following line sets YYVAL to the semantic value of
1066 the lookahead token. This behavior is undocumented and Bison
1067 users should not rely upon it. Assigning to YYVAL
1068 unconditionally makes the parser a bit smaller, and it avoids a
1069 GCC warning that YYVAL may be used uninitialized. */
1070 yyval
= yyvsp
[1-yylen
];
1073 [ /* Default location. */
1074 YYLLOC_DEFAULT (yyloc
, (yylsp
- yylen
), yylen
);])[
1077 /* We have to keep this `#if YYDEBUG', since we use variables which
1078 are defined only if `YYDEBUG' is set. */
1083 YYFPRINTF (stderr
, "Reducing via rule %d (line %d), ",
1084 yyn
- 1, yyrline
[yyn
]);
1086 /* Print the symbols being reduced, and their result. */
1087 for (yyi
= yyprhs
[yyn
]; yyrhs
[yyi
] >= 0; yyi
++)
1088 YYFPRINTF (stderr
, "%s ", yytname
[yyrhs
[yyi
]]);
1089 YYFPRINTF (stderr
, " -> %s\n", yytname
[yyr1
[yyn
]]);
1097 /* Line __line__ of __file__. */
1098 #line __oline__ "__ofile__"
1102 ]b4_location_if([ yylsp
-= yylen
;])[
1107 short *yyssp1
= yyss
- 1;
1108 YYFPRINTF (stderr
, "state stack now");
1109 while (yyssp1
!= yyssp
)
1110 YYFPRINTF (stderr
, " %d", *++yyssp1
);
1111 YYFPRINTF (stderr
, "\n");
1116 ]b4_location_if([ *++yylsp
= yyloc
;])[
1118 /* Now `shift' the result of the reduction. Determine what state
1119 that goes to, based on the state we popped back to and the rule
1120 number reduced by. */
1124 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
1125 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
1126 yystate
= yytable
[yystate
];
1128 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
1133 /*------------------------------------.
1134 | yyerrlab -- here on detecting error |
1135 `------------------------------------*/
1137 /* If not already recovering from an error, report this error. */
1141 yyreport_parse_error (yystate
, yychar
, yylval
]b4_location_if([, yylloc
])[);
1146 /*----------------------------------------------------.
1147 | yyerrlab1 -- error raised explicitly by an action. |
1148 `----------------------------------------------------*/
1150 if (yyerrstatus
== 3)
1152 /* If just tried and failed to reuse lookahead token after an
1153 error, discard it. */
1155 /* Return failure if at end of input. */
1156 if (yychar
== YYEOF
)
1158 /* Pop the error token. */
1160 /* Pop the rest of the stack. */
1161 while (yyssp
> yyss
)
1163 YYDPRINTF ((stderr
, "Error: popping "));
1164 YYDSYMPRINT ((stderr
,
1166 *yyvsp
]b4_location_if([, *yylsp
])[));
1167 YYDPRINTF ((stderr
, "\n"));
1168 yydestruct (yystos
[*yyssp
], *yyvsp
]b4_location_if([, *yylsp
])[);
1174 YYDPRINTF ((stderr
, "Discarding token %d (%s).\n",
1175 yychar
, yytname
[yychar1
]));
1176 yydestruct (yychar1
, yylval
]b4_location_if([, yylloc
])[);
1180 /* Else will try to reuse lookahead token after shifting the error
1183 yyerrstatus
= 3; /* Each real token shifted decrements this. */
1187 yyn
= yypact
[yystate
];
1188 if (yyn
!= YYPACT_NINF
)
1191 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
1199 /* Pop the current state because it cannot handle the error token. */
1203 YYDPRINTF ((stderr
, "Error: popping "));
1204 YYDSYMPRINT ((stderr
,
1205 yystos
[*yyssp
], *yyvsp
]b4_location_if([, *yylsp
])[));
1206 YYDPRINTF ((stderr
, "\n"));
1208 yydestruct (yystos
[yystate
], *yyvsp
]b4_location_if([, *yylsp
])[);
1211 ]b4_location_if([ yylsp
--;])[
1216 short *yyssp1
= yyss
- 1;
1217 YYFPRINTF (stderr
, "Error: state stack now");
1218 while (yyssp1
!= yyssp
)
1219 YYFPRINTF (stderr
, " %d", *++yyssp1
);
1220 YYFPRINTF (stderr
, "\n");
1228 YYDPRINTF ((stderr
, "Shifting error token, "));
1231 ]b4_location_if([ *++yylsp
= yylloc
;])[
1237 /*-------------------------------------.
1238 | yyacceptlab -- YYACCEPT comes here. |
1239 `-------------------------------------*/
1244 /*-----------------------------------.
1245 | yyabortlab -- YYABORT comes here. |
1246 `-----------------------------------*/
1252 /*----------------------------------------------.
1253 | yyoverflowlab -- parser overflow comes here. |
1254 `----------------------------------------------*/
1256 yyerror ("parser stack overflow");
1264 YYSTACK_FREE (yyss
);
1271 m4_if(b4_defines_flag
, 0, [],
1272 [#output "b4_output_header_name"
1273 b4_copyright([Skeleton parser
for Yacc
-like parsing with Bison
],
1274 [1984, 1989, 1990, 2000, 2001, 2002])
1276 #ifndef b4_header_guard
1277 # define b4_header_guard
1279 b4_token_defines(b4_tokens
)
1282 m4_ifdef([b4_stype
],
1283 [#line b4_stype_line "b4_filename"
1284 typedef union b4_stype yystype
;
1285 /* Line __line__ of __file__. */
1286 #line __oline__ "__ofile__"],
1287 [typedef int yystype
;])
1288 # define YYSTYPE yystype
1292 [extern YYSTYPE b4_prefix
[]lval
;])
1296 typedef struct yyltype
1303 # define YYLTYPE yyltype
1307 [extern YYLTYPE b4_prefix
[]lloc
;])
1309 #endif /* not b4_header_guard */