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
)))
44 ## ----------------- ##
45 ## Semantic Values. ##
46 ## ----------------- ##
49 # b4_lhs_value([TYPE])
50 # --------------------
51 # Expansion of $<TYPE>$.
52 m4_define([b4_lhs_value
],
53 [yyval
[]m4_ifval([$
1], [.$
1])])
56 # b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
57 # --------------------------------------
58 # Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
60 m4_define([b4_rhs_value
],
61 [yyvsp@
<:@
m4_eval([$
2 - $
1])@
:>@
m4_ifval([$
3], [.$
3])])
72 m4_define([b4_lhs_location
],
76 # b4_rhs_location(RULE-LENGTH, NUM)
77 # ---------------------------------
78 # Expansion of @NUM, where the current rule has RULE-LENGTH symbols
80 m4_define([b4_rhs_location
],
81 [yylsp@
<:@
m4_eval([$
2 - $
1])@
:>@
])
85 ## ------------------- ##
86 ## Output file names. ##
87 ## ------------------- ##
89 m4_define_default([b4_input_suffix
], [.y
])
91 m4_define_default([b4_output_parser_suffix
],
92 [m4_translit(b4_input_suffix
, [yY
], [cC
])])
94 m4_define_default([b4_output_parser_name
],
95 [b4_output_prefix
[]b4_output_infix
[]b4_output_parser_suffix
[]])
98 m4_define_default([b4_output_header_suffix
],
99 [m4_translit(b4_input_suffix
, [yY
], [hH
])])
101 m4_define_default([b4_output_header_name
],
102 [b4_output_prefix
[]b4_output_infix
[]b4_output_header_suffix
[]])
104 m4_define_default([b4_header_guard
],
105 [m4_bpatsubst(m4_toupper([BISON_
]b4_output_header_name
),
106 [[^ABCDEFGHIJKLMNOPQRSTUVWXYZ
]], [_
])])
110 ## --------------------------------------------------------- ##
111 ## Defining symbol actions, e.g., printers and destructors. ##
112 ## --------------------------------------------------------- ##
114 # b4_symbol_actions(FILENAME, LINENO,
115 # SYMBOL-TAG, SYMBOL-NUM,
116 # SYMBOL-ACTION, SYMBOL-TYPENAME)
117 # -------------------------------------------------
118 m4_define([b4_symbol_actions
],
119 [m4_pushdef([b4_dollar_dollar
], [yyvalue
.$
6])dnl
120 m4_pushdef([b4_at_dollar
], [yylocation
])dnl
124 #line __oline__ "__ofile__"
126 m4_popdef([b4_at_dollar
])dnl
127 m4_popdef([b4_dollar_dollar
])dnl
133 #output "b4_output_parser_name"
134 b4_copyright([Skeleton parser
for Yacc
-like parsing with Bison
],
135 [1984, 1989, 1990, 2000, 2001, 2002])
137 /* As a special exception, when this file is copied by Bison into a
138 Bison output file, you may use that output file without restriction.
139 This special exception was added by the Free Software Foundation
140 in version 1.24 of Bison. */
142 /* Written by Richard Stallman by simplifying the original so called
143 ``semantic'' parser. */
145 /* All symbols defined below should begin with yy or YY, to avoid
146 infringing on user name space. This should be done even for local
147 variables, as they might otherwise be expanded by user macros.
148 There are some unavoidable exceptions within include files to
149 define necessary library symbols; they are noted "INFRINGES ON
150 USER NAME SPACE" below. */
152 /* Identify Bison output. */
156 #define YYPURE b4_pure
158 /* Using locations. */
159 #define YYLSP_NEEDED b4_locations_flag
161 m4_if(b4_prefix
[], [yy
], [],
162 [/* If NAME_PREFIX is specified substitute the variables and functions
164 #define yyparse b4_prefix[]parse
165 #define yylex b4_prefix[]lex
166 #define yyerror b4_prefix[]error
167 #define yylval b4_prefix[]lval
168 #define yychar b4_prefix[]char
169 #define yydebug b4_prefix[]debug
170 #define yynerrs b4_prefix[]nerrs
171 b4_location_if([#define yylloc b4_prefix[]lloc])])
173 b4_token_defines(b4_tokens
)
175 /* Copy the first part of user declarations. */
178 /* Enabling traces. */
180 # define YYDEBUG b4_debug
183 /* Enabling verbose error messages. */
184 #ifdef YYERROR_VERBOSE
185 # undef YYERROR_VERBOSE
186 # define YYERROR_VERBOSE 1
188 # define YYERROR_VERBOSE b4_error_verbose
193 [#line b4_stype_line "b4_filename"
194 typedef union b4_stype yystype
;
195 /* Line __line__ of __file__. */
196 #line __oline__ "__ofile__"],
197 [typedef int yystype
;])
198 # define YYSTYPE yystype
199 # define YYSTYPE_IS_TRIVIAL 1
203 typedef struct yyltype
210 # define YYLTYPE b4_location_type
211 # define YYLTYPE_IS_TRIVIAL 1
214 /* Copy the second part of user declarations. */
217 /* Line __line__ of __file__. */
218 #line __oline__ "__ofile__"
220 #if ! defined (yyoverflow) || YYERROR_VERBOSE
222 /* The parser invokes alloca or malloc; define the necessary symbols. */
224 # if YYSTACK_USE_ALLOCA
225 # define YYSTACK_ALLOC alloca
227 # ifndef YYSTACK_USE_ALLOCA
228 # if defined (alloca) || defined (_ALLOCA_H)
229 # define YYSTACK_ALLOC alloca
232 # define YYSTACK_ALLOC __builtin_alloca
238 # ifdef YYSTACK_ALLOC
239 /* Pacify GCC's `empty if-body' warning. */
240 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
242 # if defined (__STDC__) || defined (__cplusplus)
243 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
244 # define YYSIZE_T size_t
246 # define YYSTACK_ALLOC malloc
247 # define YYSTACK_FREE free
249 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
252 #if (! defined (yyoverflow) \
253 && (! defined (__cplusplus) \
254 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
256 /* A type that is properly aligned for any stack member. */
261 b4_location_if([ YYLTYPE yyls
;
265 /* The size of the maximum gap between one aligned stack and the next. */
266 # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
268 /* The size of an array large to enough to hold all stacks, each with
271 [# define YYSTACK_BYTES(N) \
272 ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
273 + 2 * YYSTACK_GAP_MAX)],
274 [# define YYSTACK_BYTES(N) \
275 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
278 /* Copy COUNT objects from FROM to TO. The source and destination do
282 # define YYCOPY(To, From, Count) \
283 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
285 # define YYCOPY(To, From, Count) \
288 register YYSIZE_T yyi; \
289 for (yyi = 0; yyi < (Count); yyi++) \
290 (To)[[yyi]] = (From)[[yyi]]; \
296 /* Relocate STACK from its old location to the new one. The
297 local variables YYSIZE and YYSTACKSIZE give the old and new number of
298 elements in the stack, and YYPTR gives the new location of the
299 stack. Advance YYPTR to a properly aligned location for the next
301 # define YYSTACK_RELOCATE(Stack) \
304 YYSIZE_T yynewbytes; \
305 YYCOPY (&yyptr->Stack, Stack, yysize); \
306 Stack = &yyptr->Stack; \
307 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
308 yyptr += yynewbytes / sizeof (*yyptr); \
314 #if defined (__STDC__) || defined (__cplusplus)
315 typedef signed char yysigned_char
;
317 typedef short yysigned_char
;
320 /* YYFINAL -- State number of the termination state. */
321 #define YYFINAL b4_final_state_number
322 /* YYLAST -- Last index in YYTABLE. */
323 #define YYLAST b4_last
325 /* YYNTOKENS -- Number of terminals. */
326 #define YYNTOKENS b4_tokens_number
327 /* YYNNTS -- Number of nonterminals. */
328 #define YYNNTS b4_nterms_number
329 /* YYNRULES -- Number of rules. */
330 #define YYNRULES b4_rules_number
331 /* YYNRULES -- Number of states. */
332 #define YYNSTATES b4_states_number
334 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
335 #define YYUNDEFTOK b4_undef_token_number
336 #define YYMAXUTOK b4_user_token_number_max
338 #define YYTRANSLATE(X) \
339 ((unsigned)(X) <= YYMAXUTOK ? yytranslate[[X]] : YYUNDEFTOK)
341 /* YYTRANSLATE[[YYLEX]] -- Bison symbol number corresponding to YYLEX. */
342 static const b4_int_type_for([b4_translate
]) yytranslate
[[]] =
348 /* YYPRHS[[YYN]] -- Index of the first RHS symbol of rule number YYN in
350 static const b4_int_type_for([b4_prhs
]) yyprhs
[[]] =
355 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
356 static const b4_int_type_for([b4_rhs
]) yyrhs
[[]] =
361 /* YYRLINE[[YYN]] -- source line where rule number YYN was defined. */
362 static const b4_int_type_for([b4_rline
]) yyrline
[[]] =
368 #if YYDEBUG || YYERROR_VERBOSE
369 /* YYTNME[[SYMBOL-NUM]] -- String name of the symbol SYMBOL-NUM.
370 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
371 static const char *const yytname
[[]] =
378 /* YYTOKNUM[[YYLEX-NUM]] -- Internal token number corresponding to
380 static const b4_int_type_for([b4_toknum
]) yytoknum
[[]] =
386 /* YYR1[[YYN]] -- Symbol number of symbol that rule YYN derives. */
387 static const b4_int_type_for([b4_r1
]) yyr1
[[]] =
392 /* YYR2[[YYN]] -- Number of symbols composing right hand side of rule YYN. */
393 static const b4_int_type_for([b4_r2
]) yyr2
[[]] =
398 /* YYDEFACT[[STATE-NAME]] -- Default rule to reduce with in state
399 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
400 means the default is an error. */
401 static const b4_int_type_for([b4_defact
]) yydefact
[[]] =
406 /* YYDEFGOTO[[NTERM-NUM]]. */
407 static const b4_int_type_for([b4_defgoto
]) yydefgoto
[[]] =
412 /* YYPACT[[STATE-NUM]] -- Index in YYTABLE of the portion describing
414 #define YYPACT_NINF b4_pact_ninf
415 static const b4_int_type_for([b4_pact
]) yypact
[[]] =
420 /* YYPGOTO[[NTERM-NUM]]. */
421 static const b4_int_type_for([b4_pgoto
]) yypgoto
[[]] =
426 /* YYTABLE[[YYPACT[STATE-NUM]]]. What to do in state STATE-NUM. If
427 positive, shift that token. If negative, reduce the rule which
428 number is the opposite. If zero, do what YYDEFACT says.
429 If YYTABLE_NINF, parse error. */
430 #define YYTABLE_NINF b4_table_ninf
431 static const b4_int_type_for([b4_table
]) yytable
[[]] =
436 static const b4_int_type_for([b4_check
]) yycheck
[[]] =
441 /* YYSTOS[[STATE-NUM]] -- The (internal number of the) accessing
442 symbol of state STATE-NUM. */
443 static const b4_int_type_for([b4_stos
]) yystos
[[]] =
448 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
449 # define YYSIZE_T __SIZE_TYPE__
451 #if ! defined (YYSIZE_T) && defined (size_t)
452 # define YYSIZE_T size_t
454 #if ! defined (YYSIZE_T)
455 # if defined (__STDC__) || defined (__cplusplus)
456 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
457 # define YYSIZE_T size_t
460 #if ! defined (YYSIZE_T)
461 # define YYSIZE_T unsigned int
464 #define yyerrok (yyerrstatus = 0)
465 #define yyclearin (yychar = YYEMPTY)
469 #define YYACCEPT goto yyacceptlab
470 #define YYABORT goto yyabortlab
471 #define YYERROR goto yyerrlab1
473 /* Like YYERROR except do call yyerror. This remains here temporarily
474 to ease the transition to the new meaning of YYERROR, for GCC.
475 Once GCC version 2 has supplanted version 1, this can go. */
477 #define YYFAIL goto yyerrlab
479 #define YYRECOVERING() (!!yyerrstatus)
481 #define YYBACKUP(Token, Value) \
483 if (yychar == YYEMPTY && yylen == 1) \
487 yychar1 = YYTRANSLATE (yychar); \
493 yyerror ("syntax error: cannot back up"); \
499 #define YYERRCODE 256
501 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
504 #ifndef YYLLOC_DEFAULT
505 # define YYLLOC_DEFAULT(Current, Rhs, N) \
506 Current.first_line = Rhs[[1]].first_line; \
507 Current.first_column = Rhs[[1]].first_column; \
508 Current.last_line = Rhs[[N]].last_line; \
509 Current.last_column = Rhs[[N]].last_column;
512 /* YYLEX -- calling `yylex' with the right arguments. */
515 # define YYLEX yylex (b4_pure_if([&yylval[]b4_location_if([, &yylloc]), ])YYLEX_PARAM)
517 # define YYLEX b4_c_function_call([yylex], [int], b4_lex_param)
520 /* Enable debugging if requested. */
524 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
525 # define YYFPRINTF fprintf
528 # define YYDPRINTF(Args) \
533 # define YYDSYMPRINT(Args) \
538 /* Nonzero means print parse trace. It is left uninitialized so that
539 multiple parsers can coexist. */
542 # define YYDPRINTF(Args)
543 # define YYDSYMPRINT(Args)
544 #endif /* !YYDEBUG */
546 /* YYINITDEPTH -- initial size of the parser's stacks. */
548 # define YYINITDEPTH b4_stack_depth_init
551 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
552 if the built-in stack extension method is used).
554 Do not make this value too large; the results are undefined if
555 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
556 evaluated with infinite-precision integer arithmetic. */
563 # define YYMAXDEPTH b4_stack_depth_max
571 # if defined (__GLIBC__) && defined (_STRING_H)
572 # define yystrlen strlen
574 /* Return the length of YYSTR. */
576 # if defined (__STDC__) || defined (__cplusplus)
577 yystrlen (const char *yystr
)
583 register const char *yys
= yystr
;
585 while (*yys
++ != '\0')
588 return yys
- yystr
- 1;
594 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
595 # define yystpcpy stpcpy
597 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
600 # if defined (__STDC__) || defined (__cplusplus)
601 yystpcpy (char *yydest
, const char *yysrc
)
603 yystpcpy (yydest
, yysrc
)
608 register char *yyd
= yydest
;
609 register const char *yys
= yysrc
;
611 while ((*yyd
++ = *yys
++) != '\0')
619 #endif /* !YYERROR_VERBOSE */
624 /*-----------------------------.
625 | Print this symbol on YYOUT. |
626 `-----------------------------*/
628 b4_c_function([yysymprint
],
632 [[YYSTYPE
], [yyvalue
]]b4_location_if([,
633 [[YYLTYPE
], [yylocation
]]]))
635 /* Pacify ``unused variable'' warnings. */
637 b4_location_if([ (void) yylocation
;
640 if (yytype
< YYNTOKENS
)
642 YYFPRINTF (yyout
, "token %s (", yytname
[[yytype]]);
644 YYPRINT (yyout
, yytoknum
[[yytype]], yyvalue
);
648 YYFPRINTF (yyout
, "nterm %s (", yytname
[[yytype]]);
652 m4_map([b4_symbol_actions
], m4_defn([b4_symbol_printers
]))dnl
656 YYFPRINTF (yyout
, ")");
658 #endif /* YYDEBUG. */
661 /*-----------------------------------------------.
662 | Release the memory associated to this symbol. |
663 `-----------------------------------------------*/
665 b4_c_function([yydestruct
],
668 [[YYSTYPE
], [yyvalue
]]b4_location_if([,
669 [[YYLTYPE
], [yylocation
]]]))
671 /* Pacify ``unused variable'' warnings. */
673 b4_location_if([ (void) yylocation
;
678 m4_map([b4_symbol_actions
], m4_defn([b4_symbol_destructors
]))dnl
686 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
687 into yyparse. The argument should have type void *.
688 It should actually point to an object.
689 Grammar actions can access the variable by casting it
690 to the proper pointer type. */
693 # if defined (__STDC__) || defined (__cplusplus)
694 # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
695 # define YYPARSE_PARAM_DECL
697 # define YYPARSE_PARAM_ARG YYPARSE_PARAM
698 # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
700 #else /* !YYPARSE_PARAM */
701 # define YYPARSE_PARAM_ARG
702 # define YYPARSE_PARAM_DECL
703 #endif /* !YYPARSE_PARAM */
705 /* Prevent warning if -Wstrict-prototypes. */
707 # ifdef YYPARSE_PARAM
708 int yyparse (void *);
714 m4_divert_push([KILL
])# ======================== M4 code.
715 # b4_declare_parser_variables
716 # ---------------------------
717 # Declare the variables that are global, or local to YYPARSE if
719 m4_define([b4_declare_parser_variables
],
720 [/* The lookahead symbol. */
723 /* The semantic value of the lookahead symbol. */
726 /* Number of parse errors so far. */
727 int yynerrs
;b4_location_if([
728 /* Location data for the lookahead symbol. */
731 m4_divert_pop([KILL
])dnl
# ====================== End of M4 code.
734 [b4_declare_parser_variables
])
737 yyparse (YYPARSE_PARAM_ARG
)
740 ]b4_pure_if([b4_declare_parser_variables
])[
741 register int yystate
;
744 /* Number of tokens to shift before error messages enabled. */
746 /* Lookahead token as an internal (translated) token number. */
749 /* Three stacks and their tools:
750 `yyss': related to states,
751 `yyvs': related to semantic values,
752 `yyls': related to locations.
754 Refer to the stacks thru separate pointers, to allow yyoverflow
755 to reallocate them elsewhere. */
757 /* The state stack. */
758 short yyssa
[YYINITDEPTH
];
760 register short *yyssp
;
762 /* The semantic value stack. */
763 YYSTYPE yyvsa
[YYINITDEPTH
];
764 YYSTYPE
*yyvs
= yyvsa
;
765 register YYSTYPE
*yyvsp
;
768 [[ /* The location stack. */
769 YYLTYPE yylsa
[YYINITDEPTH
];
770 YYLTYPE
*yyls
= yylsa
;
773 #define YYPOPSTACK (yyvsp--, yyssp--]b4_location_if([, yylsp--])[)
775 YYSIZE_T yystacksize
= YYINITDEPTH
;
777 /* The variables used to return semantic value and location from the
780 ]b4_location_if([ YYLTYPE yyloc
;])[
782 /* When reducing, the number of symbols on the RHS of the reduced
786 YYDPRINTF ((stderr
, "Starting parse\n"));
791 yychar
= YYEMPTY
; /* Cause a token to be read. */
793 /* Initialize stack pointers.
794 Waste one element of value and location stack
795 so that they stay on the same level as the state stack.
796 The wasted elements are never initialized. */
800 ]b4_location_if([ yylsp
= yyls
;])[
803 /*------------------------------------------------------------.
804 | yynewstate -- Push a new state, which is found in yystate. |
805 `------------------------------------------------------------*/
807 /* In all cases, when you get here, the value and location stacks
808 have just been pushed. so pushing a state here evens the stacks.
815 if (yyss
+ yystacksize
- 1 <= yyssp
)
817 /* Get the current used size of the three stacks, in elements. */
818 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
822 /* Give user a chance to reallocate the stack. Use copies of
823 these so that the &'s don't force the real ones into
825 YYSTYPE
*yyvs1
= yyvs
;
827 ]b4_location_if([ YYLTYPE
*yyls1
= yyls
;])[
829 /* Each stack pointer address is followed by the size of the
830 data in use in that stack, in bytes. This used to be a
831 conditional around just the two extra args, but that might
832 be undefined if yyoverflow is a macro. */
833 yyoverflow ("parser stack overflow",
834 &yyss1
, yysize
* sizeof (*yyssp
),
835 &yyvs1
, yysize
* sizeof (*yyvsp
),
836 ]b4_location_if([ &yyls1
, yysize
* sizeof (*yylsp
),])[
838 ]b4_location_if([ yyls
= yyls1
;])[
842 #else /* no yyoverflow */
843 # ifndef YYSTACK_RELOCATE
846 /* Extend the stack our own way. */
847 if (YYMAXDEPTH
<= yystacksize
)
850 if (YYMAXDEPTH
< yystacksize
)
851 yystacksize
= YYMAXDEPTH
;
855 union yyalloc
*yyptr
=
856 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
859 YYSTACK_RELOCATE (yyss
);
860 YYSTACK_RELOCATE (yyvs
);
861 ]b4_location_if([ YYSTACK_RELOCATE (yyls
);])[
862 # undef YYSTACK_RELOCATE
864 YYSTACK_FREE (yyss1
);
867 #endif /* no yyoverflow */
869 yyssp
= yyss
+ yysize
- 1;
870 yyvsp
= yyvs
+ yysize
- 1;
871 ]b4_location_if([ yylsp
= yyls
+ yysize
- 1;])[
873 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
874 (unsigned long int) yystacksize
));
876 if (yyss
+ yystacksize
- 1 <= yyssp
)
880 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
889 /* Do appropriate processing given the current state. */
890 /* Read a lookahead token if we need one and don't already have one. */
893 /* First try to decide what to do without reference to lookahead token. */
895 yyn
= yypact
[yystate
];
896 if (yyn
== YYPACT_NINF
)
899 /* Not known => get a lookahead token if don't already have one. */
901 /* yychar is either YYEMPTY or YYEOF
902 or a valid token in external form. */
904 if (yychar
== YYEMPTY
)
906 YYDPRINTF ((stderr
, "Reading a token: "));
910 /* Convert token to internal form (in yychar1) for indexing tables with. */
912 if (yychar
<= 0) /* This means end of input. */
915 yychar
= YYEOF
; /* Don't call YYLEX any more. */
917 YYDPRINTF ((stderr
, "Now at end of input.\n"));
921 yychar1
= YYTRANSLATE (yychar
);
923 /* We have to keep this `#if YYDEBUG', since we use variables
924 which are defined only if `YYDEBUG' is set. */
925 YYDPRINTF ((stderr
, "Next token is "));
926 YYDSYMPRINT ((stderr
, yychar1
, yylval
]b4_location_if([, yyloc
])[));
927 YYDPRINTF ((stderr
, "\n"));
930 /* If the proper action on seeing token YYCHAR1 is to reduce or to
931 detect an error, take that action. */
933 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yychar1
)
938 if (yyn
== 0 || yyn
== YYTABLE_NINF
)
947 /* Shift the lookahead token. */
948 YYDPRINTF ((stderr
, "Shifting token %d (%s), ",
949 yychar
, yytname
[yychar1
]));
951 /* Discard the token being shifted unless it is eof. */
956 ]b4_location_if([ *++yylsp
= yylloc
;])[
958 /* Count tokens shifted since error; after three, turn off error
967 /*-----------------------------------------------------------.
968 | yydefault -- do the default action for the current state. |
969 `-----------------------------------------------------------*/
971 yyn
= yydefact
[yystate
];
977 /*-----------------------------.
978 | yyreduce -- Do a reduction. |
979 `-----------------------------*/
981 /* yyn is the number of a rule to reduce with. */
984 /* If YYLEN is nonzero, implement the default value of the action:
987 Otherwise, the following line sets YYVAL to garbage.
988 This behavior is undocumented and Bison
989 users should not rely upon it. Assigning to YYVAL
990 unconditionally makes the parser a bit smaller, and it avoids a
991 GCC warning that YYVAL may be used uninitialized. */
992 yyval
= yyvsp
[1-yylen
];
995 [ /* Default location. */
996 YYLLOC_DEFAULT (yyloc
, (yylsp
- yylen
), yylen
);])[
999 /* We have to keep this `#if YYDEBUG', since we use variables which
1000 are defined only if `YYDEBUG' is set. */
1005 YYFPRINTF (stderr
, "Reducing via rule %d (line %d), ",
1006 yyn
- 1, yyrline
[yyn
]);
1008 /* Print the symbols being reduced, and their result. */
1009 for (yyi
= yyprhs
[yyn
]; 0 <= yyrhs
[yyi
]; yyi
++)
1010 YYFPRINTF (stderr
, "%s ", yytname
[yyrhs
[yyi
]]);
1011 YYFPRINTF (stderr
, " -> %s\n", yytname
[yyr1
[yyn
]]);
1019 /* Line __line__ of __file__. */
1020 #line __oline__ "__ofile__"
1024 ]b4_location_if([ yylsp
-= yylen
;])[
1029 short *yyssp1
= yyss
- 1;
1030 YYFPRINTF (stderr
, "state stack now");
1031 while (yyssp1
!= yyssp
)
1032 YYFPRINTF (stderr
, " %d", *++yyssp1
);
1033 YYFPRINTF (stderr
, "\n");
1038 ]b4_location_if([ *++yylsp
= yyloc
;])[
1040 /* Now `shift' the result of the reduction. Determine what state
1041 that goes to, based on the state we popped back to and the rule
1042 number reduced by. */
1046 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
1047 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
1048 yystate
= yytable
[yystate
];
1050 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
1055 /*------------------------------------.
1056 | yyerrlab -- here on detecting error |
1057 `------------------------------------*/
1059 /* If not already recovering from an error, report this error. */
1064 yyn
= yypact
[yystate
];
1066 if (YYPACT_NINF
< yyn
&& yyn
< YYLAST
)
1068 YYSIZE_T yysize
= 0;
1069 int yytype
= YYTRANSLATE (yychar
);
1074 /* Start YYX at -YYN if negative to avoid negative indexes in
1076 for (yyx
= yyn
< 0 ? -yyn
: 0;
1077 yyx
< (int) (sizeof (yytname
) / sizeof (char *)); yyx
++)
1078 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1079 yysize
+= yystrlen (yytname
[yyx
]) + 15, yycount
++;
1080 yysize
+= yystrlen ("parse error, unexpected ") + 1;
1081 yysize
+= yystrlen (yytname
[yytype
]);
1082 yymsg
= (char *) YYSTACK_ALLOC (yysize
);
1085 char *yyp
= yystpcpy (yymsg
, "parse error, unexpected ");
1086 yyp
= yystpcpy (yyp
, yytname
[yytype
]);
1091 for (yyx
= yyn
< 0 ? -yyn
: 0;
1092 yyx
< (int) (sizeof (yytname
) / sizeof (char *));
1094 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1096 const char *yyq
= ! yycount
? ", expecting " : " or ";
1097 yyp
= yystpcpy (yyp
, yyq
);
1098 yyp
= yystpcpy (yyp
, yytname
[yyx
]);
1103 YYSTACK_FREE (yymsg
);
1106 yyerror ("parse error; also virtual memory exhausted");
1109 #endif /* YYERROR_VERBOSE */
1110 yyerror ("parse error");
1115 /*----------------------------------------------------.
1116 | yyerrlab1 -- error raised explicitly by an action. |
1117 `----------------------------------------------------*/
1119 if (yyerrstatus
== 3)
1121 /* If just tried and failed to reuse lookahead token after an
1122 error, discard it. */
1124 /* Return failure if at end of input. */
1125 if (yychar
== YYEOF
)
1127 /* Pop the error token. */
1129 /* Pop the rest of the stack. */
1130 while (yyss
< yyssp
)
1132 YYDPRINTF ((stderr
, "Error: popping "));
1133 YYDSYMPRINT ((stderr
,
1135 *yyvsp
]b4_location_if([, *yylsp
])[));
1136 YYDPRINTF ((stderr
, "\n"));
1137 yydestruct (yystos
[*yyssp
], *yyvsp
]b4_location_if([, *yylsp
])[);
1143 YYDPRINTF ((stderr
, "Discarding token %d (%s).\n",
1144 yychar
, yytname
[yychar1
]));
1145 yydestruct (yychar1
, yylval
]b4_location_if([, yylloc
])[);
1149 /* Else will try to reuse lookahead token after shifting the error
1152 yyerrstatus
= 3; /* Each real token shifted decrements this. */
1156 yyn
= yypact
[yystate
];
1157 if (yyn
!= YYPACT_NINF
)
1160 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
1168 /* Pop the current state because it cannot handle the error token. */
1172 YYDPRINTF ((stderr
, "Error: popping "));
1173 YYDSYMPRINT ((stderr
,
1174 yystos
[*yyssp
], *yyvsp
]b4_location_if([, *yylsp
])[));
1175 YYDPRINTF ((stderr
, "\n"));
1177 yydestruct (yystos
[yystate
], *yyvsp
]b4_location_if([, *yylsp
])[);
1180 ]b4_location_if([ yylsp
--;])[
1185 short *yyssp1
= yyss
- 1;
1186 YYFPRINTF (stderr
, "Error: state stack now");
1187 while (yyssp1
!= yyssp
)
1188 YYFPRINTF (stderr
, " %d", *++yyssp1
);
1189 YYFPRINTF (stderr
, "\n");
1197 YYDPRINTF ((stderr
, "Shifting error token, "));
1200 ]b4_location_if([ *++yylsp
= yylloc
;])[
1206 /*-------------------------------------.
1207 | yyacceptlab -- YYACCEPT comes here. |
1208 `-------------------------------------*/
1213 /*-----------------------------------.
1214 | yyabortlab -- YYABORT comes here. |
1215 `-----------------------------------*/
1221 /*----------------------------------------------.
1222 | yyoverflowlab -- parser overflow comes here. |
1223 `----------------------------------------------*/
1225 yyerror ("parser stack overflow");
1233 YYSTACK_FREE (yyss
);
1240 m4_if(b4_defines_flag
, 0, [],
1241 [#output "b4_output_header_name"
1242 b4_copyright([Skeleton parser
for Yacc
-like parsing with Bison
],
1243 [1984, 1989, 1990, 2000, 2001, 2002])
1245 /* As a special exception, when this file is copied by Bison into a
1246 Bison output file, you may use that output file without restriction.
1247 This special exception was added by the Free Software Foundation
1248 in version 1.24 of Bison. */
1250 #ifndef b4_header_guard
1251 # define b4_header_guard
1253 b4_token_defines(b4_tokens
)
1256 m4_ifdef([b4_stype
],
1257 [#line b4_stype_line "b4_filename"
1258 typedef union b4_stype yystype
;
1259 /* Line __line__ of __file__. */
1260 #line __oline__ "__ofile__"],
1261 [typedef int yystype
;])
1262 # define YYSTYPE yystype
1266 [extern YYSTYPE b4_prefix
[]lval
;])
1270 typedef struct yyltype
1277 # define YYLTYPE yyltype
1281 [extern YYLTYPE b4_prefix
[]lloc
;])
1283 #endif /* not b4_header_guard */