org.aspectj.org.eclipse.jdt.internal.core.util
Class PublicScanner

java.lang.Object
  extended by org.aspectj.org.eclipse.jdt.internal.core.util.PublicScanner
All Implemented Interfaces:
IScanner, ITerminalSymbols

public class PublicScanner
extends java.lang.Object
implements IScanner, ITerminalSymbols


Field Summary
static java.lang.String BINARY_LITERAL_NOT_BELOW_17
           
static int BracketKinds
           
 char[][][][] charArray_length
           
 boolean checkNonExternalizedStringLiterals
           
static int COMMENT_ARRAYS_SIZE
           
 int commentPtr
           
 int[] commentStarts
           
 int[] commentStops
           
 int[] commentTagStarts
           
 long complianceLevel
           
 boolean containsAssertKeyword
           
static int CurlyBracket
           
 char currentCharacter
           
 int currentPosition
           
 boolean diet
           
static java.lang.String END_OF_SOURCE
           
 int eofPosition
           
 int foundTaskCount
           
 char[][] foundTaskMessages
           
 int[][] foundTaskPositions
           
 char[][] foundTaskPriorities
           
 char[][] foundTaskTags
           
static int HIGH_SURROGATE_MAX_VALUE
           
static int HIGH_SURROGATE_MIN_VALUE
           
static java.lang.String ILLEGAL_HEXA_LITERAL
           
 int initialPosition
           
 boolean insideRecovery
           
static java.lang.String INVALID_BINARY
           
static java.lang.String INVALID_CHAR_IN_STRING
           
static java.lang.String INVALID_CHARACTER_CONSTANT
           
static java.lang.String INVALID_DIGIT
           
static java.lang.String INVALID_ESCAPE
           
static java.lang.String INVALID_FLOAT
           
static java.lang.String INVALID_HEXA
           
static java.lang.String INVALID_HIGH_SURROGATE
           
static java.lang.String INVALID_INPUT
           
static java.lang.String INVALID_LOW_SURROGATE
           
static java.lang.String INVALID_OCTAL
           
static java.lang.String INVALID_UNDERSCORE
           
static java.lang.String INVALID_UNICODE_ESCAPE
           
 boolean isTaskCaseSensitive
           
protected  int lastCommentLinePosition
           
protected  int lastPosition
           
 int[] lineEnds
           
 int linePtr
           
static int LOW_SURROGATE_MAX_VALUE
           
static int LOW_SURROGATE_MIN_VALUE
           
protected  int nlsTagsPtr
           
static java.lang.String NULL_SOURCE_STRING
           
static int OptimizedLength
           
 boolean recordLineSeparator
           
 boolean returnOnlyGreater
           
static int RoundBracket
           
 boolean scanningFloatLiteral
           
 boolean skipComments
           
 char[] source
           
 long sourceLevel
           
static int SquareBracket
           
 int startPosition
           
static char TAG_POSTFIX
           
static int TAG_POSTFIX_LENGTH
           
static char[] TAG_PREFIX
           
static int TAG_PREFIX_LENGTH
           
 char[][] taskPriorities
           
 char[][] taskTags
           
 boolean tokenizeComments
           
 boolean tokenizeWhiteSpace
           
static java.lang.String UNDERSCORES_IN_LITERALS_NOT_BELOW_17
           
 boolean unicodeAsBackSlash
           
static java.lang.String UNTERMINATED_COMMENT
           
static java.lang.String UNTERMINATED_STRING
           
 boolean useAssertAsAnIndentifier
           
 boolean useEnumAsAnIndentifier
           
 boolean wasAcr
           
 char[] withoutUnicodeBuffer
           
 int withoutUnicodePtr
           
 
