1 # Java skeleton
for Bison
-*- autoconf
-*-
3 #
Copyright (C
) 2007-2012 Free Software Foundation
, Inc
.
5 # This program is free software
: you can redistribute it and
/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation
, either version
3 of the License
, or
8 #
(at your option
) any later version
.
10 # This program is distributed in the hope that it will be useful
,
11 # but WITHOUT ANY WARRANTY
; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
. See the
13 # GNU General Public License
for more details
.
15 # You should have received a copy of the GNU General Public License
16 # along with
this program
. If not
, see
<http
://www.gnu.org/licenses/>.
18 m4_include(b4_pkgdatadir
/[java
.m4
])
20 b4_defines_if([b4_fatal([%s
: %%defines does not make sense in Java
], [b4_skeleton
])])
21 m4_ifval(m4_defn([b4_symbol_destructors
]),
22 [b4_fatal([%s
: %%destructor does not make sense in Java
], [b4_skeleton
])],
26 @output(b4_parser_file_name@
)@
27 b4_copyright([Skeleton implementation
for Bison
LALR(1) parsers in Java
],
30 b4_percent_define_ifdef([package], [package b4_percent_define_get([package]);
31 ])[/* First part of user declarations. */
33 b4_percent_code_get([[imports
]])
35 * A Bison parser, automatically generated from <tt>]m4_bpatsubst(b4_file_name, [^"\(.*\)"$], [\1])[</tt>.
37 * @@author LALR (1) parser skeleton written by Paolo Bonzini.
39 ]b4_public_if([public ])dnl
40 b4_abstract_if([abstract ])dnl
41 b4_final_if([final ])dnl
42 b4_strictfp_if([strictfp ])dnl
43 [class ]b4_parser_class_name
[]dnl
44 b4_percent_define_get3([extends], [ extends ])dnl
45 b4_percent_define_get3([implements], [ implements ])[
49 /** True if verbose error messages are enabled. */
50 public boolean errorVerbose
= ]b4_flag_value([error_verbose
]);
54 * A class defining a pair of positions. Positions, defined by the
55 * <code>]b4_position_type[</code> class, denote a point in the input.
56 * Locations represent a part of the input through the beginning
57 * and ending positions. */
58 public class ]b4_location_type
[ {
59 /** The first, inclusive, position in the range. */
60 public ]b4_position_type
[ begin
;
62 /** The first position beyond the range. */
63 public ]b4_position_type
[ end
;
66 * Create a <code>]b4_location_type[</code> denoting an empty range located at
68 * @@param loc The position at which the range is anchored. */
69 public ]b4_location_type
[ (]b4_position_type
[ loc
) {
70 this.begin
= this.end
= loc
;
74 * Create a <code>]b4_location_type[</code> from the endpoints of the range.
75 * @@param begin The first position included in the range.
76 * @@param end The first position beyond the range. */
77 public ]b4_location_type
[ (]b4_position_type
[ begin
, ]b4_position_type
[ end
) {
83 * Print a representation of the location. For this to be correct,
84 * <code>]b4_position_type[</code> should override the <code>equals</code>
86 public String
toString () {
87 if (begin
.equals (end
))
88 return begin
.toString ();
90 return begin
.toString () + "-" + end
.toString ();
96 [ /** Token returned by the scanner to signal the end of its input. */
97 public static final int EOF
= 0;]
99 b4_token_enums(b4_tokens
)
102 private ]b4_location_type
[ yylloc (YYStack rhs
, int n
)
105 return new ]b4_location_type
[ (rhs
.locationAt (n
-1).begin
, rhs
.locationAt (0).end
);
107 return new ]b4_location_type
[ (rhs
.locationAt (0).end
);
111 * Communication interface between the scanner and the Bison-generated
112 * parser <tt>]b4_parser_class_name[</tt>.
114 public interface Lexer
{
115 ]b4_locations_if([[/**
116 * Method to retrieve the beginning position of the last scanned token.
117 * @@return the position at which the last scanned token starts. */
118 ]b4_position_type
[ getStartPos ();
121 * Method to retrieve the ending position of the last scanned token.
122 * @@return the first position beyond the last scanned token. */
123 ]b4_position_type
[ getEndPos ();]])[
126 * Method to retrieve the semantic value of the last scanned token.
127 * @@return the semantic value of the last scanned token. */
128 ]b4_yystype
[ getLVal ();
131 * Entry point for the scanner. Returns the token identifier corresponding
132 * to the next token and prepares to return the semantic value
133 * ]b4_locations_if([and beginning/ending positions ])[of the token.
134 * @@return the token identifier corresponding to the next token. */
135 int yylex () ]b4_maybe_throws([b4_lex_throws
])[;
138 * Entry point for error reporting. Emits an error
139 * ]b4_locations_if([referring to the given location ])[in a user-defined way.
141 * ]b4_locations_if([[@@param loc The location of the element to which the
142 * error message is related]])[
143 * @@param s The string for the error message. */
144 void yyerror (]b4_locations_if([b4_location_type
[ loc
, ]])[String s
);]
147 b4_lexer_if([[private class YYLexer
implements Lexer
{
148 ]b4_percent_code_get([[lexer
]])[
151 ]])[/** The object doing lexical analysis for us. */
152 private Lexer yylexer
;
158 * Instantiates the Bison-generated parser.
160 public ]b4_parser_class_name (b4_parse_param_decl([b4_lex_param_decl
])[) {
161 this.yylexer
= new YYLexer(]b4_lex_param_call
[);
162 ]b4_parse_param_cons
[
167 * Instantiates the Bison-generated parser.
168 * @@param yylexer The scanner that will supply tokens to the parser.
170 b4_lexer_if([[protected]], [[public]]) b4_parser_class_name
[ (]b4_parse_param_decl([[Lexer yylexer
]])[) {
171 this.yylexer
= yylexer
;
172 ]b4_parse_param_cons
[
175 private java
.io
.PrintStream yyDebugStream
= System
.err
;
178 * Return the <tt>PrintStream</tt> on which the debugging output is
181 public final java
.io
.PrintStream
getDebugStream () { return yyDebugStream
; }
184 * Set the <tt>PrintStream</tt> on which the debug output is printed.
185 * @@param s The stream that is used for debugging output.
187 public final void setDebugStream(java
.io
.PrintStream s
) { yyDebugStream
= s
; }
189 private int yydebug
= 0;
192 * Answer the verbosity of the debugging output; 0 means that all kinds of
193 * output from the parser are suppressed.
195 public final int getDebugLevel() { return yydebug
; }
198 * Set the verbosity of the debugging output; 0 means that all kinds of
199 * output from the parser are suppressed.
200 * @@param level The verbosity level for debugging output.
202 public final void setDebugLevel(int level
) { yydebug
= level
; }
204 private final int yylex () ]b4_maybe_throws([b4_lex_throws
]) [{
205 return yylexer
.yylex ();
207 protected final void yyerror (]b4_locations_if([b4_location_type
[ loc
, ]])[String s
) {
208 yylexer
.yyerror (]b4_locations_if([loc
, ])[s
);
212 protected final void yyerror (String s
) {
213 yylexer
.yyerror ((]b4_location_type
[)null, s
);
215 protected final void yyerror (]b4_position_type
[ loc
, String s
) {
216 yylexer
.yyerror (new ]b4_location_type
[ (loc
), s
);
219 [protected final void yycdebug (String s
) {
221 yyDebugStream
.println (s
);
224 private final class YYStack
{
225 private int[] stateStack
= new int[16];
226 ]b4_locations_if([[private ]b4_location_type
[[] locStack
= new ]b4_location_type
[[16];]])[
227 private ]b4_yystype
[[] valueStack
= new ]b4_yystype
[[16];
229 public int size
= 16;
230 public int height
= -1;
232 public final void push (int state
, ]b4_yystype
[ value
]dnl
233 b4_locations_if([, ]b4_location_type
[ loc
])[) {
237 int[] newStateStack
= new int[size
* 2];
238 System
.arraycopy (stateStack
, 0, newStateStack
, 0, height
);
239 stateStack
= newStateStack
;
241 ]b4_location_type
[[] newLocStack
= new ]b4_location_type
[[size
* 2];
242 System
.arraycopy (locStack
, 0, newLocStack
, 0, height
);
243 locStack
= newLocStack
;]])
245 b4_yystype
[[] newValueStack
= new ]b4_yystype
[[size
* 2];
246 System
.arraycopy (valueStack
, 0, newValueStack
, 0, height
);
247 valueStack
= newValueStack
;
252 stateStack
[height
] = state
;
253 ]b4_locations_if([[locStack
[height
] = loc
;]])[
254 valueStack
[height
] = value
;
257 public final void pop () {
261 public final void pop (int num
) {
262 // Avoid memory leaks... garbage collection is a white lie!
264 java
.util
.Arrays
.fill (valueStack
, height
- num
+ 1, height
+ 1, null);
265 ]b4_locations_if([[java
.util
.Arrays
.fill (locStack
, height
- num
+ 1, height
+ 1, null);]])[
270 public final int stateAt (int i
) {
271 return stateStack
[height
- i
];
274 ]b4_locations_if([[public final ]b4_location_type
[ locationAt (int i
) {
275 return locStack
[height
- i
];
278 ]])[public final ]b4_yystype
[ valueAt (int i
) {
279 return valueStack
[height
- i
];
282 // Print the state stack on the debug stream.
283 public void print (java
.io
.PrintStream out
)
285 out
.print ("Stack now");
287 for (int i
= 0; i
<= height
; i
++)
290 out
.print (stateStack
[i
]);
297 * Returned by a Bison action in order to stop the parsing process and
298 * return success (<tt>true</tt>). */
299 public static final int YYACCEPT
= 0;
302 * Returned by a Bison action in order to stop the parsing process and
303 * return failure (<tt>false</tt>). */
304 public static final int YYABORT
= 1;
307 * Returned by a Bison action in order to start error recovery without
308 * printing an error message. */
309 public static final int YYERROR
= 2;
311 // Internal return codes that are not supported for user semantic
313 private static final int YYERRLAB
= 3;
314 private static final int YYNEWSTATE
= 4;
315 private static final int YYDEFAULT
= 5;
316 private static final int YYREDUCE
= 6;
317 private static final int YYERRLAB1
= 7;
318 private static final int YYRETURN
= 8;
320 private int yyerrstatus_
= 0;
323 * Return whether error recovery is being done. In this state, the parser
324 * reads token until it reaches a known state, and then restarts normal
326 public final boolean recovering ()
328 return yyerrstatus_
== 0;
331 private int yyaction (int yyn
, YYStack yystack
, int yylen
) ]b4_maybe_throws([b4_throws
])[
334 ]b4_locations_if([b4_location_type
[ yyloc
= yylloc (yystack
, yylen
);]])[
336 /* If YYLEN is nonzero, implement the default value of the action:
337 `$$ = $1'. Otherwise, use the top of the stack.
339 Otherwise, the following line sets YYVAL to garbage.
340 This behavior is undocumented and Bison
341 users should not rely upon it. */
343 yyval
= yystack
.valueAt (yylen
- 1);
345 yyval
= yystack
.valueAt (0);
347 yy_reduce_print (yyn
, yystack
);
355 yy_symbol_print ("-> $$ =", yyr1_
[yyn
], yyval
]b4_locations_if([, yyloc
])[);
360 /* Shift the result of the reduction. */
362 int yystate
= yypgoto_
[yyn
- yyntokens_
] + yystack
.stateAt (0);
363 if (0 <= yystate
&& yystate
<= yylast_
364 && yycheck_
[yystate
] == yystack
.stateAt (0))
365 yystate
= yytable_
[yystate
];
367 yystate
= yydefgoto_
[yyn
- yyntokens_
];
369 yystack
.push (yystate
, yyval
]b4_locations_if([, yyloc
])[);
373 /* Return YYSTR after stripping away unnecessary quotes and
374 backslashes, so that it's suitable for yyerror. The heuristic is
375 that double-quoting is unnecessary unless the string contains an
376 apostrophe, a comma, or backslash (other than backslash-backslash).
377 YYSTR is taken from yytname. */
378 private final String
yytnamerr_ (String yystr
)
380 if (yystr
.charAt (0) == '"')
382 StringBuffer yyr
= new StringBuffer ();
383 strip_quotes
: for (int i
= 1; i
< yystr
.length (); i
++)
384 switch (yystr
.charAt (i
))
391 if (yystr
.charAt(++i
) != '\\')
395 yyr
.append (yystr
.charAt (i
));
399 return yyr
.toString ();
402 else if (yystr
.equals ("$end"))
403 return "end of input";
408 /*--------------------------------.
409 | Print this symbol on YYOUTPUT. |
410 `--------------------------------*/
412 private void yy_symbol_print (String s
, int yytype
,
413 ]b4_yystype
[ yyvaluep
]dnl
414 b4_locations_if([, Object yylocationp
])[)
417 yycdebug (s
+ (yytype
< yyntokens_ ?
" token " : " nterm ")
418 + yytname_
[yytype
] + " ("]b4_locations_if([
419 + yylocationp
+ ": "])[
420 + (yyvaluep
== null ?
"(null)" : yyvaluep
.toString ()) + ")");
424 * Parse input from the scanner that was specified at object construction
425 * time. Return whether the end of the input was reached successfully.
427 * @@return <tt>true</tt> if the parsing succeeds. Note that this does not
428 * imply that there were no syntax errors.
430 public boolean parse () ]b4_maybe_throws([b4_list2([b4_lex_throws
], [b4_throws
])])[
432 /// Lookahead and lookahead in internal form.
433 int yychar
= yyempty_
;
441 YYStack yystack
= new YYStack ();
443 /* Error handling. */
445 ]b4_locations_if([/// The location where the error started.
446 ]b4_location_type
[ yyerrloc
= null;
448 /// ]b4_location_type[ of the lookahead.
449 ]b4_location_type
[ yylloc
= new ]b4_location_type
[ (null, null);
452 ]b4_location_type
[ yyloc
;])
454 /// Semantic value of the lookahead.
455 b4_yystype
[ yylval
= null;
457 yycdebug ("Starting parse\n");
460 ]m4_ifdef([b4_initial_action
], [
461 b4_dollar_pushdef([yylval
], [], [yylloc
])dnl
462 /* User initialization code. */
463 b4_user_initial_action
464 b4_dollar_popdef
])[]dnl
466 [ /* Initialize the stack. */
467 yystack
.push (yystate
, yylval
]b4_locations_if([, yylloc
])[);
469 int label
= YYNEWSTATE
;
473 /* New state. Unlike in the C/C++ skeletons, the state is already
474 pushed when we come here. */
476 yycdebug ("Entering state " + yystate
+ "\n");
478 yystack
.print (yyDebugStream
);
481 if (yystate
== yyfinal_
)
484 /* Take a decision. First try without lookahead. */
485 yyn
= yypact_
[yystate
];
486 if (yy_pact_value_is_default_ (yyn
))
492 /* Read a lookahead token. */
493 if (yychar
== yyempty_
)
495 yycdebug ("Reading a token: ");
498 yylloc
= new ]b4_location_type
[(yylexer
.getStartPos (),
499 yylexer
.getEndPos ());]])
500 yylval
= yylexer
.getLVal ();[
503 /* Convert token to internal form. */
506 yychar
= yytoken
= EOF
;
507 yycdebug ("Now at end of input.\n");
511 yytoken
= yytranslate_ (yychar
);
512 yy_symbol_print ("Next token is", yytoken
,
513 yylval
]b4_locations_if([, yylloc
])[);
516 /* If the proper action on seeing token YYTOKEN is to reduce or to
517 detect an error, take that action. */
519 if (yyn
< 0 || yylast_
< yyn
|| yycheck_
[yyn
] != yytoken
)
522 /* <= 0 means reduce or error. */
523 else if ((yyn
= yytable_
[yyn
]) <= 0)
525 if (yy_table_value_is_error_ (yyn
))
536 /* Shift the lookahead token. */
537 yy_symbol_print ("Shifting", yytoken
,
538 yylval
]b4_locations_if([, yylloc
])[);
540 /* Discard the token being shifted. */
543 /* Count tokens shifted since error; after three, turn off error
545 if (yyerrstatus_
> 0)
549 yystack
.push (yystate
, yylval
]b4_locations_if([, yylloc
])[);
554 /*-----------------------------------------------------------.
555 | yydefault -- do the default action for the current state. |
556 `-----------------------------------------------------------*/
558 yyn
= yydefact_
[yystate
];
565 /*-----------------------------.
566 | yyreduce -- Do a reduction. |
567 `-----------------------------*/
570 label
= yyaction (yyn
, yystack
, yylen
);
571 yystate
= yystack
.stateAt (0);
574 /*------------------------------------.
575 | yyerrlab -- here on detecting error |
576 `------------------------------------*/
578 /* If not already recovering from an error, report this error. */
579 if (yyerrstatus_
== 0)
582 if (yychar
== yyempty_
)
584 yyerror (]b4_locations_if([yylloc
, ])[yysyntax_error (yystate
, yytoken
));
587 ]b4_locations_if([yyerrloc
= yylloc
;])[
588 if (yyerrstatus_
== 3)
590 /* If just tried and failed to reuse lookahead token after an
591 error, discard it. */
595 /* Return failure if at end of input. */
603 /* Else will try to reuse lookahead token after shifting the error
608 /*---------------------------------------------------.
609 | errorlab -- error raised explicitly by YYERROR. |
610 `---------------------------------------------------*/
613 ]b4_locations_if([yyerrloc
= yystack
.locationAt (yylen
- 1);])[
614 /* Do not reclaim the symbols of the rule which action triggered
618 yystate
= yystack
.stateAt (0);
622 /*-------------------------------------------------------------.
623 | yyerrlab1 -- common code for both syntax error and YYERROR. |
624 `-------------------------------------------------------------*/
626 yyerrstatus_
= 3; /* Each real token shifted decrements this. */
630 yyn
= yypact_
[yystate
];
631 if (!yy_pact_value_is_default_ (yyn
))
634 if (0 <= yyn
&& yyn
<= yylast_
&& yycheck_
[yyn
] == yyterror_
)
642 /* Pop the current state because it cannot handle the error token. */
643 if (yystack
.height
== 0)
646 ]b4_locations_if([yyerrloc
= yystack
.locationAt (0);])[
648 yystate
= yystack
.stateAt (0);
650 yystack
.print (yyDebugStream
);
654 /* Muck with the stack to setup for yylloc. */
655 yystack
.push (0, null, yylloc
);
656 yystack
.push (0, null, yyerrloc
);
657 yyloc
= yylloc (yystack
, 2);
660 /* Shift the error token. */
661 yy_symbol_print ("Shifting", yystos_
[yyn
],
662 yylval
]b4_locations_if([, yyloc
])[);
665 yystack
.push (yyn
, yylval
]b4_locations_if([, yyloc
])[);
679 // Generate an error message.
680 private String
yysyntax_error (int yystate
, int tok
)
684 /* There are many possibilities here to consider:
685 - Assume YYFAIL is not used. It's too flawed to consider.
687 <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
688 for details. YYERROR is fine as it does not invoke this
690 - If this state is a consistent state with a default action,
691 then the only way this function was invoked is if the
692 default action is an error action. In that case, don't
693 check for expected tokens because there are none.
694 - The only way there can be no lookahead present (in tok) is
695 if this state is a consistent state with a default action.
696 Thus, detecting the absence of a lookahead is sufficient to
697 determine that there is no unexpected or expected token to
698 report. In that case, just report a simple "syntax error".
699 - Don't assume there isn't a lookahead just because this
700 state is a consistent state with a default action. There
701 might have been a previous inconsistent state, consistent
702 state with a non-default action, or user semantic action
703 that manipulated yychar. (However, yychar is currently out
704 of scope during semantic actions.)
705 - Of course, the expected token list depends on states to
706 have correct lookahead information, and it depends on the
707 parser not to perform extra reductions after fetching a
708 lookahead from the scanner and before detecting a syntax
709 error. Thus, state merging (from LALR or IELR) and default
710 reductions corrupt the expected token list. However, the
711 list is correct for canonical LR with one exception: it
712 will still contain any token that will not be accepted due
713 to an error action in a later state.
717 // FIXME: This method of building the message is not compatible
718 // with internationalization.
720 new StringBuffer ("syntax error, unexpected ");
721 res
.append (yytnamerr_ (yytname_
[tok
]));
722 int yyn
= yypact_
[yystate
];
723 if (!yy_pact_value_is_default_ (yyn
))
725 /* Start YYX at -YYN if negative to avoid negative
726 indexes in YYCHECK. In other words, skip the first
727 -YYN actions for this state because they are default
729 int yyxbegin
= yyn
< 0 ?
-yyn
: 0;
730 /* Stay within bounds of both yycheck and yytname. */
731 int yychecklim
= yylast_
- yyn
+ 1;
732 int yyxend
= yychecklim
< yyntokens_ ? yychecklim
: yyntokens_
;
734 for (int x
= yyxbegin
; x
< yyxend
; ++x
)
735 if (yycheck_
[x
+ yyn
] == x
&& x
!= yyterror_
736 && !yy_table_value_is_error_ (yytable_
[x
+ yyn
]))
741 for (int x
= yyxbegin
; x
< yyxend
; ++x
)
742 if (yycheck_
[x
+ yyn
] == x
&& x
!= yyterror_
743 && !yy_table_value_is_error_ (yytable_
[x
+ yyn
]))
745 res
.append (count
++ == 0 ?
", expecting " : " or ");
746 res
.append (yytnamerr_ (yytname_
[x
]));
750 return res
.toString ();
754 return "syntax error";
758 * Whether the given <code>yypact_</code> value indicates a defaulted state.
759 * @@param yyvalue the value to check
761 private static boolean yy_pact_value_is_default_ (int yyvalue
)
763 return yyvalue
== yypact_ninf_
;
767 * Whether the given <code>yytable_</code> value indicates a syntax error.
768 * @@param yyvalue the value to check
770 private static boolean yy_table_value_is_error_ (int yyvalue
)
772 return yyvalue
== yytable_ninf_
;
775 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
777 private static final ]b4_int_type_for([b4_pact
])[ yypact_ninf_
= ]b4_pact_ninf
[;
778 private static final ]b4_int_type_for([b4_pact
])[ yypact_
[] =
783 /* YYDEFACT[S] -- default reduction number in state S. Performed when
784 YYTABLE doesn't specify something else to do. Zero means the
785 default is an error. */
786 private static final ]b4_int_type_for([b4_defact
])[ yydefact_
[] =
791 /* YYPGOTO[NTERM-NUM]. */
792 private static final ]b4_int_type_for([b4_pgoto
])[ yypgoto_
[] =
797 /* YYDEFGOTO[NTERM-NUM]. */
798 private static final ]b4_int_type_for([b4_defgoto
])[
804 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
805 positive, shift that token. If negative, reduce the rule which
806 number is the opposite. If YYTABLE_NINF_, syntax error. */
807 private static final ]b4_int_type_for([b4_table
])[ yytable_ninf_
= ]b4_table_ninf
[;
808 private static final ]b4_int_type_for([b4_table
])[
815 private static final ]b4_int_type_for([b4_check
])[
821 /* STOS_[STATE-NUM] -- The (internal number of the) accessing
822 symbol of state STATE-NUM. */
823 private static final ]b4_int_type_for([b4_stos
])[
829 /* TOKEN_NUMBER_[YYLEX-NUM] -- Internal symbol number corresponding
831 private static final ]b4_int_type_for([b4_toknum
])[
837 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
838 private static final ]b4_int_type_for([b4_r1
])[
844 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
845 private static final ]b4_int_type_for([b4_r2
])[
851 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
852 First, the terminals, then, starting at \a yyntokens_, nonterminals. */
853 private static final String yytname_
[] =
858 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
859 private static final ]b4_int_type_for([b4_rhs
])[ yyrhs_
[] =
864 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
866 private static final ]b4_int_type_for([b4_prhs
])[ yyprhs_
[] =
871 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
872 private static final ]b4_int_type_for([b4_rline
])[ yyrline_
[] =
877 // Report on the debug stream that the rule yyrule is going to be reduced.
878 private void yy_reduce_print (int yyrule
, YYStack yystack
)
883 int yylno
= yyrline_
[yyrule
];
884 int yynrhs
= yyr2_
[yyrule
];
885 /* Print the symbols being reduced, and their result. */
886 yycdebug ("Reducing stack by rule " + (yyrule
- 1)
887 + " (line " + yylno
+ "), ");
889 /* The symbols being reduced. */
890 for (int yyi
= 0; yyi
< yynrhs
; yyi
++)
891 yy_symbol_print (" $" + (yyi
+ 1) + " =",
892 yyrhs_
[yyprhs_
[yyrule
] + yyi
],
893 ]b4_rhs_value(yynrhs
, yyi
+ 1)b4_locations_if([,
894 b4_rhs_location(yynrhs
, yyi
+ 1)])[);
897 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
898 private static final ]b4_int_type_for([b4_translate
])[ yytranslate_table_
[] =
903 private static final ]b4_int_type_for([b4_translate
])[ yytranslate_ (int t
)
905 if (t
>= 0 && t
<= yyuser_token_number_max_
)
906 return yytranslate_table_
[t
];
908 return yyundef_token_
;
911 private static final int yylast_
= ]b4_last
[;
912 private static final int yynnts_
= ]b4_nterms_number
[;
913 private static final int yyempty_
= -2;
914 private static final int yyfinal_
= ]b4_final_state_number
[;
915 private static final int yyterror_
= 1;
916 private static final int yyerrcode_
= 256;
917 private static final int yyntokens_
= ]b4_tokens_number
[;
919 private static final int yyuser_token_number_max_
= ]b4_user_token_number_max
[;
920 private static final int yyundef_token_
= ]b4_undef_token_number
[;
922 ]/* User implementation code. */
923 b4_percent_code_get
[]dnl