public class LispReader extends Lexer
Modifier and Type | Field and Description |
---|---|
static int |
SCM_NUMBERS |
protected boolean |
seenEscapes
If true, then tokenbuffer contains escaped characters.
|
static char |
TOKEN_ESCAPE_CHAR |
interactive, nesting, port, tokenBuffer, tokenBufferLength
Constructor and Description |
---|
LispReader(LineBufferedReader port) |
LispReader(LineBufferedReader port,
SourceMessages messages) |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
bindSharedObject(int sharingIndex,
java.lang.Object value)
Bind value to index in sharingStructuretable.
|
char |
getReadCase()
Get specification of how symbols should be case-folded.
|
protected java.lang.Object |
makeNil() |
protected Pair |
makePair(java.lang.Object car,
int line,
int column) |
protected Pair |
makePair(java.lang.Object car,
java.lang.Object cdr,
int line,
int column) |
protected Pair |
makePair2(java.lang.Object car,
java.lang.Object cadr,
java.lang.Object cddr,
int line,
int column) |
static java.lang.Object |
parseNumber(char[] buffer,
int start,
int count,
char exactness,
int radix,
int flags)
Parse a number.
|
static java.lang.Object |
parseNumber(java.lang.CharSequence str,
int radix) |
protected java.lang.Object |
readAndHandleToken(int ch,
int startPos,
ReadTable rtable) |
static java.lang.Object |
readCharacter(LispReader reader) |
java.lang.Object |
readCommand()
Read a "command" - a top-level expression or declaration.
|
int |
readEscape()
Reads a C-style String escape sequence.
|
int |
readEscape(int c) |
int |
readHexEscape() |
void |
readNestedComment(char c1,
char c2)
Read a #|...|#-style comment (which may contain other nested comments).
|
static java.lang.Object |
readNumberWithRadix(int previous,
LispReader reader,
int radix)
Read a number from a LispReader
|
java.lang.Object |
readObject() |
java.lang.Object |
readObject(int c) |
java.lang.Object |
readObject(int sharingIndex,
boolean topLevel) |
static SimpleVector |
readSimpleVector(LispReader reader,
char kind) |
static SimpleVector |
readSimpleVector(LispReader reader,
char kind,
int ch,
int size) |
static java.lang.Object |
readSpecial(LispReader reader) |
java.lang.String |
readTokenString(int ch,
ReadTable rtable) |
java.lang.Object |
readValues(int ch,
ReadTableEntry entry,
ReadTable rtable,
int sharingIndex)
May return zero or multiple values.
|
java.lang.Object |
readValues(int ch,
ReadTable rtable,
int sharingIndex) |
Pair |
readValuesAndAppend(int ch,
ReadTable rtable,
Pair last) |
protected void |
setCar(java.lang.Object pair,
java.lang.Object car) |
protected void |
setCdr(java.lang.Object pair,
java.lang.Object cdr) |
void |
setReadCase(char readCase) |
protected boolean |
validPostfixLookupStart(int ch,
ReadTable rtable) |
checkErrors, checkNext, clearErrors, close, eofError, eofError, error, error, error, fatal, getColumnNumber, getErrors, getLineNumber, getMessages, getName, getPort, isInteractive, mark, peek, popNesting, pushNesting, read, read, readCodePoint, readDelimited, readDigitsInBuffer, readOptionalExponent, readUnicodeChar, reset, seenErrors, setInteractive, setMessages, skip_quick, skip, tokenBufferAppend, tokenBufferString, unread_quick, unread, unread
public static final char TOKEN_ESCAPE_CHAR
protected boolean seenEscapes
public static final int SCM_NUMBERS
public LispReader(LineBufferedReader port)
public LispReader(LineBufferedReader port, SourceMessages messages)
public java.lang.Object bindSharedObject(int sharingIndex, java.lang.Object value)
value
- The object being defined.sharingIndex
- Back-reference index.
I.e. the value N in a @code{#N=} form. If negative, do nothing.public final void readNestedComment(char c1, char c2) throws java.io.IOException, SyntaxException
java.io.IOException
SyntaxException
public char getReadCase()
public void setReadCase(char readCase)
public java.lang.Object readValues(int ch, ReadTable rtable, int sharingIndex) throws java.io.IOException, SyntaxException
java.io.IOException
SyntaxException
public java.lang.Object readValues(int ch, ReadTableEntry entry, ReadTable rtable, int sharingIndex) throws java.io.IOException, SyntaxException
java.io.IOException
SyntaxException
public Pair readValuesAndAppend(int ch, ReadTable rtable, Pair last) throws java.io.IOException, SyntaxException
java.io.IOException
SyntaxException
protected java.lang.Object readAndHandleToken(int ch, int startPos, ReadTable rtable) throws java.io.IOException, SyntaxException
java.io.IOException
SyntaxException
public java.lang.String readTokenString(int ch, ReadTable rtable) throws java.io.IOException, SyntaxException
java.io.IOException
SyntaxException
public java.lang.Object readObject() throws java.io.IOException, SyntaxException
java.io.IOException
SyntaxException
public java.lang.Object readObject(int sharingIndex, boolean topLevel) throws java.io.IOException, SyntaxException
java.io.IOException
SyntaxException
protected boolean validPostfixLookupStart(int ch, ReadTable rtable) throws java.io.IOException
java.io.IOException
public static java.lang.Object parseNumber(java.lang.CharSequence str, int radix)
public static java.lang.Object parseNumber(char[] buffer, int start, int count, char exactness, int radix, int flags)
buffer
- contains the characters of the numberstart
- startinging index of the number in the buffercount
- number of characters in buffer to useexactness
- 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.radix
- the number base to use or 0 if unspecifiedpublic int readEscape() throws java.io.IOException, SyntaxException
java.io.IOException
SyntaxException
public final int readEscape(int c) throws java.io.IOException, SyntaxException
java.io.IOException
SyntaxException
public int readHexEscape() throws java.io.IOException, SyntaxException
java.io.IOException
SyntaxException
public final java.lang.Object readObject(int c) throws java.io.IOException, SyntaxException
java.io.IOException
SyntaxException
public java.lang.Object readCommand() throws java.io.IOException, SyntaxException
java.io.IOException
SyntaxException
protected java.lang.Object makeNil()
protected Pair makePair(java.lang.Object car, int line, int column)
protected Pair makePair(java.lang.Object car, java.lang.Object cdr, int line, int column)
protected Pair makePair2(java.lang.Object car, java.lang.Object cadr, java.lang.Object cddr, int line, int column)
protected void setCar(java.lang.Object pair, java.lang.Object car)
protected void setCdr(java.lang.Object pair, java.lang.Object cdr)
public static java.lang.Object readNumberWithRadix(int previous, LispReader reader, int radix) throws java.io.IOException, SyntaxException
previous
- number of characters already pushed on tokenBufferreader
- LispReader to read fromradix
- base to use or -1 if unspecifiedjava.io.IOException
SyntaxException
public static java.lang.Object readCharacter(LispReader reader) throws java.io.IOException, SyntaxException
java.io.IOException
SyntaxException
public static java.lang.Object readSpecial(LispReader reader) throws java.io.IOException, SyntaxException
java.io.IOException
SyntaxException
public static SimpleVector readSimpleVector(LispReader reader, char kind) throws java.io.IOException, SyntaxException
java.io.IOException
SyntaxException
public static SimpleVector readSimpleVector(LispReader reader, char kind, int ch, int size) throws java.io.IOException, SyntaxException
java.io.IOException
SyntaxException