|
Eclipse JDT Release 3.0 |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
Definition of a Java scanner, as returned by the ToolFactory.
The scanner is responsible for tokenizing a given source, providing information about
the nature of the token read, its positions and source equivalent.
When the scanner has finished tokenizing, it answers an EOF token (
ITerminalSymbols#TokenNameEOF.
When encountering lexical errors, an InvalidInputException is thrown.
ToolFactory,
ITerminalSymbols| Method Summary | |
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. |
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 charPosition)
Answers a 1-based line number using the lines which have been encountered so far. |
int |
getLineStart(int lineNumber)
Answers the starting position of a given line number. |
int |
getNextToken()
Read the next token in the source, and answers its ID as specified by ITerminalSymbols.
|
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 |
resetTo(int startPosition,
int endPosition)
Reposition the scanner on some portion of the original source. |
void |
setSource(char[] source)
Set the scanner source to process. |
| Method Detail |
public char[] getCurrentTokenSource()
\\u0061bc then it will answer abc.
public char[] getRawTokenSource()
\\u0061bc then it will answer \\u0061bc.
public int getCurrentTokenStartPosition()
public int getCurrentTokenEndPosition()
public int getLineStart(int lineNumber)
lineNumber - the given line number
public int getLineEnd(int lineNumber)
lineNumber - the given line number
public int[] getLineEnds()
public int getLineNumber(int charPosition)
charPosition - the given character position
public int getNextToken()
throws InvalidInputException
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).
InvalidInputException - in case a lexical error was detected while reading the current tokenpublic char[] getSource()
public void resetTo(int startPosition,
int endPosition)
ITerminalSymbols.TokenNameEOF).
startPosition - the given start positionendPosition - the given end positionpublic void setSource(char[] source)
source - the given source
|
Eclipse JDT Release 3.0 |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||