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_pure_args
],
55 [b4_Pure_if([b4_location_if([, &yylloc
])])[]b4_user_args
])
60 # Accumule in b4_lex_param all the yylex arguments.
61 # b4_lex_param arrives quoted twice, but we want to keep only one level.
62 m4_define([b4_lex_param
],
63 m4_dquote(b4_pure_if([[[[YYSTYPE
*]], [[&yylval
]]][]dnl
64 b4_location_if([, [[YYLTYPE
*], [&yylloc
]]])])dnl
65 m4_ifdef([b4_lex_param
], [, ]b4_lex_param
)))
73 # b4_int_type(MIN, MAX)
74 # ---------------------
75 # Return the smallest int type able to handle numbers ranging from
76 # MIN to MAX (included). We overwrite the version from c.m4 which relies
77 # on "signed char" which is not portable to old K&R compilers.
78 m4_define([b4_int_type
],
79 [m4_if(b4_ints_in($@
, [0], [255]), [1], [unsigned char],
80 b4_ints_in($@
, [-128], [127]), [1], [yysigned_char
],
82 b4_ints_in($@
, [0], [65535]), [1], [unsigned short],
83 b4_ints_in($@
, [-32768], [32767]), [1], [short],
85 m4_eval([0 <= $
1]), [1], [unsigned int],
90 ## ----------------- ##
91 ## Semantic Values. ##
92 ## ----------------- ##
95 # b4_lhs_value([TYPE])
96 # --------------------
97 # Expansion of $<TYPE>$.
98 m4_define([b4_lhs_value
],
99 [yyval
[]m4_ifval([$
1], [.$
1])])
102 # b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
103 # --------------------------------------
104 # Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
106 m4_define([b4_rhs_value
],
107 [yyvsp@
<:@
m4_eval([$
2 - $
1])@
:>@
m4_ifval([$
3], [.$
3])])
118 m4_define([b4_lhs_location
],
122 # b4_rhs_location(RULE-LENGTH, NUM)
123 # ---------------------------------
124 # Expansion of @NUM, where the current rule has RULE-LENGTH symbols
126 m4_define([b4_rhs_location
],
127 [yylsp@
<:@
m4_eval([$
2 - $
1])@
:>@
])
131 ## ------------------- ##
132 ## Output file names. ##
133 ## ------------------- ##
135 m4_define_default([b4_input_suffix
], [.y
])
137 m4_define_default([b4_output_parser_suffix
],
138 [m4_translit(b4_input_suffix
, [yY
], [cC
])])
140 m4_define_default([b4_output_parser_name
],
141 [b4_output_prefix
[]b4_output_infix
[]b4_output_parser_suffix
[]])
144 m4_define_default([b4_output_header_suffix
],
145 [m4_translit(b4_input_suffix
, [yY
], [hH
])])
147 m4_define_default([b4_output_header_name
],
148 [b4_output_prefix
[]b4_output_infix
[]b4_output_header_suffix
[]])
150 m4_define_default([b4_header_guard
],
151 [m4_bpatsubst(m4_toupper([BISON_
]b4_output_header_name
),
152 [[^ABCDEFGHIJKLMNOPQRSTUVWXYZ
]], [_
])])
156 ## --------------------------------------------------------- ##
157 ## Defining symbol actions, e.g., printers and destructors. ##
158 ## --------------------------------------------------------- ##
160 # b4_symbol_actions(FILENAME, LINENO,
161 # SYMBOL-TAG, SYMBOL-NUM,
162 # SYMBOL-ACTION, SYMBOL-TYPENAME)
163 # -------------------------------------------------
164 m4_define([b4_symbol_actions
],
165 [m4_pushdef([b4_dollar_dollar
], [yyvalue
.$
6])dnl
166 m4_pushdef([b4_at_dollar
], [yylocation
])dnl
170 #line __oline__ "__ofile__"
172 m4_popdef([b4_at_dollar
])dnl
173 m4_popdef([b4_dollar_dollar
])dnl
177 # We do want M4 expansion after # for CPP macros.
180 #output "b4_output_parser_name"
181 b4_copyright([Skeleton parser
for Yacc
-like parsing with Bison
],
182 [1984, 1989, 1990, 2000, 2001, 2002])
184 /* As a special exception, when this file is copied by Bison into a
185 Bison output file, you may use that output file without restriction.
186 This special exception was added by the Free Software Foundation
187 in version 1.24 of Bison. */
189 /* Written by Richard Stallman by simplifying the original so called
190 ``semantic'' parser. */
192 /* All symbols defined below should begin with yy or YY, to avoid
193 infringing on user name space. This should be done even for local
194 variables, as they might otherwise be expanded by user macros.
195 There are some unavoidable exceptions within include files to
196 define necessary library symbols; they are noted "INFRINGES ON
197 USER NAME SPACE" below. */
200 m4_if(b4_prefix
[], [yy
], [],
201 [/* If NAME_PREFIX is specified substitute the variables and functions
203 #define yyparse b4_prefix[]parse
204 #define yylex b4_prefix[]lex
205 #define yyerror b4_prefix[]error
206 #define yylval b4_prefix[]lval
207 #define yychar b4_prefix[]char
208 #define yydebug b4_prefix[]debug
209 #define yynerrs b4_prefix[]nerrs
210 b4_location_if([#define yylloc b4_prefix[]lloc])])
212 b4_token_defines(b4_tokens
)
214 /* Copy the first part of user declarations. */
217 /* Enabling traces. */
219 # define YYDEBUG b4_debug
222 /* Enabling verbose error messages. */
223 #ifdef YYERROR_VERBOSE
224 # undef YYERROR_VERBOSE
225 # define YYERROR_VERBOSE 1
227 # define YYERROR_VERBOSE b4_error_verbose
232 [#line b4_stype_line "b4_filename"
233 typedef union b4_stype yystype
;
234 /* Line __line__ of __file__. */
235 #line __oline__ "__ofile__"],
236 [typedef int yystype
;])
237 # define YYSTYPE yystype
238 # define YYSTYPE_IS_TRIVIAL 1
242 typedef struct yyltype
249 # define YYLTYPE b4_location_type
250 # define YYLTYPE_IS_TRIVIAL 1
253 /* Copy the second part of user declarations. */
256 /* Line __line__ of __file__. */
257 #line __oline__ "__ofile__"
259 #if ! defined (yyoverflow) || YYERROR_VERBOSE
261 /* The parser invokes alloca or malloc; define the necessary symbols. */
263 # if YYSTACK_USE_ALLOCA
264 # define YYSTACK_ALLOC alloca
266 # ifndef YYSTACK_USE_ALLOCA
267 # if defined (alloca) || defined (_ALLOCA_H)
268 # define YYSTACK_ALLOC alloca
271 # define YYSTACK_ALLOC __builtin_alloca
277 # ifdef YYSTACK_ALLOC
278 /* Pacify GCC's `empty if-body' warning. */
279 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
281 # if defined (__STDC__) || defined (__cplusplus)
282 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
283 # define YYSIZE_T size_t
285 # define YYSTACK_ALLOC malloc
286 # define YYSTACK_FREE free
288 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
291 #if (! defined (yyoverflow) \
292 && (! defined (__cplusplus) \
293 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
295 /* A type that is properly aligned for any stack member. */
300 b4_location_if([ YYLTYPE yyls
;
304 /* The size of the maximum gap between one aligned stack and the next. */
305 # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
307 /* The size of an array large to enough to hold all stacks, each with
310 [# define YYSTACK_BYTES(N) \
311 ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
312 + 2 * YYSTACK_GAP_MAX)],
313 [# define YYSTACK_BYTES(N) \
314 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
317 /* Copy COUNT objects from FROM to TO. The source and destination do
321 # define YYCOPY(To, From, Count) \
322 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
324 # define YYCOPY(To, From, Count) \
327 register YYSIZE_T yyi; \
328 for (yyi = 0; yyi < (Count); yyi++) \
329 (To)[[yyi]] = (From)[[yyi]]; \
335 /* Relocate STACK from its old location to the new one. The
336 local variables YYSIZE and YYSTACKSIZE give the old and new number of
337 elements in the stack, and YYPTR gives the new location of the
338 stack. Advance YYPTR to a properly aligned location for the next
340 # define YYSTACK_RELOCATE(Stack) \
343 YYSIZE_T yynewbytes; \
344 YYCOPY (&yyptr->Stack, Stack, yysize); \
345 Stack = &yyptr->Stack; \
346 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
347 yyptr += yynewbytes / sizeof (*yyptr); \
353 #if defined (__STDC__) || defined (__cplusplus)
354 typedef signed char yysigned_char
;
356 typedef short yysigned_char
;
359 /* YYFINAL -- State number of the termination state. */
360 #define YYFINAL b4_final_state_number
361 /* YYLAST -- Last index in YYTABLE. */
362 #define YYLAST b4_last
364 /* YYNTOKENS -- Number of terminals. */
365 #define YYNTOKENS b4_tokens_number
366 /* YYNNTS -- Number of nonterminals. */
367 #define YYNNTS b4_nterms_number
368 /* YYNRULES -- Number of rules. */
369 #define YYNRULES b4_rules_number
370 /* YYNRULES -- Number of states. */
371 #define YYNSTATES b4_states_number
373 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
374 #define YYUNDEFTOK b4_undef_token_number
375 #define YYMAXUTOK b4_user_token_number_max
377 #define YYTRANSLATE(X) \
378 ((unsigned)(X) <= YYMAXUTOK ? yytranslate[[X]] : YYUNDEFTOK)
380 /* YYTRANSLATE[[YYLEX]] -- Bison symbol number corresponding to YYLEX. */
381 static const b4_int_type_for([b4_translate
]) yytranslate
[[]] =
387 /* YYPRHS[[YYN]] -- Index of the first RHS symbol of rule number YYN in
389 static const b4_int_type_for([b4_prhs
]) yyprhs
[[]] =
394 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
395 static const b4_int_type_for([b4_rhs
]) yyrhs
[[]] =
400 /* YYRLINE[[YYN]] -- source line where rule number YYN was defined. */
401 static const b4_int_type_for([b4_rline
]) yyrline
[[]] =
407 #if YYDEBUG || YYERROR_VERBOSE
408 /* YYTNME[[SYMBOL-NUM]] -- String name of the symbol SYMBOL-NUM.
409 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
410 static const char *const yytname
[[]] =
417 /* YYTOKNUM[[YYLEX-NUM]] -- Internal token number corresponding to
419 static const b4_int_type_for([b4_toknum
]) yytoknum
[[]] =
425 /* YYR1[[YYN]] -- Symbol number of symbol that rule YYN derives. */
426 static const b4_int_type_for([b4_r1
]) yyr1
[[]] =
431 /* YYR2[[YYN]] -- Number of symbols composing right hand side of rule YYN. */
432 static const b4_int_type_for([b4_r2
]) yyr2
[[]] =
437 /* YYDEFACT[[STATE-NAME]] -- Default rule to reduce with in state
438 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
439 means the default is an error. */
440 static const b4_int_type_for([b4_defact
]) yydefact
[[]] =
445 /* YYDEFGOTO[[NTERM-NUM]]. */
446 static const b4_int_type_for([b4_defgoto
]) yydefgoto
[[]] =
451 /* YYPACT[[STATE-NUM]] -- Index in YYTABLE of the portion describing
453 #define YYPACT_NINF b4_pact_ninf
454 static const b4_int_type_for([b4_pact
]) yypact
[[]] =
459 /* YYPGOTO[[NTERM-NUM]]. */
460 static const b4_int_type_for([b4_pgoto
]) yypgoto
[[]] =
465 /* YYTABLE[[YYPACT[STATE-NUM]]]. What to do in state STATE-NUM. If
466 positive, shift that token. If negative, reduce the rule which
467 number is the opposite. If zero, do what YYDEFACT says.
468 If YYTABLE_NINF, parse error. */
469 #define YYTABLE_NINF b4_table_ninf
470 static const b4_int_type_for([b4_table
]) yytable
[[]] =
475 static const b4_int_type_for([b4_check
]) yycheck
[[]] =
480 /* YYSTOS[[STATE-NUM]] -- The (internal number of the) accessing
481 symbol of state STATE-NUM. */
482 static const b4_int_type_for([b4_stos
]) yystos
[[]] =
487 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
488 # define YYSIZE_T __SIZE_TYPE__
490 #if ! defined (YYSIZE_T) && defined (size_t)
491 # define YYSIZE_T size_t
493 #if ! defined (YYSIZE_T)
494 # if defined (__STDC__) || defined (__cplusplus)
495 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
496 # define YYSIZE_T size_t
499 #if ! defined (YYSIZE_T)
500 # define YYSIZE_T unsigned int
503 #define yyerrok (yyerrstatus = 0)
504 #define yyclearin (yychar = YYEMPTY)
508 #define YYACCEPT goto yyacceptlab
509 #define YYABORT goto yyabortlab
510 #define YYERROR goto yyerrlab1
512 /* Like YYERROR except do call yyerror. This remains here temporarily
513 to ease the transition to the new meaning of YYERROR, for GCC.
514 Once GCC version 2 has supplanted version 1, this can go. */
516 #define YYFAIL goto yyerrlab
518 #define YYRECOVERING() (!!yyerrstatus)
520 #define YYBACKUP(Token, Value) \
522 if (yychar == YYEMPTY && yylen == 1) \
526 yychar1 = YYTRANSLATE (yychar); \
532 yyerror ("syntax error: cannot back up"b4_pure_args); \
538 #define YYERRCODE 256
540 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
543 #ifndef YYLLOC_DEFAULT
544 # define YYLLOC_DEFAULT(Current, Rhs, N) \
545 Current.first_line = Rhs[[1]].first_line; \
546 Current.first_column = Rhs[[1]].first_column; \
547 Current.last_line = Rhs[[N]].last_line; \
548 Current.last_column = Rhs[[N]].last_column;
551 /* YYLEX -- calling `yylex' with the right arguments. */
554 # define YYLEX yylex (b4_pure_if([&yylval[]b4_location_if([, &yylloc]), ])YYLEX_PARAM)
556 # define YYLEX b4_c_function_call([yylex], [int], b4_lex_param)
559 /* Enable debugging if requested. */
563 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
564 # define YYFPRINTF fprintf
567 # define YYDPRINTF(Args) \
572 # define YYDSYMPRINT(Args) \
577 /* Nonzero means print parse trace. It is left uninitialized so that
578 multiple parsers can coexist. */
581 # define YYDPRINTF(Args)
582 # define YYDSYMPRINT(Args)
583 #endif /* !YYDEBUG */
585 /* YYINITDEPTH -- initial size of the parser's stacks. */
587 # define YYINITDEPTH b4_stack_depth_init
590 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
591 if the built-in stack extension method is used).
593 Do not make this value too large; the results are undefined if
594 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
595 evaluated with infinite-precision integer arithmetic. */
602 # define YYMAXDEPTH b4_stack_depth_max
610 # if defined (__GLIBC__) && defined (_STRING_H)
611 # define yystrlen strlen
613 /* Return the length of YYSTR. */
615 # if defined (__STDC__) || defined (__cplusplus)
616 yystrlen (const char *yystr
)
622 register const char *yys
= yystr
;
624 while (*yys
++ != '\0')
627 return yys
- yystr
- 1;
633 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
634 # define yystpcpy stpcpy
636 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
639 # if defined (__STDC__) || defined (__cplusplus)
640 yystpcpy (char *yydest
, const char *yysrc
)
642 yystpcpy (yydest
, yysrc
)
647 register char *yyd
= yydest
;
648 register const char *yys
= yysrc
;
650 while ((*yyd
++ = *yys
++) != '\0')
658 #endif /* !YYERROR_VERBOSE */
663 /*-----------------------------.
664 | Print this symbol on YYOUT. |
665 `-----------------------------*/
667 b4_c_function_def([yysymprint
],
669 [[FILE *yyout
], [yyout
]],
670 [[int yytype
], [yytype
]],
671 [[YYSTYPE yyvalue
], [yyvalue
]]b4_location_if([,
672 [[YYLTYPE yylocation
], [yylocation
]]]))
674 /* Pacify ``unused variable'' warnings. */
676 b4_location_if([ (void) yylocation
;
679 if (yytype
< YYNTOKENS
)
681 YYFPRINTF (yyout
, "token %s (", yytname
[[yytype]]);
683 YYPRINT (yyout
, yytoknum
[[yytype]], yyvalue
);
687 YYFPRINTF (yyout
, "nterm %s (", yytname
[[yytype]]);
691 m4_map([b4_symbol_actions
], m4_defn([b4_symbol_printers
]))dnl
695 YYFPRINTF (yyout
, ")");
697 #endif /* YYDEBUG. */
700 /*-----------------------------------------------.
701 | Release the memory associated to this symbol. |
702 `-----------------------------------------------*/
704 b4_c_function_def([yydestruct
],
706 [[int yytype
], [yytype
]],
707 [[YYSTYPE yyvalue
], [yyvalue
]]b4_location_if([,
708 [[YYLTYPE yylocation
], [yylocation
]]]))
710 /* Pacify ``unused variable'' warnings. */
712 b4_location_if([ (void) yylocation
;
717 m4_map([b4_symbol_actions
], m4_defn([b4_symbol_destructors
]))dnl
725 /* Prevent warnings from -Wmissing-prototypes. */
728 # if defined (__STDC__) || defined (__cplusplus)
729 int yyparse (void *YYPARSE_PARAM
);
733 #else /* ! YYPARSE_PARAM */
734 b4_c_function_decl([yyparse
], [int], b4_parse_param
)
738 m4_divert_push([KILL
])# ======================== M4 code.
739 # b4_declare_parser_variables
740 # ---------------------------
741 # Declare the variables that are global, or local to YYPARSE if
743 m4_define([b4_declare_parser_variables
],
744 [/* The lookahead symbol. */
747 /* The semantic value of the lookahead symbol. */
750 /* Number of parse errors so far. */
751 int yynerrs
;b4_location_if([
752 /* Location data for the lookahead symbol. */
755 m4_divert_pop([KILL
])dnl
# ====================== End of M4 code.
758 [b4_declare_parser_variables
])
766 # if defined (__STDC__) || defined (__cplusplus)
767 int yyparse (void *YYPARSE_PARAM
)
769 int yyparse (YYPARSE_PARAM
)
772 #else /* ! YYPARSE_PARAM */
773 b4_c_function_def([yyparse
], [int], b4_parse_param
)
776 ]b4_pure_if([b4_declare_parser_variables
])[
777 register int yystate
;
780 /* Number of tokens to shift before error messages enabled. */
782 /* Lookahead token as an internal (translated) token number. */
785 /* Three stacks and their tools:
786 `yyss': related to states,
787 `yyvs': related to semantic values,
788 `yyls': related to locations.
790 Refer to the stacks thru separate pointers, to allow yyoverflow
791 to reallocate them elsewhere. */
793 /* The state stack. */
794 short yyssa
[YYINITDEPTH
];
796 register short *yyssp
;
798 /* The semantic value stack. */
799 YYSTYPE yyvsa
[YYINITDEPTH
];
800 YYSTYPE
*yyvs
= yyvsa
;
801 register YYSTYPE
*yyvsp
;
804 [[ /* The location stack. */
805 YYLTYPE yylsa
[YYINITDEPTH
];
806 YYLTYPE
*yyls
= yylsa
;
809 #define YYPOPSTACK (yyvsp--, yyssp--]b4_location_if([, yylsp--])[)
811 YYSIZE_T yystacksize
= YYINITDEPTH
;
813 /* The variables used to return semantic value and location from the
816 ]b4_location_if([ YYLTYPE yyloc
;])[
818 /* When reducing, the number of symbols on the RHS of the reduced
822 YYDPRINTF ((stderr
, "Starting parse\n"));
827 yychar
= YYEMPTY
; /* Cause a token to be read. */
829 /* Initialize stack pointers.
830 Waste one element of value and location stack
831 so that they stay on the same level as the state stack.
832 The wasted elements are never initialized. */
836 ]b4_location_if([ yylsp
= yyls
;])[
839 /*------------------------------------------------------------.
840 | yynewstate -- Push a new state, which is found in yystate. |
841 `------------------------------------------------------------*/
843 /* In all cases, when you get here, the value and location stacks
844 have just been pushed. so pushing a state here evens the stacks.
851 if (yyss
+ yystacksize
- 1 <= yyssp
)
853 /* Get the current used size of the three stacks, in elements. */
854 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
858 /* Give user a chance to reallocate the stack. Use copies of
859 these so that the &'s don't force the real ones into
861 YYSTYPE
*yyvs1
= yyvs
;
863 ]b4_location_if([ YYLTYPE
*yyls1
= yyls
;])[
865 /* Each stack pointer address is followed by the size of the
866 data in use in that stack, in bytes. This used to be a
867 conditional around just the two extra args, but that might
868 be undefined if yyoverflow is a macro. */
869 yyoverflow ("parser stack overflow",
870 &yyss1
, yysize
* sizeof (*yyssp
),
871 &yyvs1
, yysize
* sizeof (*yyvsp
),
872 ]b4_location_if([ &yyls1
, yysize
* sizeof (*yylsp
),])[
874 ]b4_location_if([ yyls
= yyls1
;])[
878 #else /* no yyoverflow */
879 # ifndef YYSTACK_RELOCATE
882 /* Extend the stack our own way. */
883 if (YYMAXDEPTH
<= yystacksize
)
886 if (YYMAXDEPTH
< yystacksize
)
887 yystacksize
= YYMAXDEPTH
;
891 union yyalloc
*yyptr
=
892 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
895 YYSTACK_RELOCATE (yyss
);
896 YYSTACK_RELOCATE (yyvs
);
897 ]b4_location_if([ YYSTACK_RELOCATE (yyls
);])[
898 # undef YYSTACK_RELOCATE
900 YYSTACK_FREE (yyss1
);
903 #endif /* no yyoverflow */
905 yyssp
= yyss
+ yysize
- 1;
906 yyvsp
= yyvs
+ yysize
- 1;
907 ]b4_location_if([ yylsp
= yyls
+ yysize
- 1;])[
909 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
910 (unsigned long int) yystacksize
));
912 if (yyss
+ yystacksize
- 1 <= yyssp
)
916 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
925 /* Do appropriate processing given the current state. */
926 /* Read a lookahead token if we need one and don't already have one. */
929 /* First try to decide what to do without reference to lookahead token. */
931 yyn
= yypact
[yystate
];
932 if (yyn
== YYPACT_NINF
)
935 /* Not known => get a lookahead token if don't already have one. */
937 /* yychar is either YYEMPTY or YYEOF
938 or a valid token in external form. */
940 if (yychar
== YYEMPTY
)
942 YYDPRINTF ((stderr
, "Reading a token: "));
946 /* Convert token to internal form (in yychar1) for indexing tables with. */
948 if (yychar
<= 0) /* This means end of input. */
951 yychar
= YYEOF
; /* Don't call YYLEX any more. */
953 YYDPRINTF ((stderr
, "Now at end of input.\n"));
957 yychar1
= YYTRANSLATE (yychar
);
959 /* We have to keep this `#if YYDEBUG', since we use variables
960 which are defined only if `YYDEBUG' is set. */
961 YYDPRINTF ((stderr
, "Next token is "));
962 YYDSYMPRINT ((stderr
, yychar1
, yylval
]b4_location_if([, yyloc
])[));
963 YYDPRINTF ((stderr
, "\n"));
966 /* If the proper action on seeing token YYCHAR1 is to reduce or to
967 detect an error, take that action. */
969 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yychar1
)
974 if (yyn
== 0 || yyn
== YYTABLE_NINF
)
983 /* Shift the lookahead token. */
984 YYDPRINTF ((stderr
, "Shifting token %d (%s), ",
985 yychar
, yytname
[yychar1
]));
987 /* Discard the token being shifted unless it is eof. */
992 ]b4_location_if([ *++yylsp
= yylloc
;])[
994 /* Count tokens shifted since error; after three, turn off error
1003 /*-----------------------------------------------------------.
1004 | yydefault -- do the default action for the current state. |
1005 `-----------------------------------------------------------*/
1007 yyn
= yydefact
[yystate
];
1013 /*-----------------------------.
1014 | yyreduce -- Do a reduction. |
1015 `-----------------------------*/
1017 /* yyn is the number of a rule to reduce with. */
1020 /* If YYLEN is nonzero, implement the default value of the action:
1023 Otherwise, the following line sets YYVAL to garbage.
1024 This behavior is undocumented and Bison
1025 users should not rely upon it. Assigning to YYVAL
1026 unconditionally makes the parser a bit smaller, and it avoids a
1027 GCC warning that YYVAL may be used uninitialized. */
1028 yyval
= yyvsp
[1-yylen
];
1031 [ /* Default location. */
1032 YYLLOC_DEFAULT (yyloc
, (yylsp
- yylen
), yylen
);])[
1035 /* We have to keep this `#if YYDEBUG', since we use variables which
1036 are defined only if `YYDEBUG' is set. */
1041 YYFPRINTF (stderr
, "Reducing via rule %d (line %d), ",
1042 yyn
- 1, yyrline
[yyn
]);
1044 /* Print the symbols being reduced, and their result. */
1045 for (yyi
= yyprhs
[yyn
]; 0 <= yyrhs
[yyi
]; yyi
++)
1046 YYFPRINTF (stderr
, "%s ", yytname
[yyrhs
[yyi
]]);
1047 YYFPRINTF (stderr
, " -> %s\n", yytname
[yyr1
[yyn
]]);
1055 /* Line __line__ of __file__. */
1056 #line __oline__ "__ofile__"
1060 ]b4_location_if([ yylsp
-= yylen
;])[
1065 short *yyssp1
= yyss
- 1;
1066 YYFPRINTF (stderr
, "state stack now");
1067 while (yyssp1
!= yyssp
)
1068 YYFPRINTF (stderr
, " %d", *++yyssp1
);
1069 YYFPRINTF (stderr
, "\n");
1074 ]b4_location_if([ *++yylsp
= yyloc
;])[
1076 /* Now `shift' the result of the reduction. Determine what state
1077 that goes to, based on the state we popped back to and the rule
1078 number reduced by. */
1082 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
1083 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
1084 yystate
= yytable
[yystate
];
1086 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
1091 /*------------------------------------.
1092 | yyerrlab -- here on detecting error |
1093 `------------------------------------*/
1095 /* If not already recovering from an error, report this error. */
1100 yyn
= yypact
[yystate
];
1102 if (YYPACT_NINF
< yyn
&& yyn
< YYLAST
)
1104 YYSIZE_T yysize
= 0;
1105 int yytype
= YYTRANSLATE (yychar
);
1110 /* Start YYX at -YYN if negative to avoid negative indexes in
1112 for (yyx
= yyn
< 0 ? -yyn
: 0;
1113 yyx
< (int) (sizeof (yytname
) / sizeof (char *)); yyx
++)
1114 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1115 yysize
+= yystrlen (yytname
[yyx
]) + 15, yycount
++;
1116 yysize
+= yystrlen ("parse error, unexpected ") + 1;
1117 yysize
+= yystrlen (yytname
[yytype
]);
1118 yymsg
= (char *) YYSTACK_ALLOC (yysize
);
1121 char *yyp
= yystpcpy (yymsg
, "parse error, unexpected ");
1122 yyp
= yystpcpy (yyp
, yytname
[yytype
]);
1127 for (yyx
= yyn
< 0 ? -yyn
: 0;
1128 yyx
< (int) (sizeof (yytname
) / sizeof (char *));
1130 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1132 const char *yyq
= ! yycount
? ", expecting " : " or ";
1133 yyp
= yystpcpy (yyp
, yyq
);
1134 yyp
= yystpcpy (yyp
, yytname
[yyx
]);
1138 yyerror (yymsg
]b4_pure_args
[);
1139 YYSTACK_FREE (yymsg
);
1142 yyerror ("parse error; also virtual memory exhausted"]b4_pure_args
[);
1145 #endif /* YYERROR_VERBOSE */
1146 yyerror ("parse error"]b4_pure_args
[);
1151 /*----------------------------------------------------.
1152 | yyerrlab1 -- error raised explicitly by an action. |
1153 `----------------------------------------------------*/
1155 if (yyerrstatus
== 3)
1157 /* If just tried and failed to reuse lookahead token after an
1158 error, discard it. */
1160 /* Return failure if at end of input. */
1161 if (yychar
== YYEOF
)
1163 /* Pop the error token. */
1165 /* Pop the rest of the stack. */
1166 while (yyss
< yyssp
)
1168 YYDPRINTF ((stderr
, "Error: popping "));
1169 YYDSYMPRINT ((stderr
,
1171 *yyvsp
]b4_location_if([, *yylsp
])[));
1172 YYDPRINTF ((stderr
, "\n"));
1173 yydestruct (yystos
[*yyssp
], *yyvsp
]b4_location_if([, *yylsp
])[);
1179 YYDPRINTF ((stderr
, "Discarding token %d (%s).\n",
1180 yychar
, yytname
[yychar1
]));
1181 yydestruct (yychar1
, yylval
]b4_location_if([, yylloc
])[);
1185 /* Else will try to reuse lookahead token after shifting the error
1188 yyerrstatus
= 3; /* Each real token shifted decrements this. */
1192 yyn
= yypact
[yystate
];
1193 if (yyn
!= YYPACT_NINF
)
1196 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
1204 /* Pop the current state because it cannot handle the error token. */
1208 YYDPRINTF ((stderr
, "Error: popping "));
1209 YYDSYMPRINT ((stderr
,
1210 yystos
[*yyssp
], *yyvsp
]b4_location_if([, *yylsp
])[));
1211 YYDPRINTF ((stderr
, "\n"));
1213 yydestruct (yystos
[yystate
], *yyvsp
]b4_location_if([, *yylsp
])[);
1216 ]b4_location_if([ yylsp
--;])[
1221 short *yyssp1
= yyss
- 1;
1222 YYFPRINTF (stderr
, "Error: state stack now");
1223 while (yyssp1
!= yyssp
)
1224 YYFPRINTF (stderr
, " %d", *++yyssp1
);
1225 YYFPRINTF (stderr
, "\n");
1233 YYDPRINTF ((stderr
, "Shifting error token, "));
1236 ]b4_location_if([ *++yylsp
= yylloc
;])[
1242 /*-------------------------------------.
1243 | yyacceptlab -- YYACCEPT comes here. |
1244 `-------------------------------------*/
1249 /*-----------------------------------.
1250 | yyabortlab -- YYABORT comes here. |
1251 `-----------------------------------*/
1257 /*----------------------------------------------.
1258 | yyoverflowlab -- parser overflow comes here. |
1259 `----------------------------------------------*/
1261 yyerror ("parser stack overflow"]b4_pure_args
[);
1269 YYSTACK_FREE (yyss
);
1276 m4_if(b4_defines_flag
, 0, [],
1277 [#output "b4_output_header_name"
1278 b4_copyright([Skeleton parser
for Yacc
-like parsing with Bison
],
1279 [1984, 1989, 1990, 2000, 2001, 2002])
1281 /* As a special exception, when this file is copied by Bison into a
1282 Bison output file, you may use that output file without restriction.
1283 This special exception was added by the Free Software Foundation
1284 in version 1.24 of Bison. */
1286 #ifndef b4_header_guard
1287 # define b4_header_guard
1289 b4_token_defines(b4_tokens
)
1292 m4_ifdef([b4_stype
],
1293 [#line b4_stype_line "b4_filename"
1294 typedef union b4_stype yystype
;
1295 /* Line __line__ of __file__. */
1296 #line __oline__ "__ofile__"],
1297 [typedef int yystype
;])
1298 # define YYSTYPE yystype
1302 [extern YYSTYPE b4_prefix
[]lval
;])
1306 typedef struct yyltype
1313 # define YYLTYPE yyltype
1317 [extern YYLTYPE b4_prefix
[]lloc
;])
1319 #endif /* not b4_header_guard */