public abstract class Source extends Object implements Iterable<Token>, Closeable
| Constructor and Description |
|---|
Source() |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
protected void |
error(int line,
int column,
String msg) |
int |
getColumn()
Returns the current column number within this Source.
|
int |
getLine()
Returns the current line number within this Source.
|
String |
getName()
Returns the human-readable name of the current Source.
|
Source |
getParent()
Returns the parent source of this source.
|
String |
getPath()
Returns the File currently being lexed.
|
Iterator<Token> |
iterator()
Returns a token iterator for this Source.
|
void |
setListener(PreprocessorListener pl)
Sets the listener for this Source.
|
Token |
skipline(boolean white)
Skips tokens until the end of line.
|
abstract Token |
token()
Returns the next Token parsed from this input stream.
|
protected void |
warning(int line,
int column,
String msg) |
public final Source getParent()
public void setListener(PreprocessorListener pl)
public String getPath()
FileLexerSource, then
it will ask the parent Source, and so forth recursively.
If no Source on the stack is a FileLexerSource, returns null.public String getName()
public int getLine()
public int getColumn()
public abstract Token token() throws IOException, LexerException
IOExceptionLexerExceptionTokenpublic Token skipline(boolean white) throws IOException, LexerException
white - true if only whitespace is permitted on the
remainder of the line.IOExceptionLexerExceptionprotected void error(int line,
int column,
String msg)
throws LexerException
LexerExceptionprotected void warning(int line,
int column,
String msg)
throws LexerException
LexerExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOException