X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/45c64fa627f205f49ac7afb51ad3d6e851b62f86..671850a1c3e1aaac93a89fabc6d810be6a4a77fe:/data/lalr1.java?ds=inline diff --git a/data/lalr1.java b/data/lalr1.java index d137ed81..670ea013 100644 --- a/data/lalr1.java +++ b/data/lalr1.java @@ -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. */ @@ -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; }