public class Scanner extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Scanner.ExtensionToken |
static class |
Scanner.ScanException
Scan exception type
|
static class |
Scanner.Symbol
Symbol type
|
static class |
Scanner.Token |
Modifier and Type | Field and Description |
---|---|
protected StringBuilder |
builder |
Modifier | Constructor and Description |
---|---|
protected |
Scanner(String input)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected Scanner.Token |
fixed(Scanner.Symbol symbol) |
String |
getInput() |
int |
getPosition() |
Scanner.Token |
getToken() |
protected boolean |
isDigit(char c) |
protected boolean |
isEval() |
protected Scanner.Token |
keyword(String s) |
Scanner.Token |
next()
Scan next token.
|
protected Scanner.Token |
nextEval()
token inside an eval expression
|
protected Scanner.Token |
nextNumber()
number token
|
protected Scanner.Token |
nextString()
string token
|
protected Scanner.Token |
nextText()
text token
|
protected Scanner.Token |
nextToken() |
protected Scanner.Token |
token(Scanner.Symbol symbol,
String value,
int length) |
protected final StringBuilder builder
protected Scanner(String input)
input
- expression stringpublic String getInput()
public Scanner.Token getToken()
public int getPosition()
protected boolean isDigit(char c)
true
iff the specified character is a digitprotected Scanner.Token keyword(String s)
s
- namenull
protected Scanner.Token fixed(Scanner.Symbol symbol)
symbol
- protected Scanner.Token token(Scanner.Symbol symbol, String value, int length)
protected boolean isEval()
protected Scanner.Token nextText() throws Scanner.ScanException
Scanner.ScanException
protected Scanner.Token nextString() throws Scanner.ScanException
Scanner.ScanException
protected Scanner.Token nextNumber() throws Scanner.ScanException
Scanner.ScanException
protected Scanner.Token nextEval() throws Scanner.ScanException
Scanner.ScanException
protected Scanner.Token nextToken() throws Scanner.ScanException
Scanner.ScanException
public Scanner.Token next() throws Scanner.ScanException
getToken()
and getPosition()
can be used to retreive the token's image and input position.Scanner.ScanException
Copyright © 2021. All rights reserved.