public abstract class Source extends java.lang.Object implements java.lang.Iterable<Token>, java.io.Closeable
| Constructor and Description |
|---|
Source() |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
protected void |
error(int line,
int column,
java.lang.String msg) |
int |
getColumn()
Returns the current column number within this Source.
|
int |
getLine()
Returns the current line number within this Source.
|
java.lang.String |
getName()
Returns the human-readable name of the current Source.
|
java.lang.String |
getPath()
Returns the File currently being lexed.
|
java.util.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,
java.lang.String msg) |
public Source()
public void setListener(PreprocessorListener pl)
@CheckForNull public java.lang.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.@CheckForNull public java.lang.String getName()
@Nonnegative public int getLine()
public int getColumn()
@Nonnull public abstract Token token() throws java.io.IOException, LexerException
java.io.IOExceptionLexerExceptionTokenpublic java.util.Iterator<Token> iterator()
iterator in interface java.lang.Iterable<Token>@Nonnull public Token skipline(boolean white) throws java.io.IOException, LexerException
white - true if only whitespace is permitted on the
remainder of the line.java.io.IOExceptionLexerExceptionprotected void error(int line, int column, java.lang.String msg) throws LexerException
LexerExceptionprotected void warning(int line, int column, java.lang.String msg) throws LexerException
LexerExceptionpublic void close() throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOException