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
])
36 # Accumule in b4_lex_param all the yylex arguments.
37 # Yes, this is quite ugly...
38 m4_define([b4_lex_param
],
39 m4_dquote(b4_pure_if([[[[YYSTYPE
*]], [[&yylval
]]][]dnl
40 b4_location_if([, [[YYLTYPE
*], [&yylloc
]]])])dnl
41 m4_ifdef([b4_lex_param
], [, ]b4_lex_param
)))
43 # Yes, this is quite ugly...
44 m4_define_default([b4_parse_param
])
45 m4_ifdef([b4_parse_param
],
46 [m4_define([b4_parse_param
],
55 # b4_int_type(MIN, MAX)
56 # ---------------------
57 # Return the smallest int type able to handle numbers ranging from
58 # MIN to MAX (included). We overwrite the version from c.m4 which relies
59 # on `signed char' which is not portable to old K&R compilers.
60 m4_define([b4_int_type],
61 [m4_if(b4_ints_in($@, [0], [255]), [1], [unsigned char],
62 b4_ints_in($@, [-128], [127]), [1], [yysigned_char],
64 b4_ints_in($@, [0], [65535]), [1], [unsigned short],
65 b4_ints_in($@, [-32768], [32767]), [1], [short],
67 m4_eval([0 <= $1]), [1], [unsigned int],
72 ## ----------------- ##
73 ## Semantic Values. ##
74 ## ----------------- ##
77 # b4_lhs_value([TYPE])
78 # --------------------
79 # Expansion of $<TYPE>$.
80 m4_define([b4_lhs_value],
81 [yyval[]m4_ifval([$1], [.$1])])
84 # b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
85 # --------------------------------------
86 # Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
88 m4_define([b4_rhs_value],
89 [yyvsp@<:@m4_eval([$2 - $1])@:>@m4_ifval([$3], [.$3])])
100 m4_define([b4_lhs_location],
104 # b4_rhs_location(RULE-LENGTH, NUM)
105 # ---------------------------------
106 # Expansion of @NUM, where the current rule has RULE-LENGTH symbols
108 m4_define([b4_rhs_location],
109 [yylsp@<:@m4_eval([$2 - $1])@:>@])
113 ## ------------------- ##
114 ## Output file names. ##
115 ## ------------------- ##
117 m4_define_default([b4_input_suffix], [.y])
119 m4_define_default([b4_output_parser_suffix],
120 [m4_translit(b4_input_suffix, [yY], [cC])])
122 m4_define_default([b4_output_parser_name],
123 [b4_output_prefix[]b4_output_infix[]b4_output_parser_suffix[]])
126 m4_define_default([b4_output_header_suffix],
127 [m4_translit(b4_input_suffix, [yY], [hH])])
129 m4_define_default([b4_output_header_name],
130 [b4_output_prefix[]b4_output_infix[]b4_output_header_suffix[]])
132 m4_define_default([b4_header_guard],
133 [m4_bpatsubst(m4_toupper([BISON_]b4_output_header_name),
134 [[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]], [_])])
138 ## --------------------------------------------------------- ##
139 ## Defining symbol actions, e.g., printers and destructors. ##
140 ## --------------------------------------------------------- ##
142 # b4_symbol_actions(FILENAME, LINENO,
143 # SYMBOL-TAG, SYMBOL-NUM,
144 # SYMBOL-ACTION, SYMBOL-TYPENAME)
145 # -------------------------------------------------
146 m4_define([b4_symbol_actions],
147 [m4_pushdef([b4_dollar_dollar], [yyvalue.$6])dnl
148 m4_pushdef([b4_at_dollar], [yylocation])dnl
152 #line __oline__ "__ofile__"
154 m4_popdef([b4_at_dollar])dnl
155 m4_popdef([b4_dollar_dollar])dnl
161 #output "b4_output_parser_name"
162 b4_copyright([Skeleton parser for Yacc-like parsing with Bison],
163 [1984, 1989, 1990, 2000, 2001, 2002])
165 /* As a special exception, when this file is copied by Bison into a
166 Bison output file, you may use that output file without restriction.
167 This special exception was added by the Free Software Foundation
168 in version 1.24 of Bison. */
170 /* Written by Richard Stallman by simplifying the original so called
171 ``semantic'' parser. */
173 /* All symbols defined below should begin with yy or YY, to avoid
174 infringing on user name space. This should be done even for local
175 variables, as they might otherwise be expanded by user macros.
176 There are some unavoidable exceptions within include files to
177 define necessary library symbols; they are noted "INFRINGES ON
178 USER NAME SPACE" below. */
180 /* Identify Bison output. */
184 #define YYPURE b4_pure
186 /* Using locations. */
187 #define YYLSP_NEEDED b4_locations_flag
189 m4_if(b4_prefix[], [yy], [],
190 [/* If NAME_PREFIX is specified substitute the variables and functions
192 #define yyparse b4_prefix[]parse
193 #define yylex b4_prefix[]lex
194 #define yyerror b4_prefix[]error
195 #define yylval b4_prefix[]lval
196 #define yychar b4_prefix[]char
197 #define yydebug b4_prefix[]debug
198 #define yynerrs b4_prefix[]nerrs
199 b4_location_if([#define yylloc b4_prefix[]lloc])])
201 b4_token_defines(b4_tokens)
203 /* Copy the first part of user declarations. */
206 /* Enabling traces. */
208 # define YYDEBUG b4_debug
211 /* Enabling verbose error messages. */
212 #ifdef YYERROR_VERBOSE
213 # undef YYERROR_VERBOSE
214 # define YYERROR_VERBOSE 1
216 # define YYERROR_VERBOSE b4_error_verbose
221 [#line b4_stype_line "b4_filename"
222 typedef union b4_stype yystype;
223 /* Line __line__ of __file__. */
224 #line __oline__ "__ofile__"],
225 [typedef int yystype;])
226 # define YYSTYPE yystype
227 # define YYSTYPE_IS_TRIVIAL 1
231 typedef struct yyltype
238 # define YYLTYPE b4_location_type
239 # define YYLTYPE_IS_TRIVIAL 1
242 /* Copy the second part of user declarations. */
245 /* Line __line__ of __file__. */
246 #line __oline__ "__ofile__"
248 #if ! defined (yyoverflow) || YYERROR_VERBOSE
250 /* The parser invokes alloca or malloc; define the necessary symbols. */
252 # if YYSTACK_USE_ALLOCA
253 # define YYSTACK_ALLOC alloca
255 # ifndef YYSTACK_USE_ALLOCA
256 # if defined (alloca) || defined (_ALLOCA_H)
257 # define YYSTACK_ALLOC alloca
260 # define YYSTACK_ALLOC __builtin_alloca
266 # ifdef YYSTACK_ALLOC
267 /* Pacify GCC's `empty if-body' warning. */
268 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
270 # if defined (__STDC__) || defined (__cplusplus)
271 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
272 # define YYSIZE_T size_t
274 # define YYSTACK_ALLOC malloc
275 # define YYSTACK_FREE free
277 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
280 #if (! defined (yyoverflow) \
281 && (! defined (__cplusplus) \
282 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
284 /* A type that is properly aligned for any stack member. */
289 b4_location_if([ YYLTYPE yyls;
293 /* The size of the maximum gap between one aligned stack and the next. */
294 # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
296 /* The size of an array large to enough to hold all stacks, each with
299 [# define YYSTACK_BYTES(N) \
300 ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
301 + 2 * YYSTACK_GAP_MAX)],
302 [# define YYSTACK_BYTES(N) \
303 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
306 /* Copy COUNT objects from FROM to TO. The source and destination do
310 # define YYCOPY(To, From, Count) \
311 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
313 # define YYCOPY(To, From, Count) \
316 register YYSIZE_T yyi; \
317 for (yyi = 0; yyi < (Count); yyi++) \
318 (To)[[yyi]] = (From)[[yyi]]; \
324 /* Relocate STACK from its old location to the new one. The
325 local variables YYSIZE and YYSTACKSIZE give the old and new number of
326 elements in the stack, and YYPTR gives the new location of the
327 stack. Advance YYPTR to a properly aligned location for the next
329 # define YYSTACK_RELOCATE(Stack) \
332 YYSIZE_T yynewbytes; \
333 YYCOPY (&yyptr->Stack, Stack, yysize); \
334 Stack = &yyptr->Stack; \
335 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
336 yyptr += yynewbytes / sizeof (*yyptr); \
342 #if defined (__STDC__) || defined (__cplusplus)
343 typedef signed char yysigned_char;
345 typedef short yysigned_char;
348 /* YYFINAL -- State number of the termination state. */
349 #define YYFINAL b4_final_state_number
350 /* YYLAST -- Last index in YYTABLE. */
351 #define YYLAST b4_last
353 /* YYNTOKENS -- Number of terminals. */
354 #define YYNTOKENS b4_tokens_number
355 /* YYNNTS -- Number of nonterminals. */
356 #define YYNNTS b4_nterms_number
357 /* YYNRULES -- Number of rules. */
358 #define YYNRULES b4_rules_number
359 /* YYNRULES -- Number of states. */
360 #define YYNSTATES b4_states_number
362 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
363 #define YYUNDEFTOK b4_undef_token_number
364 #define YYMAXUTOK b4_user_token_number_max
366 #define YYTRANSLATE(X) \
367 ((unsigned)(X) <= YYMAXUTOK ? yytranslate[[X]] : YYUNDEFTOK)
369 /* YYTRANSLATE[[YYLEX]] -- Bison symbol number corresponding to YYLEX. */
370 static const b4_int_type_for([b4_translate]) yytranslate[[]] =
376 /* YYPRHS[[YYN]] -- Index of the first RHS symbol of rule number YYN in
378 static const b4_int_type_for([b4_prhs]) yyprhs[[]] =
383 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
384 static const b4_int_type_for([b4_rhs]) yyrhs[[]] =
389 /* YYRLINE[[YYN]] -- source line where rule number YYN was defined. */
390 static const b4_int_type_for([b4_rline]) yyrline[[]] =
396 #if YYDEBUG || YYERROR_VERBOSE
397 /* YYTNME[[SYMBOL-NUM]] -- String name of the symbol SYMBOL-NUM.
398 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
399 static const char *const yytname[[]] =
406 /* YYTOKNUM[[YYLEX-NUM]] -- Internal token number corresponding to
408 static const b4_int_type_for([b4_toknum]) yytoknum[[]] =
414 /* YYR1[[YYN]] -- Symbol number of symbol that rule YYN derives. */
415 static const b4_int_type_for([b4_r1]) yyr1[[]] =
420 /* YYR2[[YYN]] -- Number of symbols composing right hand side of rule YYN. */
421 static const b4_int_type_for([b4_r2]) yyr2[[]] =
426 /* YYDEFACT[[STATE-NAME]] -- Default rule to reduce with in state
427 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
428 means the
default is an error
. */
429 static const b4_int_type_for([b4_defact
]) yydefact
[[]] =
434 /* YYDEFGOTO[[NTERM-NUM]]. */
435 static const b4_int_type_for([b4_defgoto
]) yydefgoto
[[]] =
440 /* YYPACT[[STATE-NUM]] -- Index in YYTABLE of the portion describing
442 #define YYPACT_NINF b4_pact_ninf
443 static const b4_int_type_for([b4_pact
]) yypact
[[]] =
448 /* YYPGOTO[[NTERM-NUM]]. */
449 static const b4_int_type_for([b4_pgoto
]) yypgoto
[[]] =
454 /* YYTABLE[[YYPACT[STATE-NUM]]]. What to do in state STATE-NUM. If
455 positive, shift that token. If negative, reduce the rule which
456 number is the opposite. If zero, do what YYDEFACT says.
457 If YYTABLE_NINF, parse error. */
458 #define YYTABLE_NINF b4_table_ninf
459 static const b4_int_type_for([b4_table
]) yytable
[[]] =
464 static const b4_int_type_for([b4_check
]) yycheck
[[]] =
469 /* YYSTOS[[STATE-NUM]] -- The (internal number of the) accessing
470 symbol of state STATE-NUM. */
471 static const b4_int_type_for([b4_stos
]) yystos
[[]] =
476 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
477 # define YYSIZE_T __SIZE_TYPE__
479 #if ! defined (YYSIZE_T) && defined (size_t)
480 # define YYSIZE_T size_t
482 #if ! defined (YYSIZE_T)
483 # if defined (__STDC__) || defined (__cplusplus)
484 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
485 # define YYSIZE_T size_t
488 #if ! defined (YYSIZE_T)
489 # define YYSIZE_T unsigned int
492 #define yyerrok (yyerrstatus = 0)
493 #define yyclearin (yychar = YYEMPTY)
497 #define YYACCEPT goto yyacceptlab
498 #define YYABORT goto yyabortlab
499 #define YYERROR goto yyerrlab1
501 /* Like YYERROR except do call yyerror. This remains here temporarily
502 to ease the transition to the new meaning of YYERROR, for GCC.
503 Once GCC version 2 has supplanted version 1, this can go. */
505 #define YYFAIL goto yyerrlab
507 #define YYRECOVERING() (!!yyerrstatus)
509 #define YYBACKUP(Token, Value) \
511 if (yychar == YYEMPTY && yylen == 1) \
515 yychar1 = YYTRANSLATE (yychar); \
521 yyerror ("syntax error: cannot back up"); \
527 #define YYERRCODE 256
529 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
532 #ifndef YYLLOC_DEFAULT
533 # define YYLLOC_DEFAULT(Current, Rhs, N) \
534 Current.first_line = Rhs[[1]].first_line; \
535 Current.first_column = Rhs[[1]].first_column; \
536 Current.last_line = Rhs[[N]].last_line; \
537 Current.last_column = Rhs[[N]].last_column;
540 /* YYLEX -- calling `yylex' with the right arguments. */
543 # define YYLEX yylex (b4_pure_if([&yylval[]b4_location_if([, &yylloc]), ])YYLEX_PARAM)
545 # define YYLEX b4_c_function_call([yylex], [int], b4_lex_param)
548 /* Enable debugging if requested. */
552 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
553 # define YYFPRINTF fprintf
556 # define YYDPRINTF(Args) \
561 # define YYDSYMPRINT(Args) \
566 /* Nonzero means print parse trace. It is left uninitialized so that
567 multiple parsers can coexist. */
570 # define YYDPRINTF(Args)
571 # define YYDSYMPRINT(Args)
572 #endif /* !YYDEBUG */
574 /* YYINITDEPTH -- initial size of the parser's stacks. */
576 # define YYINITDEPTH b4_stack_depth_init
579 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
580 if the built-in stack extension method is used).
582 Do not make this value too large; the results are undefined if
583 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
584 evaluated with infinite-precision integer arithmetic. */
591 # define YYMAXDEPTH b4_stack_depth_max
599 # if defined (__GLIBC__) && defined (_STRING_H)
600 # define yystrlen strlen
602 /* Return the length of YYSTR. */
604 # if defined (__STDC__) || defined (__cplusplus)
605 yystrlen (const char *yystr
)
611 register const char *yys
= yystr
;
613 while (*yys
++ != '\0')
616 return yys
- yystr
- 1;
622 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
623 # define yystpcpy stpcpy
625 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
628 # if defined (__STDC__) || defined (__cplusplus)
629 yystpcpy (char *yydest
, const char *yysrc
)
631 yystpcpy (yydest
, yysrc
)
636 register char *yyd
= yydest
;
637 register const char *yys
= yysrc
;
639 while ((*yyd
++ = *yys
++) != '\0')
647 #endif /* !YYERROR_VERBOSE */
652 /*-----------------------------.
653 | Print this symbol on YYOUT. |
654 `-----------------------------*/
656 b4_c_function_def([yysymprint
],
658 [[FILE *yyout
], [yyout
]],
659 [[int yytype
], [yytype
]],
660 [[YYSTYPE yyvalue
], [yyvalue
]]b4_location_if([,
661 [[YYLTYPE yylocation
], [yylocation
]]]))
663 /* Pacify ``unused variable'' warnings. */
665 b4_location_if([ (void) yylocation
;
668 if (yytype
< YYNTOKENS
)
670 YYFPRINTF (yyout
, "token %s (", yytname
[[yytype]]);
672 YYPRINT (yyout
, yytoknum
[[yytype]], yyvalue
);
676 YYFPRINTF (yyout
, "nterm %s (", yytname
[[yytype]]);
680 m4_map([b4_symbol_actions
], m4_defn([b4_symbol_printers
]))dnl
684 YYFPRINTF (yyout
, ")");
686 #endif /* YYDEBUG. */
689 /*-----------------------------------------------.
690 | Release the memory associated to this symbol. |
691 `-----------------------------------------------*/
693 b4_c_function_def([yydestruct
],
695 [[int yytype
], [yytype
]],
696 [[YYSTYPE yyvalue
], [yyvalue
]]b4_location_if([,
697 [[YYLTYPE yylocation
], [yylocation
]]]))
699 /* Pacify ``unused variable'' warnings. */
701 b4_location_if([ (void) yylocation
;
706 m4_map([b4_symbol_actions
], m4_defn([b4_symbol_destructors
]))dnl
714 /* Prevent warnings from -Wmissing-prototypes. */
717 # if defined (__STDC__) || defined (__cplusplus)
718 int yyparse (void *YYPARSE_PARAM
);
722 #else /* ! YYPARSE_PARAM */
723 b4_c_function_decl([yyparse
], [int], b4_parse_param
)
727 m4_divert_push([KILL
])# ======================== M4 code.
728 # b4_declare_parser_variables
729 # ---------------------------
730 # Declare the variables that are global, or local to YYPARSE if
732 m4_define([b4_declare_parser_variables
],
733 [/* The lookahead symbol. */
736 /* The semantic value of the lookahead symbol. */
739 /* Number of parse errors so far. */
740 int yynerrs
;b4_location_if([
741 /* Location data for the lookahead symbol. */
744 m4_divert_pop([KILL
])dnl
# ====================== End of M4 code.
747 [b4_declare_parser_variables
])
755 # if defined (__STDC__) || defined (__cplusplus)
756 int yyparse (void *YYPARSE_PARAM
)
758 int yyparse (YYPARSE_PARAM
)
761 #else /* ! YYPARSE_PARAM */
762 b4_c_function_def([yyparse
], [int], b4_parse_param
)
765 ]b4_pure_if([b4_declare_parser_variables
])[
766 register int yystate
;
769 /* Number of tokens to shift before error messages enabled. */
771 /* Lookahead token as an internal (translated) token number. */
774 /* Three stacks and their tools:
775 `yyss': related to states,
776 `yyvs': related to semantic values,
777 `yyls': related to locations.
779 Refer to the stacks thru separate pointers, to allow yyoverflow
780 to reallocate them elsewhere. */
782 /* The state stack. */
783 short yyssa
[YYINITDEPTH
];
785 register short *yyssp
;
787 /* The semantic value stack. */
788 YYSTYPE yyvsa
[YYINITDEPTH
];
789 YYSTYPE
*yyvs
= yyvsa
;
790 register YYSTYPE
*yyvsp
;
793 [[ /* The location stack. */
794 YYLTYPE yylsa
[YYINITDEPTH
];
795 YYLTYPE
*yyls
= yylsa
;
798 #define YYPOPSTACK (yyvsp--, yyssp--]b4_location_if([, yylsp--])[)
800 YYSIZE_T yystacksize
= YYINITDEPTH
;
802 /* The variables used to return semantic value and location from the
805 ]b4_location_if([ YYLTYPE yyloc
;])[
807 /* When reducing, the number of symbols on the RHS of the reduced
811 YYDPRINTF ((stderr
, "Starting parse\n"));
816 yychar
= YYEMPTY
; /* Cause a token to be read. */
818 /* Initialize stack pointers.
819 Waste one element of value and location stack
820 so that they stay on the same level as the state stack.
821 The wasted elements are never initialized. */
825 ]b4_location_if([ yylsp
= yyls
;])[
828 /*------------------------------------------------------------.
829 | yynewstate -- Push a new state, which is found in yystate. |
830 `------------------------------------------------------------*/
832 /* In all cases, when you get here, the value and location stacks
833 have just been pushed. so pushing a state here evens the stacks.
840 if (yyss
+ yystacksize
- 1 <= yyssp
)
842 /* Get the current used size of the three stacks, in elements. */
843 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
847 /* Give user a chance to reallocate the stack. Use copies of
848 these so that the &'s don't force the real ones into
850 YYSTYPE
*yyvs1
= yyvs
;
852 ]b4_location_if([ YYLTYPE
*yyls1
= yyls
;])[
854 /* Each stack pointer address is followed by the size of the
855 data in use in that stack, in bytes. This used to be a
856 conditional around just the two extra args, but that might
857 be undefined if yyoverflow is a macro. */
858 yyoverflow ("parser stack overflow",
859 &yyss1
, yysize
* sizeof (*yyssp
),
860 &yyvs1
, yysize
* sizeof (*yyvsp
),
861 ]b4_location_if([ &yyls1
, yysize
* sizeof (*yylsp
),])[
863 ]b4_location_if([ yyls
= yyls1
;])[
867 #else /* no yyoverflow */
868 # ifndef YYSTACK_RELOCATE
871 /* Extend the stack our own way. */
872 if (YYMAXDEPTH
<= yystacksize
)
875 if (YYMAXDEPTH
< yystacksize
)
876 yystacksize
= YYMAXDEPTH
;
880 union yyalloc
*yyptr
=
881 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
884 YYSTACK_RELOCATE (yyss
);
885 YYSTACK_RELOCATE (yyvs
);
886 ]b4_location_if([ YYSTACK_RELOCATE (yyls
);])[
887 # undef YYSTACK_RELOCATE
889 YYSTACK_FREE (yyss1
);
892 #endif /* no yyoverflow */
894 yyssp
= yyss
+ yysize
- 1;
895 yyvsp
= yyvs
+ yysize
- 1;
896 ]b4_location_if([ yylsp
= yyls
+ yysize
- 1;])[
898 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
899 (unsigned long int) yystacksize
));
901 if (yyss
+ yystacksize
- 1 <= yyssp
)
905 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
914 /* Do appropriate processing given the current state. */
915 /* Read a lookahead token if we need one and don't already have one. */
918 /* First try to decide what to do without reference to lookahead token. */
920 yyn
= yypact
[yystate
];
921 if (yyn
== YYPACT_NINF
)
924 /* Not known => get a lookahead token if don't already have one. */
926 /* yychar is either YYEMPTY or YYEOF
927 or a valid token in external form. */
929 if (yychar
== YYEMPTY
)
931 YYDPRINTF ((stderr
, "Reading a token: "));
935 /* Convert token to internal form (in yychar1) for indexing tables with. */
937 if (yychar
<= 0) /* This means end of input. */
940 yychar
= YYEOF
; /* Don't call YYLEX any more. */
942 YYDPRINTF ((stderr
, "Now at end of input.\n"));
946 yychar1
= YYTRANSLATE (yychar
);
948 /* We have to keep this `#if YYDEBUG', since we use variables
949 which are defined only if `YYDEBUG' is set. */
950 YYDPRINTF ((stderr
, "Next token is "));
951 YYDSYMPRINT ((stderr
, yychar1
, yylval
]b4_location_if([, yyloc
])[));
952 YYDPRINTF ((stderr
, "\n"));
955 /* If the proper action on seeing token YYCHAR1 is to reduce or to
956 detect an error, take that action. */
958 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yychar1
)
963 if (yyn
== 0 || yyn
== YYTABLE_NINF
)
972 /* Shift the lookahead token. */
973 YYDPRINTF ((stderr
, "Shifting token %d (%s), ",
974 yychar
, yytname
[yychar1
]));
976 /* Discard the token being shifted unless it is eof. */
981 ]b4_location_if([ *++yylsp
= yylloc
;])[
983 /* Count tokens shifted since error; after three, turn off error
992 /*-----------------------------------------------------------.
993 | yydefault -- do the default action for the current state. |
994 `-----------------------------------------------------------*/
996 yyn
= yydefact
[yystate
];
1002 /*-----------------------------.
1003 | yyreduce -- Do a reduction. |
1004 `-----------------------------*/
1006 /* yyn is the number of a rule to reduce with. */
1009 /* If YYLEN is nonzero, implement the default value of the action:
1012 Otherwise, the following line sets YYVAL to garbage.
1013 This behavior is undocumented and Bison
1014 users should not rely upon it. Assigning to YYVAL
1015 unconditionally makes the parser a bit smaller, and it avoids a
1016 GCC warning that YYVAL may be used uninitialized. */
1017 yyval
= yyvsp
[1-yylen
];
1020 [ /* Default location. */
1021 YYLLOC_DEFAULT (yyloc
, (yylsp
- yylen
), yylen
);])[
1024 /* We have to keep this `#if YYDEBUG', since we use variables which
1025 are defined only if `YYDEBUG' is set. */
1030 YYFPRINTF (stderr
, "Reducing via rule %d (line %d), ",
1031 yyn
- 1, yyrline
[yyn
]);
1033 /* Print the symbols being reduced, and their result. */
1034 for (yyi
= yyprhs
[yyn
]; 0 <= yyrhs
[yyi
]; yyi
++)
1035 YYFPRINTF (stderr
, "%s ", yytname
[yyrhs
[yyi
]]);
1036 YYFPRINTF (stderr
, " -> %s\n", yytname
[yyr1
[yyn
]]);
1044 /* Line __line__ of __file__. */
1045 #line __oline__ "__ofile__"
1049 ]b4_location_if([ yylsp
-= yylen
;])[
1054 short *yyssp1
= yyss
- 1;
1055 YYFPRINTF (stderr
, "state stack now");
1056 while (yyssp1
!= yyssp
)
1057 YYFPRINTF (stderr
, " %d", *++yyssp1
);
1058 YYFPRINTF (stderr
, "\n");
1063 ]b4_location_if([ *++yylsp
= yyloc
;])[
1065 /* Now `shift' the result of the reduction. Determine what state
1066 that goes to, based on the state we popped back to and the rule
1067 number reduced by. */
1071 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
1072 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
1073 yystate
= yytable
[yystate
];
1075 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
1080 /*------------------------------------.
1081 | yyerrlab -- here on detecting error |
1082 `------------------------------------*/
1084 /* If not already recovering from an error, report this error. */
1089 yyn
= yypact
[yystate
];
1091 if (YYPACT_NINF
< yyn
&& yyn
< YYLAST
)
1093 YYSIZE_T yysize
= 0;
1094 int yytype
= YYTRANSLATE (yychar
);
1099 /* Start YYX at -YYN if negative to avoid negative indexes in
1101 for (yyx
= yyn
< 0 ? -yyn
: 0;
1102 yyx
< (int) (sizeof (yytname
) / sizeof (char *)); yyx
++)
1103 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1104 yysize
+= yystrlen (yytname
[yyx
]) + 15, yycount
++;
1105 yysize
+= yystrlen ("parse error, unexpected ") + 1;
1106 yysize
+= yystrlen (yytname
[yytype
]);
1107 yymsg
= (char *) YYSTACK_ALLOC (yysize
);
1110 char *yyp
= yystpcpy (yymsg
, "parse error, unexpected ");
1111 yyp
= yystpcpy (yyp
, yytname
[yytype
]);
1116 for (yyx
= yyn
< 0 ? -yyn
: 0;
1117 yyx
< (int) (sizeof (yytname
) / sizeof (char *));
1119 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1121 const char *yyq
= ! yycount
? ", expecting " : " or ";
1122 yyp
= yystpcpy (yyp
, yyq
);
1123 yyp
= yystpcpy (yyp
, yytname
[yyx
]);
1128 YYSTACK_FREE (yymsg
);
1131 yyerror ("parse error; also virtual memory exhausted");
1134 #endif /* YYERROR_VERBOSE */
1135 yyerror ("parse error");
1140 /*----------------------------------------------------.
1141 | yyerrlab1 -- error raised explicitly by an action. |
1142 `----------------------------------------------------*/
1144 if (yyerrstatus
== 3)
1146 /* If just tried and failed to reuse lookahead token after an
1147 error, discard it. */
1149 /* Return failure if at end of input. */
1150 if (yychar
== YYEOF
)
1152 /* Pop the error token. */
1154 /* Pop the rest of the stack. */
1155 while (yyss
< yyssp
)
1157 YYDPRINTF ((stderr
, "Error: popping "));
1158 YYDSYMPRINT ((stderr
,
1160 *yyvsp
]b4_location_if([, *yylsp
])[));
1161 YYDPRINTF ((stderr
, "\n"));
1162 yydestruct (yystos
[*yyssp
], *yyvsp
]b4_location_if([, *yylsp
])[);
1168 YYDPRINTF ((stderr
, "Discarding token %d (%s).\n",
1169 yychar
, yytname
[yychar1
]));
1170 yydestruct (yychar1
, yylval
]b4_location_if([, yylloc
])[);
1174 /* Else will try to reuse lookahead token after shifting the error
1177 yyerrstatus
= 3; /* Each real token shifted decrements this. */
1181 yyn
= yypact
[yystate
];
1182 if (yyn
!= YYPACT_NINF
)
1185 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
1193 /* Pop the current state because it cannot handle the error token. */
1197 YYDPRINTF ((stderr
, "Error: popping "));
1198 YYDSYMPRINT ((stderr
,
1199 yystos
[*yyssp
], *yyvsp
]b4_location_if([, *yylsp
])[));
1200 YYDPRINTF ((stderr
, "\n"));
1202 yydestruct (yystos
[yystate
], *yyvsp
]b4_location_if([, *yylsp
])[);
1205 ]b4_location_if([ yylsp
--;])[
1210 short *yyssp1
= yyss
- 1;
1211 YYFPRINTF (stderr
, "Error: state stack now");
1212 while (yyssp1
!= yyssp
)
1213 YYFPRINTF (stderr
, " %d", *++yyssp1
);
1214 YYFPRINTF (stderr
, "\n");
1222 YYDPRINTF ((stderr
, "Shifting error token, "));
1225 ]b4_location_if([ *++yylsp
= yylloc
;])[
1231 /*-------------------------------------.
1232 | yyacceptlab -- YYACCEPT comes here. |
1233 `-------------------------------------*/
1238 /*-----------------------------------.
1239 | yyabortlab -- YYABORT comes here. |
1240 `-----------------------------------*/
1246 /*----------------------------------------------.
1247 | yyoverflowlab -- parser overflow comes here. |
1248 `----------------------------------------------*/
1250 yyerror ("parser stack overflow");
1258 YYSTACK_FREE (yyss
);
1265 m4_if(b4_defines_flag
, 0, [],
1266 [#output "b4_output_header_name"
1267 b4_copyright([Skeleton parser
for Yacc
-like parsing with Bison
],
1268 [1984, 1989, 1990, 2000, 2001, 2002])
1270 /* As a special exception, when this file is copied by Bison into a
1271 Bison output file, you may use that output file without restriction.
1272 This special exception was added by the Free Software Foundation
1273 in version 1.24 of Bison. */
1275 #ifndef b4_header_guard
1276 # define b4_header_guard
1278 b4_token_defines(b4_tokens
)
1281 m4_ifdef([b4_stype
],
1282 [#line b4_stype_line "b4_filename"
1283 typedef union b4_stype yystype
;
1284 /* Line __line__ of __file__. */
1285 #line __oline__ "__ofile__"],
1286 [typedef int yystype
;])
1287 # define YYSTYPE yystype
1291 [extern YYSTYPE b4_prefix
[]lval
;])
1295 typedef struct yyltype
1302 # define YYLTYPE yyltype
1306 [extern YYLTYPE b4_prefix
[]lloc
;])
1308 #endif /* not b4_header_guard */