Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.1.0)

E13403-02

oracle.javatools.parser.java.v1
Class JavaDocLexer

java.lang.Object
  extended by oracle.javatools.parser.AbstractLexer
      extended by oracle.javatools.parser.java.v1.JavaDocLexer
All Implemented Interfaces:
JavaDocTokens, Lexer

public class JavaDocLexer
extends AbstractLexer
implements JavaDocTokens

The JavaDocLexer is an implementation of the Lexer interface for tokenizing a JavaDoc comment from the Java language. Details of the Java Language taken from Java Language Specification

This implementation was written to help tokenize a JavaDoc comment for the purpose of syntax highlighting, not for JavaDoc generation. Tokens are generated only for JavaDoc tags and JavaDoc tag text, not for plain JavaDoc comment text.

See Also:
Lexer, JavaDocTokens

Nested Class Summary
 
Nested classes/interfaces inherited from class oracle.javatools.parser.AbstractLexer
AbstractLexer.DefaultLexerToken
 
Field Summary
 
Fields inherited from class oracle.javatools.parser.AbstractLexer
currentPos, textBuffer
 
Fields inherited from interface oracle.javatools.parser.java.v1.JavaDocTokens
TK_DOC_AUTHOR, TK_DOC_COMMENTTEXT, TK_DOC_DEPRECATED, TK_DOC_EXCEPTION, TK_DOC_HIDDEN, TK_DOC_PARAM, TK_DOC_RETURN, TK_DOC_SEE, TK_DOC_SERIAL, TK_DOC_SERIALDATA, TK_DOC_SERIALFIELD, TK_DOC_SINCE, TK_DOC_TAGTEXT, TK_DOC_THROWS, TK_DOC_UNKNOWNTAG, TK_DOC_VERSION
 
Fields inherited from interface oracle.javatools.parser.Lexer
TK_EOF, TK_NOT_FOUND
 
Constructor Summary
JavaDocLexer()
          Constructs a default JavaDocLexer with a starting position of 0.
 
Method Summary
 void backup()
          Unlexes the last found token.
 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.
 void setRecognizeUnknownTags(boolean recognizeUnknownTags)
          Sets whether the JavaDocLexer should recognize unknown tags in the correct location, and generate a token for them (vs.
 void setSkipCommentText(boolean skipCommentText)
          Sets whether the JavaDocLexer should generate tokens for plain comment text not associated with a tag, or skip them.
static java.lang.String tokenToString(int token)
          Utility routine to map the token to a string representation of the token (for debug printing.)
static java.lang.String tokenToText(int token)
          Utility routine to map the token to the original text (if retrievable) of the token (for debug printing.)
 
Methods inherited from class oracle.javatools.parser.AbstractLexer
createLexerToken, getTextBuffer, setTextBuffer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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().

Method Detail

setRecognizeUnknownTags

public void setRecognizeUnknownTags(boolean recognizeUnknownTags)
Sets whether the JavaDocLexer should recognize unknown tags in the correct location, and generate a token for them (vs. treating them as comment or tag text.) The default is NOT to recognize unknown tags.

Parameters:
recognizeUnknownTags - whether to recognize unknown tags

setSkipCommentText

public void setSkipCommentText(boolean skipCommentText)
Sets whether the JavaDocLexer should generate tokens for plain comment text not associated with a tag, or skip them. The default is to skip comment text altogether.

Parameters:
skipCommentText - whether to skip comment text

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 AbstractLexer
Parameters:
lexedToken - the instance passed in where token info is stored
Returns:
the token that was found, same as calling lexedToken.getToken() (for convenience)

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
Specified by:
backup in class AbstractLexer

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.

tokenToString

public static java.lang.String tokenToString(int token)
Utility routine to map the token to a string representation of the token (for debug printing.)

Parameters:
token - the token to map
Returns:
a printable representation of the token

tokenToText

public static java.lang.String tokenToText(int token)
Utility routine to map the token to the original text (if retrievable) of the token (for debug printing.)

Parameters:
token - the token to map
Returns:
a printable representation of the token

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.1.0)

E13403-02

Copyright © 1997, 2009, Oracle. All rights reserved.