|
|||||||||
| Home >> All >> com >> port80 >> eclipse >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.port80.eclipse.util
Class JavaCodeScanner

java.lang.Objectcom.port80.eclipse.util.JavaCodeScanner
- All Implemented Interfaces:
- IJavaCodeSymbol, org.eclipse.jdt.core.compiler.IScanner
- public class JavaCodeScanner
- extends java.lang.Object
- implements org.eclipse.jdt.core.compiler.IScanner, IJavaCodeSymbol
- extends java.lang.Object
| Field Summary | |
private boolean |
assertMode
|
static int |
BracketKinds
|
(package private) static char[] |
charArray_a
|
(package private) static char[] |
charArray_b
|
(package private) static char[] |
charArray_c
|
(package private) static char[] |
charArray_d
|
(package private) static char[] |
charArray_e
|
(package private) static char[] |
charArray_f
|
(package private) static char[] |
charArray_g
|
(package private) static char[] |
charArray_h
|
(package private) static char[] |
charArray_i
|
(package private) static char[] |
charArray_j
|
(package private) static char[] |
charArray_k
|
(package private) static char[] |
charArray_l
|
char[][][][] |
charArray_length
|
(package private) static char[] |
charArray_m
|
(package private) static char[] |
charArray_n
|
(package private) static char[] |
charArray_o
|
(package private) static char[] |
charArray_p
|
(package private) static char[] |
charArray_q
|
(package private) static char[] |
charArray_r
|
(package private) static char[] |
charArray_s
|
(package private) static char[] |
charArray_t
|
(package private) static char[] |
charArray_u
|
(package private) static char[] |
charArray_v
|
(package private) static char[] |
charArray_w
|
(package private) static char[] |
charArray_x
|
(package private) static char[] |
charArray_y
|
(package private) static char[] |
charArray_z
|
boolean |
checkNonExternalizedStringLiterals
|
int |
commentPtr
|
int[] |
commentStarts
|
int[] |
commentStops
|
boolean |
containsAssertKeyword
|
static int |
CurlyBracket
|
char |
currentCharacter
|
(package private) org.eclipse.jdt.internal.compiler.parser.NLSLine |
currentLine
|
(package private) int |
currentLineNr
|
int |
currentPosition
|
boolean |
diet
|
static java.lang.String |
END_OF_SOURCE
|
int |
eofPosition
|
(package private) static char[] |
initCharArray
|
int |
initialPosition
|
(package private) static int |
InternalTableSize
|
static java.lang.String |
INVALID_CHAR_IN_STRING
|
static java.lang.String |
INVALID_CHARACTER_CONSTANT
|
static java.lang.String |
INVALID_ESCAPE
|
static java.lang.String |
INVALID_FLOAT
|
static java.lang.String |
INVALID_HEXA
|
static java.lang.String |
INVALID_INPUT
|
static java.lang.String |
INVALID_OCTAL
|
static java.lang.String |
INVALID_UNICODE_ESCAPE
|
int[] |
lineEnds
|
int |
linePtr
|
(package private) java.util.List |
lines
|
(package private) static int |
newEntry2
|
(package private) static int |
newEntry3
|
(package private) static int |
newEntry4
|
(package private) static int |
newEntry5
|
(package private) static int |
newEntry6
|
org.eclipse.jdt.internal.compiler.ast.StringLiteral[] |
nonNLSStrings
|
static java.lang.String |
NULL_SOURCE_STRING
|
static int |
OptimizedLength
|
(package private) int |
previousLineNr
|
boolean |
recordLineSeparator
|
static int |
RoundBracket
|
boolean |
scanningFloatLiteral
|
char[] |
source
|
static int |
SquareBracket
|
int |
startPosition
|
(package private) static int |
TableSize
|
static java.lang.String |
TAG_POSTFIX
|
static int |
TAG_POSTFIX_LENGTH
|
static java.lang.String |
TAG_PREFIX
|
static int |
TAG_PREFIX_LENGTH
|
boolean |
tokenizeComments
|
boolean |
tokenizeWhiteSpace
|
boolean |
unicodeAsBackSlash
|
static java.lang.String |
UNTERMINATED_COMMENT
|
static java.lang.String |
UNTERMINATED_STRING
|
boolean |
useAssertAsAnIndentifier
|
boolean |
wasAcr
|
boolean |
wasNonExternalizedStringLiteral
|
char[] |
withoutUnicodeBuffer
|
int |
withoutUnicodePtr
|
| Constructor Summary | |
JavaCodeScanner()
|
|
JavaCodeScanner(boolean tokenizeComments,
boolean tokenizeWhiteSpace)
|
|
JavaCodeScanner(boolean tokenizeComments,
boolean tokenizeWhiteSpace,
boolean checkNonExternalizedStringLiterals)
|
|
JavaCodeScanner(boolean tokenizeComments,
boolean tokenizeWhiteSpace,
boolean checkNonExternalizedStringLiterals,
boolean assertMode)
|
|
| Method Summary | |
boolean |
atEnd()
|
private void |
checkNonExternalizeString()
|
char[] |
getCurrentIdentifierSource()
|
int |
getCurrentTokenEndPosition()
Answers the ending position of the current token inside the original source. |
char[] |
getCurrentTokenSource()
Answers the current identifier source, after unicode escape sequences have been translated into unicode characters. |
char[] |
getCurrentTokenSourceString()
|
int |
getCurrentTokenStartPosition()
Answers the starting position of the current token inside the original source. |
int |
getLineEnd(int lineNumber)
Answers the ending position of a given line number. |
int[] |
getLineEnds()
Answers an array of the ending positions of the lines encountered so far. |
int |
getLineNumber(int position)
Search the line number corresponding to a specific position |
int |
getLineStart(int lineNumber)
Search the source position corresponding to the beginning of a given line number Line numbers are 1-based, and relative to the scanner initialPosition. |
boolean |
getNextChar(char testedChar)
|
int |
getNextChar(char testedChar1,
char testedChar2)
|
boolean |
getNextCharAsDigit()
|
boolean |
getNextCharAsDigit(int radix)
|
boolean |
getNextCharAsJavaIdentifierPart()
|
int |
getNextToken()
Read the next token in the source, and answers its ID as specified by ITerminalSymbols. |
void |
getNextUnicodeChar()
|
char[] |
getRawTokenSource()
Answers the current identifier source, before unicode escape sequences have been translated into unicode characters. |
char[] |
getSource()
Answers the original source being processed (not a copy of it). |
void |
jumpOverMethodBody()
|
boolean |
jumpOverUnicodeWhiteSpace()
|
(package private) char[] |
optimizedCurrentTokenSource1()
|
(package private) char[] |
optimizedCurrentTokenSource2()
|
(package private) char[] |
optimizedCurrentTokenSource3()
|
(package private) char[] |
optimizedCurrentTokenSource4()
|
(package private) char[] |
optimizedCurrentTokenSource5()
|
(package private) char[] |
optimizedCurrentTokenSource6()
|
private void |
parseTags(org.eclipse.jdt.internal.compiler.parser.NLSLine line)
|
void |
pushLineSeparator()
|
void |
pushUnicodeLineSeparator()
|
void |
recordComment(boolean isJavadoc)
|
void |
resetTo(int begin,
int end)
Reposition the scanner on some portion of the original source. |
void |
scanEscapeCharacter()
|
int |
scanIdentifierOrKeyword()
|
int |
scanNumber(boolean dotPrefix)
|
void |
setSource(char[] source)
Set the scanner source to process. |
java.lang.String |
toString()
Convert this Object to a human-readable String. |
java.lang.String |
toStringAction(int act)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
assertMode
private boolean assertMode
useAssertAsAnIndentifier
public boolean useAssertAsAnIndentifier
containsAssertKeyword
public boolean containsAssertKeyword
recordLineSeparator
public boolean recordLineSeparator
currentCharacter
public char currentCharacter
startPosition
public int startPosition
currentPosition
public int currentPosition
initialPosition
public int initialPosition
eofPosition
public int eofPosition
tokenizeComments
public boolean tokenizeComments
tokenizeWhiteSpace
public boolean tokenizeWhiteSpace
source
public char[] source
withoutUnicodeBuffer
public char[] withoutUnicodeBuffer
withoutUnicodePtr
public int withoutUnicodePtr
unicodeAsBackSlash
public boolean unicodeAsBackSlash
scanningFloatLiteral
public boolean scanningFloatLiteral
commentStops
public int[] commentStops
commentStarts
public int[] commentStarts
commentPtr
public int commentPtr
diet
public boolean diet
lineEnds
public int[] lineEnds
linePtr
public int linePtr
wasAcr
public boolean wasAcr
END_OF_SOURCE
public static final java.lang.String END_OF_SOURCE
- See Also:
- Constant Field Values
INVALID_HEXA
public static final java.lang.String INVALID_HEXA
- See Also:
- Constant Field Values
INVALID_OCTAL
public static final java.lang.String INVALID_OCTAL
- See Also:
- Constant Field Values
INVALID_CHARACTER_CONSTANT
public static final java.lang.String INVALID_CHARACTER_CONSTANT
- See Also:
- Constant Field Values
INVALID_ESCAPE
public static final java.lang.String INVALID_ESCAPE
- See Also:
- Constant Field Values
INVALID_INPUT
public static final java.lang.String INVALID_INPUT
- See Also:
- Constant Field Values
INVALID_UNICODE_ESCAPE
public static final java.lang.String INVALID_UNICODE_ESCAPE
- See Also:
- Constant Field Values
INVALID_FLOAT
public static final java.lang.String INVALID_FLOAT
- See Also:
- Constant Field Values
NULL_SOURCE_STRING
public static final java.lang.String NULL_SOURCE_STRING
- See Also:
- Constant Field Values
UNTERMINATED_STRING
public static final java.lang.String UNTERMINATED_STRING
- See Also:
- Constant Field Values
UNTERMINATED_COMMENT
public static final java.lang.String UNTERMINATED_COMMENT
- See Also:
- Constant Field Values
INVALID_CHAR_IN_STRING
public static final java.lang.String INVALID_CHAR_IN_STRING
- See Also:
- Constant Field Values
charArray_a
static final char[] charArray_a
charArray_b
static final char[] charArray_b
charArray_c
static final char[] charArray_c
charArray_d
static final char[] charArray_d
charArray_e
static final char[] charArray_e
charArray_f
static final char[] charArray_f
charArray_g
static final char[] charArray_g
charArray_h
static final char[] charArray_h
charArray_i
static final char[] charArray_i
charArray_j
static final char[] charArray_j
charArray_k
static final char[] charArray_k
charArray_l
static final char[] charArray_l
charArray_m
static final char[] charArray_m
charArray_n
static final char[] charArray_n
charArray_o
static final char[] charArray_o
charArray_p
static final char[] charArray_p
charArray_q
static final char[] charArray_q
charArray_r
static final char[] charArray_r
charArray_s
static final char[] charArray_s
charArray_t
static final char[] charArray_t
charArray_u
static final char[] charArray_u
charArray_v
static final char[] charArray_v
charArray_w
static final char[] charArray_w
charArray_x
static final char[] charArray_x
charArray_y
static final char[] charArray_y
charArray_z
static final char[] charArray_z
initCharArray
static final char[] initCharArray
TableSize
static final int TableSize
- See Also:
- Constant Field Values
InternalTableSize
static final int InternalTableSize
- See Also:
- Constant Field Values
OptimizedLength
public static final int OptimizedLength
- See Also:
- Constant Field Values
charArray_length
public final char[][][][] charArray_length
currentLineNr
int currentLineNr
previousLineNr
int previousLineNr
currentLine
org.eclipse.jdt.internal.compiler.parser.NLSLine currentLine
lines
java.util.List lines
TAG_PREFIX
public static final java.lang.String TAG_PREFIX
- See Also:
- Constant Field Values
TAG_PREFIX_LENGTH
public static final int TAG_PREFIX_LENGTH
TAG_POSTFIX
public static final java.lang.String TAG_POSTFIX
- See Also:
- Constant Field Values
TAG_POSTFIX_LENGTH
public static final int TAG_POSTFIX_LENGTH
nonNLSStrings
public org.eclipse.jdt.internal.compiler.ast.StringLiteral[] nonNLSStrings
checkNonExternalizedStringLiterals
public boolean checkNonExternalizedStringLiterals
wasNonExternalizedStringLiteral
public boolean wasNonExternalizedStringLiteral
newEntry2
static int newEntry2
newEntry3
static int newEntry3
newEntry4
static int newEntry4
newEntry5
static int newEntry5
newEntry6
static int newEntry6
RoundBracket
public static final int RoundBracket
- See Also:
- Constant Field Values
SquareBracket
public static final int SquareBracket
- See Also:
- Constant Field Values
CurlyBracket
public static final int CurlyBracket
- See Also:
- Constant Field Values
BracketKinds
public static final int BracketKinds
- See Also:
- Constant Field Values
| Constructor Detail |
JavaCodeScanner
public JavaCodeScanner()
JavaCodeScanner
public JavaCodeScanner(boolean tokenizeComments,
boolean tokenizeWhiteSpace)
JavaCodeScanner
public JavaCodeScanner(boolean tokenizeComments,
boolean tokenizeWhiteSpace,
boolean checkNonExternalizedStringLiterals)
JavaCodeScanner
public JavaCodeScanner(boolean tokenizeComments,
boolean tokenizeWhiteSpace,
boolean checkNonExternalizedStringLiterals,
boolean assertMode)
| Method Detail |
atEnd
public final boolean atEnd()
getCurrentIdentifierSource
public char[] getCurrentIdentifierSource()
getCurrentTokenEndPosition
public int getCurrentTokenEndPosition()
- Description copied from interface:
org.eclipse.jdt.core.compiler.IScanner - Answers the ending position of the current token inside the original source.
This position is zero-based and inclusive. It corresponds to the position of the last character
which is part of this token. If this character was a unicode escape sequence, it points at the last
character of this sequence.
- Specified by:
getCurrentTokenEndPositionin interfaceorg.eclipse.jdt.core.compiler.IScanner
getCurrentTokenSource
public final char[] getCurrentTokenSource()
- Description copied from interface:
org.eclipse.jdt.core.compiler.IScanner - Answers the current identifier source, after unicode escape sequences have
been translated into unicode characters.
For example, if original source was
\\u0061bcthen it will answerabc.- Specified by:
getCurrentTokenSourcein interfaceorg.eclipse.jdt.core.compiler.IScanner
getCurrentTokenSourceString
public final char[] getCurrentTokenSourceString()
getCurrentTokenStartPosition
public int getCurrentTokenStartPosition()
- Description copied from interface:
org.eclipse.jdt.core.compiler.IScanner - Answers the starting position of the current token inside the original source.
This position is zero-based and inclusive. It corresponds to the position of the first character
which is part of this token. If this character was a unicode escape sequence, it points at the first
character of this sequence.
- Specified by:
getCurrentTokenStartPositionin interfaceorg.eclipse.jdt.core.compiler.IScanner
getLineEnd
public final int getLineEnd(int lineNumber)
- Description copied from interface:
org.eclipse.jdt.core.compiler.IScanner - Answers the ending position of a given line number. This line has to have been encountered
already in the tokenization process (in other words, it cannot be used to compute positions of lines beyond
current token). Once the entire source has been processed, it can be used without any limit.
Line ending positions are zero-based, and correspond to the last character of the line separator
(in case multi-character line separators).
- Specified by:
getLineEndin interfaceorg.eclipse.jdt.core.compiler.IScanner
getLineStart
public final int getLineStart(int lineNumber)
- Search the source position corresponding to the beginning of a given line number
Line numbers are 1-based, and relative to the scanner initialPosition.
Character positions are 0-based.
e.g. getLineStart(1) --> 0 i.e. first line starts at character 0.
In case the given line number is inconsistent, answers -1.
- Specified by:
getLineStartin interfaceorg.eclipse.jdt.core.compiler.IScanner
getNextChar
public final boolean getNextChar(char testedChar)
getNextChar
public final int getNextChar(char testedChar1,
char testedChar2)
getNextCharAsDigit
public final boolean getNextCharAsDigit()
getNextCharAsDigit
public final boolean getNextCharAsDigit(int radix)
getNextCharAsJavaIdentifierPart
public boolean getNextCharAsJavaIdentifierPart()
getNextToken
public int getNextToken()
throws org.eclipse.jdt.core.compiler.InvalidInputException
- Description copied from interface:
org.eclipse.jdt.core.compiler.IScanner - Read the next token in the source, and answers its ID as specified by
ITerminalSymbols. Note that the actual token ID values are subject to change if new keywords were added to the language (for instance, 'assert' is a keyword in 1.4).- Specified by:
getNextTokenin interfaceorg.eclipse.jdt.core.compiler.IScanner
getNextUnicodeChar
public final void getNextUnicodeChar()
throws java.lang.IndexOutOfBoundsException,
org.eclipse.jdt.core.compiler.InvalidInputException
jumpOverMethodBody
public final void jumpOverMethodBody()
jumpOverUnicodeWhiteSpace
public final boolean jumpOverUnicodeWhiteSpace()
throws org.eclipse.jdt.core.compiler.InvalidInputException
getLineEnds
public final int[] getLineEnds()
- Description copied from interface:
org.eclipse.jdt.core.compiler.IScanner - Answers an array of the ending positions of the lines encountered so far. Line ending positions
are zero-based, and correspond to the last character of the line separator (in case multi-character
line separators).
- Specified by:
getLineEndsin interfaceorg.eclipse.jdt.core.compiler.IScanner
getSource
public char[] getSource()
- Description copied from interface:
org.eclipse.jdt.core.compiler.IScanner - Answers the original source being processed (not a copy of it).
- Specified by:
getSourcein interfaceorg.eclipse.jdt.core.compiler.IScanner
optimizedCurrentTokenSource1
final char[] optimizedCurrentTokenSource1()
optimizedCurrentTokenSource2
final char[] optimizedCurrentTokenSource2()
optimizedCurrentTokenSource3
final char[] optimizedCurrentTokenSource3()
optimizedCurrentTokenSource4
final char[] optimizedCurrentTokenSource4()
optimizedCurrentTokenSource5
final char[] optimizedCurrentTokenSource5()
optimizedCurrentTokenSource6
final char[] optimizedCurrentTokenSource6()
pushLineSeparator
public final void pushLineSeparator()
throws org.eclipse.jdt.core.compiler.InvalidInputException
pushUnicodeLineSeparator
public final void pushUnicodeLineSeparator()
recordComment
public final void recordComment(boolean isJavadoc)
resetTo
public void resetTo(int begin,
int end)
- Description copied from interface:
org.eclipse.jdt.core.compiler.IScanner - Reposition the scanner on some portion of the original source. The given endPosition is the last valid position.
Beyond this position, the scanner will answer EOF tokens (
ITerminalSymbols.TokenNameEOF).- Specified by:
resetToin interfaceorg.eclipse.jdt.core.compiler.IScanner
scanEscapeCharacter
public final void scanEscapeCharacter()
throws org.eclipse.jdt.core.compiler.InvalidInputException
scanIdentifierOrKeyword
public int scanIdentifierOrKeyword()
throws org.eclipse.jdt.core.compiler.InvalidInputException
scanNumber
public int scanNumber(boolean dotPrefix)
throws org.eclipse.jdt.core.compiler.InvalidInputException
getLineNumber
public final int getLineNumber(int position)
- Search the line number corresponding to a specific position
- Specified by:
getLineNumberin interfaceorg.eclipse.jdt.core.compiler.IScanner
setSource
public final void setSource(char[] source)
- Description copied from interface:
org.eclipse.jdt.core.compiler.IScanner - Set the scanner source to process. By default, the scanner will consider starting at the beginning of the
source until it reaches its end.
- Specified by:
setSourcein interfaceorg.eclipse.jdt.core.compiler.IScanner
toString
public java.lang.String toString()
- Description copied from class:
java.lang.Object - Convert this Object to a human-readable String.
There are no limits placed on how long this String
should be or what it should contain. We suggest you
make it as intuitive as possible to be able to place
it into System.out.println() 55
and such.
It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.
This method will be called when performing string concatenation with this object. If the result is
null, string concatenation will instead use"null".The default implementation returns
getClass().getName() + "@" + Integer.toHexString(hashCode()).
toStringAction
public final java.lang.String toStringAction(int act)
checkNonExternalizeString
private void checkNonExternalizeString()
throws org.eclipse.jdt.core.compiler.InvalidInputException
parseTags
private void parseTags(org.eclipse.jdt.internal.compiler.parser.NLSLine line) throws org.eclipse.jdt.core.compiler.InvalidInputException
getRawTokenSource
public char[] getRawTokenSource()
- Description copied from interface:
org.eclipse.jdt.core.compiler.IScanner - Answers the current identifier source, before unicode escape sequences have
been translated into unicode characters.
For example, if original source was
\\u0061bcthen it will answer\\u0061bc.- Specified by:
getRawTokenSourcein interfaceorg.eclipse.jdt.core.compiler.IScanner
|
|||||||||
| Home >> All >> com >> port80 >> eclipse >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
com.port80.eclipse.util.JavaCodeScanner