Fields inherited from interface org.aspectj.org.eclipse.jdt.core.compiler.ITerminalSymbols
TokenNameabstract, TokenNameAND, TokenNameAND_AND, TokenNameAND_EQUAL, TokenNameassert, TokenNameAT, TokenNameboolean, TokenNamebreak, TokenNamebyte, TokenNamecase, TokenNamecatch, TokenNamechar, TokenNameCharacterLiteral, TokenNameclass, TokenNameCOLON, TokenNameCOMMA, TokenNameCOMMENT_BLOCK, TokenNameCOMMENT_JAVADOC, TokenNameCOMMENT_LINE, TokenNameconst, TokenNamecontinue, TokenNamedefault, TokenNameDIVIDE, TokenNameDIVIDE_EQUAL, TokenNamedo, TokenNameDOT, TokenNamedouble, TokenNameDoubleLiteral, TokenNameELLIPSIS, TokenNameelse, TokenNameenum, TokenNameEOF, TokenNameEQUAL, TokenNameEQUAL_EQUAL, TokenNameERROR, TokenNameextends, TokenNamefalse, TokenNamefinal, TokenNamefinally, TokenNamefloat, TokenNameFloatingPointLiteral, TokenNamefor, TokenNamegoto, TokenNameGREATER, TokenNameGREATER_EQUAL, TokenNameIdentifier, TokenNameif, TokenNameimplements, TokenNameimport, TokenNameinstanceof, TokenNameint, TokenNameIntegerLiteral, TokenNameinterface, TokenNameLBRACE, TokenNameLBRACKET, TokenNameLEFT_SHIFT, TokenNameLEFT_SHIFT_EQUAL, TokenNameLESS, TokenNameLESS_EQUAL, TokenNamelong, TokenNameLongLiteral, TokenNameLPAREN, TokenNameMINUS, TokenNameMINUS_EQUAL, TokenNameMINUS_MINUS, TokenNameMULTIPLY, TokenNameMULTIPLY_EQUAL, TokenNamenative, TokenNamenew, TokenNameNOT, TokenNameNOT_EQUAL, TokenNamenull, TokenNameOR, TokenNameOR_EQUAL, TokenNameOR_OR, TokenNamepackage, TokenNamePLUS, TokenNamePLUS_EQUAL, TokenNamePLUS_PLUS, TokenNameprivate, TokenNameprotected, TokenNamepublic, TokenNameQUESTION, TokenNameRBRACE, TokenNameRBRACKET, TokenNameREMAINDER, TokenNameREMAINDER_EQUAL, TokenNamereturn, TokenNameRIGHT_SHIFT, TokenNameRIGHT_SHIFT_EQUAL, TokenNameRPAREN, TokenNameSEMICOLON, TokenNameshort, TokenNamestatic, TokenNamestrictfp, TokenNameStringLiteral, TokenNamesuper, TokenNameswitch, TokenNamesynchronized, TokenNamethis, TokenNamethrow, TokenNamethrows, TokenNametransient, TokenNametrue, TokenNametry, TokenNameTWIDDLE, TokenNameUNSIGNED_RIGHT_SHIFT, TokenNameUNSIGNED_RIGHT_SHIFT_EQUAL, TokenNamevoid, TokenNamevolatile, TokenNamewhile, TokenNameWHITESPACE, TokenNameXOR, TokenNameXOR_EQUAL
 
Constructor Summary
PublicScanner()
           
PublicScanner(boolean tokenizeComments, boolean tokenizeWhiteSpace, boolean checkNonExternalizedStringLiterals, long sourceLevel, char[][] taskTags, char[][] taskPriorities, boolean isTaskCaseSensitive)
           
PublicScanner(boolean tokenizeComments, boolean tokenizeWhiteSpace, boolean checkNonExternalizedStringLiterals, long sourceLevel, long complianceLevel, char[][] taskTags, char[][] taskPriorities, boolean isTaskCaseSensitive)
           
 
Method Summary
 boolean atEnd()
           
 void checkTaskTag(int commentStart, int commentEnd)
           
 char[] getCurrentIdentifierSource()
           
 java.lang.String getCurrentStringLiteral()
           
 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.
 java.lang.String getCurrentTokenString()
           
 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.
 int getNextChar()
           
 boolean getNextChar(char testedChar)
           
 int getNextChar(char testedChar1, char testedChar2)
           
 boolean getNextCharAsDigit()
           
 boolean getNextCharAsDigit(int radix)
           
 boolean getNextCharAsJavaIdentifierPart()
           
 boolean getNextCharAsJavaIdentifierPartWithBoundCheck()
           
 int getNextCharWithBoundChecks()
           
 int getNextToken()
          Read the next token in the source, and answers its ID as specified by ITerminalSymbols.
 void getNextUnicodeChar()
           
 NLSTag[] getNLSTags()
           
 char[] getRawTokenSource()
          Answers the current identifier source, before unicode escape sequences have been translated into unicode characters.
 char[] getRawTokenSourceEnd()
           
 char[] getSource()
          Answers the original source being processed (not a copy of it).
