public interface Context<V>
Modifier and Type | Method and Description |
---|---|
char |
getCurrentChar()
Returns the character at the current index..
|
int |
getCurrentCodePoint()
Return the code point at the current index
|
int |
getCurrentIndex()
Returns the current index in the input buffer.
|
char |
getFirstMatchChar()
Returns the first character of the input text matched by the rule
immediately preceding the action expression that is currently being
evaluated.
|
InputBuffer |
getInputBuffer()
Returns the InputBuffer the parser is currently running against
|
int |
getLevel()
Returns the current matcher level, with 0 being the root level, 1 being
one level below the root and so on.
|
String |
getMatch()
Returns the input text matched by the rule immediately preceding the
action expression that is currently being evaluated.
|
int |
getMatchEndIndex()
Returns the end index of the rule immediately preceding the action
expression that is currently being evaluated.
|
Matcher |
getMatcher()
Returns the Matcher of this context or null, if this context is not valid
anymore.
|
int |
getMatchLength()
Returns the number of characters matched by the rule immediately
preceding the action expression that is currently being evaluated.
|
IndexRange |
getMatchRange()
Creates a new
IndexRange instance covering the input text matched
by the rule immediately preceding the action expression that is currently
being evaluated. |
int |
getMatchStartIndex()
Returns the start index of the rule immediately preceding the action
expression that is currently being evaluated.
|
Position |
getPosition()
Returns the current position in the underlying
InputBuffer as
a Position instance. |
int |
getStartIndex()
Returns the index into the underlying input buffer where the matcher of
this context started its match.
|
ValueStack<V> |
getValueStack()
Returns the value stack instance used during this parsing run.
|
boolean |
hasError()
Determines if this context or any sub node recorded a parse error.
|
boolean |
inPredicate()
Determines if the current rule is running somewhere underneath a
Test/TestNot rule.
|
@Nonnull InputBuffer getInputBuffer()
@Nullable Matcher getMatcher()
int getStartIndex()
int getCurrentIndex()
char getCurrentChar()
int getCurrentCodePoint()
InputBuffer.codePointAt(int)
int getLevel()
boolean inPredicate()
boolean hasError()
String getMatch()
Returns the input text matched by the rule immediately preceding the action expression that is currently being evaluated. This call can only be used in actions that are part of a Sequence rule and are not at first position in this Sequence.
char getFirstMatchChar()
Returns the first character of the input text matched by the rule immediately preceding the action expression that is currently being evaluated. This call can only be used in actions that are part of a Sequence rule and are not at first position in this Sequence.
If the immediately preceding rule did not match anything this method throws a GrammarException. If you need to able to handle that case use the getMatch() method.
int getMatchStartIndex()
Returns the start index of the rule immediately preceding the action expression that is currently being evaluated. This call can only be used in actions that are part of a Sequence rule and are not at first position in this Sequence.
int getMatchEndIndex()
Returns the end index of the rule immediately preceding the action expression that is currently being evaluated. This call can only be used in actions that are part of a Sequence rule and are not at first position in this Sequence.
int getMatchLength()
Returns the number of characters matched by the rule immediately preceding the action expression that is currently being evaluated. This call can only be used in actions that are part of a Sequence rule and are not at first position in this Sequence.
Position getPosition()
Returns the current position in the underlying InputBuffer
as
a Position
instance.
IndexRange getMatchRange()
IndexRange
instance covering the input text matched
by the rule immediately preceding the action expression that is currently
being evaluated. This call can only be used in actions that are part of a
Sequence rule and are not at first position in this Sequence.ValueStack<V> getValueStack()