| java.io.PushbackInputStream org.w3c.tools.sexpr.SimpleSExprStream
Method Summary | |
public SExprParser | addParser(char key, SExprParser parser) Associates a dispatch character with a parser in the read table. | public boolean | getListsAsVectors() Checks whether lists should be parsed as Vectors or Cons cells. | public Readtable | getReadtable() Accesses the read table of the parser. | public StringBuffer | getScratchBuffer() Accesses an empty string buffer available temporary storage.
This buffer can be used by sub-parsers as a scratch area. | public Dictionary | getSymbols() Accesses the symbol table of the parser. | protected boolean | isAtomChar(char c, boolean first) Predicate function for checking if a chahracter can belong to an atom. | public static void | main(String args) | protected Number | makeNumber(String s) Attempts to parse a number from the string. | public Object | parse() Parses a single object from the underlying input stream. | public Object | parse(char c, SExprStream stream) Parses a single object started by the character c. | protected Object | parseAtom(char c) Parses an atom (a number or a symbol).
Since anything that is not a number is a symbol, syntax errors are not
possible.
exception: SExprParserException - not signalled but useful for the protocol exception: IOException - if an I/O problem occurred (e.g. | protected Cons | parseList() Parses a list (as Cons cells) sans first character. | public String | parseString() Parses a double-quote -delimited string (sans the first character).
Please note: no escape-character interpretation is performed. | protected Vector | parseVector(Vector vector, char delimiter) Parses a list (as a Vector) sans first character. | public static void | printExpr(Object expr, PrintStream out) Produces a printed representation of an s-expression. | public char | readSkipWhite() Reads from the stream, skipping whitespace and comments. | public boolean | setListsAsVectors(boolean listsAsVectors) Controls whether lists are represented as Vectors or Cons cells. | public Readtable | setReadtable(Readtable readtable) Assigns a new read table to the parser. | public Dictionary | setSymbols(Dictionary symbols) Assigns a symbol table to the parser. |
SimpleSExprStream | public SimpleSExprStream(InputStream input)(Code) | | Initializes the parser with no read table and no symbol table assigned.
Parsed lists will be represented as Cons cells.
|
getListsAsVectors | public boolean getListsAsVectors()(Code) | | Checks whether lists should be parsed as Vectors or Cons cells.
|
getReadtable | public Readtable getReadtable()(Code) | | Accesses the read table of the parser.
If no read table has been assigned, creates an empty table.
|
getScratchBuffer | public StringBuffer getScratchBuffer()(Code) | | Accesses an empty string buffer available temporary storage.
This buffer can be used by sub-parsers as a scratch area. Please note
that the buffer is not guarded in any way, so multithreaded and reentrant
programs must worry about this themselves.
|
getSymbols | public Dictionary getSymbols()(Code) | | Accesses the symbol table of the parser.
If no symbol table has been assigned, creates an empty table.
|
isAtomChar | protected boolean isAtomChar(char c, boolean first)(Code) | | Predicate function for checking if a chahracter can belong to an atom.
Parameters: first - if true means that c is the first character of the atom |
parseString | public String parseString() throws SExprParserException, IOException(Code) | | Parses a double-quote -delimited string (sans the first character).
Please note: no escape-character interpretation is performed. Override
this method for any escape character handling.
exception: SExprParserException - not signalled but useful for the protocol exception: IOException - any I/O problem (including end of file) |
parseVector | protected Vector parseVector(Vector vector, char delimiter) throws SExprParserException, IOException(Code) | | Parses a list (as a Vector) sans first character.
In order to parse list-like structures delimited by other characters
than parentheses, the delimiting (ending) character has to be provided.
exception: SExprParserException - if syntax error was detected exception: IOException - if any other I/O-related problem occurred |
printExpr | public static void printExpr(Object expr, PrintStream out)(Code) | | Produces a printed representation of an s-expression.
|
readSkipWhite | public char readSkipWhite() throws IOException(Code) | | Reads from the stream, skipping whitespace and comments.
exception: IOException - if an I/O problem occurred (including end of file) |
setListsAsVectors | public boolean setListsAsVectors(boolean listsAsVectors)(Code) | | Controls whether lists are represented as Vectors or Cons cells.
|
setSymbols | public Dictionary setSymbols(Dictionary symbols)(Code) | | Assigns a symbol table to the parser.
Assigning null will prevent an empty symbol table to be created
in the future.
|
|
|