protected  boolean isFirstTag()
           
static boolean isIdentifier(int token)
           
static boolean isKeyword(int token)
           
static boolean isLiteral(int token)
           
 void jumpOverMethodBody()
           
 boolean jumpOverUnicodeWhiteSpace()
           
 void pushLineSeparator()
           
 void pushUnicodeLineSeparator()
           
 void recordComment(int token)
           
 void resetTo(int begin, int end)
          Reposition the scanner on some portion of the original source.
protected  void scanEscapeCharacter()
           
 int scanIdentifier()
           
 int scanIdentifierOrKeyword()
           
 int scanIdentifierOrKeywordWithBoundCheck()
           
 int scanNumber(boolean dotPrefix)
           
 void setSource(char[] sourceString)
          Set the scanner source to process.
 void setSource(char[] contents, CompilationResult compilationResult)
           
 void setSource(CompilationResult compilationResult)
           
 java.lang.String toString()
           
 java.lang.String toStringAction(int act)
           
 void unicodeInitializeBuffer(int length)
           
 void unicodeStore()
           
 void unicodeStore(char character)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sourceLevel

public long sourceLevel

complianceLevel

public long complianceLevel

useAssertAsAnIndentifier

public boolean useAssertAsAnIndentifier

containsAssertKeyword

public boolean containsAssertKeyword

useEnumAsAnIndentifier

public boolean useEnumAsAnIndentifier

recordLineSeparator

public boolean recordLineSeparator

currentCharacter

public char currentCharacter

startPosition

public int startPosition

currentPosition

public int currentPosition

initialPosition

public int initialPosition

eofPosition

public int eofPosition

skipComments

public boolean skipComments

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

COMMENT_ARRAYS_SIZE

public static final int COMMENT_ARRAYS_SIZE
See Also:
Constant Field Values

commentStops

public int[] commentStops

commentStarts

public int[] commentStarts

commentTagStarts

public int[] commentTagStarts

commentPtr

public int commentPtr

lastCommentLinePosition

protected int lastCommentLinePosition

foundTaskTags

public char[][] foundTaskTags

foundTaskMessages

public char[][] foundTaskMessages

foundTaskPriorities

public char[][] foundTaskPriorities

foundTaskPositions

public int[][] foundTaskPositions

foundTaskCount

public int foundTaskCount

taskTags

public char[][] taskTags

taskPriorities

public char[][] taskPriorities

isTaskCaseSensitive

public boolean isTaskCaseSensitive

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

INVALID_LOW_SURROGATE

public static final java.lang.String INVALID_LOW_SURROGATE
See Also:
Constant Field Values

INVALID_HIGH_SURROGATE

public static final java.lang.String INVALID_HIGH_SURROGATE
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

INVALID_DIGIT

public static final java.lang.String INVALID_DIGIT
See Also:
Constant Field Values

INVALID_BINARY

public static final java.lang.String INVALID_BINARY
See Also:
Constant Field Values

BINARY_LITERAL_NOT_BELOW_17

public static final java.lang.String BINARY_LITERAL_NOT_BELOW_17
See Also:
Constant Field Values

ILLEGAL_HEXA_LITERAL

public static final java.lang.String ILLEGAL_HEXA_LITERAL
See Also:
Constant Field Values

INVALID_UNDERSCORE

public static final java.lang.String INVALID_UNDERSCORE
See Also:
Constant Field Values

