class LookaheadScanner extends Object
Modifier and Type | Field and Description |
---|---|
boolean |
isLookingAhead
Whether we are looking ahead.
|
Constructor and Description |
---|
LookaheadScanner(String fileName)
Construct a LookaheadScanner from a file name.
|
Modifier and Type | Method and Description |
---|---|
boolean |
errorHasOccured()
Has an error occurred up to now in lexical analysis?
|
String |
fileName()
Return the name of the source file.
|
void |
next()
Scan to the next token in the input.
|
TokenInfo |
previousToken()
The previously scanned token.
|
void |
recordPosition()
Record the current position in the input, so that we can start looking
ahead in the input (and later return to this position).
|
void |
returnToPosition()
Return to the previously recorded position in the input stream of tokens.
|
TokenInfo |
token()
The currently scanned token.
|
public LookaheadScanner(String fileName) throws FileNotFoundException
fileName
- the name of the file containing the source.FileNotFoundException
- when the named file cannot be found.public void next()
public void recordPosition()
public void returnToPosition()
public TokenInfo token()
public TokenInfo previousToken()
public boolean errorHasOccured()
public String fileName()