Class Source
java.lang.Object
io.github.ocelot.glslprocessor.lib.anarres.cpp.Source
- All Implemented Interfaces:
Closeable,AutoCloseable,Iterable<Token>
- Direct Known Subclasses:
LexerSource
An input to the Preprocessor.
Inputs may come from Files, Strings or other sources. The preprocessor maintains a stack of Sources. Operations such as file inclusion or token pasting will push a new source onto the Preprocessor stack. Sources pop from the stack when they are exhausted; this may be transparent or explicit.
BUG: Error messages are not handled properly.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()protected voidintReturns the current column number within this Source.intgetLine()Returns the current line number within this Source.@Nullable StringgetName()Returns the human-readable name of the current Source.iterator()Returns a token iterator for this Source.voidSets the listener for this Source.@NotNull Tokenskipline(boolean white) Skips tokens until the end of line.abstract @NotNull Tokentoken()Returns the next Token parsed from this input stream.protected voidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
Source
public Source()
-
-
Method Details
-
setListener
Sets the listener for this Source.Normally this is set by the Preprocessor when a Source is used, but if you are using a Source as a standalone object, you may wish to call this.
-
getName
Returns the human-readable name of the current Source. -
getLine
public int getLine()Returns the current line number within this Source. -
getColumn
public int getColumn()Returns the current column number within this Source. -
token
Returns the next Token parsed from this input stream.- Throws:
IOExceptionLexerException- See Also:
-
iterator
Returns a token iterator for this Source. -
skipline
Skips tokens until the end of line.- Parameters:
white- true if only whitespace is permitted on the remainder of the line.- Returns:
- the NL token.
- Throws:
IOExceptionLexerException
-
error
- Throws:
LexerException
-
warning
- Throws:
LexerException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-