UNDERSCORES_IN_LITERALS_NOT_BELOW_17

public static final java.lang.String UNDERSCORES_IN_LITERALS_NOT_BELOW_17
See Also:
Constant Field Values

OptimizedLength

public static final int OptimizedLength
See Also:
Constant Field Values

charArray_length

public final char[][][][] charArray_length

TAG_PREFIX

public static final char[] TAG_PREFIX

TAG_PREFIX_LENGTH

public static final int TAG_PREFIX_LENGTH

TAG_POSTFIX

public static final char TAG_POSTFIX
See Also:
Constant Field Values

TAG_POSTFIX_LENGTH

public static final int TAG_POSTFIX_LENGTH
See Also:
Constant Field Values

nlsTagsPtr

protected int nlsTagsPtr

checkNonExternalizedStringLiterals

public boolean checkNonExternalizedStringLiterals

lastPosition

protected int lastPosition

returnOnlyGreater

public boolean returnOnlyGreater

insideRecovery

public boolean insideRecovery

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

LOW_SURROGATE_MIN_VALUE

public static final int LOW_SURROGATE_MIN_VALUE
See Also:
Constant Field Values

HIGH_SURROGATE_MIN_VALUE

public static final int HIGH_SURROGATE_MIN_VALUE
See Also:
Constant Field Values

HIGH_SURROGATE_MAX_VALUE

public static final int HIGH_SURROGATE_MAX_VALUE
See Also:
Constant Field Values

LOW_SURROGATE_MAX_VALUE

public static final int LOW_SURROGATE_MAX_VALUE
See Also:
Constant Field Values
Constructor Detail

PublicScanner

public PublicScanner()

PublicScanner

public PublicScanner(boolean tokenizeComments,
                     boolean tokenizeWhiteSpace,
                     boolean checkNonExternalizedStringLiterals,
                     long sourceLevel,
                     long complianceLevel,
                     char[][] taskTags,
                     char[][] taskPriorities,
                     boolean isTaskCaseSensitive)

PublicScanner

public PublicScanner(boolean tokenizeComments,
                     boolean tokenizeWhiteSpace,
                     boolean checkNonExternalizedStringLiterals,
                     long sourceLevel,
                     char[][] taskTags,
                     char[][] taskPriorities,
                     boolean isTaskCaseSensitive)
Method Detail

atEnd

public final boolean atEnd()

checkTaskTag

public void checkTaskTag(int commentStart,
                         int commentEnd)
                  throws InvalidInputException
Throws:
InvalidInputException

getCurrentIdentifierSource

public char[] getCurrentIdentifierSource()

getCurrentTokenEndPosition

public int getCurrentTokenEndPosition()
Description copied from interface: 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:
getCurrentTokenEndPosition in interface IScanner
Returns:
the ending position of the current token inside the original source

getCurrentTokenSource

public char[] getCurrentTokenSource()
Description copied from interface: IScanner
Answers the current identifier source, after unicode escape sequences have been translated into unicode characters. For example, if original source was \\u0061bc then it will answer abc.

Specified by:
getCurrentTokenSource in interface IScanner
Returns:
the current identifier source, after unicode escape sequences have been translated into unicode characters

getCurrentTokenString

public final java.lang.String getCurrentTokenString()

getCurrentTokenSourceString

public char[] getCurrentTokenSourceString()

getCurrentStringLiteral

public final java.lang.String getCurrentStringLiteral()

getRawTokenSource

public final char[] getRawTokenSource()
Description copied from interface: IScanner
Answers the current identifier source, before unicode escape sequences have been translated into unicode characters. For example, if original source was \\u0061bc then it will answer \\u0061bc.

Specified by:
getRawTokenSource in interface IScanner
Returns:
the current identifier source, before unicode escape sequences have been translated into unicode characters

getRawTokenSourceEnd

public final char[] getRawTokenSourceEnd()

getCurrentTokenStartPosition

public int getCurrentTokenStartPosition()
Description copied from interface: 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:
getCurrentTokenStartPosition in interface IScanner
Returns:
the starting position of the current token inside the original source

