3 # C++ skeleton for Bison
5 # Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22 m4_include(b4_pkgdatadir
/[c
++.m4
])
23 # Backward compatibility.
24 m4_define([b4_location_constructors
])
25 m4_include(b4_pkgdatadir
/[location
.cc
])
27 # We do want M4 expansion after # for CPP macros.
30 m4_if(b4_defines_flag
, 0, [],
31 [@output @output_header_name@
32 b4_copyright([C
++ Skeleton parser
for LALR(1) parsing with Bison
],
33 [2002, 2003, 2004, 2005])
34 dnl FIXME
: This is wrong
, we want computed header guards
.
35 [/* As a special exception, when this parser skeleton is copied by
36 Bison into a Bison output file, you may use that output file
37 without restriction. This special exception was added by the Free
38 Software Foundation for C++ LALR(1) parsers in version 2.2 of
41 /* C++ LALR(1) parser skeleton written by Akim Demaille. */
43 #ifndef PARSER_HEADER_H
44 # define PARSER_HEADER_H
56 /* First part of user declarations. */
59 ]/* Line __line__ of lalr1.cc. */
60 b4_syncline([@oline@
], [@ofile@
])[
62 ]dnl Include location
.hh here
: it might depend on headers included above
.
63 [#include "location.hh"
65 /* Enabling traces. */
67 # define YYDEBUG ]b4_debug[
70 /* Enabling verbose error messages. */
71 #ifdef YYERROR_VERBOSE
72 # undef YYERROR_VERBOSE
73 # define YYERROR_VERBOSE 1
75 # define YYERROR_VERBOSE ]b4_error_verbose[
78 /* Enabling the token table. */
80 # define YYTOKEN_TABLE ]b4_token_table[
83 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
84 If N is 0, then set CURRENT to the empty location which ends
85 the previous symbol: RHS[0] (always defined). */
87 #ifndef YYLLOC_DEFAULT
88 # define YYLLOC_DEFAULT(Current, Rhs, N) \
92 (Current).begin = (Rhs)[1].begin; \
93 (Current).end = (Rhs)[N].end; \
97 (Current).begin = (Current).end = (Rhs)[0].end; \
106 class ]b4_parser_class_name
[
109 /// Symbol semantic values.
110 #if ! defined (YYSTYPE)
111 ]m4_ifdef([b4_stype
],
112 [b4_syncline([b4_stype_line
], [b4_file_name
])
113 union semantic_type b4_stype
;
114 /* Line __line__ of lalr1.cc. */
115 b4_syncline([@oline@
], [@ofile@
])],
116 [ typedef int semantic_type
;])[
118 typedef YYSTYPE semantic_type
;
120 /// Symbol locations.
121 typedef ]b4_location_type
[ location_type
;
125 ]b4_token_enums(b4_tokens
)[
128 /// Build a parser object.
129 ]b4_parser_class_name
[ (]b4_parse_param_decl
[);
130 virtual ~]b4_parser_class_name
[ ();
133 /// \returns 0 iff parsing succeeded.
134 virtual int parse ();
136 /// The current debugging stream.
137 std::ostream
& debug_stream () const;
138 /// Set the current debugging stream.
139 void set_debug_stream (std::ostream
&);
141 /// Type for debugging levels.
142 typedef int debug_level_type
;
143 /// The current debugging level.
144 debug_level_type
debug_level () const;
145 /// Set the current debugging level.
146 void set_debug_level (debug_level_type l
);
149 /// Report a syntax error.
150 /// \param loc where the syntax error is found.
151 /// \param msg a description of the syntax error.
152 virtual void error (const location_type
& loc
, const std::string
& msg
);
154 /// Generate an error message.
155 /// \param state the state where the error occurred.
156 /// \param tok the look-ahead token.
157 virtual std::string
yysyntax_error_ (int yystate
]dnl
158 b4_error_verbose_if([, int tok
])[);
161 /// \brief Report a symbol on the debug stream.
162 /// \param yytype The token type.
163 /// \param yyvaluep Its semantic value.
164 /// \param yylocationp Its location.
165 virtual void yysymprint_ (int yytype
,
166 const semantic_type
* yyvaluep
,
167 const location_type
* yylocationp
);
168 #endif /* ! YYDEBUG */
172 typedef int state_type
;
173 /// State stack type.
174 typedef stack
<state_type
> state_stack_type
;
175 /// Semantic value stack type.
176 typedef stack
<semantic_type
> semantic_stack_type
;
177 /// location stack type.
178 typedef stack
<location_type
> location_stack_type
;
181 state_stack_type yystate_stack_
;
182 /// The semantic value stack.
183 semantic_stack_type yysemantic_stack_
;
184 /// The location stack.
185 location_stack_type yylocation_stack_
;
187 /// Internal symbol numbers.
188 typedef ]b4_int_type_for([b4_translate
])[ token_number_type
;
190 /// For a state, the index in \a yytable_ of its portion.
191 static const ]b4_int_type_for([b4_pact
])[ yypact_
[];
192 static const ]b4_int_type(b4_pact_ninf
, b4_pact_ninf
)[ yypact_ninf_
;
194 /// For a state, default rule to reduce.
195 /// Unless\a yytable_ specifies something else to do.
196 /// Zero means the default is an error.
197 static const ]b4_int_type_for([b4_defact
])[ yydefact_
[];
199 static const ]b4_int_type_for([b4_pgoto
])[ yypgoto_
[];
200 static const ]b4_int_type_for([b4_defgoto
])[ yydefgoto_
[];
202 /// What to do in a state.
203 /// \a yytable_[yypact_[s]]: what to do in state \a s.
204 /// - if positive, shift that token.
205 /// - if negative, reduce the rule which number is the opposite.
206 /// - if zero, do what YYDEFACT says.
207 static const ]b4_int_type_for([b4_table
])[ yytable_
[];
208 static const ]b4_int_type(b4_table_ninf
, b4_table_ninf
)[ yytable_ninf_
;
210 static const ]b4_int_type_for([b4_check
])[ yycheck_
[];
212 /// For a state, its accessing symbol.
213 static const ]b4_int_type_for([b4_stos
])[ yystos_
[];
215 /// For a rule, its LHS.
216 static const ]b4_int_type_for([b4_r1
])[ yyr1_
[];
217 /// For a rule, its RHS length.
218 static const ]b4_int_type_for([b4_r2
])[ yyr2_
[];
220 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
221 /// For a symbol, its name in clear.
222 static const char* const yytname_
[];
226 /// Convert the symbol name \a n to a form suitable for a diagnostic.
227 virtual std::string
yytnamerr_ (const char *n
);
231 /// A type to store symbol numbers and -1.
232 typedef ]b4_int_type_for([b4_rhs
])[ rhs_number_type
;
233 /// A `-1'-separated list of the rules' RHS.
234 static const rhs_number_type yyrhs_
[];
235 /// For each rule, the index of the first RHS symbol in \a yyrhs_.
236 static const ]b4_int_type_for([b4_prhs
])[ yyprhs_
[];
237 /// For each rule, its source line number.
238 static const ]b4_int_type_for([b4_rline
])[ yyrline_
[];
239 /// For each scanner token number, its symbol number.
240 static const ]b4_int_type_for([b4_toknum
])[ yytoken_number_
[];
241 /// Report on the debug stream that the rule \a r is going to be reduced.
242 virtual void yy_reduce_print_ (int r
);
243 /// Print the state stack on the debug stream.
244 virtual void yystack_print_ ();
247 /// Convert a scanner token number to a symbol number.
248 inline token_number_type
yytranslate_ (int token
);
250 /// \brief Reclaim the memory associated to a symbol.
251 /// \param yymsg Why this token is reclaimed.
252 /// \param yytype The symbol type.
253 /// \param yyvaluep Its semantic value.
254 /// \param yylocationp Its location.
255 inline void yydestruct_ (const char* yymsg
,
257 semantic_type
* yyvaluep
,
258 location_type
* yylocationp
);
260 /// Pop \a n symbols the three stacks.
261 inline void yypop_ (unsigned int n
= 1);
264 static const int yyeof_
;
265 /* LAST_ -- Last index in TABLE_. */
266 static const int yylast_
;
267 static const int yynnts_
;
268 static const int yyempty_
;
269 static const int yyfinal_
;
270 static const int yyterror_
;
271 static const int yyerrcode_
;
272 static const int yyntokens_
;
273 static const unsigned int yyuser_token_number_max_
;
274 static const token_number_type yyundef_token_
;
278 std::ostream
* yycdebug_
;
280 ]b4_parse_param_vars
[
284 ]m4_ifset([b4_global_tokens_and_yystype
],
285 [b4_token_defines(b4_tokens
)
288 /* Redirection for backward compatibility. */
289 # define YYSTYPE yy::b4_parser_class_name::semantic_type
292 #endif /* ! defined PARSER_HEADER_H */]
294 @output @output_parser_name@
295 b4_copyright([C
++ Skeleton parser
for LALR(1) parsing with Bison
],
296 [2002, 2003, 2004, 2005])
297 m4_if(b4_prefix
[], [yy
], [],
299 // Take the name prefix into account.
300 #define yylex b4_prefix[]lex])
301 m4_if(b4_defines_flag
, 0, [],
303 #include @output_header_name@])[
305 /* User implementation prologue. */
308 ]/* Line __line__ of lalr1.cc. */
309 b4_syncline([@oline@
], [@ofile@
])[
314 # include <libintl.h> /* FIXME: INFRINGES ON USER NAME SPACE */
315 # define YY_(msgid) dgettext ("bison-runtime", msgid)
319 # define YY_(msgid) msgid
323 /* Suppress unused-variable warnings by "using" E. */
324 #define YYUSE(e) ((void) (e))
326 /* A pseudo ostream that takes yydebug_ into account. */
328 for (bool yydebugcond_ = yydebug_; yydebugcond_; yydebugcond_ = false) \
331 /* Enable debugging if requested. */
334 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
338 *yycdebug_ << Title << ' '; \
339 yysymprint_ ((Type), (Value), (Location)); \
340 *yycdebug_ << std::endl; \
344 # define YY_REDUCE_PRINT(Rule) \
347 yy_reduce_print_ (Rule); \
350 # define YY_STACK_PRINT() \
358 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
359 # define YY_REDUCE_PRINT(Rule)
360 # define YY_STACK_PRINT()
362 #endif /* !YYDEBUG */
364 #define YYACCEPT goto yyacceptlab
365 #define YYABORT goto yyabortlab
366 #define YYERROR goto yyerrorlab
370 /* Return YYSTR after stripping away unnecessary quotes and
371 backslashes, so that it's suitable for yyerror. The heuristic is
372 that double-quoting is unnecessary unless the string contains an
373 apostrophe, a comma, or backslash (other than backslash-backslash).
374 YYSTR is taken from yytname. */
376 yy::]b4_parser_class_name
[::yytnamerr_ (const char *yystr
)
380 std::string yyr
= "";
381 char const *yyp
= yystr
;
388 goto do_not_strip_quotes
;
392 goto do_not_strip_quotes
;
401 do_not_strip_quotes
: ;
411 /// Build a parser object.
412 ]b4_parser_class_name::b4_parser_class_name
[ (]b4_parse_param_decl
[)
414 yycdebug_ (&std::cerr
)]b4_parse_param_cons
[
418 ]b4_parser_class_name::~b4_parser_class_name
[ ()
423 /*--------------------------------.
424 | Print this symbol on YYOUTPUT. |
425 `--------------------------------*/
428 ]b4_parser_class_name
[::yysymprint_ (int yytype
,
429 const semantic_type
* yyvaluep
, const location_type
* yylocationp
)
431 /* Backward compatibility, but should be removed eventually. */
432 std::ostream
& cdebug_
= *yycdebug_
;
438 *yycdebug_
<< (yytype
< yyntokens_
? "token" : "nterm")
439 << ' ' << yytname_
[yytype
] << " ("
440 << *yylocationp
<< ": ";
443 ]m4_map([b4_symbol_actions
], m4_defn([b4_symbol_printers
]))dnl
449 #endif /* ! YYDEBUG */
452 ]b4_parser_class_name
[::yydestruct_ (const char* yymsg
,
453 int yytype
, semantic_type
* yyvaluep
, location_type
* yylocationp
)
459 YY_SYMBOL_PRINT (yymsg
, yytype
, yyvaluep
, yylocationp
);
463 ]m4_map([b4_symbol_actions
], m4_defn([b4_symbol_destructors
]))[
470 ]b4_parser_class_name
[::yypop_ (unsigned int n
)
472 yystate_stack_
.pop (n
);
473 yysemantic_stack_
.pop (n
);
474 yylocation_stack_
.pop (n
);
478 ]b4_parser_class_name
[::debug_stream () const
484 ]b4_parser_class_name
[::set_debug_stream (std::ostream
& o
)
490 ]b4_parser_class_name
[::debug_level_type
491 ]b4_parser_class_name
[::debug_level () const
497 ]b4_parser_class_name
[::set_debug_level (debug_level_type l
)
504 ]b4_parser_class_name
[::parse ()
506 /// Look-ahead and look-ahead in internal form.
507 int yychar
= yyempty_
;
515 /* Error handling. */
517 int yyerrstatus_
= 0;
519 /// Semantic value of the look-ahead.
520 semantic_type yylval
;
521 /// Location of the look-ahead.
522 location_type yylloc
;
523 /// The locations where the error started and ended.
524 location yyerror_range
[2];
533 YYCDEBUG
<< "Starting parse" << std::endl
;
535 ]m4_ifdef([b4_initial_action
], [
536 m4_pushdef([b4_at_dollar
], [yylloc
])dnl
537 m4_pushdef([b4_dollar_dollar
], [yylval
])dnl
538 /* User initialization code. */
540 m4_popdef([b4_dollar_dollar
])dnl
541 m4_popdef([b4_at_dollar
])dnl
542 /* Line __line__ of yacc.c. */
543 b4_syncline([@oline@
], [@ofile@
])])dnl
545 [ /* Initialize the stacks. The initial state will be pushed in
546 yynewstate, since the latter expects the semantical and the
547 location values to have been already stored, initialize these
548 stacks with a primary value. */
549 yystate_stack_
= state_stack_type (0);
550 yysemantic_stack_
= semantic_stack_type (0);
551 yylocation_stack_
= location_stack_type (0);
552 yysemantic_stack_
.push (yylval
);
553 yylocation_stack_
.push (yylloc
);
557 yystate_stack_
.push (yystate
);
558 YYCDEBUG
<< "Entering state " << yystate
<< std::endl
;
564 /* Try to take a decision without look-ahead. */
565 yyn
= yypact_
[yystate
];
566 if (yyn
== yypact_ninf_
)
569 /* Read a look-ahead token. */
570 if (yychar
== yyempty_
)
572 YYCDEBUG
<< "Reading a token: ";
573 yychar
= ]b4_c_function_call([yylex
], [int],
574 [[YYSTYPE
*], [&yylval
]][]dnl
575 b4_location_if([, [[location
*], [&yylloc
]]])dnl
576 m4_ifdef([b4_lex_param
], [, ]b4_lex_param
))[;
580 /* Convert token to internal form. */
581 if (yychar
<= yyeof_
)
583 yychar
= yytoken
= yyeof_
;
584 YYCDEBUG
<< "Now at end of input." << std::endl
;
588 yytoken
= yytranslate_ (yychar
);
589 YY_SYMBOL_PRINT ("Next token is", yytoken
, &yylval
, &yylloc
);
592 /* If the proper action on seeing token YYTOKEN is to reduce or to
593 detect an error, take that action. */
595 if (yyn
< 0 || yylast_
< yyn
|| yycheck_
[yyn
] != yytoken
)
598 /* Reduce or error. */
602 if (yyn
== 0 || yyn
== yytable_ninf_
)
612 /* Shift the look-ahead token. */
613 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
615 /* Discard the token being shifted unless it is eof. */
616 if (yychar
!= yyeof_
)
619 yysemantic_stack_
.push (yylval
);
620 yylocation_stack_
.push (yylloc
);
622 /* Count tokens shifted since error; after three, turn off error
630 /*-----------------------------------------------------------.
631 | yydefault -- do the default action for the current state. |
632 `-----------------------------------------------------------*/
634 yyn
= yydefact_
[yystate
];
639 /*-----------------------------.
640 | yyreduce -- Do a reduction. |
641 `-----------------------------*/
644 /* If YYLEN is nonzero, implement the default value of the action:
645 `$$ = $1'. Otherwise, use the top of the stack.
647 Otherwise, the following line sets YYVAL to garbage.
648 This behavior is undocumented and Bison
649 users should not rely upon it. */
651 yyval
= yysemantic_stack_
[yylen
- 1];
653 yyval
= yysemantic_stack_
[0];
656 slice
<location_type
, location_stack_type
> slice (yylocation_stack_
, yylen
);
657 YYLLOC_DEFAULT (yyloc
, slice
, yylen
);
659 YY_REDUCE_PRINT (yyn
);
663 /* Line __line__ of lalr1.cc. */
664 b4_syncline([@oline@
], [@ofile@
])[
667 YY_SYMBOL_PRINT ("-> $$ =", yyr1_
[yyn
], &yyval
, &yyloc
);
673 yysemantic_stack_
.push (yyval
);
674 yylocation_stack_
.push (yyloc
);
676 /* Shift the result of the reduction. */
678 yystate
= yypgoto_
[yyn
- yyntokens_
] + yystate_stack_
[0];
679 if (0 <= yystate
&& yystate
<= yylast_
680 && yycheck_
[yystate
] == yystate_stack_
[0])
681 yystate
= yytable_
[yystate
];
683 yystate
= yydefgoto_
[yyn
- yyntokens_
];
686 /*------------------------------------.
687 | yyerrlab -- here on detecting error |
688 `------------------------------------*/
690 /* If not already recovering from an error, report this error. */
694 error (yylloc
, yysyntax_error_ (yystate
]dnl
695 b4_error_verbose_if([, yytoken
])[));
698 yyerror_range
[0] = yylloc
;
699 if (yyerrstatus_
== 3)
701 /* If just tried and failed to reuse look-ahead token after an
702 error, discard it. */
704 if (yychar
<= yyeof_
)
706 /* Return failure if at end of input. */
707 if (yychar
== yyeof_
)
712 yydestruct_ ("Error: discarding", yytoken
, &yylval
, &yylloc
);
717 /* Else will try to reuse look-ahead token after shifting the error
722 /*---------------------------------------------------.
723 | yyerrorlab -- error raised explicitly by YYERROR. |
724 `---------------------------------------------------*/
727 /* Pacify compilers like GCC when the user code never invokes
728 YYERROR and the label yyerrorlab therefore never appears in user
733 yyerror_range
[0] = yylocation_stack_
[yylen
- 1];
734 /* Do not reclaim the symbols of the rule which action triggered
738 yystate
= yystate_stack_
[0];
741 /*-------------------------------------------------------------.
742 | yyerrlab1 -- common code for both syntax error and YYERROR. |
743 `-------------------------------------------------------------*/
745 yyerrstatus_
= 3; /* Each real token shifted decrements this. */
749 yyn
= yypact_
[yystate
];
750 if (yyn
!= yypact_ninf_
)
753 if (0 <= yyn
&& yyn
<= yylast_
&& yycheck_
[yyn
] == yyterror_
)
761 /* Pop the current state because it cannot handle the error token. */
762 if (yystate_stack_
.height () == 1)
765 yyerror_range
[0] = yylocation_stack_
[0];
766 yydestruct_ ("Error: popping",
768 &yysemantic_stack_
[0], &yylocation_stack_
[0]);
770 yystate
= yystate_stack_
[0];
777 yyerror_range
[1] = yylloc
;
778 // Using YYLLOC is tempting, but would change the location of
779 // the look-ahead. YYLOC is available though.
780 YYLLOC_DEFAULT (yyloc
, yyerror_range
- 1, 2);
781 yysemantic_stack_
.push (yylval
);
782 yylocation_stack_
.push (yyloc
);
784 /* Shift the error token. */
785 YY_SYMBOL_PRINT ("Shifting", yystos_
[yyn
],
786 &yysemantic_stack_
[0], &yylocation_stack_
[0]);
802 if (yychar
!= yyeof_
&& yychar
!= yyempty_
)
803 yydestruct_ ("Cleanup: discarding lookahead", yytoken
, &yylval
, &yylloc
);
805 /* Do not reclaim the symbols of the rule which action triggered
806 this YYABORT or YYACCEPT. */
808 while (yystate_stack_
.height () != 1)
810 yydestruct_ ("Cleanup: popping",
811 yystos_
[yystate_stack_
[0]],
812 &yysemantic_stack_
[0],
813 &yylocation_stack_
[0]);
820 // Generate an error message.
822 ]b4_parser_class_name
[::yysyntax_error_ (int yystate
]dnl
823 b4_error_verbose_if([, int tok
])[)
827 int yyn
= yypact_
[yystate
];
828 if (yypact_ninf_
< yyn
&& yyn
< yylast_
)
830 /* Start YYX at -YYN if negative to avoid negative indexes in
832 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
834 /* Stay within bounds of both yycheck and yytname. */
835 int yychecklim
= yylast_
- yyn
;
836 int yyxend
= yychecklim
< yyntokens_
? yychecklim
: yyntokens_
;
838 for (int x
= yyxbegin
; x
< yyxend
; ++x
)
839 if (yycheck_
[x
+ yyn
] == x
&& x
!= yyterror_
)
842 // FIXME: This method of building the message is not compatible
843 // with internationalization. It should work like yacc.c does it.
844 // That is, first build a string that looks like this:
845 // "syntax error, unexpected %s or %s or %s"
846 // Then, invoke YY_ on this string.
847 // Finally, use the string as a format to output
848 // yytname_[tok], etc.
849 // Until this gets fixed, this message appears in English only.
850 res
= "syntax error, unexpected ";
851 res
+= yytnamerr_ (yytname_
[tok
]);
855 for (int x
= yyxbegin
; x
< yyxend
; ++x
)
856 if (yycheck_
[x
+ yyn
] == x
&& x
!= yyterror_
)
858 res
+= (!count
++) ? ", expecting " : " or ";
859 res
+= yytnamerr_ (yytname_
[x
]);
865 res
= YY_("syntax error");
870 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
872 const ]b4_int_type(b4_pact_ninf
, b4_pact_ninf
) b4_parser_class_name::yypact_ninf_
= b4_pact_ninf
[;
873 const ]b4_int_type_for([b4_pact
])[
874 ]b4_parser_class_name
[::yypact_
[] =
879 /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
880 doesn't specify something else to do. Zero means the default is an
882 const ]b4_int_type_for([b4_defact
])[
883 ]b4_parser_class_name
[::yydefact_
[] =
888 /* YYPGOTO[NTERM-NUM]. */
889 const ]b4_int_type_for([b4_pgoto
])[
890 ]b4_parser_class_name
[::yypgoto_
[] =
895 /* YYDEFGOTO[NTERM-NUM]. */
896 const ]b4_int_type_for([b4_defgoto
])[
897 ]b4_parser_class_name
[::yydefgoto_
[] =
902 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
903 positive, shift that token. If negative, reduce the rule which
904 number is the opposite. If zero, do what YYDEFACT says. */
905 const ]b4_int_type(b4_table_ninf
, b4_table_ninf
) b4_parser_class_name::yytable_ninf_
= b4_table_ninf
[;
906 const ]b4_int_type_for([b4_table
])[
907 ]b4_parser_class_name
[::yytable_
[] =
913 const ]b4_int_type_for([b4_check
])[
914 ]b4_parser_class_name
[::yycheck_
[] =
919 /* STOS_[STATE-NUM] -- The (internal number of the) accessing
920 symbol of state STATE-NUM. */
921 const ]b4_int_type_for([b4_stos
])[
922 ]b4_parser_class_name
[::yystos_
[] =
928 /* TOKEN_NUMBER_[YYLEX-NUM] -- Internal symbol number corresponding
930 const ]b4_int_type_for([b4_toknum
])[
931 ]b4_parser_class_name
[::yytoken_number_
[] =
937 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
938 const ]b4_int_type_for([b4_r1
])[
939 ]b4_parser_class_name
[::yyr1_
[] =
944 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
945 const ]b4_int_type_for([b4_r2
])[
946 ]b4_parser_class_name
[::yyr2_
[] =
951 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
952 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
953 First, the terminals, then, starting at \a yyntokens_, nonterminals. */
955 const ]b4_parser_class_name
[::yytname_
[] =
962 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
963 const ]b4_parser_class_name
[::rhs_number_type
964 ]b4_parser_class_name
[::yyrhs_
[] =
969 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
971 const ]b4_int_type_for([b4_prhs
])[
972 ]b4_parser_class_name
[::yyprhs_
[] =
977 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
978 const ]b4_int_type_for([b4_rline
])[
979 ]b4_parser_class_name
[::yyrline_
[] =
984 // Print the state stack on the debug stream.
986 ]b4_parser_class_name
[::yystack_print_ ()
988 *yycdebug_
<< "Stack now";
989 for (state_stack_type::const_iterator i
= yystate_stack_
.begin ();
990 i
!= yystate_stack_
.end (); ++i
)
991 *yycdebug_
<< ' ' << *i
;
992 *yycdebug_
<< std::endl
;
995 // Report on the debug stream that the rule \a yyrule is going to be reduced.
997 ]b4_parser_class_name
[::yy_reduce_print_ (int yyrule
)
999 unsigned int yylno
= yyrline_
[yyrule
];
1000 int yynrhs
= yyr2_
[yyrule
];
1001 /* Print the symbols being reduced, and their result. */
1002 *yycdebug_
<< "Reducing stack by rule " << yyrule
- 1
1003 << " (line " << yylno
<< "), ";
1004 /* The symbols being reduced. */
1005 for (int yyi
= 0; yyi
< yynrhs
; yyi
++)
1006 YY_SYMBOL_PRINT (" $" << yyi
+ 1 << " =",
1007 yyrhs_
[yyprhs_
[yyrule
] + yyi
],
1008 &]b4_rhs_value(yynrhs
, yyi
+ 1)[,
1009 &]b4_rhs_location(yynrhs
, yyi
+ 1)[);
1013 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1014 ]b4_parser_class_name
[::token_number_type
1015 ]b4_parser_class_name
[::yytranslate_ (int token
)
1018 const token_number_type
1023 if ((unsigned int) token
<= yyuser_token_number_max_
)
1024 return translate_table
[token
];
1026 return yyundef_token_
;
1029 const int ]b4_parser_class_name
[::yyeof_
= 0;
1030 const int ]b4_parser_class_name
[::yylast_
= ]b4_last
[;
1031 const int ]b4_parser_class_name
[::yynnts_
= ]b4_nterms_number
[;
1032 const int ]b4_parser_class_name
[::yyempty_
= -2;
1033 const int ]b4_parser_class_name
[::yyfinal_
= ]b4_final_state_number
[;
1034 const int ]b4_parser_class_name
[::yyterror_
= 1;
1035 const int ]b4_parser_class_name
[::yyerrcode_
= 256;
1036 const int ]b4_parser_class_name
[::yyntokens_
= ]b4_tokens_number
[;
1038 const unsigned int ]b4_parser_class_name
[::yyuser_token_number_max_
= ]b4_user_token_number_max
[;
1039 const ]b4_parser_class_name
[::token_number_type
]b4_parser_class_name
[::yyundef_token_
= ]b4_undef_token_number
[;
1045 @output b4_dir_prefix
[]stack
.hh
1046 b4_copyright([stack handling
for Bison C
++ parsers
], [2002, 2003, 2004, 2005])[
1048 #ifndef BISON_STACK_HH
1049 # define BISON_STACK_HH
1055 template <class T
, class S
= std::deque
<T
> >
1060 // Hide our reversed order.
1061 typedef typename
S::reverse_iterator iterator
;
1062 typedef typename
S::const_reverse_iterator const_iterator
;
1068 stack (unsigned int n
) : seq_ (n
)
1074 operator [] (unsigned int i
)
1081 operator [] (unsigned int i
) const
1090 seq_
.push_front (t
);
1095 pop (unsigned int n
= 1)
1105 return seq_
.size ();
1108 inline const_iterator
begin () const { return seq_
.rbegin (); }
1109 inline const_iterator
end () const { return seq_
.rend (); }
1116 /// Present a slice of the top of a stack.
1117 template <class T
, class S
= stack
<T
> >
1122 slice (const S
& stack
,
1123 unsigned int range
) : stack_ (stack
),
1130 operator [] (unsigned int i
) const
1132 return stack_
[range_
- i
];
1138 unsigned int range_
;
1142 #endif // not BISON_STACK_HH]