public class GenericReader extends Object implements Reader
| Constructor and Description |
|---|
GenericReader() |
| Modifier and Type | Method and Description |
|---|---|
Integer |
get()
Get the next character from the input stream.
|
String |
getFileName()
Get the name of the file to which the object is bound to.
|
int |
getLineNumber()
Get the line number to which the object is bound to.
|
int |
getPosition()
Get the position on the line to which the object is bound to.
|
SourceProvider |
getSourceProvider()
Get the source provider that provided this reader.
|
void |
pushBack(Integer ch)
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(Reader sourceReader) |
void |
set(String sourceFileName) |
void |
setFactory(Factory factory)
When a factory creates an instance of a class implementing this interface
this method is called to register the factory that created the instance.
|
void |
setSourceProvider(SourceProvider sourceProvider) |
public void setFactory(Factory factory)
FactoryManagedsetFactory in interface FactoryManagedfactory - the factory that manages the instance.public void set(Reader sourceReader)
public String getFileName()
SourceLocationBoundgetFileName in interface SourceLocationBoundpublic int getLineNumber()
SourceLocationBoundgetLineNumber in interface SourceLocationBoundpublic int getPosition()
SourceLocationBoundgetPosition in interface SourceLocationBoundpublic void pushBack(Integer ch)
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.
This implementation will not track the position properly when a new line
character is pushed back
public Integer get()
Readerpublic void setSourceProvider(SourceProvider sourceProvider)
public SourceProvider getSourceProvider()
ReadergetSourceProvider in interface ReaderCopyright © 2013 Verhas and Verhas Software Craftsmen. All Rights Reserved.