getLineEnd

public final int getLineEnd(int lineNumber)
Description copied from interface: 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:
getLineEnd in interface IScanner
Parameters:
lineNumber - the given line number
Returns:
the ending position of a given line number

getLineEnds

public final int[] getLineEnds()
Description copied from interface: 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:
getLineEnds in interface IScanner
Returns:
an array of the ending positions of the lines encountered so far

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 indicates that the first line starts at character 0. In case the given line number is inconsistent, answers -1.

Specified by:
getLineStart in interface IScanner
Parameters:
lineNumber - int
Returns:
int

getNextChar

public final int getNextChar()

getNextCharWithBoundChecks

public final int getNextCharWithBoundChecks()

getNextChar

public final boolean getNextChar(char testedChar)

getNextChar

public final int getNextChar(char testedChar1,
                             char testedChar2)

getNextCharAsDigit

public final boolean getNextCharAsDigit()
                                 throws InvalidInputException
Throws:
InvalidInputException

getNextCharAsDigit

public final boolean getNextCharAsDigit(int radix)

getNextCharAsJavaIdentifierPartWithBoundCheck

public boolean getNextCharAsJavaIdentifierPartWithBoundCheck()

getNextCharAsJavaIdentifierPart

public boolean getNextCharAsJavaIdentifierPart()

scanIdentifier

public int scanIdentifier()
                   throws InvalidInputException
Throws:
InvalidInputException

getNextToken

public int getNextToken()
                 throws InvalidInputException
Description copied from interface: 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:
getNextToken in interface IScanner
Returns:
the next token
Throws:
InvalidInputException - in case a lexical error was detected while reading the current token

getNextUnicodeChar

public void getNextUnicodeChar()
                        throws InvalidInputException
Throws:
InvalidInputException

getNLSTags

public NLSTag[] getNLSTags()

getSource

public char[] getSource()
Description copied from interface: IScanner
Answers the original source being processed (not a copy of it).

Specified by:
getSource in interface IScanner
Returns:
the original source being processed

isFirstTag

protected boolean isFirstTag()

jumpOverMethodBody

public final void jumpOverMethodBody()

jumpOverUnicodeWhiteSpace

public final boolean jumpOverUnicodeWhiteSpace()
                                        throws InvalidInputException
Throws:
InvalidInputException

pushLineSeparator

public final void pushLineSeparator()

pushUnicodeLineSeparator

public final void pushUnicodeLineSeparator()

recordComment

public void recordComment(int token)

resetTo

public void resetTo(int begin,
                    int end)
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:
resetTo in interface IScanner
Parameters:
begin - the given start position
end - the given end position

scanEscapeCharacter

protected final void scanEscapeCharacter()
                                  throws InvalidInputException
Throws:
InvalidInputException

scanIdentifierOrKeywordWithBoundCheck

public int scanIdentifierOrKeywordWithBoundCheck()

scanIdentifierOrKeyword

public int scanIdentifierOrKeyword()

scanNumber

public int scanNumber(boolean dotPrefix)
               throws InvalidInputException
Throws:
InvalidInputException

getLineNumber

public final int getLineNumber(int position)
Search the line number corresponding to a specific position

Specified by:
getLineNumber in interface IScanner
Parameters:
position - int
Returns:
int

setSource

public final void setSource(char[] sourceString)
Description copied from interface: 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. If the given source is null, this clears the source.

Specified by:
setSource in interface IScanner
Parameters:
sourceString - the given source

setSource

public final void setSource(char[] contents,
                            CompilationResult compilationResult)

setSource

public final void setSource(CompilationResult compilationResult)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toStringAction

public java.lang.String toStringAction(int act)

unicodeInitializeBuffer

public void unicodeInitializeBuffer(int length)

unicodeStore

public void unicodeStore()

unicodeStore

public void unicodeStore(char character)

isIdentifier

public static boolean isIdentifier(int token)

isLiteral

public static boolean isLiteral(int token)

isKeyword

public static boolean isKeyword(int token)