Create a semantic value based on this result. A straight-forward implementation of this method simply creates a new semantic value, using the specified actual value, this result's index, and the specified parse error:
public SemanticValue value(Object value, ParseError error) { return new SemanticValue(value, index, error); }
However, for a result that already is a semantic value, a more sophisticated implementation can avoid creating a new semantic value if the specified actual value and parse error are
identical to those for this result.
@param value The actual value.
@param error The embedded parse error.
@throws IllegalStateException Signals that this result is aparse error.