public abstract class LookAheadLexer extends LexerBase
Modifier and Type | Class and Description |
---|---|
protected static class |
LookAheadLexer.LookAheadLexerPosition |
Constructor and Description |
---|
LookAheadLexer(Lexer baseLexer) |
LookAheadLexer(Lexer baseLexer,
int capacity) |
Modifier and Type | Method and Description |
---|---|
protected void |
addToken(IElementType type) |
protected void |
addToken(int endOffset,
IElementType type) |
void |
advance()
Advances the lexer to the next token.
|
protected void |
advanceAs(Lexer lexer,
IElementType type) |
protected void |
advanceLexer(Lexer lexer) |
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.
|
protected int |
getCachedOffset(int index) |
protected IElementType |
getCachedType(int index) |
protected int |
getCacheSize() |
LookAheadLexer.LookAheadLexerPosition |
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 void |
lookAhead(Lexer baseLexer) |
IElementType |
replaceCachedType(int index,
IElementType token) |
protected void |
resetCacheSize(int size) |
void |
restore(LexerPosition _position)
Restores the lexer to the specified state and position.
|
protected void |
restore(LookAheadLexer.LookAheadLexerPosition position) |
void |
start(java.lang.CharSequence buffer,
int startOffset,
int endOffset,
int initialState)
Prepare for lexing character data from
buffer passed. |
getTokenSequence, getTokenText, start, start
public LookAheadLexer(Lexer baseLexer, int capacity)
public LookAheadLexer(Lexer baseLexer)
protected void addToken(IElementType type)
protected void addToken(int endOffset, IElementType type)
protected void lookAhead(Lexer baseLexer)
public void advance()
Lexer
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
protected int getCacheSize()
protected void resetCacheSize(int size)
public IElementType replaceCachedType(int index, IElementType token)
protected final IElementType getCachedType(int index)
protected final int getCachedOffset(int index)
public int getState()
Lexer
public int getTokenEnd()
Lexer
getTokenEnd
in class Lexer
public int getTokenStart()
Lexer
getTokenStart
in class Lexer
public LookAheadLexer.LookAheadLexerPosition getCurrentPosition()
Lexer
getCurrentPosition
in class LexerBase
public final void restore(LexerPosition _position)
Lexer
protected void restore(LookAheadLexer.LookAheadLexerPosition position)
public IElementType getTokenType()
Lexer
null
if lexing is finished.getTokenType
in class Lexer
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.protected final void advanceLexer(Lexer lexer)
protected final void advanceAs(Lexer lexer, IElementType type)