public final class ArrayedLexer extends FastLexer
AbstractLexer.DefaultLexerToken
skipComments
currentPos, textBuffer
TK_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, getTextBuffer
public ArrayedLexer(TokenArray tokens, FastLexer baseLexer)
public void setTextBuffer(ReadTextBuffer textBuffer)
AbstractLexer
setTextBuffer
in interface Lexer
setTextBuffer
in class AbstractLexer
textBuffer
- the text buffer to usepublic void setPosition(int offset)
AbstractLexer
setPosition
in interface Lexer
setPosition
in class AbstractLexer
offset
- 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)
FastLexer
FastLexer
should generate tokens
for Source comments.setSkipComments
in class FastLexer
skipComments
- true to ignore comments in token generationprotected boolean isComment(int tk)
FastLexer
public int getToken()
LexerToken
LexerToken
. You must refer to the language-specific
Lexer that was responsible for filling this
LexerToken
instance to interpret the token.getToken
in interface LexerToken
getToken
in class FastLexer
public int getStartOffset()
LexerToken
ReadTextBuffer
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 LexerToken
getStartOffset
in class FastLexer
public int getEndOffset()
LexerToken
ReadTextBuffer
being lexed. Note that the end offset is
exclusive (similar to end offsets in the String class.)getEndOffset
in interface LexerToken
getEndOffset
in class FastLexer
public int getTokenIndex()
public int lex()
FastLexer
public int lex(LexerToken lexerToken)
AbstractLexer
lexedToken
instance passed in to the
call.