]> git.saurik.com Git - bison.git/blob - data/lalr1.java
* doc/bison.texinfo (Push Decl): Document the push parser.
[bison.git] / data / lalr1.java
1 # Java skeleton for Bison -*- autoconf -*-
2
3 # Copyright (C) 2007 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 <http://www.gnu.org/licenses/>.
17
18 m4_include(b4_pkgdatadir/[java.m4])
19
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 [])
24
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])
29
30 b4_percent_define_ifdef([package], [package b4_percent_define_get([package]);
31 ])[/* First part of user declarations. */
32 ]b4_pre_prologue
33 b4_percent_code_get([[imports]])
34 [/**
35 * A Bison parser, automatically generated from <tt>@ofile@</tt>.
36 *
37 * @@author LALR (1) parser skeleton written by Paolo Bonzini.
38 */
39 ]b4_public_if([public ])b4_abstract_if([abstract ])[class ]b4_parser_class_name[
40 {
41 ]b4_identification[
42
43 /** True if verbose error messages are enabled. */
44 public boolean errorVerbose = ]b4_flag_value([error_verbose]);
45
46 b4_locations_if([[
47 /**
48 * A class defining a pair of positions. Positions, defined by the
49 * <code>]b4_position_type[</code> class, denote a point in the input.
50 * Locations represent a part of the input through the beginning
51 * and ending positions. */
52 public class ]b4_location_type[ {
53 /** The first, inclusive, position in the range. */
54 public ]b4_position_type[ begin;
55
56 /** The first position beyond the range. */
57 public ]b4_position_type[ end;
58
59 /**
60 * Create a ]b4_location_type[ denoting an empty range located at
61 * a given point.
62 * @@param loc The position at which the range is anchored. */
63 public ]b4_location_type[ (]b4_position_type[ loc) {
64 this.begin = this.end = loc;
65 }
66
67 /**
68 * Create a <code>]b4_location_type[</code> from the endpoints of the range.
69 * @@param begin The first position included in the range.
70 * @@param begin The first position beyond the range. */
71 public ]b4_location_type[ (]b4_position_type[ begin, ]b4_position_type[ end) {
72 this.begin = begin;
73 this.end = end;
74 }
75
76 /**
77 * Print a representation of the location. For this to be correct,
78 * <code>]b4_position_type[</code> should override the <code>equals</code>
79 * method. */
80 public String toString () {
81 if (begin.equals (end))
82 return begin.toString ();
83 else
84 return begin.toString () + "-" + end.toString ();
85 }
86 }
87
88 ]])
89
90 [ /** Token returned by the scanner to signal the end of its input. */
91 public static final int EOF = 0;]
92
93 b4_token_enums(b4_tokens)
94
95 b4_locations_if([[
96 private ]b4_location_type[ yylloc (YYStack rhs, int n)
97 {
98 if (n > 0)
99 return new ]b4_location_type[ (rhs.locationAt (1).begin, rhs.locationAt (n).end);
100 else
101 return new ]b4_location_type[ (rhs.locationAt (0).end);
102 }]])
103
104 /**
105 * Communication interface between the scanner and the Bison-generated
106 * parser <tt>]b4_parser_class_name[</tt>.
107 */
108 public interface Lexer {
109 ]b4_locations_if([[/**
110 * Method to retrieve the beginning position of the last scanned token.
111 * @@return the position at which the last scanned token starts. */
112 ]b4_position_type[ getStartPos ();
113
114 /**
115 * Method to retrieve the ending position of the last scanned token.
116 * @@return the first position beyond the last scanned token. */
117 ]b4_position_type[ getEndPos ();]])[
118
119 /**
120 * Method to retrieve the semantic value of the last scanned token.
121 * @@return the semantic value of the last scanned token. */
122 ]b4_yystype[ getLVal ();]
123
124 /**
125 * Entry point for the scanner. Returns the token identifier corresponding
126 * to the next token and ]b4_pure_if([prepares to return], [stores])[
127 * the semantic value]b4_locations_if([ and beginning/ending positions])[
128 * of the token.
129 * @@return the token identifier corresponding to the next token. */
130 int yylex () ]b4_maybe_throws([b4_lex_throws])[;
131
132 /**
133 * Entry point for error reporting. Emits an error
134 * ]b4_locations_if([ referring to the given location])[in a user-defined
135 * way.
136 *
137 * ]b4_locations_if([loc], [[The location of the element to which the
138 * error message is related]])[
139 * @@param s The string for the error message. */
140 void yyerror (]b4_locations_if([b4_location_type[ loc, ]])[String s);]
141 }
142
143 b4_lexer_if([[private class YYLexer implements Lexer {
144 ]b4_percent_code_get([[lexer]])[
145 }
146
147 ]])[/** The object doing lexical analysis for us. */
148 private Lexer yylexer;
149 ]
150 b4_parse_param_vars
151
152 b4_lexer_if([[
153 /**
154 * Instantiates the Bison-generated parser.
155 */
156 public ]b4_parser_class_name (b4_parse_param_decl([b4_lex_param_decl])[) {
157 this.yylexer = new YYLexer(]b4_lex_param_call[);
158 ]b4_parse_param_cons[
159 }
160 ]])
161
162 /**
163 * Instantiates the Bison-generated parser.
164 * @@param yylex The scanner that will supply tokens to the parser.
165 */
166 b4_lexer_if([[protected]], [[public]]) b4_parser_class_name[ (]b4_parse_param_decl([[Lexer yylexer]])[) {
167 this.yylexer = yylexer;
168 ]b4_parse_param_cons[
169 }
170
171 private java.io.PrintStream yyDebugStream = System.err;
172
173 /**
174 * Return the <tt>PrintStream</tt> on which the debugging output is
175 * printed.
176 */
177 public final java.io.PrintStream getDebugStream () { return yyDebugStream; }
178
179 /**
180 * Set the <tt>PrintStream</tt> on which the debug output is printed.
181 * @@param s The stream that is used for debugging output.
182 */
183 public final void setDebugStream(java.io.PrintStream s) { yyDebugStream = s; }
184
185 private int yydebug = 0;
186
187 /**
188 * Answer the verbosity of the debugging output; 0 means that all kinds of
189 * output from the parser are suppressed.
190 */
191 public final int getDebugLevel() { return yydebug; }
192
193 /**
194 * Set the verbosity of the debugging output; 0 means that all kinds of
195 * output from the parser are suppressed.
196 * @@param level The verbosity level for debugging output.
197 */
198 public final void setDebugLevel(int level) { yydebug = level; }
199
200 private final int yylex () ]b4_maybe_throws([b4_lex_throws]) [{
201 return yylexer.yylex ();
202 }
203 protected final void yyerror (]b4_locations_if([b4_location_type[ loc, ]])[String s) {
204 yylexer.yyerror (]b4_locations_if([loc, ])[s);
205 }
206
207 ]b4_locations_if([
208 protected final void yyerror (String s) {
209 yylexer.yyerror ((Location)null, s);
210 }
211 protected final void yyerror (]b4_position_type[ loc, String s) {
212 yylexer.yyerror (new ]b4_location_type[ (loc), s);
213 }])
214
215 [protected final void yycdebug (String s) {
216 if (yydebug > 0)
217 yyDebugStream.println (s);
218 }
219
220 private final class YYStack {
221 private int[] stateStack = new int[16];
222 ]b4_locations_if([[private ]b4_location_type[[] locStack = new ]b4_location_type[[16];]])[
223 private ]b4_yystype[[] valueStack = new ]b4_yystype[[16];
224
225 public int size = 16;
226 public int height = -1;
227
228 public final void push (int state, ]b4_yystype[ value]dnl
229 b4_locations_if([, ]b4_location_type[ loc])[) {
230 height++;
231 if (size == height)
232 {
233 int[] newStateStack = new int[size * 2];
234 System.arraycopy (stateStack, 0, newStateStack, 0, height);
235 stateStack = newStateStack;
236 ]b4_locations_if([[
237 ]b4_location_type[[] newLocStack = new ]b4_location_type[[size * 2];
238 System.arraycopy (locStack, 0, newLocStack, 0, height);
239 locStack = newLocStack;]])
240
241 b4_yystype[[] newValueStack = new ]b4_yystype[[size * 2];
242 System.arraycopy (valueStack, 0, newValueStack, 0, height);
243 valueStack = newValueStack;
244
245 size *= 2;
246 }
247
248 stateStack[height] = state;
249 ]b4_locations_if([[locStack[height] = loc;]])[
250 valueStack[height] = value;
251 }
252
253 public final void pop () {
254 height--;
255 }
256
257 public final void pop (int num) {
258 // Avoid memory leaks... garbage collection is a white lie!
259 if (num > 0) {
260 java.util.Arrays.fill (valueStack, height - num + 1, height, null);
261 ]b4_locations_if([[java.util.Arrays.fill (locStack, height - num + 1, height, null);]])[
262 }
263 height -= num;
264 }
265
266 public final int stateAt (int i) {
267 return stateStack[height - i];
268 }
269
270 ]b4_locations_if([[public final ]b4_location_type[ locationAt (int i) {
271 return locStack[height - i];
272 }
273
274 ]])[public final ]b4_yystype[ valueAt (int i) {
275 return valueStack[height - i];
276 }
277
278 // Print the state stack on the debug stream.
279 public void print (java.io.PrintStream out)
280 {
281 out.print ("Stack now");
282
283 for (int i = 0; i < height; i++)
284 {
285 out.print (' ');
286 out.print (stateStack[i]);
287 }
288 out.println ();
289 }
290 }
291
292 /**
293 * Returned by a Bison action in order to stop the parsing process and
294 * return success (<tt>true</tt>). */
295 public static final int YYACCEPT = 0;
296
297 /**
298 * Returned by a Bison action in order to stop the parsing process and
299 * return failure (<tt>false</tt>). */
300 public static final int YYABORT = 1;
301
302 /**
303 * Returned by a Bison action in order to start error recovery without
304 * printing an error message. */
305 public static final int YYERROR = 2;
306
307 /**
308 * Returned by a Bison action in order to print an error message and start
309 * error recovery. */
310 public static final int YYFAIL = 3;
311
312 private static final int YYNEWSTATE = 4;
313 private static final int YYDEFAULT = 5;
314 private static final int YYREDUCE = 6;
315 private static final int YYERRLAB1 = 7;
316 private static final int YYRETURN = 8;
317
318 private int yyerrstatus_ = 0;
319
320 /**
321 * Return whether error recovery is being done. In this state, the parser
322 * reads token until it reaches a known state, and then restarts normal
323 * operation. */
324 public final boolean recovering ()
325 {
326 return yyerrstatus_ == 0;
327 }
328
329 private int yyaction (int yyn, YYStack yystack, int yylen)
330 {
331 ]b4_yystype[ yyval;
332 ]b4_locations_if([b4_location_type[ yyloc = yylloc (yystack, yylen);]])[
333
334 /* If YYLEN is nonzero, implement the default value of the action:
335 `$$ = $1'. Otherwise, use the top of the stack.
336
337 Otherwise, the following line sets YYVAL to garbage.
338 This behavior is undocumented and Bison
339 users should not rely upon it. */
340 if (yylen > 0)
341 yyval = yystack.valueAt (yylen - 1);
342 else
343 yyval = yystack.valueAt (0);
344
345 yy_reduce_print (yyn, yystack);
346
347 switch (yyn)
348 {
349 ]b4_user_actions[
350 default: break;
351 }
352
353 yy_symbol_print ("-> $$ =", yyr1_[yyn], yyval]b4_locations_if([, yyloc])[);
354
355 yystack.pop (yylen);
356 yylen = 0;
357
358 /* Shift the result of the reduction. */
359 yyn = yyr1_[yyn];
360 int yystate = yypgoto_[yyn - yyntokens_] + yystack.stateAt (0);
361 if (0 <= yystate && yystate <= yylast_
362 && yycheck_[yystate] == yystack.stateAt (0))
363 yystate = yytable_[yystate];
364 else
365 yystate = yydefgoto_[yyn - yyntokens_];
366
367 yystack.push (yystate, yyval]b4_locations_if([, yyloc])[);
368 return YYNEWSTATE;
369 }
370
371 /* Return YYSTR after stripping away unnecessary quotes and
372 backslashes, so that it's suitable for yyerror. The heuristic is
373 that double-quoting is unnecessary unless the string contains an
374 apostrophe, a comma, or backslash (other than backslash-backslash).
375 YYSTR is taken from yytname. */
376 private final String yytnamerr_ (String yystr)
377 {
378 if (yystr.charAt (0) == '"')
379 {
380 StringBuffer yyr = new StringBuffer ();
381 strip_quotes: for (int i = 1; i < yystr.length (); i++)
382 switch (yystr.charAt (i))
383 {
384 case '\'':
385 case ',':
386 break strip_quotes;
387
388 case '\\':
389 if (yystr.charAt(++i) != '\\')
390 break strip_quotes;
391 /* Fall through. */
392 default:
393 yyr.append (yystr.charAt (i));
394 break;
395
396 case '"':
397 return yyr.toString ();
398 }
399 }
400 else if (yystr.equals ("$end"))
401 return "end of input";
402
403 return yystr;
404 }
405
406 /*--------------------------------.
407 | Print this symbol on YYOUTPUT. |
408 `--------------------------------*/
409
410 private void yy_symbol_print (String s, int yytype,
411 ]b4_yystype[ yyvaluep]dnl
412 b4_locations_if([, Object yylocationp])[)
413 {
414 if (yydebug > 0)
415 yycdebug (s + (yytype < yyntokens_ ? " token " : " nterm ")
416 + yytname_[yytype] + " ("]b4_locations_if([
417 + yylocationp + ": "])[
418 + (yyvaluep == null ? "(null)" : yyvaluep) + ")");
419 }
420
421 /**
422 * Parse input from the scanner that was specified at object construction
423 * time. Return whether the end of the input was reached successfully.
424 *
425 * @@return <tt>true</tt> if the parsing succeeds. Note that this does not
426 * imply that there were no syntax errors.
427 */
428 public boolean parse () ]b4_maybe_throws([b4_throws])[
429 {
430 /// Lookahead and lookahead in internal form.
431 int yychar = yyempty_;
432 int yytoken = 0;
433
434 /* State. */
435 int yyn = 0;
436 int yylen = 0;
437 int yystate = 0;
438
439 YYStack yystack = new YYStack ();
440
441 /* Error handling. */
442 int yynerrs_ = 0;
443 ]b4_locations_if([/// The location where the error started.
444 ]b4_location_type[ yyerrloc = null;
445
446 /// ]b4_location_type[ of the lookahead.
447 ]b4_location_type[ yylloc = new ]b4_location_type[ (null, null);
448
449 /// @@$.
450 ]b4_location_type[ yyloc;])
451
452 /// Semantic value of the lookahead.
453 b4_yystype[ yylval = null;
454
455 int yyresult;
456
457 yycdebug ("Starting parse\n");
458 yyerrstatus_ = 0;
459
460 ]m4_ifdef([b4_initial_action], [
461 m4_pushdef([b4_at_dollar], [yylloc])dnl
462 m4_pushdef([b4_dollar_dollar], [yylval])dnl
463 /* User initialization code. */
464 b4_user_initial_action
465 m4_popdef([b4_dollar_dollar])dnl
466 m4_popdef([b4_at_dollar])])dnl
467
468 [ /* Initialize the stack. */
469 yystack.push (yystate, yylval]b4_locations_if([, yylloc])[);
470
471 int label = YYNEWSTATE;
472 for (;;)
473 switch (label)
474 {
475 /* New state. Unlike in the C/C++ skeletons, the state is already
476 pushed when we come here. */
477 case YYNEWSTATE:
478 yycdebug ("Entering state " + yystate + "\n");
479 if (yydebug > 0)
480 yystack.print (yyDebugStream);
481
482 /* Accept? */
483 if (yystate == yyfinal_)
484 return true;
485
486 /* Take a decision. First try without lookahead. */
487 yyn = yypact_[yystate];
488 if (yyn == yypact_ninf_)
489 {
490 label = YYDEFAULT;
491 break;
492 }
493
494 /* Read a lookahead token. */
495 if (yychar == yyempty_)
496 {
497 yycdebug ("Reading a token: ");
498 yychar = yylex ();]
499 b4_locations_if([[
500 yylloc = new ]b4_location_type[(yylexer.getStartPos (),
501 yylexer.getEndPos ());]])
502 yylval = yylexer.getLVal ();[
503 }
504
505 /* Convert token to internal form. */
506 if (yychar <= EOF)
507 {
508 yychar = yytoken = EOF;
509 yycdebug ("Now at end of input.\n");
510 }
511 else
512 {
513 yytoken = yytranslate_ (yychar);
514 yy_symbol_print ("Next token is", yytoken,
515 yylval]b4_locations_if([, yylloc])[);
516 }
517
518 /* If the proper action on seeing token YYTOKEN is to reduce or to
519 detect an error, take that action. */
520 yyn += yytoken;
521 if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yytoken)
522 label = YYDEFAULT;
523
524 /* <= 0 means reduce or error. */
525 else if ((yyn = yytable_[yyn]) <= 0)
526 {
527 if (yyn == 0 || yyn == yytable_ninf_)
528 label = YYFAIL;
529 else
530 {
531 yyn = -yyn;
532 label = YYREDUCE;
533 }
534 }
535
536 else
537 {
538 /* Shift the lookahead token. */
539 yy_symbol_print ("Shifting", yytoken,
540 yylval]b4_locations_if([, yylloc])[);
541
542 /* Discard the token being shifted. */
543 yychar = yyempty_;
544
545 /* Count tokens shifted since error; after three, turn off error
546 status. */
547 if (yyerrstatus_ > 0)
548 --yyerrstatus_;
549
550 yystate = yyn;
551 yystack.push (yystate, yylval]b4_locations_if([, yylloc])[);
552 label = YYNEWSTATE;
553 }
554 break;
555
556 /*-----------------------------------------------------------.
557 | yydefault -- do the default action for the current state. |
558 `-----------------------------------------------------------*/
559 case YYDEFAULT:
560 yyn = yydefact_[yystate];
561 if (yyn == 0)
562 label = YYFAIL;
563 else
564 label = YYREDUCE;
565 break;
566
567 /*-----------------------------.
568 | yyreduce -- Do a reduction. |
569 `-----------------------------*/
570 case YYREDUCE:
571 yylen = yyr2_[yyn];
572 label = yyaction (yyn, yystack, yylen);
573 yystate = yystack.stateAt (0);
574 break;
575
576 /*------------------------------------.
577 | yyerrlab -- here on detecting error |
578 `------------------------------------*/
579 case YYFAIL:
580 /* If not already recovering from an error, report this error. */
581 if (yyerrstatus_ == 0)
582 {
583 ++yynerrs_;
584 yyerror (]b4_locations_if([yylloc, ])[yysyntax_error (yystate, yytoken));
585 }
586
587 ]b4_locations_if([yyerrloc = yylloc;])[
588 if (yyerrstatus_ == 3)
589 {
590 /* If just tried and failed to reuse lookahead token after an
591 error, discard it. */
592
593 if (yychar <= EOF)
594 {
595 /* Return failure if at end of input. */
596 if (yychar == EOF)
597 return false;
598 }
599 else
600 yychar = yyempty_;
601 }
602
603 /* Else will try to reuse lookahead token after shifting the error
604 token. */
605 label = YYERRLAB1;
606 break;
607
608 /*---------------------------------------------------.
609 | errorlab -- error raised explicitly by YYERROR. |
610 `---------------------------------------------------*/
611 case YYERROR:
612
613 ]b4_locations_if([yyerrloc = yystack.locationAt (yylen - 1);])[
614 /* Do not reclaim the symbols of the rule which action triggered
615 this YYERROR. */
616 yystack.pop (yylen);
617 yylen = 0;
618 yystate = yystack.stateAt (0);
619 label = YYERRLAB1;
620 break;
621
622 /*-------------------------------------------------------------.
623 | yyerrlab1 -- common code for both syntax error and YYERROR. |
624 `-------------------------------------------------------------*/
625 case YYERRLAB1:
626 yyerrstatus_ = 3; /* Each real token shifted decrements this. */
627
628 for (;;)
629 {
630 yyn = yypact_[yystate];
631 if (yyn != yypact_ninf_)
632 {
633 yyn += yyterror_;
634 if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_)
635 {
636 yyn = yytable_[yyn];
637 if (0 < yyn)
638 break;
639 }
640 }
641
642 /* Pop the current state because it cannot handle the error token. */
643 if (yystack.height == 1)
644 return false;
645
646 ]b4_locations_if([yyerrloc = yystack.locationAt (0);])[
647 yystack.pop ();
648 yystate = yystack.stateAt (0);
649 if (yydebug > 0)
650 yystack.print (yyDebugStream);
651 }
652
653 ]b4_locations_if([
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);
658 yystack.pop (2);])[
659
660 /* Shift the error token. */
661 yy_symbol_print ("Shifting", yystos_[yyn],
662 yylval]b4_locations_if([, yyloc])[);
663
664 yystate = yyn;
665 yystack.push (yyn, yylval]b4_locations_if([, yyloc])[);
666 label = YYNEWSTATE;
667 break;
668
669 /* Accept. */
670 case YYACCEPT:
671 return true;
672
673 /* Abort. */
674 case YYABORT:
675 return false;
676 }
677 }
678
679 // Generate an error message.
680 private String yysyntax_error (int yystate, int tok)
681 {
682 if (errorVerbose)
683 {
684 int yyn = yypact_[yystate];
685 if (yypact_ninf_ < yyn && yyn <= yylast_)
686 {
687 StringBuffer res;
688
689 /* Start YYX at -YYN if negative to avoid negative indexes in
690 YYCHECK. */
691 int yyxbegin = yyn < 0 ? -yyn : 0;
692
693 /* Stay within bounds of both yycheck and yytname. */
694 int yychecklim = yylast_ - yyn + 1;
695 int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
696 int count = 0;
697 for (int x = yyxbegin; x < yyxend; ++x)
698 if (yycheck_[x + yyn] == x && x != yyterror_)
699 ++count;
700
701 // FIXME: This method of building the message is not compatible
702 // with internationalization.
703 res = new StringBuffer ("syntax error, unexpected ");
704 res.append (yytnamerr_ (yytname_[tok]));
705 if (count < 5)
706 {
707 count = 0;
708 for (int x = yyxbegin; x < yyxend; ++x)
709 if (yycheck_[x + yyn] == x && x != yyterror_)
710 {
711 res.append (count++ == 0 ? ", expecting " : " or ");
712 res.append (yytnamerr_ (yytname_[x]));
713 }
714 }
715 return res.toString ();
716 }
717 }
718
719 return "syntax error";
720 }
721
722
723 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
724 STATE-NUM. */
725 private static final ]b4_int_type_for([b4_pact])[ yypact_ninf_ = ]b4_pact_ninf[;
726 private static final ]b4_int_type_for([b4_pact])[ yypact_[] =
727 {
728 ]b4_pact[
729 };
730
731 /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
732 doesn't specify something else to do. Zero means the default is an
733 error. */
734 private static final ]b4_int_type_for([b4_defact])[ yydefact_[] =
735 {
736 ]b4_defact[
737 };
738
739 /* YYPGOTO[NTERM-NUM]. */
740 private static final ]b4_int_type_for([b4_pgoto])[ yypgoto_[] =
741 {
742 ]b4_pgoto[
743 };
744
745 /* YYDEFGOTO[NTERM-NUM]. */
746 private static final ]b4_int_type_for([b4_defgoto])[
747 yydefgoto_[] =
748 {
749 ]b4_defgoto[
750 };
751
752 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
753 positive, shift that token. If negative, reduce the rule which
754 number is the opposite. If zero, do what YYDEFACT says. */
755 private static final ]b4_int_type_for([b4_table])[ yytable_ninf_ = ]b4_table_ninf[;
756 private static final ]b4_int_type_for([b4_table])[
757 yytable_[] =
758 {
759 ]b4_table[
760 };
761
762 /* YYCHECK. */
763 private static final ]b4_int_type_for([b4_check])[
764 yycheck_[] =
765 {
766 ]b4_check[
767 };
768
769 /* STOS_[STATE-NUM] -- The (internal number of the) accessing
770 symbol of state STATE-NUM. */
771 private static final ]b4_int_type_for([b4_stos])[
772 yystos_[] =
773 {
774 ]b4_stos[
775 };
776
777 /* TOKEN_NUMBER_[YYLEX-NUM] -- Internal symbol number corresponding
778 to YYLEX-NUM. */
779 private static final ]b4_int_type_for([b4_toknum])[
780 yytoken_number_[] =
781 {
782 ]b4_toknum[
783 };
784
785 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
786 private static final ]b4_int_type_for([b4_r1])[
787 yyr1_[] =
788 {
789 ]b4_r1[
790 };
791
792 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
793 private static final ]b4_int_type_for([b4_r2])[
794 yyr2_[] =
795 {
796 ]b4_r2[
797 };
798
799 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
800 First, the terminals, then, starting at \a yyntokens_, nonterminals. */
801 private static final String yytname_[] =
802 {
803 ]b4_tname[
804 };
805
806 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
807 private static final ]b4_int_type_for([b4_rhs])[ yyrhs_[] =
808 {
809 ]b4_rhs[
810 };
811
812 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
813 YYRHS. */
814 private static final ]b4_int_type_for([b4_prhs])[ yyprhs_[] =
815 {
816 ]b4_prhs[
817 };
818
819 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
820 private static final ]b4_int_type_for([b4_rline])[ yyrline_[] =
821 {
822 ]b4_rline[
823 };
824
825 // Report on the debug stream that the rule yyrule is going to be reduced.
826 private void yy_reduce_print (int yyrule, YYStack yystack)
827 {
828 if (yydebug == 0)
829 return;
830
831 int yylno = yyrline_[yyrule];
832 int yynrhs = yyr2_[yyrule];
833 /* Print the symbols being reduced, and their result. */
834 yycdebug ("Reducing stack by rule " + (yyrule - 1)
835 + " (line " + yylno + "), ");
836
837 /* The symbols being reduced. */
838 for (int yyi = 0; yyi < yynrhs; yyi++)
839 yy_symbol_print (" $" + (yyi + 1) + " =",
840 yyrhs_[yyprhs_[yyrule] + yyi],
841 ]b4_rhs_value(yynrhs, yyi + 1)b4_locations_if([,
842 b4_rhs_location(yynrhs, yyi + 1)])[);
843 }
844
845 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
846 private static final ]b4_int_type_for([b4_translate])[ yytranslate_table_[] =
847 {
848 ]b4_translate[
849 };
850
851 private static final ]b4_int_type_for([b4_translate])[ yytranslate_ (int t)
852 {
853 if (t >= 0 && t <= yyuser_token_number_max_)
854 return yytranslate_table_[t];
855 else
856 return yyundef_token_;
857 }
858
859 private static final int yylast_ = ]b4_last[;
860 private static final int yynnts_ = ]b4_nterms_number[;
861 private static final int yyempty_ = -2;
862 private static final int yyfinal_ = ]b4_final_state_number[;
863 private static final int yyterror_ = 1;
864 private static final int yyerrcode_ = 256;
865 private static final int yyntokens_ = ]b4_tokens_number[;
866
867 private static final int yyuser_token_number_max_ = ]b4_user_token_number_max[;
868 private static final int yyundef_token_ = ]b4_undef_token_number[;
869
870 ]/* User implementation code. */
871 b4_percent_code_get[]dnl
872
873 }
874
875 b4_epilogue
876 m4_divert_pop(0)dnl