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
])
39 ## ----------------- ##
40 ## Semantic Values. ##
41 ## ----------------- ##
44 # b4_lhs_value([TYPE])
45 # --------------------
46 # Expansion of $<TYPE>$.
47 m4_define([b4_lhs_value
],
48 [yyval
[]m4_ifval([$
1], [.$
1])])
51 # b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
52 # --------------------------------------
53 # Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
55 m4_define([b4_rhs_value
],
56 [yyvsp@
<:@
m4_eval([$
2 - $
1])@
:>@
m4_ifval([$
3], [.$
3])])
64 # b4_location_if(IF-TRUE, IF-FALSE)
65 # ---------------------------------
66 # Expand IF-TRUE, if locations are used, IF-FALSE otherwise.
67 m4_define([b4_location_if
],
68 [m4_if(b4_locations_flag
, [1],
76 m4_define([b4_lhs_location
],
80 # b4_rhs_location(RULE-LENGTH, NUM)
81 # ---------------------------------
82 # Expansion of @NUM, where the current rule has RULE-LENGTH symbols
84 m4_define([b4_rhs_location
],
85 [yylsp@
<:@
m4_eval([$
2 - $
1])@
:>@
])
93 # b4_pure_if(IF-TRUE, IF-FALSE)
94 # -----------------------------
95 # Expand IF-TRUE, if %pure-parser, IF-FALSE otherwise.
96 m4_define([b4_pure_if
],
102 ## ------------------- ##
103 ## Output file names. ##
104 ## ------------------- ##
106 m4_define_default([b4_input_suffix
], [.y
])
108 m4_define_default([b4_output_parser_suffix
],
109 [m4_translit(b4_input_suffix
, [yY
], [cC
])])
111 m4_define_default([b4_output_parser_name
],
112 [b4_output_prefix
[]b4_output_infix
[]b4_output_parser_suffix
[]])
115 m4_define_default([b4_output_header_suffix
],
116 [m4_translit(b4_input_suffix
, [yY
], [hH
])])
118 m4_define_default([b4_output_header_name
],
119 [b4_output_prefix
[]b4_output_infix
[]b4_output_header_suffix
[]])
121 m4_define_default([b4_header_guard
],
122 [m4_bpatsubst(m4_toupper([BISON_
]b4_output_header_name
),
123 [[^ABCDEFGHIJKLMNOPQRSTUVWXYZ
]], [_
])])
127 ## --------------------------------------------------------- ##
128 ## Defining symbol actions, e.g., printers and destructors. ##
129 ## --------------------------------------------------------- ##
131 # b4_symbol_actions(FILENAME, LINENO,
132 # SYMBOL-TAG, SYMBOL-NUM,
133 # SYMBOL-ACTION, SYMBOL-TYPENAME)
134 # -------------------------------------------------
135 m4_define([b4_symbol_actions
],
136 [m4_pushdef([b4_dollar_dollar
], [yyvalue
.$
6])dnl
137 m4_pushdef([b4_at_dollar
], [yylocation
])dnl
141 #line __oline__ "__ofile__"
143 m4_popdef([b4_at_dollar
])dnl
144 m4_popdef([b4_dollar_dollar
])dnl
150 #output "b4_output_parser_name"
151 b4_copyright([Skeleton parser
for Yacc
-like parsing with Bison
],
152 [1984, 1989, 1990, 2000, 2001, 2002])
154 /* As a special exception, when this file is copied by Bison into a
155 Bison output file, you may use that output file without restriction.
156 This special exception was added by the Free Software Foundation
157 in version 1.24 of Bison. */
159 /* Written by Richard Stallman by simplifying the original so called
160 ``semantic'' parser. */
162 /* All symbols defined below should begin with yy or YY, to avoid
163 infringing on user name space. This should be done even for local
164 variables, as they might otherwise be expanded by user macros.
165 There are some unavoidable exceptions within include files to
166 define necessary library symbols; they are noted "INFRINGES ON
167 USER NAME SPACE" below. */
169 /* Identify Bison output. */
173 #define YYPURE b4_pure
175 /* Using locations. */
176 #define YYLSP_NEEDED b4_locations_flag
178 m4_if(b4_prefix
[], [yy
], [],
179 [/* If NAME_PREFIX is specified substitute the variables and functions
181 #define yyparse b4_prefix[]parse
182 #define yylex b4_prefix[]lex
183 #define yyerror b4_prefix[]error
184 #define yylval b4_prefix[]lval
185 #define yychar b4_prefix[]char
186 #define yydebug b4_prefix[]debug
187 #define yynerrs b4_prefix[]nerrs
188 b4_location_if([#define yylloc b4_prefix[]lloc])])
190 b4_token_defines(b4_tokens
)
192 /* Copy the first part of user declarations. */
195 /* Enabling traces. */
197 # define YYDEBUG b4_debug
200 /* Enabling verbose error messages. */
201 #ifdef YYERROR_VERBOSE
202 # undef YYERROR_VERBOSE
203 # define YYERROR_VERBOSE 1
205 # define YYERROR_VERBOSE b4_error_verbose
210 [#line b4_stype_line "b4_filename"
211 typedef union b4_stype yystype
;
212 /* Line __line__ of __file__. */
213 #line __oline__ "__ofile__"],
214 [typedef int yystype
;])
215 # define YYSTYPE yystype
216 # define YYSTYPE_IS_TRIVIAL 1
220 typedef struct yyltype
227 # define YYLTYPE b4_location_type
228 # define YYLTYPE_IS_TRIVIAL 1
231 /* Copy the second part of user declarations. */
234 /* Line __line__ of __file__. */
235 #line __oline__ "__ofile__"
237 #if ! defined (yyoverflow) || YYERROR_VERBOSE
239 /* The parser invokes alloca or malloc; define the necessary symbols. */
241 # if YYSTACK_USE_ALLOCA
242 # define YYSTACK_ALLOC alloca
244 # ifndef YYSTACK_USE_ALLOCA
245 # if defined (alloca) || defined (_ALLOCA_H)
246 # define YYSTACK_ALLOC alloca
249 # define YYSTACK_ALLOC __builtin_alloca
255 # ifdef YYSTACK_ALLOC
256 /* Pacify GCC's `empty if-body' warning. */
257 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
259 # if defined (__STDC__) || defined (__cplusplus)
260 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
261 # define YYSIZE_T size_t
263 # define YYSTACK_ALLOC malloc
264 # define YYSTACK_FREE free
266 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
269 #if (! defined (yyoverflow) \
270 && (! defined (__cplusplus) \
271 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
273 /* A type that is properly aligned for any stack member. */
278 b4_location_if([ YYLTYPE yyls
;
282 /* The size of the maximum gap between one aligned stack and the next. */
283 # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
285 /* The size of an array large to enough to hold all stacks, each with
288 [# define YYSTACK_BYTES(N) \
289 ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
290 + 2 * YYSTACK_GAP_MAX)],
291 [# define YYSTACK_BYTES(N) \
292 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
295 /* Copy COUNT objects from FROM to TO. The source and destination do
299 # define YYCOPY(To, From, Count) \
300 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
302 # define YYCOPY(To, From, Count) \
305 register YYSIZE_T yyi; \
306 for (yyi = 0; yyi < (Count); yyi++) \
307 (To)[[yyi]] = (From)[[yyi]]; \
313 /* Relocate STACK from its old location to the new one. The
314 local variables YYSIZE and YYSTACKSIZE give the old and new number of
315 elements in the stack, and YYPTR gives the new location of the
316 stack. Advance YYPTR to a properly aligned location for the next
318 # define YYSTACK_RELOCATE(Stack) \
321 YYSIZE_T yynewbytes; \
322 YYCOPY (&yyptr->Stack, Stack, yysize); \
323 Stack = &yyptr->Stack; \
324 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
325 yyptr += yynewbytes / sizeof (*yyptr); \
331 #if defined (__STDC__) || defined (__cplusplus)
332 typedef signed char yysigned_char
;
334 typedef short yysigned_char
;
337 /* YYFINAL -- State number of the termination state. */
338 #define YYFINAL b4_final_state_number
339 #define YYLAST b4_last
341 /* YYNTOKENS -- Number of terminals. */
342 #define YYNTOKENS b4_tokens_number
343 /* YYNNTS -- Number of nonterminals. */
344 #define YYNNTS b4_nterms_number
345 /* YYNRULES -- Number of rules. */
346 #define YYNRULES b4_rules_number
347 /* YYNRULES -- Number of states. */
348 #define YYNSTATES b4_states_number
350 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
351 #define YYUNDEFTOK b4_undef_token_number
352 #define YYMAXUTOK b4_user_token_number_max
354 #define YYTRANSLATE(X) \
355 ((unsigned)(X) <= YYMAXUTOK ? yytranslate[[X]] : YYUNDEFTOK)
357 /* YYTRANSLATE[[YYLEX]] -- Bison symbol number corresponding to YYLEX. */
358 static const b4_int_type_for([b4_translate
]) yytranslate
[[]] =
364 /* YYPRHS[[YYN]] -- Index of the first RHS symbol of rule number YYN in
366 static const b4_int_type_for([b4_prhs
]) yyprhs
[[]] =
371 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
372 static const b4_int_type_for([b4_rhs
]) yyrhs
[[]] =
377 /* YYRLINE[[YYN]] -- source line where rule number YYN was defined. */
378 static const b4_int_type_for([b4_rline
]) yyrline
[[]] =
384 #if YYDEBUG || YYERROR_VERBOSE
385 /* YYTNME[[SYMBOL-NUM]] -- String name of the symbol SYMBOL-NUM.
386 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
387 static const char *const yytname
[[]] =
394 /* YYTOKNUM[[YYLEX-NUM]] -- Internal token number corresponding to
396 static const b4_int_type_for([b4_toknum
]) yytoknum
[[]] =
402 /* YYR1[[YYN]] -- Symbol number of symbol that rule YYN derives. */
403 static const b4_int_type_for([b4_r1
]) yyr1
[[]] =
408 /* YYR2[[YYN]] -- Number of symbols composing right hand side of rule YYN. */
409 static const b4_int_type_for([b4_r2
]) yyr2
[[]] =
414 /* YYDEFACT[[STATE-NAME]] -- Default rule to reduce with in state
415 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
416 means the default is an error. */
417 static const b4_int_type_for([b4_defact
]) yydefact
[[]] =
422 /* YYDEFGOTO[[NTERM-NUM]]. */
423 static const b4_int_type_for([b4_defgoto
]) yydefgoto
[[]] =
428 /* YYPACT[[STATE-NUM]] -- Index in YYTABLE of the portion describing
430 #define YYPACT_NINF b4_pact_ninf
431 static const b4_int_type_for([b4_pact
]) yypact
[[]] =
436 /* YYPGOTO[[NTERM-NUM]]. */
437 static const b4_int_type_for([b4_pgoto
]) yypgoto
[[]] =
442 /* YYTABLE[[YYPACT[STATE-NUM]]]. What to do in state STATE-NUM. If
443 positive, shift that token. If negative, reduce the rule which
444 number is the opposite. If zero, do what YYDEFACT says.
445 If YYTABLE_NINF, parse error. */
446 #define YYTABLE_NINF b4_table_ninf
447 static const b4_int_type_for([b4_table
]) yytable
[[]] =
452 static const b4_int_type_for([b4_check
]) yycheck
[[]] =
457 /* YYSTOS[[STATE-NUM]] -- The (internal number of the) accessing
458 symbol of state STATE-NUM. */
459 static const b4_int_type_for([b4_stos
]) yystos
[[]] =
464 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
465 # define YYSIZE_T __SIZE_TYPE__
467 #if ! defined (YYSIZE_T) && defined (size_t)
468 # define YYSIZE_T size_t
470 #if ! defined (YYSIZE_T)
471 # if defined (__STDC__) || defined (__cplusplus)
472 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
473 # define YYSIZE_T size_t
476 #if ! defined (YYSIZE_T)
477 # define YYSIZE_T unsigned int
480 #define yyerrok (yyerrstatus = 0)
481 #define yyclearin (yychar = YYEMPTY)
485 #define YYACCEPT goto yyacceptlab
486 #define YYABORT goto yyabortlab
487 #define YYERROR goto yyerrlab1
489 /* Like YYERROR except do call yyerror. This remains here temporarily
490 to ease the transition to the new meaning of YYERROR, for GCC.
491 Once GCC version 2 has supplanted version 1, this can go. */
493 #define YYFAIL goto yyerrlab
495 #define YYRECOVERING() (!!yyerrstatus)
497 #define YYBACKUP(Token, Value) \
499 if (yychar == YYEMPTY && yylen == 1) \
503 yychar1 = YYTRANSLATE (yychar); \
509 yyerror ("syntax error: cannot back up"); \
515 #define YYERRCODE 256
517 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
520 #ifndef YYLLOC_DEFAULT
521 # define YYLLOC_DEFAULT(Current, Rhs, N) \
522 Current.first_line = Rhs[[1]].first_line; \
523 Current.first_column = Rhs[[1]].first_column; \
524 Current.last_line = Rhs[[N]].last_line; \
525 Current.last_column = Rhs[[N]].last_column;
528 /* YYLEX -- calling `yylex' with the right arguments. */
531 # define YYLEX yylex (b4_pure_if([&yylval[]b4_location_if([, &yylloc]), ])YYLEX_PARAM)
533 # define YYLEX b4_c_function_call([yylex], [int],
534 b4_pure_if([[[[]], [[&yylval
]]],
535 b4_location_if([[[], [&yylloc
]],])])
536 m4_fst(b4_lex_param
))
539 /* Enable debugging if requested. */
543 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
544 # define YYFPRINTF fprintf
547 # define YYDPRINTF(Args) \
552 # define YYDSYMPRINT(Args) \
557 /* Nonzero means print parse trace. It is left uninitialized so that
558 multiple parsers can coexist. */
561 # define YYDPRINTF(Args)
562 # define YYDSYMPRINT(Args)
563 #endif /* !YYDEBUG */
565 /* YYINITDEPTH -- initial size of the parser's stacks. */
567 # define YYINITDEPTH b4_stack_depth_init
570 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
571 if the built-in stack extension method is used).
573 Do not make this value too large; the results are undefined if
574 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
575 evaluated with infinite-precision integer arithmetic. */
582 # define YYMAXDEPTH b4_stack_depth_max
590 # if defined (__GLIBC__) && defined (_STRING_H)
591 # define yystrlen strlen
593 /* Return the length of YYSTR. */
595 # if defined (__STDC__) || defined (__cplusplus)
596 yystrlen (const char *yystr
)
602 register const char *yys
= yystr
;
604 while (*yys
++ != '\0')
607 return yys
- yystr
- 1;
613 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
614 # define yystpcpy stpcpy
616 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
619 # if defined (__STDC__) || defined (__cplusplus)
620 yystpcpy (char *yydest
, const char *yysrc
)
622 yystpcpy (yydest
, yysrc
)
627 register char *yyd
= yydest
;
628 register const char *yys
= yysrc
;
630 while ((*yyd
++ = *yys
++) != '\0')
638 #endif /* !YYERROR_VERBOSE */
643 /*-----------------------------.
644 | Print this symbol on YYOUT. |
645 `-----------------------------*/
647 b4_c_function([yysymprint
],
651 [[YYSTYPE
], [yyvalue
]]b4_location_if([,
652 [[YYLTYPE
], [yylocation
]]]))
654 /* Pacify ``unused variable'' warnings. */
656 b4_location_if([ (void) yylocation
;
659 if (yytype
< YYNTOKENS
)
661 YYFPRINTF (yyout
, "token %s (", yytname
[[yytype]]);
663 YYPRINT (yyout
, yytoknum
[[yytype]], yyvalue
);
667 YYFPRINTF (yyout
, "nterm %s (", yytname
[[yytype]]);
671 m4_map([b4_symbol_actions
], m4_defn([b4_symbol_printers
]))dnl
675 YYFPRINTF (yyout
, ")");
677 #endif /* YYDEBUG. */
680 /*-----------------------------------------------.
681 | Release the memory associated to this symbol. |
682 `-----------------------------------------------*/
684 b4_c_function([yydestruct
],
687 [[YYSTYPE
], [yyvalue
]]b4_location_if([,
688 [[YYLTYPE
], [yylocation
]]]))
690 /* Pacify ``unused variable'' warnings. */
692 b4_location_if([ (void) yylocation
;
697 m4_map([b4_symbol_actions
], m4_defn([b4_symbol_destructors
]))dnl
705 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
706 into yyparse. The argument should have type void *.
707 It should actually point to an object.
708 Grammar actions can access the variable by casting it
709 to the proper pointer type. */
712 # if defined (__STDC__) || defined (__cplusplus)
713 # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
714 # define YYPARSE_PARAM_DECL
716 # define YYPARSE_PARAM_ARG YYPARSE_PARAM
717 # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
719 #else /* !YYPARSE_PARAM */
720 # define YYPARSE_PARAM_ARG
721 # define YYPARSE_PARAM_DECL
722 #endif /* !YYPARSE_PARAM */
724 /* Prevent warning if -Wstrict-prototypes. */
726 # ifdef YYPARSE_PARAM
727 int yyparse (void *);
733 m4_divert_push([KILL
])# ======================== M4 code.
734 # b4_declare_parser_variables
735 # ---------------------------
736 # Declare the variables that are global, or local to YYPARSE if
738 m4_define([b4_declare_parser_variables
],
739 [/* The lookahead symbol. */
742 /* The semantic value of the lookahead symbol. */
745 /* Number of parse errors so far. */
746 int yynerrs
;b4_location_if([
747 /* Location data for the lookahead symbol. */
750 m4_divert_pop([KILL
])dnl
# ====================== End of M4 code.
753 [b4_declare_parser_variables
])
756 yyparse (YYPARSE_PARAM_ARG
)
759 ]b4_pure_if([b4_declare_parser_variables
])[
760 register int yystate
;
763 /* Number of tokens to shift before error messages enabled. */
765 /* Lookahead token as an internal (translated) token number. */
768 /* Three stacks and their tools:
769 `yyss': related to states,
770 `yyvs': related to semantic values,
771 `yyls': related to locations.
773 Refer to the stacks thru separate pointers, to allow yyoverflow
774 to reallocate them elsewhere. */
776 /* The state stack. */
777 short yyssa
[YYINITDEPTH
];
779 register short *yyssp
;
781 /* The semantic value stack. */
782 YYSTYPE yyvsa
[YYINITDEPTH
];
783 YYSTYPE
*yyvs
= yyvsa
;
784 register YYSTYPE
*yyvsp
;
787 [[ /* The location stack. */
788 YYLTYPE yylsa
[YYINITDEPTH
];
789 YYLTYPE
*yyls
= yylsa
;
792 #define YYPOPSTACK (yyvsp--, yyssp--]b4_location_if([, yylsp--])[)
794 YYSIZE_T yystacksize
= YYINITDEPTH
;
796 /* The variables used to return semantic value and location from the
799 ]b4_location_if([ YYLTYPE yyloc
;])[
801 /* When reducing, the number of symbols on the RHS of the reduced
805 YYDPRINTF ((stderr
, "Starting parse\n"));
810 yychar
= YYEMPTY
; /* Cause a token to be read. */
812 /* Initialize stack pointers.
813 Waste one element of value and location stack
814 so that they stay on the same level as the state stack.
815 The wasted elements are never initialized. */
819 ]b4_location_if([ yylsp
= yyls
;])[
822 /*------------------------------------------------------------.
823 | yynewstate -- Push a new state, which is found in yystate. |
824 `------------------------------------------------------------*/
826 /* In all cases, when you get here, the value and location stacks
827 have just been pushed. so pushing a state here evens the stacks.
834 if (yyssp
>= yyss
+ yystacksize
- 1)
836 /* Get the current used size of the three stacks, in elements. */
837 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
841 /* Give user a chance to reallocate the stack. Use copies of
842 these so that the &'s don't force the real ones into
844 YYSTYPE
*yyvs1
= yyvs
;
846 ]b4_location_if([ YYLTYPE
*yyls1
= yyls
;])[
848 /* Each stack pointer address is followed by the size of the
849 data in use in that stack, in bytes. This used to be a
850 conditional around just the two extra args, but that might
851 be undefined if yyoverflow is a macro. */
852 yyoverflow ("parser stack overflow",
853 &yyss1
, yysize
* sizeof (*yyssp
),
854 &yyvs1
, yysize
* sizeof (*yyvsp
),
855 ]b4_location_if([ &yyls1
, yysize
* sizeof (*yylsp
),])[
857 ]b4_location_if([ yyls
= yyls1
;])[
861 #else /* no yyoverflow */
862 # ifndef YYSTACK_RELOCATE
865 /* Extend the stack our own way. */
866 if (yystacksize
>= YYMAXDEPTH
)
869 if (yystacksize
> YYMAXDEPTH
)
870 yystacksize
= YYMAXDEPTH
;
874 union yyalloc
*yyptr
=
875 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
878 YYSTACK_RELOCATE (yyss
);
879 YYSTACK_RELOCATE (yyvs
);
880 ]b4_location_if([ YYSTACK_RELOCATE (yyls
);])[
881 # undef YYSTACK_RELOCATE
883 YYSTACK_FREE (yyss1
);
886 #endif /* no yyoverflow */
888 yyssp
= yyss
+ yysize
- 1;
889 yyvsp
= yyvs
+ yysize
- 1;
890 ]b4_location_if([ yylsp
= yyls
+ yysize
- 1;])[
892 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
893 (unsigned long int) yystacksize
));
895 if (yyssp
>= yyss
+ yystacksize
- 1)
899 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
908 /* Do appropriate processing given the current state. */
909 /* Read a lookahead token if we need one and don't already have one. */
912 /* First try to decide what to do without reference to lookahead token. */
914 yyn
= yypact
[yystate
];
915 if (yyn
== YYPACT_NINF
)
918 /* Not known => get a lookahead token if don't already have one. */
920 /* yychar is either YYEMPTY or YYEOF
921 or a valid token in external form. */
923 if (yychar
== YYEMPTY
)
925 YYDPRINTF ((stderr
, "Reading a token: "));
929 /* Convert token to internal form (in yychar1) for indexing tables with. */
931 if (yychar
<= 0) /* This means end of input. */
934 yychar
= YYEOF
; /* Don't call YYLEX any more. */
936 YYDPRINTF ((stderr
, "Now at end of input.\n"));
940 yychar1
= YYTRANSLATE (yychar
);
942 /* We have to keep this `#if YYDEBUG', since we use variables
943 which are defined only if `YYDEBUG' is set. */
944 YYDPRINTF ((stderr
, "Next token is "));
945 YYDSYMPRINT ((stderr
, yychar1
, yylval
]b4_location_if([, yyloc
])[));
946 YYDPRINTF ((stderr
, "\n"));
949 /* If the proper action on seeing token YYCHAR1 is to reduce or to
950 detect an error, take that action. */
952 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yychar1
)
957 if (yyn
== 0 || yyn
== YYTABLE_NINF
)
966 /* Shift the lookahead token. */
967 YYDPRINTF ((stderr
, "Shifting token %d (%s), ",
968 yychar
, yytname
[yychar1
]));
970 /* Discard the token being shifted unless it is eof. */
975 ]b4_location_if([ *++yylsp
= yylloc
;])[
977 /* Count tokens shifted since error; after three, turn off error
986 /*-----------------------------------------------------------.
987 | yydefault -- do the default action for the current state. |
988 `-----------------------------------------------------------*/
990 yyn
= yydefact
[yystate
];
996 /*-----------------------------.
997 | yyreduce -- Do a reduction. |
998 `-----------------------------*/
1000 /* yyn is the number of a rule to reduce with. */
1003 /* If YYLEN is nonzero, implement the default value of the action:
1006 Otherwise, the following line sets YYVAL to garbage.
1007 This behavior is undocumented and Bison
1008 users should not rely upon it. Assigning to YYVAL
1009 unconditionally makes the parser a bit smaller, and it avoids a
1010 GCC warning that YYVAL may be used uninitialized. */
1011 yyval
= yyvsp
[1-yylen
];
1014 [ /* Default location. */
1015 YYLLOC_DEFAULT (yyloc
, (yylsp
- yylen
), yylen
);])[
1018 /* We have to keep this `#if YYDEBUG', since we use variables which
1019 are defined only if `YYDEBUG' is set. */
1024 YYFPRINTF (stderr
, "Reducing via rule %d (line %d), ",
1025 yyn
- 1, yyrline
[yyn
]);
1027 /* Print the symbols being reduced, and their result. */
1028 for (yyi
= yyprhs
[yyn
]; yyrhs
[yyi
] >= 0; yyi
++)
1029 YYFPRINTF (stderr
, "%s ", yytname
[yyrhs
[yyi
]]);
1030 YYFPRINTF (stderr
, " -> %s\n", yytname
[yyr1
[yyn
]]);
1038 /* Line __line__ of __file__. */
1039 #line __oline__ "__ofile__"
1043 ]b4_location_if([ yylsp
-= yylen
;])[
1048 short *yyssp1
= yyss
- 1;
1049 YYFPRINTF (stderr
, "state stack now");
1050 while (yyssp1
!= yyssp
)
1051 YYFPRINTF (stderr
, " %d", *++yyssp1
);
1052 YYFPRINTF (stderr
, "\n");
1057 ]b4_location_if([ *++yylsp
= yyloc
;])[
1059 /* Now `shift' the result of the reduction. Determine what state
1060 that goes to, based on the state we popped back to and the rule
1061 number reduced by. */
1065 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
1066 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
1067 yystate
= yytable
[yystate
];
1069 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
1074 /*------------------------------------.
1075 | yyerrlab -- here on detecting error |
1076 `------------------------------------*/
1078 /* If not already recovering from an error, report this error. */
1083 yyn
= yypact
[yystate
];
1085 if (YYPACT_NINF
< yyn
&& yyn
< YYLAST
)
1087 YYSIZE_T yysize
= 0;
1088 int yytype
= YYTRANSLATE (yychar
);
1093 /* Start YYX at -YYN if negative to avoid negative indexes in
1095 for (yyx
= yyn
< 0 ? -yyn
: 0;
1096 yyx
< (int) (sizeof (yytname
) / sizeof (char *)); yyx
++)
1097 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1098 yysize
+= yystrlen (yytname
[yyx
]) + 15, yycount
++;
1099 yysize
+= yystrlen ("parse error, unexpected ") + 1;
1100 yysize
+= yystrlen (yytname
[yytype
]);
1101 yymsg
= (char *) YYSTACK_ALLOC (yysize
);
1104 char *yyp
= yystpcpy (yymsg
, "parse error, unexpected ");
1105 yyp
= yystpcpy (yyp
, yytname
[yytype
]);
1110 for (yyx
= yyn
< 0 ? -yyn
: 0;
1111 yyx
< (int) (sizeof (yytname
) / sizeof (char *));
1113 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1115 const char *yyq
= ! yycount
? ", expecting " : " or ";
1116 yyp
= yystpcpy (yyp
, yyq
);
1117 yyp
= yystpcpy (yyp
, yytname
[yyx
]);
1122 YYSTACK_FREE (yymsg
);
1125 yyerror ("parse error; also virtual memory exhausted");
1128 #endif /* YYERROR_VERBOSE */
1129 yyerror ("parse error");
1134 /*----------------------------------------------------.
1135 | yyerrlab1 -- error raised explicitly by an action. |
1136 `----------------------------------------------------*/
1138 if (yyerrstatus
== 3)
1140 /* If just tried and failed to reuse lookahead token after an
1141 error, discard it. */
1143 /* Return failure if at end of input. */
1144 if (yychar
== YYEOF
)
1146 /* Pop the error token. */
1148 /* Pop the rest of the stack. */
1149 while (yyssp
> yyss
)
1151 YYDPRINTF ((stderr
, "Error: popping "));
1152 YYDSYMPRINT ((stderr
,
1154 *yyvsp
]b4_location_if([, *yylsp
])[));
1155 YYDPRINTF ((stderr
, "\n"));
1156 yydestruct (yystos
[*yyssp
], *yyvsp
]b4_location_if([, *yylsp
])[);
1162 YYDPRINTF ((stderr
, "Discarding token %d (%s).\n",
1163 yychar
, yytname
[yychar1
]));
1164 yydestruct (yychar1
, yylval
]b4_location_if([, yylloc
])[);
1168 /* Else will try to reuse lookahead token after shifting the error
1171 yyerrstatus
= 3; /* Each real token shifted decrements this. */
1175 yyn
= yypact
[yystate
];
1176 if (yyn
!= YYPACT_NINF
)
1179 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
1187 /* Pop the current state because it cannot handle the error token. */
1191 YYDPRINTF ((stderr
, "Error: popping "));
1192 YYDSYMPRINT ((stderr
,
1193 yystos
[*yyssp
], *yyvsp
]b4_location_if([, *yylsp
])[));
1194 YYDPRINTF ((stderr
, "\n"));
1196 yydestruct (yystos
[yystate
], *yyvsp
]b4_location_if([, *yylsp
])[);
1199 ]b4_location_if([ yylsp
--;])[
1204 short *yyssp1
= yyss
- 1;
1205 YYFPRINTF (stderr
, "Error: state stack now");
1206 while (yyssp1
!= yyssp
)
1207 YYFPRINTF (stderr
, " %d", *++yyssp1
);
1208 YYFPRINTF (stderr
, "\n");
1216 YYDPRINTF ((stderr
, "Shifting error token, "));
1219 ]b4_location_if([ *++yylsp
= yylloc
;])[
1225 /*-------------------------------------.
1226 | yyacceptlab -- YYACCEPT comes here. |
1227 `-------------------------------------*/
1232 /*-----------------------------------.
1233 | yyabortlab -- YYABORT comes here. |
1234 `-----------------------------------*/
1240 /*----------------------------------------------.
1241 | yyoverflowlab -- parser overflow comes here. |
1242 `----------------------------------------------*/
1244 yyerror ("parser stack overflow");
1252 YYSTACK_FREE (yyss
);
1259 m4_if(b4_defines_flag
, 0, [],
1260 [#output "b4_output_header_name"
1261 b4_copyright([Skeleton parser
for Yacc
-like parsing with Bison
],
1262 [1984, 1989, 1990, 2000, 2001, 2002])
1264 /* As a special exception, when this file is copied by Bison into a
1265 Bison output file, you may use that output file without restriction.
1266 This special exception was added by the Free Software Foundation
1267 in version 1.24 of Bison. */
1269 #ifndef b4_header_guard
1270 # define b4_header_guard
1272 b4_token_defines(b4_tokens
)
1275 m4_ifdef([b4_stype
],
1276 [#line b4_stype_line "b4_filename"
1277 typedef union b4_stype yystype
;
1278 /* Line __line__ of __file__. */
1279 #line __oline__ "__ofile__"],
1280 [typedef int yystype
;])
1281 # define YYSTYPE yystype
1285 [extern YYSTYPE b4_prefix
[]lval
;])
1289 typedef struct yyltype
1296 # define YYLTYPE yyltype
1300 [extern YYLTYPE b4_prefix
[]lloc
;])
1302 #endif /* not b4_header_guard */