public interface Reader extends FactoryManaged, SourceLocationBound
java.io.Reader
and the implementation GenericReader
actually
wraps the standard java.io.Reader
class. The extra functionality is
keeping track of the file name, the line number and the position to help
error reporting of lexical and syntax analyzers and to allow character push
back when the lexical analyzer needs to push back some characters.
When it comes to reading the only way to get character from the stream is
calling the method get()
.
Modifier and Type | Method and Description |
---|---|
Integer |
get()
Get the next character from the input stream.
|
SourceProvider |
getSourceProvider()
Get the source provider that provided this reader.
|
void |
pushBack(Integer character)
Readers should support lexical analyzers offering the possibility to push
some characters back to the input stream, when a lexical analyzer can not
decide its selection only consuming extra characters.
|
void |
set(String sourceFileName) |
setFactory
getFileName, getLineNumber, getPosition
void set(String sourceFileName)
void pushBack(Integer character)
Some of the readers may limit the operation of this push back functionality not supporting tracking line numbers, position and file name when this method is used.
Lexical analyzers should push back the characters that were read from the reader the backward order as they were read. (Read last pushed back first.)
Implementation should ignore null
parameter.
character
- the character to push backInteger get()
SourceProvider getSourceProvider()
Copyright © 2013 Verhas and Verhas Software Craftsmen. All Rights Reserved.