X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/53f036ce027289d3f5e70c88735b88aa6725381d..10659d0ec997368fe57712a7c564795c530ba0c2:/data/lalr1.java
diff --git a/data/lalr1.java b/data/lalr1.java
index 646b7772..6637c3a2 100644
--- a/data/lalr1.java
+++ b/data/lalr1.java
@@ -533,7 +533,7 @@ m4_popdef([b4_at_dollar])])dnl
/* Take a decision. First try without lookahead. */
yyn = yypact_[yystate];
- if (yyn == yypact_ninf_)
+ if (yy_pact_value_is_default_ (yyn))
{
label = YYDEFAULT;
break;
@@ -572,7 +572,7 @@ m4_popdef([b4_at_dollar])])dnl
/* <= 0 means reduce or error. */
else if ((yyn = yytable_[yyn]) <= 0)
{
- if (yyn == 0 || yyn == yytable_ninf_)
+ if (yy_table_value_is_error_ (yyn))
label = YYFAIL;
else
{
@@ -676,7 +676,7 @@ m4_popdef([b4_at_dollar])])dnl
for (;;)
{
yyn = yypact_[yystate];
- if (yyn != yypact_ninf_)
+ if (!yy_pact_value_is_default_ (yyn))
{
yyn += yyterror_;
if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_)
@@ -745,7 +745,7 @@ m4_popdef([b4_at_dollar])])dnl
int count = 0;
for (int x = yyxbegin; x < yyxend; ++x)
if (yycheck_[x + yyn] == x && x != yyterror_
- && yycheck_[x + yyn] != yytable_ninf_)
+ && !yy_table_value_is_error_ (yytable_[x + yyn]))
++count;
// FIXME: This method of building the message is not compatible
@@ -757,7 +757,7 @@ m4_popdef([b4_at_dollar])])dnl
count = 0;
for (int x = yyxbegin; x < yyxend; ++x)
if (yycheck_[x + yyn] == x && x != yyterror_
- && yycheck_[x + yyn] != yytable_ninf_)
+ && !yy_table_value_is_error_ (yytable_[x + yyn]))
{
res.append (count++ == 0 ? ", expecting " : " or ");
res.append (yytnamerr_ (yytname_[x]));
@@ -770,6 +770,24 @@ m4_popdef([b4_at_dollar])])dnl
return "syntax error";
}
+ /**
+ * Whether the given yypact_
value indicates a defaulted state.
+ * @@param yyvalue the value to check
+ */
+ private static boolean yy_pact_value_is_default_ (int yyvalue)
+ {
+ return yyvalue == yypact_ninf_;
+ }
+
+ /**
+ * Whether the given yytable_
value indicates a syntax error.
+ * @@param yyvalue the value to check
+ */
+ private static boolean yy_table_value_is_error_ (int yyvalue)
+ {
+ return yyvalue == yytable_ninf_;
+ }
+
private static final ]b4_int_type_for([b4_pact])[ yypact_ninf_ = ]b4_pact_ninf[;
private static final ]b4_int_type_for([b4_table])[ yytable_ninf_ = ]b4_table_ninf[;