| gnu.text.Lexer gnu.kawa.lispexpr.LispReader
All known Subclasses: gnu.kawa.brl.BRLRead, gnu.q2.lang.Q2Read,
LispReader | public class LispReader extends Lexer (Code) | | A Lexer for reading S-expressions in generic Lisp-like syntax.
This class may have outlived its usefulness: It's mostly just a
wrapper around a LineBufferedReader plus a helper token-buffer.
The functionality should be moved to ReadTable, though it is
unclear what to do about the tokenBuffer.
|
Method Summary | |
static char | getReadCase() Get specification of how symbols should be case-folded. | Object | handlePostfix(Object value, ReadTable rtable, int line, int column) | public Object | handleToken(int startPos, int endPos, ReadTable rtable) Classify and return a token in tokenBuffer from startPos to endPos. | public static Object | lookupUnit(String name) Resolve a unit name, if possible.
Returns null if the unit name is unknown. | protected Object | makeNil() | protected Object | makePair(Object car, int line, int column) | public Object | makePair(Object car, Object cdr) | public static Object | parseNumber(char[] buffer, int start, int count, char exactness, int radix, int flags) Parse a number. | public static Object | readCharacter(LispReader reader) | public Object | readCommand() Read a "command" - a top-level expression or declaration.
Return Sequence.eofValue of end of file. | public int | readEscape() Reads a C-style String escape sequence.
Assume '\\' has already been read.
Return the converted character, or -1 on EOF, or -2 to ignore. | final public int | readEscape(int c) | final public void | readNestedComment(char c1, char c2) Read a #|...|#-style comment (which may contain other nested comments). | public static Object | readNumberWithRadix(int previous, LispReader reader, int radix) | public Object | readObject() | final public Object | readObject(int c) | public static SimpleVector | readSimpleVector(LispReader reader, char kind) | public static Object | readSpecial(LispReader reader) | void | readToken(int ch, char readCase, ReadTable rtable) | public Object | readValues(int ch, ReadTable rtable) | public Object | readValues(int ch, ReadTableEntry entry, ReadTable rtable) May return zero or multiple values. | protected Object | returnSymbol(int startPos, int endPos, ReadTable rtable) | protected void | setCdr(Object pair, Object cdr) | protected boolean | validPostfixLookupStart(ReadTable rtable) |
SCM_COMPLEX | final static int SCM_COMPLEX(Code) | | |
SCM_NUMBERS | final public static int SCM_NUMBERS(Code) | | |
TOKEN_ESCAPE_CHAR | final public static char TOKEN_ESCAPE_CHAR(Code) | | |
finalColonIsKeyword | protected boolean finalColonIsKeyword(Code) | | True if "IDENTIFIER:" should be treated as a keyword.
|
initialColonIsKeyword | protected boolean initialColonIsKeyword(Code) | | True if ":IDENTIFIER" should be treated as a keyword.
|
seenEscapes | protected boolean seenEscapes(Code) | | If true, then tokenbuffer contains escaped characters.
These are prefixed (in the buffer) by TOKEN_ESCAPE_CHAR.
|
getReadCase | static char getReadCase()(Code) | | Get specification of how symbols should be case-folded.
Either 'P' (means preserve case), 'U' (upcase),'D' (downcase, or 'I' (invert case). |
handleToken | public Object handleToken(int startPos, int endPos, ReadTable rtable)(Code) | | Classify and return a token in tokenBuffer from startPos to endPos.
|
lookupUnit | public static Object lookupUnit(String name)(Code) | | Resolve a unit name, if possible.
Returns null if the unit name is unknown.
|
parseNumber | public static Object parseNumber(char[] buffer, int start, int count, char exactness, int radix, int flags)(Code) | | Parse a number.
Parameters: buffer - contains the characters of the number Parameters: start - startinging index of the number in the buffer Parameters: count - number of characters in buffer to use Parameters: exactness - either 'i' or 'I' force an inexact result,either 'e' or 'E' force an exact result,'\0' yields an inact or inexact depending on the form of the literal,while ' ' is like '\0' but does not allow more exactness specifiers. Parameters: radix - the number base to use or 0 if unspecified the number if a valid number; null or a String-valued errormessage if if there was some error parsing the number. |
readEscape | public int readEscape() throws java.io.IOException, SyntaxException(Code) | | Reads a C-style String escape sequence.
Assume '\\' has already been read.
Return the converted character, or -1 on EOF, or -2 to ignore.
|
readNestedComment | final public void readNestedComment(char c1, char c2) throws java.io.IOException, SyntaxException(Code) | | Read a #|...|#-style comment (which may contain other nested comments).
Assumes the initial "#|" has already been read.
|
readNumberWithRadix | public static Object readNumberWithRadix(int previous, LispReader reader, int radix) throws java.io.IOException, SyntaxException(Code) | | Read a number from a LispReader
Parameters: previous - number of characters already pushed on tokenBuffer Parameters: reader - LispReader to read from Parameters: radix - base to use or -1 if unspecified |
Methods inherited from gnu.text.Lexer | public boolean checkErrors(PrintWriter out, int max)(Code)(Java Doc) public boolean checkNext(char ch) throws java.io.IOException(Code)(Java Doc) public void clearErrors()(Code)(Java Doc) public void close() throws java.io.IOException(Code)(Java Doc) public void eofError(String msg) throws SyntaxException(Code)(Java Doc) public void eofError(String message, int startLine, int startColumn) throws SyntaxException(Code)(Java Doc) public void error(char severity, String filename, int line, int column, String message)(Code)(Java Doc) public void error(char severity, String message)(Code)(Java Doc) public void error(String message)(Code)(Java Doc) public void fatal(String message) throws SyntaxException(Code)(Java Doc) public int getColumnNumber()(Code)(Java Doc) public SourceError getErrors()(Code)(Java Doc) public int getLineNumber()(Code)(Java Doc) public SourceMessages getMessages()(Code)(Java Doc) public String getName()(Code)(Java Doc) final public LineBufferedReader getPort()(Code)(Java Doc) public boolean isInteractive()(Code)(Java Doc) public void mark() throws java.io.IOException(Code)(Java Doc) public int peek() throws java.io.IOException(Code)(Java Doc) public void popNesting(char save)(Code)(Java Doc) public char pushNesting(char promptChar)(Code)(Java Doc) public int read() throws java.io.IOException(Code)(Java Doc) public int read(char[] buf, int offset, int length) throws java.io.IOException(Code)(Java Doc) public static long readDigitsInBuffer(LineBufferedReader port, int radix)(Code)(Java Doc) public int readOptionalExponent() throws java.io.IOException(Code)(Java Doc) public void reset() throws java.io.IOException(Code)(Java Doc) public boolean seenErrors()(Code)(Java Doc) public void setInteractive(boolean v)(Code)(Java Doc) public void setMessages(SourceMessages messages)(Code)(Java Doc) public void skip() throws java.io.IOException(Code)(Java Doc) protected void skip_quick() throws java.io.IOException(Code)(Java Doc) public void tokenBufferAppend(int ch)(Code)(Java Doc) public void unread(int ch) throws java.io.IOException(Code)(Java Doc) protected void unread() throws java.io.IOException(Code)(Java Doc) protected void unread_quick() throws java.io.IOException(Code)(Java Doc)
|
|
|