Skip navigation links
oracle.javatools.parser.java.v2.scanner
Class JavadocLexer
java.lang.Object
oracle.javatools.parser.AbstractLexer
oracle.javatools.parser.java.v2.scanner.FastLexer
oracle.javatools.parser.java.v2.scanner.JavadocLexer
- All Implemented Interfaces:
- JavadocTokens, Lexer, LexerToken
-
public class JavadocLexer
- extends FastLexer
- implements JavadocTokens
The JavaDocLexer
is an implementation of the Lexer
interface for tokenizing a Java language documentation comment ("doc comment" aka, in violation of copyright, "Javadoc comment").
- See Also:
Lexer
, JavadocTokens
Fields inherited from interface oracle.javatools.parser.java.v2.JavadocTokens |
TAG_AUTHOR, TAG_base, TAG_CODE, TAG_DEPRECATED, TAG_DOCROOT, TAG_EXCEPTION, TAG_HIDDEN, TAG_INHERITDOC, TAG_inline, TAG_LINK, TAG_LINKPLAIN, TAG_LITERAL, TAG_max, TAG_PARAM, TAG_RETURN, TAG_SEE, TAG_SERIAL, TAG_SERIALDATA, TAG_SERIALFIELD, TAG_SINCE, TAG_THROWS, TAG_unknown, TAG_VALUE, TAG_VERSION, TAG_words, TK_DOC_base, TK_DOC_COLON, TK_DOC_COMMA, TK_DOC_DOT, TK_DOC_HASH, TK_DOC_LBRACE, TK_DOC_LINE_START, TK_DOC_LPAREN, TK_DOC_NEWLINE, TK_DOC_RBRACE, TK_DOC_RPAREN, TK_DOC_TEXT, TK_DOC_WHITESPACE |
Constructor Summary |
JavadocLexer()
Constructs a default JavaDocLexer with a starting position of 0. |
Method Summary |
void |
backup()
Unlexes the last found token. |
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 |
lex()
Calls lex( LexerToken ) but does not call fillLexerToken. |
int |
lex(LexerToken lexedToken)
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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JavadocLexer
public JavadocLexer()
- Constructs a default
JavaDocLexer
with a starting position of 0. Clients must call setTextBuffer()
to initialize the text buffer used for the Lexer. To start lexing from an offset other than 0, call setPosition()
.
getToken
public int getToken()
- Description copied from interface:
LexerToken
- Fetches the (language-specific) token represented by this
LexerToken
. You must refer to the language-specific Lexer that was responsible for filling this LexerToken
instance to interpret the token.
-
- Specified by:
getToken
in interface LexerToken
- Specified by:
getToken
in class FastLexer
-
- Returns:
- the lexer token
getStartOffset
public int getStartOffset()
- Description copied from interface:
LexerToken
- Fetches the start offset of the token (offset relative to the original
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.
-
- Specified by:
getStartOffset
in interface LexerToken
- Specified by:
getStartOffset
in class FastLexer
-
- Returns:
- the starting offset
getEndOffset
public int getEndOffset()
- Description copied from interface:
LexerToken
- Fetches the end offset of the token (offset relative to the original
ReadTextBuffer
being lexed. Note that the end offset is exclusive (similar to end offsets in the String class.)
-
- Specified by:
getEndOffset
in interface LexerToken
- Specified by:
getEndOffset
in class FastLexer
-
- Returns:
- the ending offset
backup
public void backup()
- Unlexes the last found token. The next call to
lex()
will return the last token and offset information found.
-
- Specified by:
backup
in interface Lexer
- Overrides:
backup
in class FastLexer
setPosition
public void setPosition(int offset)
- Sets the current lex (read) position to the given offset in the buffer. It is the clients responsibility to ensure that this offset corresponds to the start of a token, otherwise unexpected (and incorrect) results may occur.
-
- Specified by:
setPosition
in interface Lexer
- Overrides:
setPosition
in class AbstractLexer
-
- Parameters:
offset
- the offset for the next lex()
operation.
lex
public int lex()
- Description copied from class:
FastLexer
- Calls lex( LexerToken ) but does not call fillLexerToken.
-
- Specified by:
lex
in class FastLexer
lex
public int lex(LexerToken lexedToken)
- Scans the text buffer at the current position and returns the token that was found. The token and offset information is also stored in the
lexedToken
instance passed in to the call.
-
- Specified by:
lex
in interface Lexer
- Specified by:
lex
in class FastLexer
-
- Parameters:
lexedToken
- the instance passed in where token info is stored
- Returns:
- the token that was found, same as calling
lexedToken.getToken()
(for convenience)
Skip navigation links
Copyright © 1997, 2012, Oracle. All rights reserved.