java.lang.Object | |
↳ | sun.tools.java.Scanner |
Known Direct Subclasses |
Known Indirect Subclasses |
A Scanner for Java tokens. Errors are reported to the environment object.
The scanner keeps track of the current token, the value of the current token (if any), and the start position of the current token.
The scan() method advances the scanner to the next token in the input.
The match() method is used to quickly match opening brackets (ie: '(', '{', or '[') with their closing counter part. This is useful during error recovery.
An position consists of: ((linenr << WHEREOFFSETBITS) | offset) this means that both the line number and the exact offset into the file are encoded in each position value.
The compiler treats either "\n", "\r" or "\r\n" as the end of a line.
WARNING: The contents of this source file are not part of any supported API. Code that depends on them does so at its own risk: they are subject to change or removal without notice.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | EOF | End of input | |||||||||
long | LINEINC | The increment for each line. | |||||||||
long | OFFSETINC | The increment for each character. |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
sun.tools.java.Constants
| |||||||||||
From interface
sun.tools.java.RuntimeConstants
|
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
ch | The current character | ||||||||||
charValue | |||||||||||
docComment | |||||||||||
doubleValue | |||||||||||
env | Where errors are reported | ||||||||||
floatValue | |||||||||||
idValue | |||||||||||
in | Input reader | ||||||||||
intValue | |||||||||||
longValue | |||||||||||
pos | The position of the current token | ||||||||||
prevPos | The position of the previous token | ||||||||||
radix | |||||||||||
scanComments | If true, present all comments as tokens. | ||||||||||
stringValue | |||||||||||
token | Current token |
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
sun.tools.java.Constants
| |||||||||||
From interface
sun.tools.java.RuntimeConstants
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Create a scanner to scan an input stream.
|
Protected Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Create a scanner to scan an input stream.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
The ending position of the current token
| |||||||||||
If the current token is IDENT, return the identifier occurrence.
| |||||||||||
Scan to a matching '}', ']' or ')'.
| |||||||||||
Scan the next token.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Setup input from the given input stream,
and scan the first token from it.
| |||||||||||
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
End of input
The increment for each line.
The increment for each character.
The current character
The position of the current token
The position of the previous token
If true, present all comments as tokens. Contents are not saved, but positions are recorded accurately, so the comment can be recovered from the text. Line terminations are also returned as comment tokens, and may be distinguished by their start and end positions, which are equal (meaning, these tokens contain no chars).
Current token
Create a scanner to scan an input stream.
IOException |
---|
The ending position of the current token
If the current token is IDENT, return the identifier occurrence. It will be freshly allocated.
Scan to a matching '}', ']' or ')'. The current token must be a '{', '[' or '(';
IOException |
---|
Setup input from the given input stream, and scan the first token from it.
IOException |
---|