public final class ArrayedLexer extends FastLexer
AbstractLexer.DefaultLexerTokenskipCommentscurrentPos, textBufferTK_EOF, TK_NOT_FOUND| Constructor and Description |
|---|
ArrayedLexer(TokenArray tokens,
FastLexer baseLexer) |
| Modifier and Type | Method and Description |
|---|---|
int |
getEndOffset()
Fetches the end offset of the token (offset relative to the original
ReadTextBuffer being lexed. |
int |
getStartOffset()
Fetches the start offset of the token (offset relative to the
original
ReadTextBuffer being lexed. |
int |
getToken()
Fetches the (language-specific) token represented by this
LexerToken. |
int |
getTokenIndex()
Calling getTokenIndex() before the initial lex() will produce an
unpredictable result.
|
protected boolean |
isComment(int tk)
Used by the ArrayedLexer.
|
int |
lex()
Calls lex( LexerToken ) but does not call fillLexerToken.
|
int |
lex(LexerToken lexerToken)
Scans the text buffer at the current position and returns the
token that was found.
|
void |
setPosition(int offset)
Sets the current lex (read) position to the given offset in the
buffer.
|
void |
setSkipComments(boolean skipComments)
Sets whether the
FastLexer should generate tokens
for Source comments. |
void |
setTextBuffer(ReadTextBuffer textBuffer)
Sets the text buffer that is to be used by this Lexer.
|
void |
setTokenIndex(int index) |
createLexerToken, getTextBufferpublic ArrayedLexer(TokenArray tokens, FastLexer baseLexer)
public void setTextBuffer(ReadTextBuffer textBuffer)
AbstractLexersetTextBuffer in interface LexersetTextBuffer in class AbstractLexertextBuffer - the text buffer to usepublic void setPosition(int offset)
AbstractLexersetPosition in interface LexersetPosition in class AbstractLexeroffset - The start offset of (or in the whitespace previous
to) the next token to be returned by lex().public void setTokenIndex(int index)
index - Token index of the next token to be returned by lex().public void setSkipComments(boolean skipComments)
FastLexerFastLexer should generate tokens
for Source comments.setSkipComments in class FastLexerskipComments - true to ignore comments in token generationprotected boolean isComment(int tk)
FastLexerpublic int getToken()
LexerTokenLexerToken. You must refer to the language-specific
Lexer that was responsible for filling this
LexerToken instance to interpret the token.getToken in interface LexerTokengetToken in class FastLexerpublic int getStartOffset()
LexerTokenReadTextBuffer being lexed. Note that the
start offset is inclusive (compare to end offset which is
exclusive), to match the behavior in the String
class.getStartOffset in interface LexerTokengetStartOffset in class FastLexerpublic int getEndOffset()
LexerTokenReadTextBuffer being lexed. Note that the end offset is
exclusive (similar to end offsets in the String class.)getEndOffset in interface LexerTokengetEndOffset in class FastLexerpublic int getTokenIndex()
public int lex()
FastLexerpublic int lex(LexerToken lexerToken)
AbstractLexerlexedToken instance passed in to the
call.