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
25 ## ---------------- ##
27 ## ---------------- ##
30 m4_define_default([b4_stack_depth_max
], [10000])
31 m4_define_default([b4_stack_depth_init
], [200])
34 m4_define_default([b4_location_type
], [yyltype
])
37 ## ------------------------ ##
38 ## Pure/impure interfaces. ##
39 ## ------------------------ ##
42 # b4_Pure_if(IF-TRUE, IF-FALSE)
43 # -----------------------------
44 # Expand IF-TRUE, if %pure-parser and %parse-param, IF-FALSE otherwise.
45 m4_define([b4_Pure_if
],
46 [b4_pure_if([m4_ifset([b4_parse_param
],
53 # Arguments passed to yyerror: user args plus yylloc.
54 m4_define([b4_yyerror_args
],
55 [b4_Pure_if([b4_location_if([&yylloc
, ])])dnl
56 m4_ifset([b4_parse_param
], [b4_c_args(b4_parse_param
), ])])
61 # Accumule in b4_lex_param all the yylex arguments.
62 # b4_lex_param arrives quoted twice, but we want to keep only one level.
63 m4_define([b4_lex_param
],
64 m4_dquote(b4_pure_if([[[[YYSTYPE
*]], [[&yylval
]]][]dnl
65 b4_location_if([, [[YYLTYPE
*], [&yylloc
]]])])dnl
66 m4_ifdef([b4_lex_param
], [, ]b4_lex_param
)))
74 # b4_int_type(MIN, MAX)
75 # ---------------------
76 # Return the smallest int type able to handle numbers ranging from
77 # MIN to MAX (included). We overwrite the version from c.m4 which relies
78 # on "signed char" which is not portable to old K&R compilers.
79 m4_define([b4_int_type
],
80 [m4_if(b4_ints_in($@
, [0], [255]), [1], [unsigned char],
81 b4_ints_in($@
, [-128], [127]), [1], [yysigned_char
],
83 b4_ints_in($@
, [0], [65535]), [1], [unsigned short],
84 b4_ints_in($@
, [-32768], [32767]), [1], [short],
86 m4_eval([0 <= $
1]), [1], [unsigned int],
91 ## ----------------- ##
92 ## Semantic Values. ##
93 ## ----------------- ##
96 # b4_lhs_value([TYPE])
97 # --------------------
98 # Expansion of $<TYPE>$.
99 m4_define([b4_lhs_value
],
100 [yyval
[]m4_ifval([$
1], [.$
1])])
103 # b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
104 # --------------------------------------
105 # Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
107 m4_define([b4_rhs_value
],
108 [yyvsp@
<:@
m4_eval([$
2 - $
1])@
:>@
m4_ifval([$
3], [.$
3])])
119 m4_define([b4_lhs_location
],
123 # b4_rhs_location(RULE-LENGTH, NUM)
124 # ---------------------------------
125 # Expansion of @NUM, where the current rule has RULE-LENGTH symbols
127 m4_define([b4_rhs_location
],
128 [yylsp@
<:@
m4_eval([$
2 - $
1])@
:>@
])
132 ## ------------------- ##
133 ## Output file names. ##
134 ## ------------------- ##
136 m4_define_default([b4_input_suffix
], [.y
])
138 m4_define_default([b4_output_parser_suffix
],
139 [m4_translit(b4_input_suffix
, [yY
], [cC
])])
141 m4_define_default([b4_output_parser_name
],
142 [b4_output_prefix
[]b4_output_infix
[]b4_output_parser_suffix
[]])
145 m4_define_default([b4_output_header_suffix
],
146 [m4_translit(b4_input_suffix
, [yY
], [hH
])])
148 m4_define_default([b4_output_header_name
],
149 [b4_output_prefix
[]b4_output_infix
[]b4_output_header_suffix
[]])
151 m4_define_default([b4_header_guard
],
152 [m4_bpatsubst(m4_toupper([BISON_
]b4_output_header_name
),
153 [[^ABCDEFGHIJKLMNOPQRSTUVWXYZ
]], [_
])])
157 ## --------------------------------------------------------- ##
158 ## Defining symbol actions, e.g., printers and destructors. ##
159 ## --------------------------------------------------------- ##
161 # b4_symbol_actions(FILENAME, LINENO,
162 # SYMBOL-TAG, SYMBOL-NUM,
163 # SYMBOL-ACTION, SYMBOL-TYPENAME)
164 # -------------------------------------------------
165 m4_define([b4_symbol_actions
],
166 [m4_pushdef([b4_dollar_dollar
], [yyvalue
.$
6])dnl
167 m4_pushdef([b4_at_dollar
], [yylocation
])dnl
169 b4_syncline([$
2], [$
1])
171 b4_syncline([__oline__
], [__ofile__
])
173 m4_popdef([b4_at_dollar
])dnl
174 m4_popdef([b4_dollar_dollar
])dnl
178 # We do want M4 expansion after # for CPP macros.
181 #output "b4_output_parser_name"
182 b4_copyright([Skeleton parser
for Yacc
-like parsing with Bison
],
183 [1984, 1989, 1990, 2000, 2001, 2002])
185 /* As a special exception, when this file is copied by Bison into a
186 Bison output file, you may use that output file without restriction.
187 This special exception was added by the Free Software Foundation
188 in version 1.24 of Bison. */
190 /* Written by Richard Stallman by simplifying the original so called
191 ``semantic'' parser. */
193 /* All symbols defined below should begin with yy or YY, to avoid
194 infringing on user name space. This should be done even for local
195 variables, as they might otherwise be expanded by user macros.
196 There are some unavoidable exceptions within include files to
197 define necessary library symbols; they are noted "INFRINGES ON
198 USER NAME SPACE" below. */
201 m4_if(b4_prefix
[], [yy
], [],
202 [/* If NAME_PREFIX is specified substitute the variables and functions
204 #define yyparse b4_prefix[]parse
205 #define yylex b4_prefix[]lex
206 #define yyerror b4_prefix[]error
207 #define yylval b4_prefix[]lval
208 #define yychar b4_prefix[]char
209 #define yydebug b4_prefix[]debug
210 #define yynerrs b4_prefix[]nerrs
211 b4_location_if([#define yylloc b4_prefix[]lloc])])
213 b4_token_defines(b4_tokens
)
215 /* Copy the first part of user declarations. */
218 /* Enabling traces. */
220 # define YYDEBUG b4_debug
223 /* Enabling verbose error messages. */
224 #ifdef YYERROR_VERBOSE
225 # undef YYERROR_VERBOSE
226 # define YYERROR_VERBOSE 1
228 # define YYERROR_VERBOSE b4_error_verbose
233 [b4_syncline([b4_stype_line
], [b4_filename
])
234 typedef union b4_stype yystype
;
235 /* Line __line__ of __file__. */
236 b4_syncline([__oline__
], [__ofile__
])],
237 [typedef int yystype
;])
238 # define YYSTYPE yystype
239 # define YYSTYPE_IS_TRIVIAL 1
243 typedef struct yyltype
250 # define YYLTYPE b4_location_type
251 # define YYLTYPE_IS_TRIVIAL 1
254 /* Copy the second part of user declarations. */
257 /* Line __line__ of __file__. */
258 b4_syncline([__oline__
], [__ofile__
])
260 #if ! defined (yyoverflow) || YYERROR_VERBOSE
262 /* The parser invokes alloca or malloc; define the necessary symbols. */
264 # if YYSTACK_USE_ALLOCA
265 # define YYSTACK_ALLOC alloca
267 # ifndef YYSTACK_USE_ALLOCA
268 # if defined (alloca) || defined (_ALLOCA_H)
269 # define YYSTACK_ALLOC alloca
272 # define YYSTACK_ALLOC __builtin_alloca
278 # ifdef YYSTACK_ALLOC
279 /* Pacify GCC's `empty if-body' warning. */
280 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
282 # if defined (__STDC__) || defined (__cplusplus)
283 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
284 # define YYSIZE_T size_t
286 # define YYSTACK_ALLOC malloc
287 # define YYSTACK_FREE free
289 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
292 #if (! defined (yyoverflow) \
293 && (! defined (__cplusplus) \
294 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
296 /* A type that is properly aligned for any stack member. */
301 b4_location_if([ YYLTYPE yyls
;
305 /* The size of the maximum gap between one aligned stack and the next. */
306 # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
308 /* The size of an array large to enough to hold all stacks, each with
311 [# define YYSTACK_BYTES(N) \
312 ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
313 + 2 * YYSTACK_GAP_MAX)],
314 [# define YYSTACK_BYTES(N) \
315 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
318 /* Copy COUNT objects from FROM to TO. The source and destination do
322 # define YYCOPY(To, From, Count) \
323 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
325 # define YYCOPY(To, From, Count) \
328 register YYSIZE_T yyi; \
329 for (yyi = 0; yyi < (Count); yyi++) \
330 (To)[[yyi]] = (From)[[yyi]]; \
336 /* Relocate STACK from its old location to the new one. The
337 local variables YYSIZE and YYSTACKSIZE give the old and new number of
338 elements in the stack, and YYPTR gives the new location of the
339 stack. Advance YYPTR to a properly aligned location for the next
341 # define YYSTACK_RELOCATE(Stack) \
344 YYSIZE_T yynewbytes; \
345 YYCOPY (&yyptr->Stack, Stack, yysize); \
346 Stack = &yyptr->Stack; \
347 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
348 yyptr += yynewbytes / sizeof (*yyptr); \
354 #if defined (__STDC__) || defined (__cplusplus)
355 typedef signed char yysigned_char
;
357 typedef short yysigned_char
;
360 /* YYFINAL -- State number of the termination state. */
361 #define YYFINAL b4_final_state_number
362 /* YYLAST -- Last index in YYTABLE. */
363 #define YYLAST b4_last
365 /* YYNTOKENS -- Number of terminals. */
366 #define YYNTOKENS b4_tokens_number
367 /* YYNNTS -- Number of nonterminals. */
368 #define YYNNTS b4_nterms_number
369 /* YYNRULES -- Number of rules. */
370 #define YYNRULES b4_rules_number
371 /* YYNRULES -- Number of states. */
372 #define YYNSTATES b4_states_number
374 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
375 #define YYUNDEFTOK b4_undef_token_number
376 #define YYMAXUTOK b4_user_token_number_max
378 #define YYTRANSLATE(X) \
379 ((unsigned)(X) <= YYMAXUTOK ? yytranslate[[X]] : YYUNDEFTOK)
381 /* YYTRANSLATE[[YYLEX]] -- Bison symbol number corresponding to YYLEX. */
382 static const b4_int_type_for([b4_translate
]) yytranslate
[[]] =
388 /* YYPRHS[[YYN]] -- Index of the first RHS symbol of rule number YYN in
390 static const b4_int_type_for([b4_prhs
]) yyprhs
[[]] =
395 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
396 static const b4_int_type_for([b4_rhs
]) yyrhs
[[]] =
401 /* YYRLINE[[YYN]] -- source line where rule number YYN was defined. */
402 static const b4_int_type_for([b4_rline
]) yyrline
[[]] =
408 #if YYDEBUG || YYERROR_VERBOSE
409 /* YYTNME[[SYMBOL-NUM]] -- String name of the symbol SYMBOL-NUM.
410 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
411 static const char *const yytname
[[]] =
418 /* YYTOKNUM[[YYLEX-NUM]] -- Internal token number corresponding to
420 static const b4_int_type_for([b4_toknum
]) yytoknum
[[]] =
426 /* YYR1[[YYN]] -- Symbol number of symbol that rule YYN derives. */
427 static const b4_int_type_for([b4_r1
]) yyr1
[[]] =
432 /* YYR2[[YYN]] -- Number of symbols composing right hand side of rule YYN. */
433 static const b4_int_type_for([b4_r2
]) yyr2
[[]] =
438 /* YYDEFACT[[STATE-NAME]] -- Default rule to reduce with in state
439 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
440 means the default is an error. */
441 static const b4_int_type_for([b4_defact
]) yydefact
[[]] =
446 /* YYDEFGOTO[[NTERM-NUM]]. */
447 static const b4_int_type_for([b4_defgoto
]) yydefgoto
[[]] =
452 /* YYPACT[[STATE-NUM]] -- Index in YYTABLE of the portion describing
454 #define YYPACT_NINF b4_pact_ninf
455 static const b4_int_type_for([b4_pact
]) yypact
[[]] =
460 /* YYPGOTO[[NTERM-NUM]]. */
461 static const b4_int_type_for([b4_pgoto
]) yypgoto
[[]] =
466 /* YYTABLE[[YYPACT[STATE-NUM]]]. What to do in state STATE-NUM. If
467 positive, shift that token. If negative, reduce the rule which
468 number is the opposite. If zero, do what YYDEFACT says.
469 If YYTABLE_NINF, parse error. */
470 #define YYTABLE_NINF b4_table_ninf
471 static const b4_int_type_for([b4_table
]) yytable
[[]] =
476 static const b4_int_type_for([b4_check
]) yycheck
[[]] =
481 /* YYSTOS[[STATE-NUM]] -- The (internal number of the) accessing
482 symbol of state STATE-NUM. */
483 static const b4_int_type_for([b4_stos
]) yystos
[[]] =
488 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
489 # define YYSIZE_T __SIZE_TYPE__
491 #if ! defined (YYSIZE_T) && defined (size_t)
492 # define YYSIZE_T size_t
494 #if ! defined (YYSIZE_T)
495 # if defined (__STDC__) || defined (__cplusplus)
496 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
497 # define YYSIZE_T size_t
500 #if ! defined (YYSIZE_T)
501 # define YYSIZE_T unsigned int
504 #define yyerrok (yyerrstatus = 0)
505 #define yyclearin (yychar = YYEMPTY)
509 #define YYACCEPT goto yyacceptlab
510 #define YYABORT goto yyabortlab
511 #define YYERROR goto yyerrlab1
513 /* Like YYERROR except do call yyerror. This remains here temporarily
514 to ease the transition to the new meaning of YYERROR, for GCC.
515 Once GCC version 2 has supplanted version 1, this can go. */
517 #define YYFAIL goto yyerrlab
519 #define YYRECOVERING() (!!yyerrstatus)
521 #define YYBACKUP(Token, Value) \
523 if (yychar == YYEMPTY && yylen == 1) \
527 yychar1 = YYTRANSLATE (yychar); \
533 yyerror (b4_yyerror_args"syntax error: cannot back up"); \
539 #define YYERRCODE 256
541 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
544 #ifndef YYLLOC_DEFAULT
545 # define YYLLOC_DEFAULT(Current, Rhs, N) \
546 Current.first_line = Rhs[[1]].first_line; \
547 Current.first_column = Rhs[[1]].first_column; \
548 Current.last_line = Rhs[[N]].last_line; \
549 Current.last_column = Rhs[[N]].last_column;
552 /* YYLEX -- calling `yylex' with the right arguments. */
555 # define YYLEX yylex (b4_pure_if([&yylval[]b4_location_if([, &yylloc]), ])YYLEX_PARAM)
557 # define YYLEX b4_c_function_call([yylex], [int], b4_lex_param)
560 /* Enable debugging if requested. */
564 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
565 # define YYFPRINTF fprintf
568 # define YYDPRINTF(Args) \
573 # define YYDSYMPRINT(Args) \
578 /* Nonzero means print parse trace. It is left uninitialized so that
579 multiple parsers can coexist. */
582 # define YYDPRINTF(Args)
583 # define YYDSYMPRINT(Args)
584 #endif /* !YYDEBUG */
586 /* YYINITDEPTH -- initial size of the parser's stacks. */
588 # define YYINITDEPTH b4_stack_depth_init
591 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
592 if the built-in stack extension method is used).
594 Do not make this value too large; the results are undefined if
595 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
596 evaluated with infinite-precision integer arithmetic. */
603 # define YYMAXDEPTH b4_stack_depth_max
611 # if defined (__GLIBC__) && defined (_STRING_H)
612 # define yystrlen strlen
614 /* Return the length of YYSTR. */
616 # if defined (__STDC__) || defined (__cplusplus)
617 yystrlen (const char *yystr
)
623 register const char *yys
= yystr
;
625 while (*yys
++ != '\0')
628 return yys
- yystr
- 1;
634 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
635 # define yystpcpy stpcpy
637 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
640 # if defined (__STDC__) || defined (__cplusplus)
641 yystpcpy (char *yydest
, const char *yysrc
)
643 yystpcpy (yydest
, yysrc
)
648 register char *yyd
= yydest
;
649 register const char *yys
= yysrc
;
651 while ((*yyd
++ = *yys
++) != '\0')
659 #endif /* !YYERROR_VERBOSE */
664 /*-----------------------------.
665 | Print this symbol on YYOUT. |
666 `-----------------------------*/
668 b4_c_function_def([yysymprint
],
670 [[FILE *yyout
], [yyout
]],
671 [[int yytype
], [yytype
]],
672 [[YYSTYPE yyvalue
], [yyvalue
]]b4_location_if([,
673 [[YYLTYPE yylocation
], [yylocation
]]]))
675 /* Pacify ``unused variable'' warnings. */
677 b4_location_if([ (void) yylocation
;
680 if (yytype
< YYNTOKENS
)
682 YYFPRINTF (yyout
, "token %s (", yytname
[[yytype]]);
684 YYPRINT (yyout
, yytoknum
[[yytype]], yyvalue
);
688 YYFPRINTF (yyout
, "nterm %s (", yytname
[[yytype]]);
692 m4_map([b4_symbol_actions
], m4_defn([b4_symbol_printers
]))dnl
696 YYFPRINTF (yyout
, ")");
698 #endif /* YYDEBUG. */
701 /*-----------------------------------------------.
702 | Release the memory associated to this symbol. |
703 `-----------------------------------------------*/
705 b4_c_function_def([yydestruct
],
707 [[int yytype
], [yytype
]],
708 [[YYSTYPE yyvalue
], [yyvalue
]]b4_location_if([,
709 [[YYLTYPE yylocation
], [yylocation
]]]))
711 /* Pacify ``unused variable'' warnings. */
713 b4_location_if([ (void) yylocation
;
718 m4_map([b4_symbol_actions
], m4_defn([b4_symbol_destructors
]))dnl
726 /* Prevent warnings from -Wmissing-prototypes. */
729 # if defined (__STDC__) || defined (__cplusplus)
730 int yyparse (void *YYPARSE_PARAM
);
734 #else /* ! YYPARSE_PARAM */
735 b4_c_function_decl([yyparse
], [int], b4_parse_param
)
739 m4_divert_push([KILL
])# ======================== M4 code.
740 # b4_declare_parser_variables
741 # ---------------------------
742 # Declare the variables that are global, or local to YYPARSE if
744 m4_define([b4_declare_parser_variables
],
745 [/* The lookahead symbol. */
748 /* The semantic value of the lookahead symbol. */
751 /* Number of parse errors so far. */
752 int yynerrs
;b4_location_if([
753 /* Location data for the lookahead symbol. */
756 m4_divert_pop([KILL
])dnl
# ====================== End of M4 code.
759 [b4_declare_parser_variables
])
767 # if defined (__STDC__) || defined (__cplusplus)
768 int yyparse (void *YYPARSE_PARAM
)
770 int yyparse (YYPARSE_PARAM
)
773 #else /* ! YYPARSE_PARAM */
774 b4_c_function_def([yyparse
], [int], b4_parse_param
)
777 ]b4_pure_if([b4_declare_parser_variables
])[
778 register int yystate
;
781 /* Number of tokens to shift before error messages enabled. */
783 /* Lookahead token as an internal (translated) token number. */
786 /* Three stacks and their tools:
787 `yyss': related to states,
788 `yyvs': related to semantic values,
789 `yyls': related to locations.
791 Refer to the stacks thru separate pointers, to allow yyoverflow
792 to reallocate them elsewhere. */
794 /* The state stack. */
795 short yyssa
[YYINITDEPTH
];
797 register short *yyssp
;
799 /* The semantic value stack. */
800 YYSTYPE yyvsa
[YYINITDEPTH
];
801 YYSTYPE
*yyvs
= yyvsa
;
802 register YYSTYPE
*yyvsp
;
805 [[ /* The location stack. */
806 YYLTYPE yylsa
[YYINITDEPTH
];
807 YYLTYPE
*yyls
= yylsa
;
810 #define YYPOPSTACK (yyvsp--, yyssp--]b4_location_if([, yylsp--])[)
812 YYSIZE_T yystacksize
= YYINITDEPTH
;
814 /* The variables used to return semantic value and location from the
817 ]b4_location_if([ YYLTYPE yyloc
;])[
819 /* When reducing, the number of symbols on the RHS of the reduced
823 YYDPRINTF ((stderr
, "Starting parse\n"));
828 yychar
= YYEMPTY
; /* Cause a token to be read. */
830 /* Initialize stack pointers.
831 Waste one element of value and location stack
832 so that they stay on the same level as the state stack.
833 The wasted elements are never initialized. */
837 ]b4_location_if([ yylsp
= yyls
;])[
840 /*------------------------------------------------------------.
841 | yynewstate -- Push a new state, which is found in yystate. |
842 `------------------------------------------------------------*/
844 /* In all cases, when you get here, the value and location stacks
845 have just been pushed. so pushing a state here evens the stacks.
852 if (yyss
+ yystacksize
- 1 <= yyssp
)
854 /* Get the current used size of the three stacks, in elements. */
855 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
859 /* Give user a chance to reallocate the stack. Use copies of
860 these so that the &'s don't force the real ones into
862 YYSTYPE
*yyvs1
= yyvs
;
864 ]b4_location_if([ YYLTYPE
*yyls1
= yyls
;])[
866 /* Each stack pointer address is followed by the size of the
867 data in use in that stack, in bytes. This used to be a
868 conditional around just the two extra args, but that might
869 be undefined if yyoverflow is a macro. */
870 yyoverflow ("parser stack overflow",
871 &yyss1
, yysize
* sizeof (*yyssp
),
872 &yyvs1
, yysize
* sizeof (*yyvsp
),
873 ]b4_location_if([ &yyls1
, yysize
* sizeof (*yylsp
),])[
875 ]b4_location_if([ yyls
= yyls1
;])[
879 #else /* no yyoverflow */
880 # ifndef YYSTACK_RELOCATE
883 /* Extend the stack our own way. */
884 if (YYMAXDEPTH
<= yystacksize
)
887 if (YYMAXDEPTH
< yystacksize
)
888 yystacksize
= YYMAXDEPTH
;
892 union yyalloc
*yyptr
=
893 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
896 YYSTACK_RELOCATE (yyss
);
897 YYSTACK_RELOCATE (yyvs
);
898 ]b4_location_if([ YYSTACK_RELOCATE (yyls
);])[
899 # undef YYSTACK_RELOCATE
901 YYSTACK_FREE (yyss1
);
904 #endif /* no yyoverflow */
906 yyssp
= yyss
+ yysize
- 1;
907 yyvsp
= yyvs
+ yysize
- 1;
908 ]b4_location_if([ yylsp
= yyls
+ yysize
- 1;])[
910 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
911 (unsigned long int) yystacksize
));
913 if (yyss
+ yystacksize
- 1 <= yyssp
)
917 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
926 /* Do appropriate processing given the current state. */
927 /* Read a lookahead token if we need one and don't already have one. */
930 /* First try to decide what to do without reference to lookahead token. */
932 yyn
= yypact
[yystate
];
933 if (yyn
== YYPACT_NINF
)
936 /* Not known => get a lookahead token if don't already have one. */
938 /* yychar is either YYEMPTY or YYEOF
939 or a valid token in external form. */
941 if (yychar
== YYEMPTY
)
943 YYDPRINTF ((stderr
, "Reading a token: "));
947 /* Convert token to internal form (in yychar1) for indexing tables with. */
949 if (yychar
<= 0) /* This means end of input. */
952 yychar
= YYEOF
; /* Don't call YYLEX any more. */
954 YYDPRINTF ((stderr
, "Now at end of input.\n"));
958 yychar1
= YYTRANSLATE (yychar
);
960 /* We have to keep this `#if YYDEBUG', since we use variables
961 which are defined only if `YYDEBUG' is set. */
962 YYDPRINTF ((stderr
, "Next token is "));
963 YYDSYMPRINT ((stderr
, yychar1
, yylval
]b4_location_if([, yyloc
])[));
964 YYDPRINTF ((stderr
, "\n"));
967 /* If the proper action on seeing token YYCHAR1 is to reduce or to
968 detect an error, take that action. */
970 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yychar1
)
975 if (yyn
== 0 || yyn
== YYTABLE_NINF
)
984 /* Shift the lookahead token. */
985 YYDPRINTF ((stderr
, "Shifting token %d (%s), ",
986 yychar
, yytname
[yychar1
]));
988 /* Discard the token being shifted unless it is eof. */
993 ]b4_location_if([ *++yylsp
= yylloc
;])[
995 /* Count tokens shifted since error; after three, turn off error
1004 /*-----------------------------------------------------------.
1005 | yydefault -- do the default action for the current state. |
1006 `-----------------------------------------------------------*/
1008 yyn
= yydefact
[yystate
];
1014 /*-----------------------------.
1015 | yyreduce -- Do a reduction. |
1016 `-----------------------------*/
1018 /* yyn is the number of a rule to reduce with. */
1021 /* If YYLEN is nonzero, implement the default value of the action:
1024 Otherwise, the following line sets YYVAL to garbage.
1025 This behavior is undocumented and Bison
1026 users should not rely upon it. Assigning to YYVAL
1027 unconditionally makes the parser a bit smaller, and it avoids a
1028 GCC warning that YYVAL may be used uninitialized. */
1029 yyval
= yyvsp
[1-yylen
];
1032 [ /* Default location. */
1033 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), ",
1043 yyn
- 1, yyrline
[yyn
]);
1045 /* Print the symbols being reduced, and their result. */
1046 for (yyi
= yyprhs
[yyn
]; 0 <= yyrhs
[yyi
]; yyi
++)
1047 YYFPRINTF (stderr
, "%s ", yytname
[yyrhs
[yyi
]]);
1048 YYFPRINTF (stderr
, " -> %s\n", yytname
[yyr1
[yyn
]]);
1056 /* Line __line__ of __file__. */
1057 b4_syncline([__oline__
], [__ofile__
])
1061 ]b4_location_if([ yylsp
-= yylen
;])[
1066 short *yyssp1
= yyss
- 1;
1067 YYFPRINTF (stderr
, "state stack now");
1068 while (yyssp1
!= yyssp
)
1069 YYFPRINTF (stderr
, " %d", *++yyssp1
);
1070 YYFPRINTF (stderr
, "\n");
1075 ]b4_location_if([ *++yylsp
= yyloc
;])[
1077 /* Now `shift' the result of the reduction. Determine what state
1078 that goes to, based on the state we popped back to and the rule
1079 number reduced by. */
1083 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
1084 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
1085 yystate
= yytable
[yystate
];
1087 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
1092 /*------------------------------------.
1093 | yyerrlab -- here on detecting error |
1094 `------------------------------------*/
1096 /* If not already recovering from an error, report this error. */
1101 yyn
= yypact
[yystate
];
1103 if (YYPACT_NINF
< yyn
&& yyn
< YYLAST
)
1105 YYSIZE_T yysize
= 0;
1106 int yytype
= YYTRANSLATE (yychar
);
1111 /* Start YYX at -YYN if negative to avoid negative indexes in
1113 for (yyx
= yyn
< 0 ? -yyn
: 0;
1114 yyx
< (int) (sizeof (yytname
) / sizeof (char *)); yyx
++)
1115 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1116 yysize
+= yystrlen (yytname
[yyx
]) + 15, yycount
++;
1117 yysize
+= yystrlen ("parse error, unexpected ") + 1;
1118 yysize
+= yystrlen (yytname
[yytype
]);
1119 yymsg
= (char *) YYSTACK_ALLOC (yysize
);
1122 char *yyp
= yystpcpy (yymsg
, "parse error, unexpected ");
1123 yyp
= yystpcpy (yyp
, yytname
[yytype
]);
1128 for (yyx
= yyn
< 0 ? -yyn
: 0;
1129 yyx
< (int) (sizeof (yytname
) / sizeof (char *));
1131 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1133 const char *yyq
= ! yycount
? ", expecting " : " or ";
1134 yyp
= yystpcpy (yyp
, yyq
);
1135 yyp
= yystpcpy (yyp
, yytname
[yyx
]);
1139 yyerror (]b4_yyerror_args
[yymsg
);
1140 YYSTACK_FREE (yymsg
);
1143 yyerror (]b4_yyerror_args
["parse error; also virtual memory exhausted");
1146 #endif /* YYERROR_VERBOSE */
1147 yyerror (]b4_yyerror_args
["parse error");
1152 /*----------------------------------------------------.
1153 | yyerrlab1 -- error raised explicitly by an action. |
1154 `----------------------------------------------------*/
1156 if (yyerrstatus
== 3)
1158 /* If just tried and failed to reuse lookahead token after an
1159 error, discard it. */
1161 /* Return failure if at end of input. */
1162 if (yychar
== YYEOF
)
1164 /* Pop the error token. */
1166 /* Pop the rest of the stack. */
1167 while (yyss
< yyssp
)
1169 YYDPRINTF ((stderr
, "Error: popping "));
1170 YYDSYMPRINT ((stderr
,
1172 *yyvsp
]b4_location_if([, *yylsp
])[));
1173 YYDPRINTF ((stderr
, "\n"));
1174 yydestruct (yystos
[*yyssp
], *yyvsp
]b4_location_if([, *yylsp
])[);
1180 YYDPRINTF ((stderr
, "Discarding token %d (%s).\n",
1181 yychar
, yytname
[yychar1
]));
1182 yydestruct (yychar1
, yylval
]b4_location_if([, yylloc
])[);
1186 /* Else will try to reuse lookahead token after shifting the error
1189 yyerrstatus
= 3; /* Each real token shifted decrements this. */
1193 yyn
= yypact
[yystate
];
1194 if (yyn
!= YYPACT_NINF
)
1197 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
1205 /* Pop the current state because it cannot handle the error token. */
1209 YYDPRINTF ((stderr
, "Error: popping "));
1210 YYDSYMPRINT ((stderr
,
1211 yystos
[*yyssp
], *yyvsp
]b4_location_if([, *yylsp
])[));
1212 YYDPRINTF ((stderr
, "\n"));
1214 yydestruct (yystos
[yystate
], *yyvsp
]b4_location_if([, *yylsp
])[);
1217 ]b4_location_if([ yylsp
--;])[
1222 short *yyssp1
= yyss
- 1;
1223 YYFPRINTF (stderr
, "Error: state stack now");
1224 while (yyssp1
!= yyssp
)
1225 YYFPRINTF (stderr
, " %d", *++yyssp1
);
1226 YYFPRINTF (stderr
, "\n");
1234 YYDPRINTF ((stderr
, "Shifting error token, "));
1237 ]b4_location_if([ *++yylsp
= yylloc
;])[
1243 /*-------------------------------------.
1244 | yyacceptlab -- YYACCEPT comes here. |
1245 `-------------------------------------*/
1250 /*-----------------------------------.
1251 | yyabortlab -- YYABORT comes here. |
1252 `-----------------------------------*/
1258 /*----------------------------------------------.
1259 | yyoverflowlab -- parser overflow comes here. |
1260 `----------------------------------------------*/
1262 yyerror (]b4_yyerror_args
["parser stack overflow");
1270 YYSTACK_FREE (yyss
);
1277 m4_if(b4_defines_flag
, 0, [],
1278 [#output "b4_output_header_name"
1279 b4_copyright([Skeleton parser
for Yacc
-like parsing with Bison
],
1280 [1984, 1989, 1990, 2000, 2001, 2002])
1282 /* As a special exception, when this file is copied by Bison into a
1283 Bison output file, you may use that output file without restriction.
1284 This special exception was added by the Free Software Foundation
1285 in version 1.24 of Bison. */
1287 #ifndef b4_header_guard
1288 # define b4_header_guard
1290 b4_token_defines(b4_tokens
)
1293 m4_ifdef([b4_stype
],
1294 [b4_syncline([b4_stype_line
], [b4_filename
])
1295 typedef union b4_stype yystype
;
1296 /* Line __line__ of __file__. */
1297 b4_syncline([__oline__
], [__ofile__
])],
1298 [typedef int yystype
;])
1299 # define YYSTYPE yystype
1303 [extern YYSTYPE b4_prefix
[]lval
;])
1307 typedef struct yyltype
1314 # define YYLTYPE yyltype
1318 [extern YYLTYPE b4_prefix
[]lloc
;])
1320 #endif /* not b4_header_guard */