|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.6.0) E13403-07 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object oracle.javatools.parser.AbstractLexer oracle.javatools.parser.java.v2.scanner.FastLexer
public abstract class FastLexer
The FastLexer features two optimizations that make it faster than having just a Lexer.
1. The Lexer interface methods are implemented by abstract methods. This means that the VM calls invokevirtual instead of invokeinterfacey for a performance saving (on the order of factor-4). 2. The FastLexer has a lex() method that takes no LexerToken. This saves on the field copying done by a lexer( LexerToken ).
Lexer
Nested Class Summary |
---|
Nested classes/interfaces inherited from class oracle.javatools.parser.AbstractLexer |
---|
AbstractLexer.DefaultLexerToken |
Field Summary | |
---|---|
protected boolean |
skipComments
Whether to skip comments or not. |
Fields inherited from class oracle.javatools.parser.AbstractLexer |
---|
currentPos, textBuffer |
Fields inherited from interface oracle.javatools.parser.Lexer |
---|
TK_EOF, TK_NOT_FOUND |
Constructor Summary | |
---|---|
FastLexer()
|
Method Summary | |
---|---|
void |
backup()
Unlexes the last found token. |
abstract int |
getEndOffset()
Fetches the end offset of the token (offset relative to the original ReadTextBuffer being lexed. |
abstract int |
getStartOffset()
Fetches the start offset of the token (offset relative to the original ReadTextBuffer being lexed. |
abstract int |
getToken()
Fetches the (language-specific) token represented by this LexerToken . |
protected boolean |
isComment(int tk)
Used by the ArrayedLexer. |
abstract int |
lex()
Calls lex( LexerToken ) but does not call fillLexerToken. |
abstract int |
lex(LexerToken lexedToken)
Scans the text buffer at the current position and returns the token that was found. |
void |
setSkipComments(boolean skipComments)
Sets whether the FastLexer should generate tokens
for Source comments. |
Methods inherited from class oracle.javatools.parser.AbstractLexer |
---|
createLexerToken, getTextBuffer, setPosition, setTextBuffer |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected boolean skipComments
Constructor Detail |
---|
public FastLexer()
Method Detail |
---|
public void setSkipComments(boolean skipComments)
FastLexer
should generate tokens
for Source comments.
skipComments
- true to ignore comments in token generationprotected boolean isComment(int tk)
public abstract 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
public abstract 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
public abstract 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
public abstract int lex()
public abstract int lex(LexerToken lexedToken)
AbstractLexer
lexedToken
instance passed in to the
call.
lex
in interface Lexer
lex
in class AbstractLexer
lexedToken
- the instance passed in where token info is stored
lexedToken.getToken()
(for convenience)public void backup()
lex()
will return the last token and offset information found.
backup
in interface Lexer
backup
in class AbstractLexer
|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.6.0) E13403-07 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |