public abstract class Result
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
int |
index
The index into the parser's memoization table.
|
| Constructor and Description |
|---|
Result(int index)
Create a new result with the specified index.
|
| Modifier and Type | Method and Description |
|---|---|
abstract SemanticValue |
createValue(java.lang.Object value,
ParseError error)
Create a semantic value based on this result.
|
abstract boolean |
hasValue()
Determine whether this result has a value.
|
abstract boolean |
hasValue(java.lang.String s)
Determine whether this result has the specified string value.
|
abstract boolean |
hasValueIgnoreCase(java.lang.String s)
Determine whether this result has the specified string value,
ignoring case.
|
abstract ParseError |
parseError()
Get the parse error for this result.
|
abstract ParseError |
select(ParseError error)
Select the more specific parse error.
|
abstract ParseError |
select(ParseError error,
int index)
Select the more specific parse error.
|
abstract <T> T |
semanticValue()
Get the semantic value for this result.
|
public Result(int index)
index - The index.public abstract boolean hasValue()
true if this result has a value.public abstract boolean hasValue(java.lang.String s)
null.s - The string value.true if this result has the specified string
value.public abstract boolean hasValueIgnoreCase(java.lang.String s)
null.s - The string value.true if this result has the specified string
value, ignoring case.public abstract <T> T semanticValue()
java.lang.IllegalStateException - Signals that this result does not have a semantic value.public abstract ParseError parseError()
dummy parse
error.public abstract ParseError select(ParseError error)
error - The error.public abstract ParseError select(ParseError error, int index)
error - The error.index - The index.public abstract SemanticValue createValue(java.lang.Object value, ParseError 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.value - The actual value.error - The embedded parse error.java.lang.IllegalStateException - Signals that this result is a
parse error.Copyright © 2012. All Rights Reserved.