• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #Java skeleton for Bison - *-java - *-
2 
3 #Copyright(C) 2007 - 2015, 2018 - 2021 Free Software Foundation, Inc.
4 
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.
9 #
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.
14 #
15 #You should have received a copy of the GNU General Public License
16 #along with this program.If not, see < https: // www.gnu.org/licenses/>.
17 
18 m4_include(b4_skeletonsdir/[java.m4])
19 
20 b4_header_if([b4_complain([%header/%defines does not make sense in Java])])
21 
22 m4_define([b4_symbol_no_destructor_assert],
23 [b4_symbol_if([$1], [has_destructor],
24               [b4_complain_at(m4_unquote(b4_symbol([$1], [destructor_loc])),
25                               [%destructor does not make sense in Java])])])
26 b4_symbol_foreach([b4_symbol_no_destructor_assert])
27 
28 ## --------------- ##
29 ## api.push-pull.  ##
30 ## --------------- ##
31 
32 b4_percent_define_default([[api.push-pull]], [[pull]])
33 b4_percent_define_check_values([[[[api.push-pull]],
34                                  [[pull]], [[push]], [[both]]]])
35 
36 #Define m4 conditional macros that encode the value
37 #of the api.push - pull flag.
38 b4_define_flag_if([pull]) m4_define([b4_pull_flag], [[1]])
39 b4_define_flag_if([push]) m4_define([b4_push_flag], [[1]])
40 m4_case(b4_percent_define_get([[api.push-pull]]),
41         [pull], [m4_define([b4_push_flag], [[0]])],
42         [push], [m4_define([b4_pull_flag], [[0]])])
43 
44 #Define a macro to be true when api.push - pull has the value "both".
45 m4_define([b4_both_if],[b4_push_if([b4_pull_if([$1],[$2])],[$2])])
46 
47 #Handle BISON_USE_PUSH_FOR_PULL for the test suite.So that push parsing
48 #tests function as written, do not let BISON_USE_PUSH_FOR_PULL modify the
49 #behavior of Bison at all when push parsing is already requested.
50 b4_define_flag_if([use_push_for_pull])
51 b4_use_push_for_pull_if([
52   b4_push_if([m4_define([b4_use_push_for_pull_flag], [[0]])],
53              [m4_define([b4_push_flag], [[1]])])])
54 
55 #Define a macro to encapsulate the parse state variables.This
56 #allows them to be defined either in parse() when doing pull parsing,
57 #or as class instance variable when doing push parsing.
58 m4_define([b4_define_state],
59 [[
60     /* Lookahead token kind.  */
61     int yychar = YYEMPTY_;
62     /* Lookahead symbol kind.  */
63     SymbolKind yytoken = null;
64 
65     /* State.  */
66     int yyn = 0;
67     int yylen = 0;
68     int yystate = 0;
69     YYStack yystack = new YYStack ();
70     int label = YYNEWSTATE;
71 
72 ]b4_locations_if([[
73     /* The location where the error started.  */
74     ]b4_location_type[ yyerrloc = null;
75 
76     /* Location. */
77     ]b4_location_type[ yylloc = new ]b4_location_type[ (null, null);]])[
78 
79     /* Semantic value of the lookahead.  */
80     ]b4_yystype[ yylval = null;
81 ]])
82 
83 #parse.lac
84 b4_percent_define_default([[parse.lac]], [[none]])
85 b4_percent_define_check_values([[[[parse.lac]], [[full]], [[none]]]])
86 b4_define_flag_if([lac])
87 m4_define([b4_lac_flag],
88           [m4_if(b4_percent_define_get([[parse.lac]]),
89                  [none], [[0]], [[1]])])
90 
91 
92 ## ------------- ##
93 ## Parser File.  ##
94 ## ------------- ##
95 
96 b4_output_begin([b4_parser_file_name])[
97 ]b4_copyright([Skeleton implementation for Bison LALR(1) parsers in Java],
98               [2007-2015, 2018-2021])[
99 ]b4_disclaimer[
100 ]b4_percent_define_ifdef([api.package], [package b4_percent_define_get([api.package]);[
101 ]])[
102 ]b4_user_pre_prologue[
103 ]b4_user_post_prologue[
104 import java.text.MessageFormat;
105 import java.util.ArrayList;
106 ]b4_percent_code_get([[imports]])[
107 /**
108  * A Bison parser, automatically generated from <tt>]m4_bpatsubst(b4_file_name, [^"\(.*\)"$], [\1])[</tt>.
109  *
110  * @@author LALR (1) parser skeleton written by Paolo Bonzini.
111  */
112 ]b4_parser_class_declaration[
113 {
114 ]b4_identification[
115 ][
116 ]b4_parse_error_bmatch(
117            [detailed\|verbose], [[
118   /**
119    * True if verbose error messages are enabled.
120    */
121   private boolean yyErrorVerbose = true;
122 
123   /**
124    * Whether verbose error messages are enabled.
125    */
126   public final boolean getErrorVerbose() {
127         return yyErrorVerbose; }
128 
129   /**
130    * Set the verbosity of error messages.
131    * @@param verbose True to request verbose error messages.
132    */
133   public final void setErrorVerbose(boolean verbose)
134   {
135         yyErrorVerbose = verbose; }
136 ]])[
137 
138 ]b4_locations_if([[
139   /**
140    * A class defining a pair of positions.  Positions, defined by the
141    * <code>]b4_position_type[</code> class, denote a point in the input.
142    * Locations represent a part of the input through the beginning
143    * and ending positions.
144    */
145   public static class ]b4_location_type[ {
146         /**
147          * The first, inclusive, position in the range.
148          */
149     public ]b4_position_type[ begin;
150 
151     /**
152      * The first position beyond the range.
153      */
154     public ]b4_position_type[ end;
155 
156     /**
157      * Create a <code>]b4_location_type[</code> denoting an empty range located at
158      * a given point.
159      * @@param loc The position at which the range is anchored.
160      */
161     public ]b4_location_type[ (]b4_position_type[ loc) {
162             this.begin = this.end = loc;
163     }
164 
165     /**
166      * Create a <code>]b4_location_type[</code> from the endpoints of the range.
167      * @@param begin The first position included in the range.
168      * @@param end   The first position beyond the range.
169      */
170     public ]b4_location_type[ (]b4_position_type[ begin, ]b4_position_type[ end) {
171             this.begin = begin;
172             this.end   = end;
173     }
174 
175     /**
176      * Print a representation of the location.  For this to be correct,
177      * <code>]b4_position_type[</code> should override the <code>equals</code>
178      * method.
179      */
180     public String toString() {
181             if (begin.equals(end))
182                 return begin.toString();
183             else
184                 return begin.toString() + "-" + end.toString();
185     }
186   }
187 
188   private ]b4_location_type[ yylloc(YYStack rhs, int n)
189   {
190         if (0 < n)
191       return new ]b4_location_type[(rhs.locationAt(n-1).begin, rhs.locationAt(0).end);
192         else
193       return new ]b4_location_type[(rhs.locationAt(0).end);
194   }]])[
195 
196 ]b4_declare_symbol_enum[
197 
198   /**
199    * Communication interface between the scanner and the Bison-generated
200    * parser <tt>]b4_parser_class[</tt>.
201    */
202   public interface Lexer {
203 ]b4_token_enums[
204     /** Deprecated, use ]b4_symbol(eof, id)[ instead.  */
205     public static final int EOF = ]b4_symbol(eof, id)[;
206 ]b4_pull_if([b4_locations_if([[
207     /**
208      * Method to retrieve the beginning position of the last scanned token.
209      * @@return the position at which the last scanned token starts.
210      */
211     ]b4_position_type[ getStartPos();
212 
213     /**
214      * Method to retrieve the ending position of the last scanned token.
215      * @@return the first position beyond the last scanned token.
216      */
217     ]b4_position_type[ getEndPos();]])[
218 
219     /**
220      * Method to retrieve the semantic value of the last scanned token.
221      * @@return the semantic value of the last scanned token.
222      */
223     ]b4_yystype[ getLVal();
224 
225     /**
226      * Entry point for the scanner.  Returns the token identifier corresponding
227      * to the next token and prepares to return the semantic value
228      * ]b4_locations_if([and beginning/ending positions ])[of the token.
229      * @@return the token identifier corresponding to the next token.
230      */
231     int yylex()]b4_maybe_throws([b4_lex_throws])[;
232 ]])[
233     /**
234      * Emit an error]b4_locations_if([ referring to the given location])[in a user-defined way.
235      *
236      *]b4_locations_if([[ @@param loc The location of the element to which the
237      *                error message is related.]])[
238      * @@param msg The string for the error message.
239      */
240      void yyerror(]b4_locations_if([b4_location_type[ loc, ]])[String msg);
241 
242 ]b4_parse_error_bmatch(
243            [custom], [[
244     /**
245      * Build and emit a "syntax error" message in a user-defined way.
246      *
247      * @@param ctx  The context of the error.
248      */
249      void reportSyntaxError(Context ctx);
250 ]])[
251   }
252 
253 ]b4_lexer_if([[
254   private class YYLexer implements Lexer {
255 ]b4_percent_code_get([[lexer]])[
256   }
257 
258 ]])[
259   /**
260    * The object doing lexical analysis for us.
261    */
262   private Lexer yylexer;
263 
264 ]b4_parse_param_vars[
265 
266 ]b4_lexer_if([[
267   /**
268    * Instantiates the Bison-generated parser.
269    */
270   public ]b4_parser_class[(]b4_parse_param_decl([b4_lex_param_decl])[)]b4_maybe_throws([b4_init_throws])[
271   {
272 ]b4_percent_code_get([[init]])[]b4_lac_if([[
273     this.yylacStack = new ArrayList<Integer>();
274     this.yylacEstablished = false;]])[
275     this.yylexer = new YYLexer(]b4_lex_param_call[);
276 ]b4_parse_param_cons[
277   }
278 ]])[
279 
280   /**
281    * Instantiates the Bison-generated parser.
282    * @@param yylexer The scanner that will supply tokens to the parser.
283    */
284   ]b4_lexer_if([[protected]], [[public]]) b4_parser_class[(]b4_parse_param_decl([[Lexer yylexer]])[)]b4_maybe_throws([b4_init_throws])[
285   {
286 ]b4_percent_code_get([[init]])[]b4_lac_if([[
287     this.yylacStack = new ArrayList<Integer>();
288     this.yylacEstablished = false;]])[
289     this.yylexer = yylexer;
290 ]b4_parse_param_cons[
291   }
292 
293 ]b4_parse_trace_if([[
294   private java.io.PrintStream yyDebugStream = System.err;
295 
296   /**
297    * The <tt>PrintStream</tt> on which the debugging output is printed.
298    */
299   public final java.io.PrintStream getDebugStream() {
300         return yyDebugStream; }
301 
302   /**
303    * Set the <tt>PrintStream</tt> on which the debug output is printed.
304    * @@param s The stream that is used for debugging output.
305    */
306   public final void setDebugStream(java.io.PrintStream s) {
307         yyDebugStream = s; }
308 
309   private int yydebug = 0;
310 
311   /**
312    * Answer the verbosity of the debugging output; 0 means that all kinds of
313    * output from the parser are suppressed.
314    */
315   public final int getDebugLevel() {
316         return yydebug; }
317 
318   /**
319    * Set the verbosity of the debugging output; 0 means that all kinds of
320    * output from the parser are suppressed.
321    * @@param level The verbosity level for debugging output.
322    */
323   public final void setDebugLevel(int level) {
324         yydebug = level; }
325 ]])[
326 
327   private int yynerrs = 0;
328 
329   /**
330    * The number of syntax errors so far.
331    */
332   public final int getNumberOfErrors() {
333         return yynerrs; }
334 
335   /**
336    * Print an error message via the lexer.
337    *]b4_locations_if([[ Use a <code>null</code> location.]])[
338    * @@param msg The error message.
339    */
340   public final void yyerror(String msg) {
341       yylexer.yyerror(]b4_locations_if([[(]b4_location_type[)null, ]])[msg);
342   }
343 ]b4_locations_if([[
344   /**
345    * Print an error message via the lexer.
346    * @@param loc The location associated with the message.
347    * @@param msg The error message.
348    */
349   public final void yyerror(]b4_location_type[ loc, String msg) {
350         yylexer.yyerror(loc, msg);
351   }
352 
353   /**
354    * Print an error message via the lexer.
355    * @@param pos The position associated with the message.
356    * @@param msg The error message.
357    */
358   public final void yyerror(]b4_position_type[ pos, String msg) {
359       yylexer.yyerror(new ]b4_location_type[ (pos), msg);
360   }]])[
361 ]b4_parse_trace_if([[
362   protected final void yycdebugNnl(String s) {
363         if (0 < yydebug) yyDebugStream.print(s);
364   }
365 
366   protected final void yycdebug(String s) {
367         if (0 < yydebug) yyDebugStream.println(s);
368   }]])[
369 
370   private final class YYStack {
371         private int[] stateStack          = new int[16];]b4_locations_if([[
372     private ]b4_location_type[[] locStack = new ]b4_location_type[[16];]])[
373     private ]b4_yystype[[] valueStack = new ]b4_yystype[[16];
374 
375     public int size = 16;
376     public int height = -1;
377 
378     public final void push(int state, ]b4_yystype[ value]b4_locations_if([, ]b4_location_type[ loc])[) {
379             height++;
380             if (size == height)
381             {
382                 int[] newStateStack = new int[size * 2];
383                 System.arraycopy(stateStack, 0, newStateStack, 0, height);
384                 stateStack               = newStateStack;]b4_locations_if([[
385         ]b4_location_type[[] newLocStack = new ]b4_location_type[[size * 2];
386         System.arraycopy(locStack, 0, newLocStack, 0, height);
387         locStack = newLocStack;]])
388 
389         b4_yystype[[] newValueStack = new ]b4_yystype[[size * 2];
390         System.arraycopy(valueStack, 0, newValueStack, 0, height);
391         valueStack = newValueStack;
392 
393         size *= 2;
394             }
395 
396             stateStack[height] = state;]b4_locations_if([[
397       locStack[height] = loc;]])[
398       valueStack[height] = value;
399     }
400 
401     public final void pop() {
402             pop(1);
403     }
404 
405     public final void pop(int num) {
406             // Avoid memory leaks... garbage collection is a white lie!
407             if (0 < num)
408             {
409                 java.util.Arrays.fill(valueStack, height - num + 1, height + 1, null);]b4_locations_if([[
410         java.util.Arrays.fill(locStack, height - num + 1, height + 1, null);]])[
411             }
412             height -= num;
413     }
414 
415     public final int stateAt(int i) {
416             return stateStack[height - i];
417     }
418 ]b4_locations_if([[
419 
420     public final ]b4_location_type[ locationAt(int i) {
421             return locStack[height - i];
422     }
423 ]])[
424     public final ]b4_yystype[ valueAt(int i) {
425             return valueStack[height - i];
426     }
427 
428     // Print the state stack on the debug stream.
429     public void print(java.io.PrintStream out) {
430             out.print("Stack now");
431 
432             for (int i = 0; i <= height; i++)
433             {
434                 out.print(' ');
435                 out.print(stateStack[i]);
436             }
437             out.println();
438     }
439   }
440 
441   /**
442    * Returned by a Bison action in order to stop the parsing process and
443    * return success (<tt>true</tt>).
444    */
445   public static final int YYACCEPT = 0;
446 
447   /**
448    * Returned by a Bison action in order to stop the parsing process and
449    * return failure (<tt>false</tt>).
450    */
451   public static final int YYABORT = 1;
452 
453 ]b4_push_if([
454   /**
455    * Returned by a Bison action in order to request a new token.
456    */
457   public static final int YYPUSH_MORE = 4;])[
458 
459   /**
460    * Returned by a Bison action in order to start error recovery without
461    * printing an error message.
462    */
463   public static final int YYERROR = 2;
464 
465   /**
466    * Internal return codes that are not supported for user semantic
467    * actions.
468    */
469   private static final int YYERRLAB = 3;
470   private static final int YYNEWSTATE = 4;
471   private static final int YYDEFAULT = 5;
472   private static final int YYREDUCE = 6;
473   private static final int YYERRLAB1 = 7;
474   private static final int YYRETURN = 8;
475 ]b4_push_if([[  private static final int YYGETTOKEN = 9; /* Signify that a new token is expected when doing push-parsing.  */]])[
476 
477   private int yyerrstatus_ = 0;
478 
479 ]b4_push_if([b4_define_state])[
480   /**
481    * Whether error recovery is being done.  In this state, the parser
482    * reads token until it reaches a known state, and then restarts normal
483    * operation.
484    */
485   public final boolean recovering ()
486   {
487         return yyerrstatus_ == 0;
488   }
489 
490   /** Compute post-reduction state.
491    * @@param yystate   the current state
492    * @@param yysym     the nonterminal to push on the stack
493    */
494   private int yyLRGotoState(int yystate, int yysym) {
495         int yyr = yypgoto_[yysym - YYNTOKENS_] + yystate;
496         if (0 <= yyr && yyr <= YYLAST_ && yycheck_[yyr] == yystate)
497             return yytable_[yyr];
498         else
499             return yydefgoto_[yysym - YYNTOKENS_];
500   }
501 
502   private int yyaction(int yyn, YYStack yystack, int yylen)]b4_maybe_throws([b4_throws])[
503   {
504         /* If YYLEN is nonzero, implement the default value of the action:
505            '$$ = $1'.  Otherwise, use the top of the stack.
506 
507            Otherwise, the following line sets YYVAL to garbage.
508            This behavior is undocumented and Bison
509            users should not rely upon it.  */
510     ]b4_yystype[ yyval = (0 < yylen) ? yystack.valueAt(yylen - 1) : yystack.valueAt(0);]b4_locations_if([[
511     ]b4_location_type[ yyloc = yylloc(yystack, yylen);]])[]b4_parse_trace_if([[
512 
513     yyReducePrint(yyn, yystack);]])[
514 
515     switch (yyn)
516       {
517         ]b4_user_actions[
518         default: break;
519       }]b4_parse_trace_if([[
520 
521     yySymbolPrint("-> $$ =", SymbolKind.get(yyr1_[yyn]), yyval]b4_locations_if([, yyloc])[);]])[
522 
523     yystack.pop(yylen);
524     yylen = 0;
525     /* Shift the result of the reduction.  */
526     int yystate = yyLRGotoState(yystack.stateAt(0), yyr1_[yyn]);
527     yystack.push(yystate, yyval]b4_locations_if([, yyloc])[);
528     return YYNEWSTATE;
529   }
530 
531 ]b4_parse_trace_if([[
532   /*--------------------------------.
533   | Print this symbol on YYOUTPUT.  |
534   `--------------------------------*/
535 
536   private void yySymbolPrint(String s, SymbolKind yykind,
537                              ]b4_yystype[ yyvalue]b4_locations_if([, ]b4_location_type[ yylocation])[) {
538         if (0 < yydebug)
539         {
540           yycdebug(s
541                    + (yykind.getCode() < YYNTOKENS_ ? " token " : " nterm ")
542                    + yykind.getName() + " ("]b4_locations_if([
543                    + yylocation + ": "])[
544                    + (yyvalue == null ? "(null)" : yyvalue.toString()) + ")");
545         }
546   }]])[
547 
548 ]b4_push_if([],[[
549   /**
550    * Parse input from the scanner that was specified at object construction
551    * time.  Return whether the end of the input was reached successfully.
552    *
553    * @@return <tt>true</tt> if the parsing succeeds.  Note that this does not
554    *          imply that there were no syntax errors.
555    */
556   public boolean parse()]b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])[]])[
557 ]b4_push_if([
558   /**
559    * Push Parse input from external lexer
560    *
561    * @@param yylextoken current token
562    * @@param yylexval current lval]b4_locations_if([[
563    * @@param yylexloc current position]])[
564    *
565    * @@return <tt>YYACCEPT, YYABORT, YYPUSH_MORE</tt>
566    */
567   public int push_parse(int yylextoken, b4_yystype yylexval[]b4_locations_if([, b4_location_type yylexloc]))b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])])[
568   {]b4_locations_if([[
569     /* @@$.  */
570     ]b4_location_type[ yyloc;]])[
571 ]b4_push_if([],[[
572 ]b4_define_state[
573 ]b4_lac_if([[
574     // Discard the LAC context in case there still is one left from a
575     // previous invocation.
576     yylacDiscard("init");]])[
577 ]b4_parse_trace_if([[
578     yycdebug ("Starting parse");]])[
579     yyerrstatus_ = 0;
580     yynerrs = 0;
581 
582     /* Initialize the stack.  */
583     yystack.push (yystate, yylval]b4_locations_if([, yylloc])[);
584 ]m4_ifdef([b4_initial_action], [
585 b4_dollar_pushdef([yylval], [], [], [yylloc])dnl
586     b4_user_initial_action
587 b4_dollar_popdef[]dnl
588 ])[
589 ]])[
590 ]b4_push_if([[
591     if (!this.push_parse_initialized)
592       {
593             push_parse_initialize();
594 ]m4_ifdef([b4_initial_action], [
595 b4_dollar_pushdef([yylval], [], [], [yylloc])dnl
596     b4_user_initial_action
597 b4_dollar_popdef[]dnl
598 ])[]b4_parse_trace_if([[
599         yycdebug ("Starting parse");]])[
600         yyerrstatus_ = 0;
601       } else
602         label = YYGETTOKEN;
603 
604     boolean push_token_consumed = true;
605 ]])[
606     for (;;)
607       switch (label)
608       {
609                 /* New state.  Unlike in the C/C++ skeletons, the state is already
610                    pushed when we come here.  */
611             case YYNEWSTATE:]b4_parse_trace_if([[
612         yycdebug ("Entering state " + yystate);
613         if (0 < yydebug)
614           yystack.print (yyDebugStream);]])[
615 
616         /* Accept?  */
617         if (yystate == YYFINAL_)
618           ]b4_push_if([{
619                     label = YYACCEPT;
620                     break;}],
621                       [return true;])[
622 
623         /* Take a decision.  First try without lookahead.  */
624         yyn = yypact_[yystate];
625         if (yyPactValueIsDefault (yyn))
626           {
627                     label = YYDEFAULT;
628                     break;
629           }
630 ]b4_push_if([        /* Fall Through */
631 
632       case YYGETTOKEN:])[
633         /* Read a lookahead token.  */
634         if (yychar == YYEMPTY_)
635           {
636 ]b4_push_if([[
637             if (!push_token_consumed)
638               return YYPUSH_MORE;]b4_parse_trace_if([[
639             yycdebug ("Reading a token");]])[
640             yychar = yylextoken;
641             yylval = yylexval;]b4_locations_if([
642             yylloc = yylexloc;])[
643             push_token_consumed = false;]], [b4_parse_trace_if([[
644             yycdebug ("Reading a token");]])[
645             yychar = yylexer.yylex ();
646             yylval = yylexer.getLVal();]b4_locations_if([[
647             yylloc = new ]b4_location_type[(yylexer.getStartPos(),
648                                           yylexer.getEndPos());]])[
649 ]])[
650           }
651 
652         /* Convert token to internal form.  */
653         yytoken = yytranslate_ (yychar);]b4_parse_trace_if([[
654         yySymbolPrint("Next token is", yytoken,
655                       yylval]b4_locations_if([, yylloc])[);]])[
656 
657         if (yytoken == ]b4_symbol(error, kind)[)
658           {
659                     // The scanner already issued an error message, process directly
660                     // to error recovery.  But do not keep the error token as
661                     // lookahead, it is too special and may lead us to an endless
662                     // loop in error recovery. */
663             yychar = Lexer.]b4_symbol(undef, id)[;
664             yytoken = ]b4_symbol(undef, kind)[;]b4_locations_if([[
665             yyerrloc = yylloc;]])[
666             label = YYERRLAB1;
667           }
668         else
669           {
670                     /* If the proper action on seeing token YYTOKEN is to reduce or to
671                        detect an error, take that action.  */
672                     yyn += yytoken.getCode();
673                     if (yyn < 0 || YYLAST_ < yyn || yycheck_[yyn] != yytoken.getCode())
674                     {]b4_lac_if([[
675               if (!yylacEstablish(yystack, yytoken)) {
676                             label = YYERRLAB;
677               } else]])[
678               label = YYDEFAULT;
679                     }
680 
681                     /* <= 0 means reduce or error.  */
682                     else if ((yyn = yytable_[yyn]) <= 0)
683                     {
684                         if (yyTableValueIsError(yyn))
685                         {
686                             label = YYERRLAB;
687                         }]b4_lac_if([[ else if (!yylacEstablish(yystack, yytoken)) {
688                             label = YYERRLAB;
689                 }]])[ else {
690                             yyn   = -yyn;
691                             label = YYREDUCE;
692                 }
693                     }
694 
695                     else
696                     {
697                 /* Shift the lookahead token.  */]b4_parse_trace_if([[
698                 yySymbolPrint("Shifting", yytoken,
699                               yylval]b4_locations_if([, yylloc])[);
700 ]])[
701                 /* Discard the token being shifted.  */
702                 yychar = YYEMPTY_;
703 
704                 /* Count tokens shifted since error; after three, turn off error
705                    status.  */
706                 if (yyerrstatus_ > 0)
707                   --yyerrstatus_;
708 
709                 yystate = yyn;
710                 yystack.push(yystate, yylval]b4_locations_if([, yylloc])[);]b4_lac_if([[
711                 yylacDiscard("shift");]])[
712                 label = YYNEWSTATE;
713                     }
714           }
715         break;
716 
717       /*-----------------------------------------------------------.
718       | yydefault -- do the default action for the current state.  |
719       `-----------------------------------------------------------*/
720       case YYDEFAULT:
721         yyn = yydefact_[yystate];
722         if (yyn == 0)
723           label = YYERRLAB;
724         else
725           label = YYREDUCE;
726         break;
727 
728       /*-----------------------------.
729       | yyreduce -- Do a reduction.  |
730       `-----------------------------*/
731       case YYREDUCE:
732         yylen = yyr2_[yyn];
733         label = yyaction(yyn, yystack, yylen);
734         yystate = yystack.stateAt(0);
735         break;
736 
737       /*------------------------------------.
738       | yyerrlab -- here on detecting error |
739       `------------------------------------*/
740       case YYERRLAB:
741         /* If not already recovering from an error, report this error.  */
742         if (yyerrstatus_ == 0)
743           {
744                     ++yynerrs;
745                     if (yychar == YYEMPTY_) yytoken = null;
746             yyreportSyntaxError(new Context(this, yystack, yytoken]b4_locations_if([[, yylloc]])[));
747           }
748 ]b4_locations_if([[
749         yyerrloc = yylloc;]])[
750         if (yyerrstatus_ == 3)
751           {
752                     /* If just tried and failed to reuse lookahead token after an
753                        error, discard it.  */
754 
755             if (yychar <= Lexer.]b4_symbol(eof, id)[)
756             {
757                 /* Return failure if at end of input.  */
758                 if (yychar == Lexer.]b4_symbol(eof, id)[)
759                   ]b4_push_if([{
760                                 label = YYABORT;
761                                 break;}], [return false;])[
762             }
763             else
764                 yychar = YYEMPTY_;
765           }
766 
767         /* Else will try to reuse lookahead token after shifting the error
768            token.  */
769         label = YYERRLAB1;
770         break;
771 
772       /*-------------------------------------------------.
773       | errorlab -- error raised explicitly by YYERROR.  |
774       `-------------------------------------------------*/
775       case YYERROR:]b4_locations_if([[
776         yyerrloc = yystack.locationAt (yylen - 1);]])[
777         /* Do not reclaim the symbols of the rule which action triggered
778            this YYERROR.  */
779         yystack.pop (yylen);
780         yylen = 0;
781         yystate = yystack.stateAt(0);
782         label = YYERRLAB1;
783         break;
784 
785       /*-------------------------------------------------------------.
786       | yyerrlab1 -- common code for both syntax error and YYERROR.  |
787       `-------------------------------------------------------------*/
788       case YYERRLAB1:
789         yyerrstatus_ = 3;       /* Each real token shifted decrements this.  */
790 
791         // Pop stack until we find a state that shifts the error token.
792         for (;;)
793           {
794                     yyn = yypact_[yystate];
795                     if (!yyPactValueIsDefault(yyn))
796                     {
797                 yyn += ]b4_symbol(error, kind)[.getCode();
798                 if (0 <= yyn && yyn <= YYLAST_
799                     && yycheck_[yyn] == ]b4_symbol(error, kind)[.getCode())
800                   {
801                             yyn = yytable_[yyn];
802                             if (0 < yyn) break;
803                   }
804                     }
805 
806                     /* Pop the current state because it cannot handle the
807                      * error token.  */
808                     if (yystack.height == 0)
809               ]b4_push_if([{
810                             label = YYABORT;
811                             break;}],[return false;])[
812 
813 ]b4_locations_if([[
814             yyerrloc = yystack.locationAt (0);]])[
815             yystack.pop ();
816             yystate = yystack.stateAt(0);]b4_parse_trace_if([[
817             if (0 < yydebug)
818               yystack.print (yyDebugStream);]])[
819           }
820 
821         if (label == YYABORT)
822           /* Leave the switch.  */
823           break;
824 
825 ]b4_locations_if([[
826         /* Muck with the stack to setup for yylloc.  */
827         yystack.push (0, null, yylloc);
828         yystack.push (0, null, yyerrloc);
829         yyloc = yylloc (yystack, 2);
830         yystack.pop (2);]])[
831 
832         /* Shift the error token.  */]b4_lac_if([[
833         yylacDiscard("error recovery");]])[]b4_parse_trace_if([[
834         yySymbolPrint("Shifting", SymbolKind.get(yystos_[yyn]),
835                       yylval]b4_locations_if([, yyloc])[);]])[
836 
837         yystate = yyn;
838         yystack.push (yyn, yylval]b4_locations_if([, yyloc])[);
839         label = YYNEWSTATE;
840         break;
841 
842         /* Accept.  */
843       case YYACCEPT:
844         ]b4_push_if([this.push_parse_initialized = false; return YYACCEPT;],
845                     [return true;])[
846 
847         /* Abort.  */
848       case YYABORT:
849         ]b4_push_if([this.push_parse_initialized = false; return YYABORT;],
850                     [return false;])[
851       }
852 }
853 ]b4_push_if([[
854   boolean push_parse_initialized = false;
855 
856     /**
857      * (Re-)Initialize the state of the push parser.
858      */
859   public void push_parse_initialize ()
860   {
861         /* Lookahead and lookahead in internal form.  */
862         this.yychar  = YYEMPTY_;
863         this.yytoken = null;
864 
865         /* State.  */
866         this.yyn          = 0;
867         this.yylen        = 0;
868         this.yystate      = 0;
869         this.yystack      = new YYStack();]b4_lac_if([[
870     this.yylacStack = new ArrayList<Integer>();
871     this.yylacEstablished = false;]])[
872     this.label = YYNEWSTATE;
873 
874     /* Error handling.  */
875     this.yynerrs = 0;]b4_locations_if([[
876     /* The location where the error started.  */
877     this.yyerrloc = null;
878     this.yylloc = new ]b4_location_type[ (null, null);]])[
879 
880     /* Semantic value of the lookahead.  */
881     this.yylval = null;
882 
883     yystack.push (this.yystate, this.yylval]b4_locations_if([, this.yylloc])[);
884 
885     this.push_parse_initialized = true;
886 
887   }
888 ]b4_locations_if([[
889   /**
890    * Push parse given input from an external lexer.
891    *
892    * @@param yylextoken current token
893    * @@param yylexval current lval
894    * @@param yyylexpos current position
895    *
896    * @@return <tt>YYACCEPT, YYABORT, YYPUSH_MORE</tt>
897    */
898   public int push_parse(int yylextoken, ]b4_yystype[ yylexval, ]b4_position_type[ yylexpos)]b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])[ {
899       return push_parse(yylextoken, yylexval, new ]b4_location_type[(yylexpos));
900   }
901 ]])])[
902 
903 ]b4_both_if([[
904   /**
905    * Parse input from the scanner that was specified at object construction
906    * time.  Return whether the end of the input was reached successfully.
907    * This version of parse() is defined only when api.push-push=both.
908    *
909    * @@return <tt>true</tt> if the parsing succeeds.  Note that this does not
910    *          imply that there were no syntax errors.
911    */
912   public boolean parse()]b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])[ {
913         if (yylexer == null) throw new NullPointerException("Null Lexer");
914         int status;
915         do
916         {
917             int token       = yylexer.yylex();
918           ]b4_yystype[ lval = yylexer.getLVal();]b4_locations_if([[
919           ]b4_location_type[ yyloc = new ]b4_location_type[(yylexer.getStartPos(), yylexer.getEndPos());
920           status = push_parse(token, lval, yyloc);]], [[
921           status = push_parse(token, lval);]])[
922         } while (status == YYPUSH_MORE);
923         return status == YYACCEPT;
924   }
925 ]])[
926 
927   /**
928    * Information needed to get the list of expected tokens and to forge
929    * a syntax error diagnostic.
930    */
931   public static final class Context {
932     Context(]b4_parser_class[ parser, YYStack stack, SymbolKind token]b4_locations_if([[, ]b4_location_type[ loc]])[)
933     {
934         yyparser = parser;
935         yystack  = stack;
936         yytoken  = token;]b4_locations_if([[
937       yylocation = loc;]])[
938     }
939 
940     private ]b4_parser_class[ yyparser;
941     private YYStack yystack;
942 
943 
944     /**
945      * The symbol kind of the lookahead token.
946      */
947     public final SymbolKind getToken() {
948             return yytoken;
949     }
950 
951     private SymbolKind yytoken;]b4_locations_if([[
952 
953     /**
954      * The location of the lookahead.
955      */
956     public final ]b4_location_type[ getLocation() {
957             return yylocation;
958     }
959 
960     private ]b4_location_type[ yylocation;]])[
961     static final int NTOKENS = ]b4_parser_class[.YYNTOKENS_;
962 
963     /**
964      * Put in YYARG at most YYARGN of the expected tokens given the
965      * current YYCTX, and return the number of tokens stored in YYARG.  If
966      * YYARG is null, return the number of expected tokens (guaranteed to
967      * be less than YYNTOKENS).
968      */
969     int getExpectedTokens(SymbolKind yyarg[], int yyargn) {
970             return getExpectedTokens(yyarg, 0, yyargn);
971     }
972 
973     int getExpectedTokens(SymbolKind yyarg[], int yyoffset, int yyargn) {
974             int yycount = yyoffset;]b4_lac_if([b4_parse_trace_if([[
975       // Execute LAC once. We don't care if it is successful, we
976       // only do it for the sake of debugging output.
977       if (!yyparser.yylacEstablished)
978         yyparser.yylacCheck(yystack, yytoken);
979 ]])[
980       for (int yyx = 0; yyx < YYNTOKENS_; ++yyx)
981         {
982                 SymbolKind yysym = SymbolKind.get(yyx);
983           if (yysym != ]b4_symbol(error, kind)[
984               && yysym != ]b4_symbol(undef, kind)[
985               && yyparser.yylacCheck(yystack, yysym))
986           {
987               if (yyarg == null)
988                   yycount += 1;
989               else if (yycount == yyargn)
990                   return 0;
991               else
992                   yyarg[yycount++] = yysym;
993           }
994         }]], [[
995       int yyn = yypact_[this.yystack.stateAt(0)];
996       if (!yyPactValueIsDefault(yyn))
997         {
998                 /* Start YYX at -YYN if negative to avoid negative
999                    indexes in YYCHECK.  In other words, skip the first
1000                    -YYN actions for this state because they are default
1001                    actions.  */
1002                 int yyxbegin = yyn < 0 ? -yyn : 0;
1003                 /* Stay within bounds of both yycheck and yytname.  */
1004                 int yychecklim = YYLAST_ - yyn + 1;
1005                 int yyxend     = yychecklim < NTOKENS ? yychecklim : NTOKENS;
1006                 for (int yyx = yyxbegin; yyx < yyxend; ++yyx)
1007             if (yycheck_[yyx + yyn] == yyx && yyx != ]b4_symbol(error, kind)[.getCode()
1008                 && !yyTableValueIsError(yytable_[yyx + yyn]))
1009             {
1010                 if (yyarg == null)
1011                     yycount += 1;
1012                 else if (yycount == yyargn)
1013                     return 0; // FIXME: this is incorrect.
1014                 else
1015                     yyarg[yycount++] = SymbolKind.get(yyx);
1016             }
1017         }]])[
1018       if (yyarg != null && yycount == yyoffset && yyoffset < yyargn)
1019         yyarg[yycount] = null;
1020       return yycount - yyoffset;
1021     }
1022   }
1023 
1024 ]b4_lac_if([[
1025     /** Check the lookahead yytoken.
1026      * \returns  true iff the token will be eventually shifted.
1027      */
1028     boolean yylacCheck(YYStack yystack, SymbolKind yytoken)
1029     {
1030         // Logically, the yylacStack's lifetime is confined to this function.
1031         // Clear it, to get rid of potential left-overs from previous call.
1032         yylacStack.clear();
1033         // Reduce until we encounter a shift and thereby accept the token.
1034         yycdebugNnl("LAC: checking lookahead " + yytoken.getName() + ":");
1035         int lacTop = 0;
1036         while (true)
1037         {
1038             int topState = (yylacStack.isEmpty() ? yystack.stateAt(lacTop)
1039                                                  : yylacStack.get(yylacStack.size() - 1));
1040             int yyrule   = yypact_[topState];
1041             if (yyPactValueIsDefault(yyrule) || (yyrule += yytoken.getCode()) < 0
1042                     || YYLAST_ < yyrule || yycheck_[yyrule] != yytoken.getCode())
1043             {
1044                 // Use the default action.
1045                 yyrule = yydefact_[+topState];
1046                 if (yyrule == 0)
1047                 {
1048                     yycdebug(" Err");
1049                     return false;
1050                 }
1051             }
1052             else
1053             {
1054                 // Use the action from yytable.
1055                 yyrule = yytable_[yyrule];
1056                 if (yyTableValueIsError(yyrule))
1057                 {
1058                     yycdebug(" Err");
1059                     return false;
1060                 }
1061                 if (0 < yyrule)
1062                 {
1063                     yycdebug(" S" + yyrule);
1064                     return true;
1065                 }
1066                 yyrule = -yyrule;
1067             }
1068             // By now we know we have to simulate a reduce.
1069             yycdebugNnl(" R" + (yyrule - 1));
1070             // Pop the corresponding number of values from the stack.
1071             {
1072                 int yylen = yyr2_[yyrule];
1073                 // First pop from the LAC stack as many tokens as possible.
1074                 int lacSize = yylacStack.size();
1075                 if (yylen < lacSize)
1076                 {
1077                     // yylacStack.setSize(lacSize - yylen);
1078                     for (/* Nothing */; 0 < yylen; yylen -= 1)
1079                     {
1080                         yylacStack.remove(yylacStack.size() - 1);
1081                     }
1082                     yylen = 0;
1083                 }
1084                 else if (lacSize != 0)
1085                 {
1086                     yylacStack.clear();
1087                     yylen -= lacSize;
1088                 }
1089                 // Only afterwards look at the main stack.
1090                 // We simulate popping elements by incrementing lacTop.
1091                 lacTop += yylen;
1092             }
1093             // Keep topState in sync with the updated stack.
1094             topState = (yylacStack.isEmpty() ? yystack.stateAt(lacTop)
1095                                              : yylacStack.get(yylacStack.size() - 1));
1096             // Push the resulting state of the reduction.
1097             int state = yyLRGotoState(topState, yyr1_[yyrule]);
1098             yycdebugNnl(" G" + state);
1099             yylacStack.add(state);
1100         }
1101     }
1102 
1103     /** Establish the initial context if no initial context currently exists.
1104      * \returns  true iff the token will be eventually shifted.
1105      */
1106     boolean yylacEstablish(YYStack yystack, SymbolKind yytoken) {
1107         /* Establish the initial context for the current lookahead if no initial
1108            context is currently established.
1109 
1110            We define a context as a snapshot of the parser stacks.  We define
1111            the initial context for a lookahead as the context in which the
1112            parser initially examines that lookahead in order to select a
1113            syntactic action.  Thus, if the lookahead eventually proves
1114            syntactically unacceptable (possibly in a later context reached via a
1115            series of reductions), the initial context can be used to determine
1116            the exact set of tokens that would be syntactically acceptable in the
1117            lookahead's place.  Moreover, it is the context after which any
1118            further semantic actions would be erroneous because they would be
1119            determined by a syntactically unacceptable token.
1120 
1121            yylacEstablish should be invoked when a reduction is about to be
1122            performed in an inconsistent state (which, for the purposes of LAC,
1123            includes consistent states that don't know they're consistent because
1124            their default reductions have been disabled).
1125 
1126            For parse.lac=full, the implementation of yylacEstablish is as
1127            follows.  If no initial context is currently established for the
1128            current lookahead, then check if that lookahead can eventually be
1129            shifted if syntactic actions continue from the current context.  */
1130         if (yylacEstablished)
1131         {
1132             return true;
1133         }
1134         else
1135         {
1136             yycdebug("LAC: initial context established for " + yytoken.getName());
1137             yylacEstablished = true;
1138             return yylacCheck(yystack, yytoken);
1139         }
1140     }
1141 
1142     /** Discard any previous initial lookahead context because of event.
1143      * \param event  the event which caused the lookahead to be discarded.
1144      *               Only used for debbuging output.  */
1145     void yylacDiscard(String event) {
1146         /* Discard any previous initial lookahead context because of Event,
1147            which may be a lookahead change or an invalidation of the currently
1148            established initial context for the current lookahead.
1149 
1150            The most common example of a lookahead change is a shift.  An example
1151            of both cases is syntax error recovery.  That is, a syntax error
1152            occurs when the lookahead is syntactically erroneous for the
1153            currently established initial context, so error recovery manipulates
1154            the parser stacks to try to find a new initial context in which the
1155            current lookahead is syntactically acceptable.  If it fails to find
1156            such a context, it discards the lookahead.  */
1157         if (yylacEstablished)
1158         {
1159             yycdebug("LAC: initial context discarded due to " + event);
1160             yylacEstablished = false;
1161         }
1162     }
1163 
1164     /** The stack for LAC.
1165      * Logically, the yylacStack's lifetime is confined to the function
1166      * yylacCheck. We just store it as a member of this class to hold
1167      * on to the memory and to avoid frequent reallocations.
1168      */
1169     ArrayList<Integer> yylacStack;
1170     /**  Whether an initial LAC context was established. */
1171     boolean yylacEstablished;
1172 ]])[
1173 
1174 ]b4_parse_error_bmatch(
1175 [detailed\|verbose], [[
1176   private int yysyntaxErrorArguments(Context yyctx, SymbolKind[] yyarg, int yyargn) {
1177         /* There are many possibilities here to consider:
1178            - If this state is a consistent state with a default action,
1179              then the only way this function was invoked is if the
1180              default action is an error action.  In that case, don't
1181              check for expected tokens because there are none.
1182            - The only way there can be no lookahead present (in tok) is
1183              if this state is a consistent state with a default action.
1184              Thus, detecting the absence of a lookahead is sufficient to
1185              determine that there is no unexpected or expected token to
1186              report.  In that case, just report a simple "syntax error".
1187            - Don't assume there isn't a lookahead just because this
1188              state is a consistent state with a default action.  There
1189              might have been a previous inconsistent state, consistent
1190              state with a non-default action, or user semantic action
1191              that manipulated yychar.  (However, yychar is currently out
1192              of scope during semantic actions.)
1193            - Of course, the expected token list depends on states to
1194              have correct lookahead information, and it depends on the
1195              parser not to perform extra reductions after fetching a
1196              lookahead from the scanner and before detecting a syntax
1197              error.  Thus, state merging (from LALR or IELR) and default
1198              reductions corrupt the expected token list.  However, the
1199              list is correct for canonical LR with one exception: it
1200              will still contain any token that will not be accepted due
1201              to an error action in a later state.
1202         */
1203         int yycount = 0;
1204         if (yyctx.getToken() != null)
1205         {
1206             if (yyarg != null) yyarg[yycount] = yyctx.getToken();
1207             yycount += 1;
1208             yycount += yyctx.getExpectedTokens(yyarg, 1, yyargn);
1209         }
1210         return yycount;
1211   }
1212 ]])[
1213 
1214   /**
1215    * Build and emit a "syntax error" message in a user-defined way.
1216    *
1217    * @@param ctx  The context of the error.
1218    */
1219   private void yyreportSyntaxError(Context yyctx) {]b4_parse_error_bmatch(
1220 [custom], [[
1221       yylexer.reportSyntaxError(yyctx);]],
1222 [detailed\|verbose], [[
1223       if (yyErrorVerbose) {
1224             final int argmax   = 5;
1225             SymbolKind[] yyarg = new SymbolKind[argmax];
1226             int yycount        = yysyntaxErrorArguments(yyctx, yyarg, argmax);
1227             String[] yystr     = new String[yycount];
1228             for (int yyi = 0; yyi < yycount; ++yyi)
1229             {
1230                 yystr[yyi] = yyarg[yyi].getName();
1231             }
1232             String yyformat;
1233             switch (yycount)
1234             {
1235                 default:
1236                 case 0: yyformat = ]b4_trans(["syntax error"])[; break;
1237               case 1: yyformat = ]b4_trans(["syntax error, unexpected {0}"])[; break;
1238               case 2: yyformat = ]b4_trans(["syntax error, unexpected {0}, expecting {1}"])[; break;
1239               case 3: yyformat = ]b4_trans(["syntax error, unexpected {0}, expecting {1} or {2}"])[; break;
1240               case 4: yyformat = ]b4_trans(["syntax error, unexpected {0}, expecting {1} or {2} or {3}"])[; break;
1241               case 5: yyformat = ]b4_trans(["syntax error, unexpected {0}, expecting {1} or {2} or {3} or {4}"])[; break;
1242             }
1243           yyerror(]b4_locations_if([[yyctx.yylocation, ]])[new MessageFormat(yyformat).format(yystr));
1244       } else {
1245           yyerror(]b4_locations_if([[yyctx.yylocation, ]])[]b4_trans(["syntax error"])[);
1246       }]],
1247 [simple], [[
1248       yyerror(]b4_locations_if([[yyctx.yylocation, ]])[]b4_trans(["syntax error"])[);]])[
1249   }
1250 
1251   /**
1252    * Whether the given <code>yypact_</code> value indicates a defaulted state.
1253    * @@param yyvalue   the value to check
1254    */
1255   private static boolean yyPactValueIsDefault(int yyvalue) {
1256         return yyvalue == yypact_ninf_;
1257   }
1258 
1259   /**
1260    * Whether the given <code>yytable_</code>
1261    * value indicates a syntax error.
1262    * @@param yyvalue the value to check
1263    */
1264   private static boolean yyTableValueIsError(int yyvalue) {
1265         return yyvalue == yytable_ninf_;
1266   }
1267 
1268   private static final ]b4_int_type_for([b4_pact])[ yypact_ninf_ = ]b4_pact_ninf[;
1269   private static final ]b4_int_type_for([b4_table])[ yytable_ninf_ = ]b4_table_ninf[;
1270 
1271 ]b4_parser_tables_define[
1272 
1273 ]b4_parse_trace_if([[
1274   ]b4_integral_parser_table_define([rline], [b4_rline],
1275   [[YYRLINE[YYN] -- Source line where rule number YYN was defined.]])[
1276 
1277 
1278   // Report on the debug stream that the rule yyrule is going to be reduced.
1279   private void yyReducePrint (int yyrule, YYStack yystack)
1280   {
1281         if (yydebug == 0) return;
1282 
1283         int yylno  = yyrline_[yyrule];
1284         int yynrhs = yyr2_[yyrule];
1285         /* Print the symbols being reduced, and their result.  */
1286         yycdebug("Reducing stack by rule " + (yyrule - 1) + " (line " + yylno + "):");
1287 
1288         /* The symbols being reduced.  */
1289         for (int yyi = 0; yyi < yynrhs; yyi++)
1290       yySymbolPrint("   $" + (yyi + 1) + " =",
1291                     SymbolKind.get(yystos_[yystack.stateAt(yynrhs - (yyi + 1))]),
1292                     ]b4_rhs_data(yynrhs, yyi + 1)b4_locations_if([,
1293                     b4_rhs_location(yynrhs, yyi + 1)])[);
1294   }]])[
1295 
1296   /* YYTRANSLATE_(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
1297      as returned by yylex, with out-of-bounds checking.  */
1298   private static final SymbolKind yytranslate_(int t)
1299 ]b4_api_token_raw_if(dnl
1300 [[  {
1301         return SymbolKind.get(t);
1302   }
1303 ]],
1304 [[  {
1305         // Last valid token kind.
1306     int code_max = ]b4_code_max[;
1307     if (t <= 0)
1308       return ]b4_symbol(eof, kind)[;
1309     else if (t <= code_max)
1310       return SymbolKind.get(yytranslate_table_[t]);
1311     else
1312       return ]b4_symbol(undef, kind)[;
1313   }
1314   ]b4_integral_parser_table_define([translate_table], [b4_translate])[
1315 ]])[
1316 
1317   private static final int YYLAST_ = ]b4_last[;
1318   private static final int YYEMPTY_ = -2;
1319   private static final int YYFINAL_ = ]b4_final_state_number[;
1320   private static final int YYNTOKENS_ = ]b4_tokens_number[;
1321 
1322 ]b4_percent_code_get[
1323 }
1324 ]b4_percent_code_get([[epilogue]])[]dnl
1325 b4_epilogue[]dnl
1326 b4_output_end
1327