public abstract class Scanner extends Object
A language-independent framework class. This abstract scanner class will be implemented by language-specific subclasses.
Copyright (c) 2009 by Ronald Mak
For instructional purposes only. No warranties.
Modifier and Type | Method and Description |
---|---|
boolean |
atEof()
Call the source's atEof() method.
|
boolean |
atEol()
Call the source's atEol() method.
|
char |
currentChar()
Call the source's currentChar() method.
|
Token |
currentToken() |
protected abstract Token |
extractToken()
Do the actual work of extracting and returning the next token from the
source.
|
EventDispatcher |
getEventDispatcher() |
Source |
getSource() |
char |
nextChar()
Call the source's nextChar() method.
|
Token |
nextToken()
Return next token from the source.
|
char |
peekChar()
Peeks at the next char
|
Token |
previousToken() |
void |
skipToNextLine()
Call the source's skipToNextLine() method.
|
protected Source source
public Scanner(Source source)
source
- the source to be used with this scanner.public Source getSource()
public EventDispatcher getEventDispatcher()
public Token previousToken()
public Token currentToken()
public Token nextToken() throws IOException
Exception
- if an error occurred.IOException
protected abstract Token extractToken() throws IOException
Exception
- if an error occurred.IOException
public char currentChar() throws IOException
Exception
- if an error occurred.IOException
public char nextChar() throws IOException
Exception
- if an error occurred.IOException
public char peekChar() throws IOException
Exception
IOException
public boolean atEol() throws IOException
Exception
- if an error occurred.IOException
public boolean atEof() throws IOException
Exception
- if an error occurred.IOException
public void skipToNextLine() throws IOException
Exception
- if an error occurred.IOException
Copyright © 2010–2015. All rights reserved.