public class AbstractCustomLexer extends LexerBase
Modifier and Type | Field and Description |
---|---|
protected java.lang.CharSequence |
myBuffer |
protected TokenInfo |
myCurrentToken |
protected int |
myEndOffset |
protected int |
myPosition |
protected int |
myStartOffset |
Constructor and Description |
---|
AbstractCustomLexer(java.util.List<TokenParser> tokenParsers) |
Modifier and Type | Method and Description |
---|---|
void |
advance()
Advances the lexer to the next token.
|
int |
getBufferEnd()
Returns the offset at which the lexer will stop lexing.
|
java.lang.CharSequence |
getBufferSequence()
Returns the buffer sequence over which the lexer is running.
|
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 void |
handleTokenNotFound() |
void |
start(java.lang.CharSequence buffer,
int startOffset,
int endOffset,
int initialState)
Prepare for lexing character data from
buffer passed. |
getCurrentPosition, restore
getTokenSequence, getTokenText, start, start
protected java.lang.CharSequence myBuffer
protected int myStartOffset
protected int myEndOffset
protected TokenInfo myCurrentToken
protected int myPosition
public AbstractCustomLexer(java.util.List<TokenParser> tokenParsers)
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.public int getState()
Lexer
public IElementType getTokenType()
Lexer
null
if lexing is finished.getTokenType
in class Lexer
public int getTokenStart()
Lexer
getTokenStart
in class Lexer
public int getTokenEnd()
Lexer
getTokenEnd
in class Lexer
public void advance()
Lexer
protected void handleTokenNotFound()
public java.lang.CharSequence getBufferSequence()
Lexer
start()
method.getBufferSequence
in class Lexer
public int getBufferEnd()
Lexer
endOffset
parameter
to the start()
method.getBufferEnd
in class Lexer