Klasse PublicScanner
java.lang.Object
org.aspectj.org.eclipse.jdt.internal.core.util.PublicScanner
- Alle implementierten Schnittstellen:
IScanner,ITerminalSymbols
This class acts as a facade to the internal Scanner implementation and delegates
all the work to the internal Scanner instance.
Note for maintainers
No additional logic should be added here except adopting NON-API constants
returned by getNextToken() from TerminalTokens to ITerminalSymbols.
-
Feldübersicht
Von Schnittstelle geerbte Felder org.aspectj.org.eclipse.jdt.core.compiler.ITerminalSymbols
TokenNameabstract, TokenNameAND, TokenNameAND_AND, TokenNameAND_EQUAL, TokenNameARROW, TokenNameassert, TokenNameAT, TokenNameboolean, TokenNamebreak, TokenNamebyte, TokenNamecase, TokenNamecatch, TokenNamechar, TokenNameCharacterLiteral, TokenNameclass, TokenNameCOLON, TokenNameCOLON_COLON, 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, TokenNamenon_sealed, TokenNameNOT, TokenNameNOT_EQUAL, TokenNameNotAToken, TokenNamenull, TokenNameOR, TokenNameOR_EQUAL, TokenNameOR_OR, TokenNamepackage, TokenNamePLUS, TokenNamePLUS_EQUAL, TokenNamePLUS_PLUS, TokenNameprivate, TokenNameprotected, TokenNamepublic, TokenNameQUESTION, TokenNameRBRACE, TokenNameRBRACKET, TokenNameREMAINDER, TokenNameREMAINDER_EQUAL, TokenNameRestrictedIdentifierpermits, TokenNameRestrictedIdentifierrecord, TokenNameRestrictedIdentifiersealed, TokenNameRestrictedIdentifierWhen, TokenNameRestrictedIdentifierYield, TokenNamereturn, TokenNameRIGHT_SHIFT, TokenNameRIGHT_SHIFT_EQUAL, TokenNameRPAREN, TokenNameSEMICOLON, TokenNameshort, TokenNameSingleQuoteStringLiteral, TokenNamestatic, TokenNamestrictfp, TokenNameStringLiteral, TokenNamesuper, TokenNameswitch, TokenNamesynchronized, TokenNameTextBlock, TokenNamethis, TokenNamethrow, TokenNamethrows, TokenNametransient, TokenNametrue, TokenNametry, TokenNameTWIDDLE, TokenNameUNSIGNED_RIGHT_SHIFT, TokenNameUNSIGNED_RIGHT_SHIFT_EQUAL, TokenNamevoid, TokenNamevolatile, TokenNamewhile, TokenNameWHITESPACE, TokenNameXOR, TokenNameXOR_EQUAL -
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungPublicScanner(boolean tokenizeComments, boolean tokenizeWhiteSpace, boolean checkNonExternalizedStringLiterals, long sourceLevel, long complianceLevel, char[][] taskTags, char[][] taskPriorities, boolean isTaskCaseSensitive, boolean isPreviewEnabled, boolean recordLineSeparator) -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungprotected ScannercreateScanner(boolean tokenizeComments, boolean tokenizeWhiteSpace, boolean checkNonExternalizedStringLiterals, long sourceLevel, long complianceLevel, char[][] taskTags, char[][] taskPriorities, boolean isTaskCaseSensitive, boolean isPreviewEnabled) intAnswers the ending position of the current token inside the original source.char[]Answers the current identifier source, after unicode escape sequences have been translated into unicode characters.intAnswers the starting position of the current token inside the original source.final intgetLineEnd(int lineNumber) Answers the ending position of a given line number.final int[]Answers an array of the ending positions of the lines encountered so far.final intgetLineNumber(int position) Search the line number corresponding to a specific positionfinal intgetLineStart(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.intRead the next token in the source, and answers its ID as specified byITerminalSymbols.final char[]Answers the current identifier source, before unicode escape sequences have been translated into unicode characters.char[]Answers the original source being processed (not a copy of it).voidresetTo(int begin, int end) Reposition the scanner on some portion of the original source.final voidsetSource(char[] sourceString) Set the scanner source to process.toString()
-
Konstruktordetails
-
PublicScanner
public PublicScanner(boolean tokenizeComments, boolean tokenizeWhiteSpace, boolean checkNonExternalizedStringLiterals, long sourceLevel, long complianceLevel, char[][] taskTags, char[][] taskPriorities, boolean isTaskCaseSensitive, boolean isPreviewEnabled, boolean recordLineSeparator)
-
-
Methodendetails
-
createScanner
protected Scanner createScanner(boolean tokenizeComments, boolean tokenizeWhiteSpace, boolean checkNonExternalizedStringLiterals, long sourceLevel, long complianceLevel, char[][] taskTags, char[][] taskPriorities, boolean isTaskCaseSensitive, boolean isPreviewEnabled) -
getCurrentTokenEndPosition
public int getCurrentTokenEndPosition()Beschreibung aus Schnittstelle kopiert:IScannerAnswers 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.- Angegeben von:
getCurrentTokenEndPositionin SchnittstelleIScanner- Gibt zurück:
- the ending position of the current token inside the original source
-
getCurrentTokenSource
public char[] getCurrentTokenSource()Beschreibung aus Schnittstelle kopiert:IScannerAnswers the current identifier source, after unicode escape sequences have been translated into unicode characters. For example, if original source was\\u0061bcthen it will answerabc.- Angegeben von:
getCurrentTokenSourcein SchnittstelleIScanner- Gibt zurück:
- the current identifier source, after unicode escape sequences have been translated into unicode characters
-
getRawTokenSource
public final char[] getRawTokenSource()Beschreibung aus Schnittstelle kopiert:IScannerAnswers 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.- Angegeben von:
getRawTokenSourcein SchnittstelleIScanner- Gibt zurück:
- the current identifier source, before unicode escape sequences have been translated into unicode characters
-
getCurrentTokenStartPosition
public int getCurrentTokenStartPosition()Beschreibung aus Schnittstelle kopiert:IScannerAnswers 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.- Angegeben von:
getCurrentTokenStartPositionin SchnittstelleIScanner- Gibt zurück:
- the starting position of the current token inside the original source
-
getLineEnd
public final int getLineEnd(int lineNumber) Beschreibung aus Schnittstelle kopiert:IScannerAnswers 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).- Angegeben von:
getLineEndin SchnittstelleIScanner- Parameter:
lineNumber- the given line number- Gibt zurück:
- the ending position of a given line number
-
getLineEnds
public final int[] getLineEnds()Beschreibung aus Schnittstelle kopiert:IScannerAnswers 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).- Angegeben von:
getLineEndsin SchnittstelleIScanner- Gibt zurück:
- 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.- Angegeben von:
getLineStartin SchnittstelleIScanner- Parameter:
lineNumber- int- Gibt zurück:
- int
-
getNextToken
Beschreibung aus Schnittstelle kopiert:IScannerRead the next token in the source, and answers its ID as specified byITerminalSymbols. 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).- Angegeben von:
getNextTokenin SchnittstelleIScanner- Gibt zurück:
- the next token
- Löst aus:
InvalidInputException- in case a lexical error was detected while reading the current token
-
getSource
public char[] getSource()Beschreibung aus Schnittstelle kopiert:IScannerAnswers the original source being processed (not a copy of it). -
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). -
getLineNumber
public final int getLineNumber(int position) Search the line number corresponding to a specific position- Angegeben von:
getLineNumberin SchnittstelleIScanner- Parameter:
position- int- Gibt zurück:
- int
-
setSource
public final void setSource(char[] sourceString) Beschreibung aus Schnittstelle kopiert:IScannerSet 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 isnull, this clears the source. -
toString
-