Methods Summary |
---|
public boolean | core_equals(com.sun.java_cup.internal.lr_item_core other)Equality comparison for the core only. This is separate out because we
need separate access in a super class.
return other != null &&
_the_production.equals(other._the_production) &&
_dot_pos == other._dot_pos;
|
public int | core_hashCode()Hash code for the core (separated so we keep non overridden version).
return _core_hash_cache;
|
public boolean | dot_at_end()Is the dot at the end of the production?
/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
return _dot_pos >= _the_production.rhs_length();
|
public non_terminal | dot_before_nt()Determine if we have a dot before a non terminal, and if so which one
(return null or the non terminal).
symbol sym;
/* get the symbol after the dot */
sym = symbol_after_dot();
/* if it exists and is a non terminal, return it */
if (sym != null && sym.is_non_term())
return (non_terminal)sym;
else
return null;
|
public int | dot_pos()The position of the "dot" -- this indicates the part of the production
that the marker is before, so 0 indicates a dot at the beginning of
the RHS.return _dot_pos;
|
public boolean | equals(com.sun.java_cup.internal.lr_item_core other)Equality comparison.return core_equals(other);
|
public boolean | equals(java.lang.Object other)Generic equality comparison.
if (!(other instanceof lr_item_core))
return false;
else
return equals((lr_item_core)other);
|
public int | hashCode()Hash code for the item.
return _core_hash_cache;
|
protected int | obj_hash()Return the hash code that object would have provided for us so we have
a (nearly) unique id for debugging.
return super.hashCode();
|
public com.sun.java_cup.internal.lr_item_core | shift_core()Produce a new lr_item_core that results from shifting the dot one
position to the right.
if (dot_at_end())
throw new internal_error(
"Attempt to shift past end of an lr_item_core");
return new lr_item_core(_the_production, _dot_pos+1);
|
public symbol | symbol_after_dot()Return the symbol after the dot. If there is no symbol after the dot
we return null.
/* use the cached symbol */
return _symbol_after_dot;
|
public production | the_production()The production for the item.return _the_production;
|
public java.lang.String | toString()Convert to a string
/* can't throw here since super class doesn't, so we crash instead */
try {
return to_simple_string();
} catch(internal_error e) {
e.crash();
return null;
}
|
public java.lang.String | to_simple_string()Convert to a string (separated out from toString() so we can call it
from subclass that overrides toString()).
String result;
production_part part;
if (_the_production.lhs() != null &&
_the_production.lhs().the_symbol() != null &&
_the_production.lhs().the_symbol().name() != null)
result = _the_production.lhs().the_symbol().name();
else
result = "$$NULL$$";
result += " ::= ";
for (int i = 0; i<_the_production.rhs_length(); i++)
{
/* do we need the dot before this one? */
if (i == _dot_pos)
result += "(*) ";
/* print the name of the part */
if (_the_production.rhs(i) == null)
{
result += "$$NULL$$ ";
}
else
{
part = _the_production.rhs(i);
if (part == null)
result += "$$NULL$$ ";
else if (part.is_action())
result += "{ACTION} ";
else if (((symbol_part)part).the_symbol() != null &&
((symbol_part)part).the_symbol().name() != null)
result += ((symbol_part)part).the_symbol().name() + " ";
else
result += "$$NULL$$ ";
}
}
/* put the dot after if needed */
if (_dot_pos == _the_production.rhs_length())
result += "(*) ";
return result;
|