public abstract class Lexer
extends java.lang.Object
for certain methods' implementation
Constructor and Description |
---|
Lexer() |
Modifier and Type | Method and Description |
---|---|
abstract void |
advance()
Advances the lexer to the next token.
|
abstract int |
getBufferEnd()
Returns the offset at which the lexer will stop lexing.
|
abstract java.lang.CharSequence |
getBufferSequence()
Returns the buffer sequence over which the lexer is running.
|
abstract LexerPosition |
getCurrentPosition()
Returns the current position and state of the lexer.
|
abstract int |
getState()
Returns the current state of the lexer.
|
abstract int |
getTokenEnd()
Returns the end offset of the current token.
|
java.lang.CharSequence |
getTokenSequence() |
abstract int |
getTokenStart()
Returns the start offset of the current token.
|
java.lang.String |
getTokenText() |
abstract IElementType |
getTokenType()
Returns the token at the current position of the lexer or
null if lexing is finished. |
abstract void |
restore(LexerPosition position)
Restores the lexer to the specified state and position.
|
void |
start(java.lang.CharSequence buf) |
void |
start(java.lang.CharSequence buf,
int start,
int end) |
abstract void |
start(java.lang.CharSequence buffer,
int startOffset,
int endOffset,
int initialState)
Prepare for lexing character data from
buffer passed. |
public abstract void start(java.lang.CharSequence buffer, int startOffset, int endOffset, int initialState)
buffer
passed. Internal lexer state is supposed to be initialState
. It is guaranteed
that the value of initialState is the same as returned by 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.buffer
- character data for lexing.startOffset
- offset to start lexing fromendOffset
- offset to stop lexing atinitialState
- the initial state of the lexer.public final void start(java.lang.CharSequence buf, int start, int end)
public final void start(java.lang.CharSequence buf)
public java.lang.CharSequence getTokenSequence()
public java.lang.String getTokenText()
public abstract int getState()
public abstract IElementType getTokenType()
null
if lexing is finished.public abstract int getTokenStart()
public abstract int getTokenEnd()
public abstract void advance()
public abstract LexerPosition getCurrentPosition()
public abstract void restore(LexerPosition position)
position
- the state and position to restore to.public abstract java.lang.CharSequence getBufferSequence()
start()
method.public abstract int getBufferEnd()
endOffset
parameter
to the start()
method.