public class Scanner extends 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.
The compiler treats either "\n", "\r" or "\r\n" as the end of a line.
Modifier and Type | Field and Description |
---|---|
protected int |
ch
The current character
|
protected String |
docComment |
protected SourceFile |
env
Where errors are reported
|
static int |
EOF
End of input
|
protected SourceFile |
in
Input stream
|
protected int |
indexMacro |
protected int |
intSize |
protected int |
intValue |
static int |
LBRACE |
protected org.openjdk.asmtools.jcoder.ByteBuffer |
longStringValue |
protected long |
longValue |
protected String |
macro |
protected int |
pos
The position of the current token
|
protected int |
prevCh
The current character
|
protected int |
prevPos
The position of the previous token
|
protected int |
sign |
protected String |
stringValue |
protected JcodTokens.Token |
token
Current token
|
Modifier | Constructor and Description |
---|---|
protected |
Scanner(SourceFile sf)
for use in jcfront.
|
protected |
Scanner(SourceFile sf,
HashMap<String,String> macros)
Create a scanner to scan an input stream.
|
Modifier and Type | Method and Description |
---|---|
protected void |
match(JcodTokens.Token open,
JcodTokens.Token close)
Scan to a matching '}', ']' or ')'.
|
protected int |
scan()
Scan the next token.
|
protected int |
scanMacro()
Scan the next token.
|
protected void |
skipTill(int sym) |
protected int |
xscan() |
public static final int EOF
public static final int LBRACE
protected SourceFile env
protected SourceFile in
protected int ch
protected int prevCh
protected String macro
protected int indexMacro
protected JcodTokens.Token token
protected int pos
protected int prevPos
protected long longValue
protected int intValue
protected int intSize
protected String stringValue
protected org.openjdk.asmtools.jcoder.ByteBuffer longStringValue
protected int sign
protected String docComment
protected Scanner(SourceFile sf, HashMap<String,String> macros) throws IOException
IOException
protected Scanner(SourceFile sf) throws IOException
IOException
protected void skipTill(int sym) throws IOException
IOException
protected int xscan() throws IOException
IOException
protected void match(JcodTokens.Token open, JcodTokens.Token close) throws IOException
IOException
protected int scan() throws IOException
IOException
protected int scanMacro() throws IOException
IOException
Copyright © 2021. All Rights Reserved.