public class LayeredLexer extends DelegateLexer
Modifier and Type | Field and Description |
---|---|
static java.lang.ThreadLocal<java.lang.Boolean> |
ourDisableLayersFlag |
myDelegate
Constructor and Description |
---|
LayeredLexer(Lexer baseLexer) |
Modifier and Type | Method and Description |
---|---|
void |
advance()
Advances the lexer to the next token.
|
protected Lexer |
findLayerLexer(IElementType baseTokenType) |
LexerPosition |
getCurrentPosition()
Returns the current position and state of the lexer.
|
int |
getState()
Returns the current state of the lexer.
|
int |
getTokenEnd()
Returns the end offset of the current token.
|
int |
getTokenStart()
Returns the start offset of the current token.
|
IElementType |
getTokenType()
Returns the token at the current position of the lexer or
null if lexing is finished. |
protected boolean |
isLayerActive() |
void |
registerLayer(Lexer lexer,
IElementType... startTokens) |
void |
registerSelfStoppingLayer(Lexer lexer,
IElementType[] startTokens,
IElementType[] stopTokens) |
void |
restore(LexerPosition position)
Restores the lexer to the specified state and position.
|
void |
start(java.lang.CharSequence buffer,
int startOffset,
int endOffset,
int initialState)
Prepare for lexing character data from
buffer passed. |
getBufferEnd, getBufferSequence, getDelegate
getTokenSequence, getTokenText, start, start
public static final java.lang.ThreadLocal<java.lang.Boolean> ourDisableLayersFlag
public LayeredLexer(Lexer baseLexer)
public void registerSelfStoppingLayer(Lexer lexer, IElementType[] startTokens, IElementType[] stopTokens)
public void registerLayer(Lexer lexer, IElementType... startTokens)
protected Lexer findLayerLexer(IElementType baseTokenType)
public void start(java.lang.CharSequence buffer, int startOffset, int endOffset, int initialState)
Lexer
buffer
passed. Internal lexer state is supposed to be initialState
. It is guaranteed
that the value of initialState is the same as returned by Lexer.getState()
method of this lexer at condition startOffset=getTokenStart()
.
This method is used to incrementally re-lex changed characters using lexing data acquired from this particular lexer sometime in the past.start
in class DelegateLexer
buffer
- character data for lexing.startOffset
- offset to start lexing fromendOffset
- offset to stop lexing atinitialState
- the initial state of the lexer.public int getState()
Lexer
getState
in class DelegateLexer
public IElementType getTokenType()
Lexer
null
if lexing is finished.getTokenType
in class DelegateLexer
public int getTokenStart()
Lexer
getTokenStart
in class DelegateLexer
public int getTokenEnd()
Lexer
getTokenEnd
in class DelegateLexer
public void advance()
Lexer
advance
in class DelegateLexer
public LexerPosition getCurrentPosition()
Lexer
getCurrentPosition
in class LexerBase
public void restore(LexerPosition position)
Lexer
protected boolean isLayerActive()