public interface RestartableLexer
isRestartableState(int)
to provide several restartable states.
In some cases some additional information is needed to restart from non-trivial state.
start(CharSequence, int, int, int, TokenIterator)
implementation helps quickly retrieve information from preceding part of the file
to restore lexer properly.
LexerEditorHighlighter.documentChanged(DocumentEvent)
Modifier and Type | Method and Description |
---|---|
int |
getStartState()
Returns the start state of the lexer.
|
boolean |
isRestartableState(int state)
Specifies which states are restartable.
|
void |
start(java.lang.CharSequence buffer,
int startOffset,
int endOffset,
int initialState,
TokenIterator tokenIterator)
Extended form of
Lexer.start(CharSequence, int, int, int) which provides an Iterable
based on LexerEditorHighlighter.mySegments . |
int getStartState()
boolean isRestartableState(int state)
state
- lexer state to checktrue
if state is restartable, false
otherwise.void start(java.lang.CharSequence buffer, int startOffset, int endOffset, int initialState, TokenIterator tokenIterator)
Lexer.start(CharSequence, int, int, int)
which provides an Iterable
based on LexerEditorHighlighter.mySegments
.
Iteration starts from current token and goes in reverse order. This iterable can be used for getting some additional data needed for context
dependent restart.buffer
- character data for lexingstartOffset
- offset to start lexing fromendOffset
- offset to stop lexing atinitialState
- state to start lexing withtokenIterator
- iterator for getting info from preceding tokens