]> git.saurik.com Git - bison.git/blobdiff - data/lalr1.java
gnulib: update
[bison.git] / data / lalr1.java
index d226ce3c710a2903bfcc7c582b50bee700a9ae8f..670ea01379209280cf6327e9c1ab72ed1c27c0b9 100644 (file)
@@ -1,6 +1,6 @@
 # Java skeleton for Bison -*- autoconf -*-
 
-# Copyright (C) 2007-2013 Free Software Foundation, Inc.
+# Copyright (C) 2007-2015 Free Software Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -84,7 +84,7 @@ m4_define([b4_define_state],[[
 
 b4_output_begin([b4_parser_file_name])
 b4_copyright([Skeleton implementation for Bison LALR(1) parsers in Java],
-             [2007-2013])
+             [2007-2015])
 
 b4_percent_define_ifdef([package], [package b4_percent_define_get([package]);
 ])[/* First part of user declarations.  */
@@ -419,7 +419,7 @@ b4_lexer_if([[
   /**
    * Returned by a Bison action in order to request a new token.
    */
-  public static final int YYMORE = 4;])[
+  public static final int YYPUSH_MORE = 4;])[
 
   /**
    * Returned by a Bison action in order to start error recovery without
@@ -453,6 +453,19 @@ b4_define_state])[
     return yyerrstatus_ == 0;
   }
 
+  /** Compute post-reduction state.
+   * @@param yystate   the current state
+   * @@param yysym     the nonterminal to push on the stack
+   */
+  private int yy_lr_goto_state_ (int yystate, int yysym)
+  {
+    int yyr = yypgoto_[yysym - yyntokens_] + yystate;
+    if (0 <= yyr && yyr <= yylast_ && yycheck_[yyr] == yystate)
+      return yytable_[yyr];
+    else
+      return yydefgoto_[yysym - yyntokens_];
+  }
+
   private int yyaction (int yyn, YYStack yystack, int yylen) ]b4_maybe_throws([b4_throws])[
   {
     ]b4_yystype[ yyval;
@@ -483,14 +496,7 @@ b4_define_state])[
     yylen = 0;
 
     /* Shift the result of the reduction.  */
-    yyn = yyr1_[yyn];
-    int yystate = yypgoto_[yyn - yyntokens_] + yystack.stateAt (0);
-    if (0 <= yystate && yystate <= yylast_
-        && yycheck_[yystate] == yystack.stateAt (0))
-      yystate = yytable_[yystate];
-    else
-      yystate = yydefgoto_[yyn - yyntokens_];
-
+    int yystate = yy_lr_goto_state_ (yystack.stateAt (0), yyr1_[yyn]);
     yystack.push (yystate, yyval]b4_locations_if([, yyloc])[);
     return YYNEWSTATE;
   }
@@ -564,7 +570,7 @@ b4_define_state])[
    * @@param yylexval current lval
 ]b4_locations_if([   * @@param yylexloc current position])[
    *
-   * @@return <tt>YYACCEPT, YYABORT, YYMORE</tt>
+   * @@return <tt>YYACCEPT, YYABORT, YYPUSH_MORE</tt>
    */
   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])])])[
@@ -632,7 +638,7 @@ b4_dollar_popdef[]dnl
           {
 ]b4_push_if([[
             if (!push_token_consumed)
-              return YYMORE;
+              return YYPUSH_MORE;
             yycdebug ("Reading a token: ");
             yychar = yylextoken;
             yylval = yylexval;]b4_locations_if([
@@ -870,7 +876,7 @@ b4_dollar_popdef[]dnl
    * @@param yylexval current lval
    * @@param yyylexpos current position
    *
-   * @@return <tt>YYACCEPT, YYABORT, YYMORE</tt>
+   * @@return <tt>YYACCEPT, YYABORT, YYPUSH_MORE</tt>
    */
   public int push_parse (int yylextoken, b4_yystype yylexval, b4_position_type yylexpos)
       b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])
@@ -899,10 +905,9 @@ b4_both_if([[
 ]b4_locations_if([dnl
         b4_location_type yyloc = new b4_location_type (yylexer.getStartPos (),
                                               yylexer.getEndPos ());])[
-        this.yyerrstatus_ = 0;
         ]b4_locations_if([status = push_parse(token,lval,yyloc);],[
         status = push_parse(token,lval);])[
-      } while (status == YYMORE);
+      } while (status == YYPUSH_MORE);
       return (status == YYACCEPT);
   }
 ]])[