|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.japaki.text.ParseReader
net.sf.japaki.text.ReaderWithPosition
public class ReaderWithPosition
Default implementation of a ParseReader
.
Constructor Summary | |
---|---|
ReaderWithPosition(Reader reader)
Creates a new instance of this class from a reader. |
|
ReaderWithPosition(String fileName)
Creates a new instance of this class from a file. |
Method Summary | |
---|---|
void |
checkForException(String errorMessage)
Creates a parsing exception with the specified error message. |
void |
close()
|
void |
copyFrom(ParseReader source)
Sets the status to the same as in the specified ReaderWithPosition . |
ParseReader |
deepCopy()
Saves the current settings of this ReaderWithPosition . |
boolean |
eof()
Checks if the input stream is at its end. |
boolean |
eol()
Checks if the current line is at its end. |
TreeSet<ParsingException> |
getExceptionLog()
Returns a list of all exceptions that have occured while parsing. |
Deque<Parser> |
getPath()
Returns the path of parsers in the parser network. |
ParsePosition |
getPosition()
Returns the current parse position. |
String |
getSource()
Returns the current line of the input stream. |
void |
newLine()
Forwards to the next line in the input stream. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ReaderWithPosition(Reader reader) throws IOException
reader
- base reader for the I/O operations
NullPointerException
- if reader
is null
IOException
- if the first line of the reader could not be readpublic ReaderWithPosition(String fileName) throws IOException
fileName
- name of the input file
IOException
- see FileReader.FileReader(String)
Method Detail |
---|
public TreeSet<ParsingException> getExceptionLog()
checkForException(java.lang.String)
public boolean eol()
true
if end of line is reachedpublic String getSource()
ParseReader
getSource
in class ParseReader
null
if the end of the stream has been reached.BufferedReader.readLine()
public ParsePosition getPosition()
ParseReader
getPosition
in class ParseReader
public void newLine() throws IOException, ParseException
ParseReader
newLine
in class ParseReader
IOException
- if an I/O error occurs
ParseException
- if end of current line was not reachedpublic boolean eof()
ParseReader
eof
in class ParseReader
true
if end of file is reachedpublic void checkForException(String errorMessage) throws ParsingException
ParseReader
checkForException
in class ParseReader
errorMessage
- message set in the exception
ParsingException
- if the error index of the parse position is set.public Deque<Parser> getPath()
PathTracker
public void copyFrom(ParseReader source)
ReaderWithPosition
.
source
- source of the copy operation,
normally created from a deepCopy()
operation.
ClassCastException
- if source
is not a
ReaderWithPosition
.public ParseReader deepCopy()
ReaderWithPosition
.
copyFrom
can be used to restore the settings
from the clone.
public void close() throws IOException
IOException
public String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |