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
],
50 ## ----------------- ##
51 ## Semantic Values. ##
52 ## ----------------- ##
55 # b4_lhs_value([TYPE])
56 # --------------------
57 # Expansion of $<TYPE>$.
58 m4_define([b4_lhs_value
],
59 [yyval
[]m4_ifval([$
1], [.$
1])])
62 # b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
63 # --------------------------------------
64 # Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
66 m4_define([b4_rhs_value
],
67 [yyvsp@
<:@
m4_eval([$
2 - $
1])@
:>@
m4_ifval([$
3], [.$
3])])
78 m4_define([b4_lhs_location
],
82 # b4_rhs_location(RULE-LENGTH, NUM)
83 # ---------------------------------
84 # Expansion of @NUM, where the current rule has RULE-LENGTH symbols
86 m4_define([b4_rhs_location
],
87 [yylsp@
<:@
m4_eval([$
2 - $
1])@
:>@
])
91 ## ------------------- ##
92 ## Output file names. ##
93 ## ------------------- ##
95 m4_define_default([b4_input_suffix
], [.y
])
97 m4_define_default([b4_output_parser_suffix
],
98 [m4_translit(b4_input_suffix
, [yY
], [cC
])])
100 m4_define_default([b4_output_parser_name
],
101 [b4_output_prefix
[]b4_output_infix
[]b4_output_parser_suffix
[]])
104 m4_define_default([b4_output_header_suffix
],
105 [m4_translit(b4_input_suffix
, [yY
], [hH
])])
107 m4_define_default([b4_output_header_name
],
108 [b4_output_prefix
[]b4_output_infix
[]b4_output_header_suffix
[]])
110 m4_define_default([b4_header_guard
],
111 [m4_bpatsubst(m4_toupper([BISON_
]b4_output_header_name
),
112 [[^ABCDEFGHIJKLMNOPQRSTUVWXYZ
]], [_
])])
116 ## --------------------------------------------------------- ##
117 ## Defining symbol actions, e.g., printers and destructors. ##
118 ## --------------------------------------------------------- ##
120 # b4_symbol_actions(FILENAME, LINENO,
121 # SYMBOL-TAG, SYMBOL-NUM,
122 # SYMBOL-ACTION, SYMBOL-TYPENAME)
123 # -------------------------------------------------
124 m4_define([b4_symbol_actions
],
125 [m4_pushdef([b4_dollar_dollar
], [yyvalue
.$
6])dnl
126 m4_pushdef([b4_at_dollar
], [yylocation
])dnl
130 #line __oline__ "__ofile__"
132 m4_popdef([b4_at_dollar
])dnl
133 m4_popdef([b4_dollar_dollar
])dnl
139 #output "b4_output_parser_name"
140 b4_copyright([Skeleton parser
for Yacc
-like parsing with Bison
],
141 [1984, 1989, 1990, 2000, 2001, 2002])
143 /* As a special exception, when this file is copied by Bison into a
144 Bison output file, you may use that output file without restriction.
145 This special exception was added by the Free Software Foundation
146 in version 1.24 of Bison. */
148 /* Written by Richard Stallman by simplifying the original so called
149 ``semantic'' parser. */
151 /* All symbols defined below should begin with yy or YY, to avoid
152 infringing on user name space. This should be done even for local
153 variables, as they might otherwise be expanded by user macros.
154 There are some unavoidable exceptions within include files to
155 define necessary library symbols; they are noted "INFRINGES ON
156 USER NAME SPACE" below. */
158 /* Identify Bison output. */
162 #define YYPURE b4_pure
164 /* Using locations. */
165 #define YYLSP_NEEDED b4_locations_flag
167 m4_if(b4_prefix
[], [yy
], [],
168 [/* If NAME_PREFIX is specified substitute the variables and functions
170 #define yyparse b4_prefix[]parse
171 #define yylex b4_prefix[]lex
172 #define yyerror b4_prefix[]error
173 #define yylval b4_prefix[]lval
174 #define yychar b4_prefix[]char
175 #define yydebug b4_prefix[]debug
176 #define yynerrs b4_prefix[]nerrs
177 b4_location_if([#define yylloc b4_prefix[]lloc])])
179 b4_token_defines(b4_tokens
)
181 /* Copy the first part of user declarations. */
184 /* Enabling traces. */
186 # define YYDEBUG b4_debug
189 /* Enabling verbose error messages. */
190 #ifdef YYERROR_VERBOSE
191 # undef YYERROR_VERBOSE
192 # define YYERROR_VERBOSE 1
194 # define YYERROR_VERBOSE b4_error_verbose
199 [#line b4_stype_line "b4_filename"
200 typedef union b4_stype yystype
;
201 /* Line __line__ of __file__. */
202 #line __oline__ "__ofile__"],
203 [typedef int yystype
;])
204 # define YYSTYPE yystype
205 # define YYSTYPE_IS_TRIVIAL 1
209 typedef struct yyltype
216 # define YYLTYPE b4_location_type
217 # define YYLTYPE_IS_TRIVIAL 1
220 /* Copy the second part of user declarations. */
223 /* Line __line__ of __file__. */
224 #line __oline__ "__ofile__"
226 #if ! defined (yyoverflow) || YYERROR_VERBOSE
228 /* The parser invokes alloca or malloc; define the necessary symbols. */
230 # if YYSTACK_USE_ALLOCA
231 # define YYSTACK_ALLOC alloca
233 # ifndef YYSTACK_USE_ALLOCA
234 # if defined (alloca) || defined (_ALLOCA_H)
235 # define YYSTACK_ALLOC alloca
238 # define YYSTACK_ALLOC __builtin_alloca
244 # ifdef YYSTACK_ALLOC
245 /* Pacify GCC's `empty if-body' warning. */
246 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
248 # if defined (__STDC__) || defined (__cplusplus)
249 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
250 # define YYSIZE_T size_t
252 # define YYSTACK_ALLOC malloc
253 # define YYSTACK_FREE free
255 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
258 #if (! defined (yyoverflow) \
259 && (! defined (__cplusplus) \
260 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
262 /* A type that is properly aligned for any stack member. */
267 b4_location_if([ YYLTYPE yyls
;
271 /* The size of the maximum gap between one aligned stack and the next. */
272 # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
274 /* The size of an array large to enough to hold all stacks, each with
277 [# define YYSTACK_BYTES(N) \
278 ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
279 + 2 * YYSTACK_GAP_MAX)],
280 [# define YYSTACK_BYTES(N) \
281 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
284 /* Copy COUNT objects from FROM to TO. The source and destination do
288 # define YYCOPY(To, From, Count) \
289 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
291 # define YYCOPY(To, From, Count) \
294 register YYSIZE_T yyi; \
295 for (yyi = 0; yyi < (Count); yyi++) \
296 (To)[[yyi]] = (From)[[yyi]]; \
302 /* Relocate STACK from its old location to the new one. The
303 local variables YYSIZE and YYSTACKSIZE give the old and new number of
304 elements in the stack, and YYPTR gives the new location of the
305 stack. Advance YYPTR to a properly aligned location for the next
307 # define YYSTACK_RELOCATE(Stack) \
310 YYSIZE_T yynewbytes; \
311 YYCOPY (&yyptr->Stack, Stack, yysize); \
312 Stack = &yyptr->Stack; \
313 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
314 yyptr += yynewbytes / sizeof (*yyptr); \
320 #if defined (__STDC__) || defined (__cplusplus)
321 typedef signed char yysigned_char
;
323 typedef short yysigned_char
;
326 /* YYFINAL -- State number of the termination state. */
327 #define YYFINAL b4_final_state_number
328 /* YYLAST -- Last index in YYTABLE. */
329 #define YYLAST b4_last
331 /* YYNTOKENS -- Number of terminals. */
332 #define YYNTOKENS b4_tokens_number
333 /* YYNNTS -- Number of nonterminals. */
334 #define YYNNTS b4_nterms_number
335 /* YYNRULES -- Number of rules. */
336 #define YYNRULES b4_rules_number
337 /* YYNRULES -- Number of states. */
338 #define YYNSTATES b4_states_number
340 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
341 #define YYUNDEFTOK b4_undef_token_number
342 #define YYMAXUTOK b4_user_token_number_max
344 #define YYTRANSLATE(X) \
345 ((unsigned)(X) <= YYMAXUTOK ? yytranslate[[X]] : YYUNDEFTOK)
347 /* YYTRANSLATE[[YYLEX]] -- Bison symbol number corresponding to YYLEX. */
348 static const b4_int_type_for([b4_translate
]) yytranslate
[[]] =
354 /* YYPRHS[[YYN]] -- Index of the first RHS symbol of rule number YYN in
356 static const b4_int_type_for([b4_prhs
]) yyprhs
[[]] =
361 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
362 static const b4_int_type_for([b4_rhs
]) yyrhs
[[]] =
367 /* YYRLINE[[YYN]] -- source line where rule number YYN was defined. */
368 static const b4_int_type_for([b4_rline
]) yyrline
[[]] =
374 #if YYDEBUG || YYERROR_VERBOSE
375 /* YYTNME[[SYMBOL-NUM]] -- String name of the symbol SYMBOL-NUM.
376 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
377 static const char *const yytname
[[]] =
384 /* YYTOKNUM[[YYLEX-NUM]] -- Internal token number corresponding to
386 static const b4_int_type_for([b4_toknum
]) yytoknum
[[]] =
392 /* YYR1[[YYN]] -- Symbol number of symbol that rule YYN derives. */
393 static const b4_int_type_for([b4_r1
]) yyr1
[[]] =
398 /* YYR2[[YYN]] -- Number of symbols composing right hand side of rule YYN. */
399 static const b4_int_type_for([b4_r2
]) yyr2
[[]] =
404 /* YYDEFACT[[STATE-NAME]] -- Default rule to reduce with in state
405 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
406 means the default is an error. */
407 static const b4_int_type_for([b4_defact
]) yydefact
[[]] =
412 /* YYDEFGOTO[[NTERM-NUM]]. */
413 static const b4_int_type_for([b4_defgoto
]) yydefgoto
[[]] =
418 /* YYPACT[[STATE-NUM]] -- Index in YYTABLE of the portion describing
420 #define YYPACT_NINF b4_pact_ninf
421 static const b4_int_type_for([b4_pact
]) yypact
[[]] =
426 /* YYPGOTO[[NTERM-NUM]]. */
427 static const b4_int_type_for([b4_pgoto
]) yypgoto
[[]] =
432 /* YYTABLE[[YYPACT[STATE-NUM]]]. What to do in state STATE-NUM. If
433 positive, shift that token. If negative, reduce the rule which
434 number is the opposite. If zero, do what YYDEFACT says.
435 If YYTABLE_NINF, parse error. */
436 #define YYTABLE_NINF b4_table_ninf
437 static const b4_int_type_for([b4_table
]) yytable
[[]] =
442 static const b4_int_type_for([b4_check
]) yycheck
[[]] =
447 /* YYSTOS[[STATE-NUM]] -- The (internal number of the) accessing
448 symbol of state STATE-NUM. */
449 static const b4_int_type_for([b4_stos
]) yystos
[[]] =
454 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
455 # define YYSIZE_T __SIZE_TYPE__
457 #if ! defined (YYSIZE_T) && defined (size_t)
458 # define YYSIZE_T size_t
460 #if ! defined (YYSIZE_T)
461 # if defined (__STDC__) || defined (__cplusplus)
462 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
463 # define YYSIZE_T size_t
466 #if ! defined (YYSIZE_T)
467 # define YYSIZE_T unsigned int
470 #define yyerrok (yyerrstatus = 0)
471 #define yyclearin (yychar = YYEMPTY)
475 #define YYACCEPT goto yyacceptlab
476 #define YYABORT goto yyabortlab
477 #define YYERROR goto yyerrlab1
479 /* Like YYERROR except do call yyerror. This remains here temporarily
480 to ease the transition to the new meaning of YYERROR, for GCC.
481 Once GCC version 2 has supplanted version 1, this can go. */
483 #define YYFAIL goto yyerrlab
485 #define YYRECOVERING() (!!yyerrstatus)
487 #define YYBACKUP(Token, Value) \
489 if (yychar == YYEMPTY && yylen == 1) \
493 yychar1 = YYTRANSLATE (yychar); \
499 yyerror ("syntax error: cannot back up"); \
505 #define YYERRCODE 256
507 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
510 #ifndef YYLLOC_DEFAULT
511 # define YYLLOC_DEFAULT(Current, Rhs, N) \
512 Current.first_line = Rhs[[1]].first_line; \
513 Current.first_column = Rhs[[1]].first_column; \
514 Current.last_line = Rhs[[N]].last_line; \
515 Current.last_column = Rhs[[N]].last_column;
518 /* YYLEX -- calling `yylex' with the right arguments. */
521 # define YYLEX yylex (b4_pure_if([&yylval[]b4_location_if([, &yylloc]), ])YYLEX_PARAM)
523 # define YYLEX b4_c_function_call([yylex], [int], b4_lex_param)
526 /* Enable debugging if requested. */
530 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
531 # define YYFPRINTF fprintf
534 # define YYDPRINTF(Args) \
539 # define YYDSYMPRINT(Args) \
544 /* Nonzero means print parse trace. It is left uninitialized so that
545 multiple parsers can coexist. */
548 # define YYDPRINTF(Args)
549 # define YYDSYMPRINT(Args)
550 #endif /* !YYDEBUG */
552 /* YYINITDEPTH -- initial size of the parser's stacks. */
554 # define YYINITDEPTH b4_stack_depth_init
557 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
558 if the built-in stack extension method is used).
560 Do not make this value too large; the results are undefined if
561 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
562 evaluated with infinite-precision integer arithmetic. */
569 # define YYMAXDEPTH b4_stack_depth_max
577 # if defined (__GLIBC__) && defined (_STRING_H)
578 # define yystrlen strlen
580 /* Return the length of YYSTR. */
582 # if defined (__STDC__) || defined (__cplusplus)
583 yystrlen (const char *yystr
)
589 register const char *yys
= yystr
;
591 while (*yys
++ != '\0')
594 return yys
- yystr
- 1;
600 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
601 # define yystpcpy stpcpy
603 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
606 # if defined (__STDC__) || defined (__cplusplus)
607 yystpcpy (char *yydest
, const char *yysrc
)
609 yystpcpy (yydest
, yysrc
)
614 register char *yyd
= yydest
;
615 register const char *yys
= yysrc
;
617 while ((*yyd
++ = *yys
++) != '\0')
625 #endif /* !YYERROR_VERBOSE */
630 /*-----------------------------.
631 | Print this symbol on YYOUT. |
632 `-----------------------------*/
634 b4_c_function_def([yysymprint
],
636 [[FILE *yyout
], [yyout
]],
637 [[int yytype
], [yytype
]],
638 [[YYSTYPE yyvalue
], [yyvalue
]]b4_location_if([,
639 [[YYLTYPE yylocation
], [yylocation
]]]))
641 /* Pacify ``unused variable'' warnings. */
643 b4_location_if([ (void) yylocation
;
646 if (yytype
< YYNTOKENS
)
648 YYFPRINTF (yyout
, "token %s (", yytname
[[yytype]]);
650 YYPRINT (yyout
, yytoknum
[[yytype]], yyvalue
);
654 YYFPRINTF (yyout
, "nterm %s (", yytname
[[yytype]]);
658 m4_map([b4_symbol_actions
], m4_defn([b4_symbol_printers
]))dnl
662 YYFPRINTF (yyout
, ")");
664 #endif /* YYDEBUG. */
667 /*-----------------------------------------------.
668 | Release the memory associated to this symbol. |
669 `-----------------------------------------------*/
671 b4_c_function_def([yydestruct
],
673 [[int yytype
], [yytype
]],
674 [[YYSTYPE yyvalue
], [yyvalue
]]b4_location_if([,
675 [[YYLTYPE yylocation
], [yylocation
]]]))
677 /* Pacify ``unused variable'' warnings. */
679 b4_location_if([ (void) yylocation
;
684 m4_map([b4_symbol_actions
], m4_defn([b4_symbol_destructors
]))dnl
692 /* Prevent warnings from -Wmissing-prototypes. */
695 # if defined (__STDC__) || defined (__cplusplus)
696 int yyparse (void *YYPARSE_PARAM
);
700 #else /* ! YYPARSE_PARAM */
701 b4_c_function_decl([yyparse
], [int], b4_parse_param
)
705 m4_divert_push([KILL
])# ======================== M4 code.
706 # b4_declare_parser_variables
707 # ---------------------------
708 # Declare the variables that are global, or local to YYPARSE if
710 m4_define([b4_declare_parser_variables
],
711 [/* The lookahead symbol. */
714 /* The semantic value of the lookahead symbol. */
717 /* Number of parse errors so far. */
718 int yynerrs
;b4_location_if([
719 /* Location data for the lookahead symbol. */
722 m4_divert_pop([KILL
])dnl
# ====================== End of M4 code.
725 [b4_declare_parser_variables
])
733 # if defined (__STDC__) || defined (__cplusplus)
734 int yyparse (void *YYPARSE_PARAM
)
736 int yyparse (YYPARSE_PARAM
)
739 #else /* ! YYPARSE_PARAM */
740 b4_c_function_def([yyparse
], [int], b4_parse_param
)
743 ]b4_pure_if([b4_declare_parser_variables
])[
744 register int yystate
;
747 /* Number of tokens to shift before error messages enabled. */
749 /* Lookahead token as an internal (translated) token number. */
752 /* Three stacks and their tools:
753 `yyss': related to states,
754 `yyvs': related to semantic values,
755 `yyls': related to locations.
757 Refer to the stacks thru separate pointers, to allow yyoverflow
758 to reallocate them elsewhere. */
760 /* The state stack. */
761 short yyssa
[YYINITDEPTH
];
763 register short *yyssp
;
765 /* The semantic value stack. */
766 YYSTYPE yyvsa
[YYINITDEPTH
];
767 YYSTYPE
*yyvs
= yyvsa
;
768 register YYSTYPE
*yyvsp
;
771 [[ /* The location stack. */
772 YYLTYPE yylsa
[YYINITDEPTH
];
773 YYLTYPE
*yyls
= yylsa
;
776 #define YYPOPSTACK (yyvsp--, yyssp--]b4_location_if([, yylsp--])[)
778 YYSIZE_T yystacksize
= YYINITDEPTH
;
780 /* The variables used to return semantic value and location from the
783 ]b4_location_if([ YYLTYPE yyloc
;])[
785 /* When reducing, the number of symbols on the RHS of the reduced
789 YYDPRINTF ((stderr
, "Starting parse\n"));
794 yychar
= YYEMPTY
; /* Cause a token to be read. */
796 /* Initialize stack pointers.
797 Waste one element of value and location stack
798 so that they stay on the same level as the state stack.
799 The wasted elements are never initialized. */
803 ]b4_location_if([ yylsp
= yyls
;])[
806 /*------------------------------------------------------------.
807 | yynewstate -- Push a new state, which is found in yystate. |
808 `------------------------------------------------------------*/
810 /* In all cases, when you get here, the value and location stacks
811 have just been pushed. so pushing a state here evens the stacks.
818 if (yyss
+ yystacksize
- 1 <= yyssp
)
820 /* Get the current used size of the three stacks, in elements. */
821 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
825 /* Give user a chance to reallocate the stack. Use copies of
826 these so that the &'s don't force the real ones into
828 YYSTYPE
*yyvs1
= yyvs
;
830 ]b4_location_if([ YYLTYPE
*yyls1
= yyls
;])[
832 /* Each stack pointer address is followed by the size of the
833 data in use in that stack, in bytes. This used to be a
834 conditional around just the two extra args, but that might
835 be undefined if yyoverflow is a macro. */
836 yyoverflow ("parser stack overflow",
837 &yyss1
, yysize
* sizeof (*yyssp
),
838 &yyvs1
, yysize
* sizeof (*yyvsp
),
839 ]b4_location_if([ &yyls1
, yysize
* sizeof (*yylsp
),])[
841 ]b4_location_if([ yyls
= yyls1
;])[
845 #else /* no yyoverflow */
846 # ifndef YYSTACK_RELOCATE
849 /* Extend the stack our own way. */
850 if (YYMAXDEPTH
<= yystacksize
)
853 if (YYMAXDEPTH
< yystacksize
)
854 yystacksize
= YYMAXDEPTH
;
858 union yyalloc
*yyptr
=
859 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
862 YYSTACK_RELOCATE (yyss
);
863 YYSTACK_RELOCATE (yyvs
);
864 ]b4_location_if([ YYSTACK_RELOCATE (yyls
);])[
865 # undef YYSTACK_RELOCATE
867 YYSTACK_FREE (yyss1
);
870 #endif /* no yyoverflow */
872 yyssp
= yyss
+ yysize
- 1;
873 yyvsp
= yyvs
+ yysize
- 1;
874 ]b4_location_if([ yylsp
= yyls
+ yysize
- 1;])[
876 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
877 (unsigned long int) yystacksize
));
879 if (yyss
+ yystacksize
- 1 <= yyssp
)
883 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
892 /* Do appropriate processing given the current state. */
893 /* Read a lookahead token if we need one and don't already have one. */
896 /* First try to decide what to do without reference to lookahead token. */
898 yyn
= yypact
[yystate
];
899 if (yyn
== YYPACT_NINF
)
902 /* Not known => get a lookahead token if don't already have one. */
904 /* yychar is either YYEMPTY or YYEOF
905 or a valid token in external form. */
907 if (yychar
== YYEMPTY
)
909 YYDPRINTF ((stderr
, "Reading a token: "));
913 /* Convert token to internal form (in yychar1) for indexing tables with. */
915 if (yychar
<= 0) /* This means end of input. */
918 yychar
= YYEOF
; /* Don't call YYLEX any more. */
920 YYDPRINTF ((stderr
, "Now at end of input.\n"));
924 yychar1
= YYTRANSLATE (yychar
);
926 /* We have to keep this `#if YYDEBUG', since we use variables
927 which are defined only if `YYDEBUG' is set. */
928 YYDPRINTF ((stderr
, "Next token is "));
929 YYDSYMPRINT ((stderr
, yychar1
, yylval
]b4_location_if([, yyloc
])[));
930 YYDPRINTF ((stderr
, "\n"));
933 /* If the proper action on seeing token YYCHAR1 is to reduce or to
934 detect an error, take that action. */
936 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yychar1
)
941 if (yyn
== 0 || yyn
== YYTABLE_NINF
)
950 /* Shift the lookahead token. */
951 YYDPRINTF ((stderr
, "Shifting token %d (%s), ",
952 yychar
, yytname
[yychar1
]));
954 /* Discard the token being shifted unless it is eof. */
959 ]b4_location_if([ *++yylsp
= yylloc
;])[
961 /* Count tokens shifted since error; after three, turn off error
970 /*-----------------------------------------------------------.
971 | yydefault -- do the default action for the current state. |
972 `-----------------------------------------------------------*/
974 yyn
= yydefact
[yystate
];
980 /*-----------------------------.
981 | yyreduce -- Do a reduction. |
982 `-----------------------------*/
984 /* yyn is the number of a rule to reduce with. */
987 /* If YYLEN is nonzero, implement the default value of the action:
990 Otherwise, the following line sets YYVAL to garbage.
991 This behavior is undocumented and Bison
992 users should not rely upon it. Assigning to YYVAL
993 unconditionally makes the parser a bit smaller, and it avoids a
994 GCC warning that YYVAL may be used uninitialized. */
995 yyval
= yyvsp
[1-yylen
];
998 [ /* Default location. */
999 YYLLOC_DEFAULT (yyloc
, (yylsp
- yylen
), yylen
);])[
1002 /* We have to keep this `#if YYDEBUG', since we use variables which
1003 are defined only if `YYDEBUG' is set. */
1008 YYFPRINTF (stderr
, "Reducing via rule %d (line %d), ",
1009 yyn
- 1, yyrline
[yyn
]);
1011 /* Print the symbols being reduced, and their result. */
1012 for (yyi
= yyprhs
[yyn
]; 0 <= yyrhs
[yyi
]; yyi
++)
1013 YYFPRINTF (stderr
, "%s ", yytname
[yyrhs
[yyi
]]);
1014 YYFPRINTF (stderr
, " -> %s\n", yytname
[yyr1
[yyn
]]);
1022 /* Line __line__ of __file__. */
1023 #line __oline__ "__ofile__"
1027 ]b4_location_if([ yylsp
-= yylen
;])[
1032 short *yyssp1
= yyss
- 1;
1033 YYFPRINTF (stderr
, "state stack now");
1034 while (yyssp1
!= yyssp
)
1035 YYFPRINTF (stderr
, " %d", *++yyssp1
);
1036 YYFPRINTF (stderr
, "\n");
1041 ]b4_location_if([ *++yylsp
= yyloc
;])[
1043 /* Now `shift' the result of the reduction. Determine what state
1044 that goes to, based on the state we popped back to and the rule
1045 number reduced by. */
1049 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
1050 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
1051 yystate
= yytable
[yystate
];
1053 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
1058 /*------------------------------------.
1059 | yyerrlab -- here on detecting error |
1060 `------------------------------------*/
1062 /* If not already recovering from an error, report this error. */
1067 yyn
= yypact
[yystate
];
1069 if (YYPACT_NINF
< yyn
&& yyn
< YYLAST
)
1071 YYSIZE_T yysize
= 0;
1072 int yytype
= YYTRANSLATE (yychar
);
1077 /* Start YYX at -YYN if negative to avoid negative indexes in
1079 for (yyx
= yyn
< 0 ? -yyn
: 0;
1080 yyx
< (int) (sizeof (yytname
) / sizeof (char *)); yyx
++)
1081 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1082 yysize
+= yystrlen (yytname
[yyx
]) + 15, yycount
++;
1083 yysize
+= yystrlen ("parse error, unexpected ") + 1;
1084 yysize
+= yystrlen (yytname
[yytype
]);
1085 yymsg
= (char *) YYSTACK_ALLOC (yysize
);
1088 char *yyp
= yystpcpy (yymsg
, "parse error, unexpected ");
1089 yyp
= yystpcpy (yyp
, yytname
[yytype
]);
1094 for (yyx
= yyn
< 0 ? -yyn
: 0;
1095 yyx
< (int) (sizeof (yytname
) / sizeof (char *));
1097 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1099 const char *yyq
= ! yycount
? ", expecting " : " or ";
1100 yyp
= yystpcpy (yyp
, yyq
);
1101 yyp
= yystpcpy (yyp
, yytname
[yyx
]);
1106 YYSTACK_FREE (yymsg
);
1109 yyerror ("parse error; also virtual memory exhausted");
1112 #endif /* YYERROR_VERBOSE */
1113 yyerror ("parse error");
1118 /*----------------------------------------------------.
1119 | yyerrlab1 -- error raised explicitly by an action. |
1120 `----------------------------------------------------*/
1122 if (yyerrstatus
== 3)
1124 /* If just tried and failed to reuse lookahead token after an
1125 error, discard it. */
1127 /* Return failure if at end of input. */
1128 if (yychar
== YYEOF
)
1130 /* Pop the error token. */
1132 /* Pop the rest of the stack. */
1133 while (yyss
< yyssp
)
1135 YYDPRINTF ((stderr
, "Error: popping "));
1136 YYDSYMPRINT ((stderr
,
1138 *yyvsp
]b4_location_if([, *yylsp
])[));
1139 YYDPRINTF ((stderr
, "\n"));
1140 yydestruct (yystos
[*yyssp
], *yyvsp
]b4_location_if([, *yylsp
])[);
1146 YYDPRINTF ((stderr
, "Discarding token %d (%s).\n",
1147 yychar
, yytname
[yychar1
]));
1148 yydestruct (yychar1
, yylval
]b4_location_if([, yylloc
])[);
1152 /* Else will try to reuse lookahead token after shifting the error
1155 yyerrstatus
= 3; /* Each real token shifted decrements this. */
1159 yyn
= yypact
[yystate
];
1160 if (yyn
!= YYPACT_NINF
)
1163 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
1171 /* Pop the current state because it cannot handle the error token. */
1175 YYDPRINTF ((stderr
, "Error: popping "));
1176 YYDSYMPRINT ((stderr
,
1177 yystos
[*yyssp
], *yyvsp
]b4_location_if([, *yylsp
])[));
1178 YYDPRINTF ((stderr
, "\n"));
1180 yydestruct (yystos
[yystate
], *yyvsp
]b4_location_if([, *yylsp
])[);
1183 ]b4_location_if([ yylsp
--;])[
1188 short *yyssp1
= yyss
- 1;
1189 YYFPRINTF (stderr
, "Error: state stack now");
1190 while (yyssp1
!= yyssp
)
1191 YYFPRINTF (stderr
, " %d", *++yyssp1
);
1192 YYFPRINTF (stderr
, "\n");
1200 YYDPRINTF ((stderr
, "Shifting error token, "));
1203 ]b4_location_if([ *++yylsp
= yylloc
;])[
1209 /*-------------------------------------.
1210 | yyacceptlab -- YYACCEPT comes here. |
1211 `-------------------------------------*/
1216 /*-----------------------------------.
1217 | yyabortlab -- YYABORT comes here. |
1218 `-----------------------------------*/
1224 /*----------------------------------------------.
1225 | yyoverflowlab -- parser overflow comes here. |
1226 `----------------------------------------------*/
1228 yyerror ("parser stack overflow");
1236 YYSTACK_FREE (yyss
);
1243 m4_if(b4_defines_flag
, 0, [],
1244 [#output "b4_output_header_name"
1245 b4_copyright([Skeleton parser
for Yacc
-like parsing with Bison
],
1246 [1984, 1989, 1990, 2000, 2001, 2002])
1248 /* As a special exception, when this file is copied by Bison into a
1249 Bison output file, you may use that output file without restriction.
1250 This special exception was added by the Free Software Foundation
1251 in version 1.24 of Bison. */
1253 #ifndef b4_header_guard
1254 # define b4_header_guard
1256 b4_token_defines(b4_tokens
)
1259 m4_ifdef([b4_stype
],
1260 [#line b4_stype_line "b4_filename"
1261 typedef union b4_stype yystype
;
1262 /* Line __line__ of __file__. */
1263 #line __oline__ "__ofile__"],
1264 [typedef int yystype
;])
1265 # define YYSTYPE yystype
1269 [extern YYSTYPE b4_prefix
[]lval
;])
1273 typedef struct yyltype
1280 # define YYLTYPE yyltype
1284 [extern YYLTYPE b4_prefix
[]lloc
;])
1286 #endif /* not b4_header_guard */