public abstract class LineBasedStatementRecognizerBase<STATE extends java.lang.Enum<STATE>> extends RecognizerBase<STATE>
NO_MATCH, tailRecognizers
Constructor and Description |
---|
LineBasedStatementRecognizerBase()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
getEntityName(java.util.List<IToken> tokens,
int startOffset) |
protected java.lang.String |
getEntitySubtypeName() |
protected EShallowEntityType |
getEntityType() |
protected abstract STATE |
getSubParseState()
Returns the state to be used for a sub parse.
|
protected boolean |
isNestedClosingToken(ETokenType token)
Check whether the given token is a type of closing token for tokens which
might be nested in a statement.
|
protected int |
matchesLocally(ParserState<STATE> parserState,
java.util.List<IToken> tokens,
int startOffset)
Attempts to match the recognizer locally (without respecting tail
recognizers).
|
protected void |
registerNestingMatch(ETokenType opening,
ETokenType closing)
Registers nesting tokens (e.g.
|
protected abstract boolean |
startsNewStatement(IToken token,
IToken lastToken)
Returns true if the given token starts a new statement.
|
protected abstract boolean |
tokenStartsSubParse(ETokenType tokenType,
java.util.List<IToken> tokens,
int offset,
java.util.Stack<ETokenType> expectedClosing)
Returns true if the token signals to start a sub parse (e.g.
|
createNode, createNode, createNode, debug, endNode, endNodeWithContinuation, endNodeWithContinuation, endNodeWithName, ensureTopLevel, getRecognizerStringRepresentation, markStart, matches, notPreCondition, optional, optionalSubRecognizer, parseOnce, parseStrictlyUntil, parseUntil, parseUntilOrEof, preCondition, repeated, repeatedAtLeastOnce, repeatedSubRecognizer, sequence, sequenceBefore, skipAny, skipBefore, skipBeforeWithNesting, skipBeforeWithNesting, skipBeforeWithNesting, skipBeforeWithNesting, skipBeforeWithNesting, skipBeforeWithNesting, skipForward, skipNested, skipNested, skipTo, skipToWithNesting, skipToWithNesting, skipToWithNesting, skipToWithNesting, skipWithNesting, skipWithNesting, subRecognizer, subRecognizer, toString
public LineBasedStatementRecognizerBase()
protected void registerNestingMatch(ETokenType opening, ETokenType closing)
protected boolean isNestedClosingToken(ETokenType token)
For example `)` would return true in `a = new ArrayList();`.
protected int matchesLocally(ParserState<STATE> parserState, java.util.List<IToken> tokens, int startOffset)
matchesLocally
in class RecognizerBase<STATE extends java.lang.Enum<STATE>>
parserState
- the current state of the underlying parser.tokens
- the list of tokens.startOffset
- the current offset into the tokens from where to start matching.RecognizerBase.NO_MATCH
if matching was not possible at this position.protected EShallowEntityType getEntityType()
protected java.lang.String getEntitySubtypeName()
protected java.lang.String getEntityName(java.util.List<IToken> tokens, int startOffset)
protected abstract STATE getSubParseState()
protected abstract boolean tokenStartsSubParse(ETokenType tokenType, java.util.List<IToken> tokens, int offset, java.util.Stack<ETokenType> expectedClosing)
tokenType
- the type of the current token.tokens
- the entire token stream.offset
- the offset of the current token in the token stream.expectedClosing
- the stack of currently expected closing delimitersprotected abstract boolean startsNewStatement(IToken token, IToken lastToken)