Get rid of yyrhs and yyprhs in larl1.java.
[bison/ericb.git] / data / lalr1.java
blob3d17e46192892107633f31858b395fd67a284b22
1 # Java skeleton for Bison -*- autoconf -*-
3 # Copyright (C) 2007, 2008 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])],
23 [])
25 m4_divert_push(0)dnl
26 @output(b4_parser_file_name@)@
27 b4_copyright([Skeleton implementation for Bison LALR(1) parsers in Java],
28 [2007, 2008])
30 b4_percent_define_ifdef([package], [package b4_percent_define_get([package]);
31 ])[/* First part of user declarations. */
32 ]b4_user_pre_prologue
33 b4_user_post_prologue
34 b4_percent_code_get([[imports]])
35 [/**
36 * A Bison parser, automatically generated from <tt>]m4_bpatsubst(b4_file_name, [^"\(.*\)"$], [\1])[</tt>.
38 * @@author LALR (1) parser skeleton written by Paolo Bonzini.
40 ]b4_percent_define_get3([annotations], [], [ ])dnl
41 b4_public_if([public ])dnl
42 b4_abstract_if([abstract ])dnl
43 b4_final_if([final ])dnl
44 b4_strictfp_if([strictfp ])dnl
45 [class ]b4_parser_class_name[]dnl
46 b4_percent_define_get3([extends], [ extends ])dnl
47 b4_percent_define_get3([implements], [ implements ])[
49 ]b4_identification[
50 ]b4_error_verbose_if([[
51 /** True if verbose error messages are enabled. */
52 private boolean yyErrorVerbose = true;
54 /**
55 * Return whether verbose error messages are enabled.
57 public final boolean getErrorVerbose() { return yyErrorVerbose; }
59 /**
60 * Set the verbosity of error messages.
61 * @@param verbose True to request verbose error messages.
63 public final void setErrorVerbose(boolean verbose)
64 { yyErrorVerbose = verbose; }
65 ]])
67 b4_locations_if([[
68 /**
69 * A class defining a pair of positions. Positions, defined by the
70 * <code>]b4_position_type[</code> class, denote a point in the input.
71 * Locations represent a part of the input through the beginning
72 * and ending positions. */
73 public class ]b4_location_type[ {
74 /** The first, inclusive, position in the range. */
75 public ]b4_position_type[ begin;
77 /** The first position beyond the range. */
78 public ]b4_position_type[ end;
80 /**
81 * Create a <code>]b4_location_type[</code> denoting an empty range located at
82 * a given point.
83 * @@param loc The position at which the range is anchored. */
84 public ]b4_location_type[ (]b4_position_type[ loc) {
85 this.begin = this.end = loc;
88 /**
89 * Create a <code>]b4_location_type[</code> from the endpoints of the range.
90 * @@param begin The first position included in the range.
91 * @@param end The first position beyond the range. */
92 public ]b4_location_type[ (]b4_position_type[ begin, ]b4_position_type[ end) {
93 this.begin = begin;
94 this.end = end;
97 /**
98 * Print a representation of the location. For this to be correct,
99 * <code>]b4_position_type[</code> should override the <code>equals</code>
100 * method. */
101 public String toString () {
102 if (begin.equals (end))
103 return begin.toString ();
104 else
105 return begin.toString () + "-" + end.toString ();
111 b4_locations_if([[
112 private ]b4_location_type[ yylloc (YYStack rhs, int n)
114 if (n > 0)
115 return new ]b4_location_type[ (rhs.locationAt (1).begin, rhs.locationAt (n).end);
116 else
117 return new ]b4_location_type[ (rhs.locationAt (0).end);
118 }]])[
121 * Communication interface between the scanner and the Bison-generated
122 * parser <tt>]b4_parser_class_name[</tt>.
124 public interface Lexer {
125 /** Token returned by the scanner to signal the end of its input. */
126 public static final int EOF = 0;
128 ]b4_token_enums(b4_tokens)[
130 ]b4_locations_if([[/**
131 * Method to retrieve the beginning position of the last scanned token.
132 * @@return the position at which the last scanned token starts. */
133 ]b4_position_type[ getStartPos ();
136 * Method to retrieve the ending position of the last scanned token.
137 * @@return the first position beyond the last scanned token. */
138 ]b4_position_type[ getEndPos ();]])[
141 * Method to retrieve the semantic value of the last scanned token.
142 * @@return the semantic value of the last scanned token. */
143 ]b4_yystype[ getLVal ();
146 * Entry point for the scanner. Returns the token identifier corresponding
147 * to the next token and prepares to return the semantic value
148 * ]b4_locations_if([and beginning/ending positions ])[of the token.
149 * @@return the token identifier corresponding to the next token. */
150 int yylex () ]b4_maybe_throws([b4_lex_throws])[;
153 * Entry point for error reporting. Emits an error
154 * ]b4_locations_if([referring to the given location ])[in a user-defined way.
156 * ]b4_locations_if([[@@param loc The location of the element to which the
157 * error message is related]])[
158 * @@param msg The string for the error message. */
159 void yyerror (]b4_locations_if([b4_location_type[ loc, ]])[String msg);]
162 b4_lexer_if([[private class YYLexer implements Lexer {
163 ]b4_percent_code_get([[lexer]])[
166 ]])[/** The object doing lexical analysis for us. */
167 private Lexer yylexer;
169 b4_parse_param_vars
171 b4_lexer_if([[
173 * Instantiates the Bison-generated parser.
175 public ]b4_parser_class_name (b4_parse_param_decl([b4_lex_param_decl])[) ]b4_maybe_throws([b4_init_throws])[
177 ]b4_percent_code_get([[init]])[
178 this.yylexer = new YYLexer(]b4_lex_param_call[);
179 ]b4_parse_param_cons[
184 * Instantiates the Bison-generated parser.
185 * @@param yylexer The scanner that will supply tokens to the parser.
187 b4_lexer_if([[protected]], [[public]]) b4_parser_class_name[ (]b4_parse_param_decl([[Lexer yylexer]])[) ]b4_maybe_throws([b4_init_throws])[
189 ]b4_percent_code_get([[init]])[
190 this.yylexer = yylexer;
191 ]b4_parse_param_cons[
194 private java.io.PrintStream yyDebugStream = System.err;
197 * Return the <tt>PrintStream</tt> on which the debugging output is
198 * printed.
200 public final java.io.PrintStream getDebugStream () { return yyDebugStream; }
203 * Set the <tt>PrintStream</tt> on which the debug output is printed.
204 * @@param s The stream that is used for debugging output.
206 public final void setDebugStream(java.io.PrintStream s) { yyDebugStream = s; }
208 private int yydebug = 0;
211 * Answer the verbosity of the debugging output; 0 means that all kinds of
212 * output from the parser are suppressed.
214 public final int getDebugLevel() { return yydebug; }
217 * Set the verbosity of the debugging output; 0 means that all kinds of
218 * output from the parser are suppressed.
219 * @@param level The verbosity level for debugging output.
221 public final void setDebugLevel(int level) { yydebug = level; }
224 * Print an error message via the lexer.
225 *]b4_locations_if([[ Use a <code>null</code> location.]])[
226 * @@param msg The error message.
228 public final void yyerror (String msg)
230 yylexer.yyerror (]b4_locations_if([[(]b4_location_type[)null, ]])[msg);
232 ]b4_locations_if([[
234 * Print an error message via the lexer.
235 * @@param loc The location associated with the message.
236 * @@param msg The error message.
238 public final void yyerror (]b4_location_type[ loc, String msg)
240 yylexer.yyerror (loc, msg);
244 * Print an error message via the lexer.
245 * @@param pos The position associated with the message.
246 * @@param msg The error message.
248 public final void yyerror (]b4_position_type[ pos, String msg)
250 yylexer.yyerror (new ]b4_location_type[ (pos), msg);
251 }]])
253 [protected final void yycdebug (String s) {
254 if (yydebug > 0)
255 yyDebugStream.println (s);
258 private final class YYStack {
259 private int[] stateStack = new int[16];
260 ]b4_locations_if([[private ]b4_location_type[[] locStack = new ]b4_location_type[[16];]])[
261 private ]b4_yystype[[] valueStack = new ]b4_yystype[[16];
263 public int size = 16;
264 public int height = -1;
266 public final void push (int state, ]b4_yystype[ value]dnl
267 b4_locations_if([, ]b4_location_type[ loc])[) {
268 height++;
269 if (size == height)
271 int[] newStateStack = new int[size * 2];
272 System.arraycopy (stateStack, 0, newStateStack, 0, height);
273 stateStack = newStateStack;
274 ]b4_locations_if([[
275 ]b4_location_type[[] newLocStack = new ]b4_location_type[[size * 2];
276 System.arraycopy (locStack, 0, newLocStack, 0, height);
277 locStack = newLocStack;]])
279 b4_yystype[[] newValueStack = new ]b4_yystype[[size * 2];
280 System.arraycopy (valueStack, 0, newValueStack, 0, height);
281 valueStack = newValueStack;
283 size *= 2;
286 stateStack[height] = state;
287 ]b4_locations_if([[locStack[height] = loc;]])[
288 valueStack[height] = value;
291 public final void pop () {
292 height--;
295 public final void pop (int num) {
296 // Avoid memory leaks... garbage collection is a white lie!
297 if (num > 0) {
298 java.util.Arrays.fill (valueStack, height - num + 1, height, null);
299 ]b4_locations_if([[java.util.Arrays.fill (locStack, height - num + 1, height, null);]])[
301 height -= num;
304 public final int stateAt (int i) {
305 return stateStack[height - i];
308 ]b4_locations_if([[public final ]b4_location_type[ locationAt (int i) {
309 return locStack[height - i];
312 ]])[public final ]b4_yystype[ valueAt (int i) {
313 return valueStack[height - i];
316 // Print the state stack on the debug stream.
317 public void print (java.io.PrintStream out)
319 out.print ("Stack now");
321 for (int i = 0; i < height; i++)
323 out.print (' ');
324 out.print (stateStack[i]);
326 out.println ();
331 * Returned by a Bison action in order to stop the parsing process and
332 * return success (<tt>true</tt>). */
333 public static final int YYACCEPT = 0;
336 * Returned by a Bison action in order to stop the parsing process and
337 * return failure (<tt>false</tt>). */
338 public static final int YYABORT = 1;
341 * Returned by a Bison action in order to start error recovery without
342 * printing an error message. */
343 public static final int YYERROR = 2;
346 * Returned by a Bison action in order to print an error message and start
347 * error recovery. */
348 public static final int YYFAIL = 3;
350 private static final int YYNEWSTATE = 4;
351 private static final int YYDEFAULT = 5;
352 private static final int YYREDUCE = 6;
353 private static final int YYERRLAB1 = 7;
354 private static final int YYRETURN = 8;
356 private int yyerrstatus_ = 0;
359 * Return whether error recovery is being done. In this state, the parser
360 * reads token until it reaches a known state, and then restarts normal
361 * operation. */
362 public final boolean recovering ()
364 return yyerrstatus_ == 0;
367 private int yyaction (int yyn, YYStack yystack, int yylen) ]b4_maybe_throws([b4_throws])[
369 ]b4_yystype[ yyval;
370 ]b4_locations_if([b4_location_type[ yyloc = yylloc (yystack, yylen);]])[
372 /* If YYLEN is nonzero, implement the default value of the action:
373 `$$ = $1'. Otherwise, use the top of the stack.
375 Otherwise, the following line sets YYVAL to garbage.
376 This behavior is undocumented and Bison
377 users should not rely upon it. */
378 if (yylen > 0)
379 yyval = yystack.valueAt (yylen - 1);
380 else
381 yyval = yystack.valueAt (0);
383 yy_reduce_print (yyn, yystack);
385 switch (yyn)
387 ]b4_user_actions[
388 default: break;
391 yy_symbol_print ("-> $$ =", yyr1_[yyn], yyval]b4_locations_if([, yyloc])[);
393 yystack.pop (yylen);
394 yylen = 0;
396 /* Shift the result of the reduction. */
397 yyn = yyr1_[yyn];
398 int yystate = yypgoto_[yyn - yyntokens_] + yystack.stateAt (0);
399 if (0 <= yystate && yystate <= yylast_
400 && yycheck_[yystate] == yystack.stateAt (0))
401 yystate = yytable_[yystate];
402 else
403 yystate = yydefgoto_[yyn - yyntokens_];
405 yystack.push (yystate, yyval]b4_locations_if([, yyloc])[);
406 return YYNEWSTATE;
409 ]b4_error_verbose_if([[
410 /* Return YYSTR after stripping away unnecessary quotes and
411 backslashes, so that it's suitable for yyerror. The heuristic is
412 that double-quoting is unnecessary unless the string contains an
413 apostrophe, a comma, or backslash (other than backslash-backslash).
414 YYSTR is taken from yytname. */
415 private final String yytnamerr_ (String yystr)
417 if (yystr.charAt (0) == '"')
419 StringBuffer yyr = new StringBuffer ();
420 strip_quotes: for (int i = 1; i < yystr.length (); i++)
421 switch (yystr.charAt (i))
423 case '\'':
424 case ',':
425 break strip_quotes;
427 case '\\':
428 if (yystr.charAt(++i) != '\\')
429 break strip_quotes;
430 /* Fall through. */
431 default:
432 yyr.append (yystr.charAt (i));
433 break;
435 case '"':
436 return yyr.toString ();
439 else if (yystr.equals ("$end"))
440 return "end of input";
442 return yystr;
444 ]])[
446 /*--------------------------------.
447 | Print this symbol on YYOUTPUT. |
448 `--------------------------------*/
450 private void yy_symbol_print (String s, int yytype,
451 ]b4_yystype[ yyvaluep]dnl
452 b4_locations_if([, Object yylocationp])[)
454 if (yydebug > 0)
455 yycdebug (s + (yytype < yyntokens_ ? " token " : " nterm ")
456 + yytname_[yytype] + " ("]b4_locations_if([
457 + yylocationp + ": "])[
458 + (yyvaluep == null ? "(null)" : yyvaluep.toString ()) + ")");
462 * Parse input from the scanner that was specified at object construction
463 * time. Return whether the end of the input was reached successfully.
465 * @@return <tt>true</tt> if the parsing succeeds. Note that this does not
466 * imply that there were no syntax errors.
468 public boolean parse () ]b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])[
470 /// Lookahead and lookahead in internal form.
471 int yychar = yyempty_;
472 int yytoken = 0;
474 /* State. */
475 int yyn = 0;
476 int yylen = 0;
477 int yystate = 0;
479 YYStack yystack = new YYStack ();
481 /* Error handling. */
482 int yynerrs_ = 0;
483 ]b4_locations_if([/// The location where the error started.
484 ]b4_location_type[ yyerrloc = null;
486 /// ]b4_location_type[ of the lookahead.
487 ]b4_location_type[ yylloc = new ]b4_location_type[ (null, null);
489 /// @@$.
490 ]b4_location_type[ yyloc;])
492 /// Semantic value of the lookahead.
493 b4_yystype[ yylval = null;
495 int yyresult;
497 yycdebug ("Starting parse\n");
498 yyerrstatus_ = 0;
500 ]m4_ifdef([b4_initial_action], [
501 m4_pushdef([b4_at_dollar], [yylloc])dnl
502 m4_pushdef([b4_dollar_dollar], [yylval])dnl
503 /* User initialization code. */
504 b4_user_initial_action
505 m4_popdef([b4_dollar_dollar])dnl
506 m4_popdef([b4_at_dollar])])dnl
508 [ /* Initialize the stack. */
509 yystack.push (yystate, yylval]b4_locations_if([, yylloc])[);
511 int label = YYNEWSTATE;
512 for (;;)
513 switch (label)
515 /* New state. Unlike in the C/C++ skeletons, the state is already
516 pushed when we come here. */
517 case YYNEWSTATE:
518 yycdebug ("Entering state " + yystate + "\n");
519 if (yydebug > 0)
520 yystack.print (yyDebugStream);
522 /* Accept? */
523 if (yystate == yyfinal_)
524 return true;
526 /* Take a decision. First try without lookahead. */
527 yyn = yypact_[yystate];
528 if (yyn == yypact_ninf_)
530 label = YYDEFAULT;
531 break;
534 /* Read a lookahead token. */
535 if (yychar == yyempty_)
537 yycdebug ("Reading a token: ");
538 yychar = yylexer.yylex ();]
539 b4_locations_if([[
540 yylloc = new ]b4_location_type[(yylexer.getStartPos (),
541 yylexer.getEndPos ());]])
542 yylval = yylexer.getLVal ();[
545 /* Convert token to internal form. */
546 if (yychar <= Lexer.EOF)
548 yychar = yytoken = Lexer.EOF;
549 yycdebug ("Now at end of input.\n");
551 else
553 yytoken = yytranslate_ (yychar);
554 yy_symbol_print ("Next token is", yytoken,
555 yylval]b4_locations_if([, yylloc])[);
558 /* If the proper action on seeing token YYTOKEN is to reduce or to
559 detect an error, take that action. */
560 yyn += yytoken;
561 if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yytoken)
562 label = YYDEFAULT;
564 /* <= 0 means reduce or error. */
565 else if ((yyn = yytable_[yyn]) <= 0)
567 if (yyn == 0 || yyn == yytable_ninf_)
568 label = YYFAIL;
569 else
571 yyn = -yyn;
572 label = YYREDUCE;
576 else
578 /* Shift the lookahead token. */
579 yy_symbol_print ("Shifting", yytoken,
580 yylval]b4_locations_if([, yylloc])[);
582 /* Discard the token being shifted. */
583 yychar = yyempty_;
585 /* Count tokens shifted since error; after three, turn off error
586 status. */
587 if (yyerrstatus_ > 0)
588 --yyerrstatus_;
590 yystate = yyn;
591 yystack.push (yystate, yylval]b4_locations_if([, yylloc])[);
592 label = YYNEWSTATE;
594 break;
596 /*-----------------------------------------------------------.
597 | yydefault -- do the default action for the current state. |
598 `-----------------------------------------------------------*/
599 case YYDEFAULT:
600 yyn = yydefact_[yystate];
601 if (yyn == 0)
602 label = YYFAIL;
603 else
604 label = YYREDUCE;
605 break;
607 /*-----------------------------.
608 | yyreduce -- Do a reduction. |
609 `-----------------------------*/
610 case YYREDUCE:
611 yylen = yyr2_[yyn];
612 label = yyaction (yyn, yystack, yylen);
613 yystate = yystack.stateAt (0);
614 break;
616 /*------------------------------------.
617 | yyerrlab -- here on detecting error |
618 `------------------------------------*/
619 case YYFAIL:
620 /* If not already recovering from an error, report this error. */
621 if (yyerrstatus_ == 0)
623 ++yynerrs_;
624 yyerror (]b4_locations_if([yylloc, ])[yysyntax_error (yystate, yytoken));
627 ]b4_locations_if([yyerrloc = yylloc;])[
628 if (yyerrstatus_ == 3)
630 /* If just tried and failed to reuse lookahead token after an
631 error, discard it. */
633 if (yychar <= Lexer.EOF)
635 /* Return failure if at end of input. */
636 if (yychar == Lexer.EOF)
637 return false;
639 else
640 yychar = yyempty_;
643 /* Else will try to reuse lookahead token after shifting the error
644 token. */
645 label = YYERRLAB1;
646 break;
648 /*---------------------------------------------------.
649 | errorlab -- error raised explicitly by YYERROR. |
650 `---------------------------------------------------*/
651 case YYERROR:
653 ]b4_locations_if([yyerrloc = yystack.locationAt (yylen - 1);])[
654 /* Do not reclaim the symbols of the rule which action triggered
655 this YYERROR. */
656 yystack.pop (yylen);
657 yylen = 0;
658 yystate = yystack.stateAt (0);
659 label = YYERRLAB1;
660 break;
662 /*-------------------------------------------------------------.
663 | yyerrlab1 -- common code for both syntax error and YYERROR. |
664 `-------------------------------------------------------------*/
665 case YYERRLAB1:
666 yyerrstatus_ = 3; /* Each real token shifted decrements this. */
668 for (;;)
670 yyn = yypact_[yystate];
671 if (yyn != yypact_ninf_)
673 yyn += yyterror_;
674 if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_)
676 yyn = yytable_[yyn];
677 if (0 < yyn)
678 break;
682 /* Pop the current state because it cannot handle the error token. */
683 if (yystack.height == 1)
684 return false;
686 ]b4_locations_if([yyerrloc = yystack.locationAt (0);])[
687 yystack.pop ();
688 yystate = yystack.stateAt (0);
689 if (yydebug > 0)
690 yystack.print (yyDebugStream);
693 ]b4_locations_if([
694 /* Muck with the stack to setup for yylloc. */
695 yystack.push (0, null, yylloc);
696 yystack.push (0, null, yyerrloc);
697 yyloc = yylloc (yystack, 2);
698 yystack.pop (2);])[
700 /* Shift the error token. */
701 yy_symbol_print ("Shifting", yystos_[yyn],
702 yylval]b4_locations_if([, yyloc])[);
704 yystate = yyn;
705 yystack.push (yyn, yylval]b4_locations_if([, yyloc])[);
706 label = YYNEWSTATE;
707 break;
709 /* Accept. */
710 case YYACCEPT:
711 return true;
713 /* Abort. */
714 case YYABORT:
715 return false;
719 // Generate an error message.
720 private String yysyntax_error (int yystate, int tok)
721 {]b4_error_verbose_if([[
722 if (yyErrorVerbose)
724 int yyn = yypact_[yystate];
725 if (yypact_ninf_ < yyn && yyn <= yylast_)
727 StringBuffer res;
729 /* Start YYX at -YYN if negative to avoid negative indexes in
730 YYCHECK. */
731 int yyxbegin = yyn < 0 ? -yyn : 0;
733 /* Stay within bounds of both yycheck and yytname. */
734 int yychecklim = yylast_ - yyn + 1;
735 int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
736 int count = 0;
737 for (int x = yyxbegin; x < yyxend; ++x)
738 if (yycheck_[x + yyn] == x && x != yyterror_)
739 ++count;
741 // FIXME: This method of building the message is not compatible
742 // with internationalization.
743 res = new StringBuffer ("syntax error, unexpected ");
744 res.append (yytnamerr_ (yytname_[tok]));
745 if (count < 5)
747 count = 0;
748 for (int x = yyxbegin; x < yyxend; ++x)
749 if (yycheck_[x + yyn] == x && x != yyterror_)
751 res.append (count++ == 0 ? ", expecting " : " or ");
752 res.append (yytnamerr_ (yytname_[x]));
755 return res.toString ();
758 ]])[
759 return "syntax error";
762 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
763 STATE-NUM. */
764 private static final ]b4_int_type_for([b4_pact])[ yypact_ninf_ = ]b4_pact_ninf[;
765 ]b4_integral_parser_table([yypact_], [b4_pact])[
767 /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
768 doesn't specify something else to do. Zero means the default is an
769 error. */
770 ]b4_integral_parser_table([yydefact_], [b4_defact])[
772 /* YYPGOTO[NTERM-NUM]. */
773 ]b4_integral_parser_table([yypgoto_], [b4_pgoto])[
775 /* YYDEFGOTO[NTERM-NUM]. */
776 ]b4_integral_parser_table([yydefgoto_], [b4_defgoto])[
778 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
779 positive, shift that token. If negative, reduce the rule which
780 number is the opposite. If zero, do what YYDEFACT says. */
781 private static final ]b4_int_type_for([b4_table])[ yytable_ninf_ = ]b4_table_ninf[;
782 ]b4_integral_parser_table([yytable_], [b4_table])[
784 /* YYCHECK. */
785 ]b4_integral_parser_table([yycheck_], [b4_check])[
787 /* STOS_[STATE-NUM] -- The (internal number of the) accessing
788 symbol of state STATE-NUM. */
789 ]b4_integral_parser_table([yystos_], [b4_stos])[
791 /* TOKEN_NUMBER_[YYLEX-NUM] -- Internal symbol number corresponding
792 to YYLEX-NUM. */
793 ]b4_integral_parser_table([yytoken_number_], [b4_toknum])[
795 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
796 ]b4_integral_parser_table([yyr1_], [b4_r1])[
798 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
799 ]b4_integral_parser_table([yyr2_], [b4_r2])[
801 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
802 First, the terminals, then, starting at \a yyntokens_, nonterminals. */
803 ]b4_typed_parser_table([String], [yytname_], [b4_tname])[
805 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
806 ]b4_integral_parser_table([yyrline_], [b4_rline])[
808 // Report on the debug stream that the rule yyrule is going to be reduced.
809 private void yy_reduce_print (int yyrule, YYStack yystack)
811 if (yydebug == 0)
812 return;
814 int yylno = yyrline_[yyrule];
815 int yynrhs = yyr2_[yyrule];
816 /* Print the symbols being reduced, and their result. */
817 yycdebug ("Reducing stack by rule " + (yyrule - 1)
818 + " (line " + yylno + "), ");
820 /* The symbols being reduced. */
821 for (int yyi = 0; yyi < yynrhs; yyi++)
822 yy_symbol_print (" $" + (yyi + 1) + " =",
823 yystos_[yystack.stateAt(yyi + 1 - yynrhs)],
824 ]b4_rhs_value(yynrhs, yyi + 1)b4_locations_if([,
825 b4_rhs_location(yynrhs, yyi + 1)])[);
828 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
829 ]b4_integral_parser_table([yytranslate_table_], [b4_translate])[
831 private static final ]b4_int_type_for([b4_translate])[ yytranslate_ (int t)
833 if (t >= 0 && t <= yyuser_token_number_max_)
834 return yytranslate_table_[t];
835 else
836 return yyundef_token_;
839 private static final int yylast_ = ]b4_last[;
840 private static final int yynnts_ = ]b4_nterms_number[;
841 private static final int yyempty_ = -2;
842 private static final int yyfinal_ = ]b4_final_state_number[;
843 private static final int yyterror_ = 1;
844 private static final int yyerrcode_ = 256;
845 private static final int yyntokens_ = ]b4_tokens_number[;
847 private static final int yyuser_token_number_max_ = ]b4_user_token_number_max[;
848 private static final int yyundef_token_ = ]b4_undef_token_number[;
850 ]/* User implementation code. */
851 b4_percent_code_get[]dnl
855 b4_epilogue
856 m4_divert_pop(0)dnl