|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.io.Reader gnu.text.Lexer
public class Lexer
Framework for implementing lexical scanners and parsers.
Field Summary | |
---|---|
protected boolean |
interactive
|
protected int |
nesting
|
protected LineBufferedReader |
port
|
char[] |
tokenBuffer
For building tokens of various kinds. |
int |
tokenBufferLength
The number of chars of tokenBuffer that are used. |
Fields inherited from class java.io.Reader |
---|
lock |
Constructor Summary | |
---|---|
Lexer(LineBufferedReader port)
|
|
Lexer(LineBufferedReader port,
SourceMessages messages)
|
Method Summary | |
---|---|
boolean |
checkErrors(java.io.PrintWriter out,
int max)
Returns true if any error were seen. |
boolean |
checkNext(char ch)
Check if the next character matches a given character. |
void |
clearErrors()
|
void |
close()
|
void |
eofError(java.lang.String msg)
|
void |
eofError(java.lang.String message,
int startLine,
int startColumn)
|
void |
error(char severity,
java.lang.String message)
|
void |
error(char severity,
java.lang.String filename,
int line,
int column,
java.lang.String message)
|
void |
error(java.lang.String message)
|
void |
fatal(java.lang.String message)
|
int |
getColumnNumber()
|
SourceError |
getErrors()
|
int |
getLineNumber()
|
SourceMessages |
getMessages()
|
java.lang.String |
getName()
|
LineBufferedReader |
getPort()
|
boolean |
isInteractive()
|
void |
mark()
Start tentative parsing. |
int |
peek()
|
void |
popNesting(char save)
Exit a nested expression, reversing pushNesting |
char |
pushNesting(char promptChar)
Enter a nested expression. |
int |
read()
|
int |
read(char[] buf,
int offset,
int length)
|
static long |
readDigitsInBuffer(LineBufferedReader port,
int radix)
Read digits, up to the first non-digit or the buffer limit |
int |
readOptionalExponent()
Read an optional signed integer. |
void |
reset()
Stop tentative parsing. |
boolean |
seenErrors()
|
void |
setInteractive(boolean v)
|
void |
setMessages(SourceMessages messages)
|
protected void |
skip_quick()
|
void |
skip()
|
void |
tokenBufferAppend(int ch)
Append one character to tokenBuffer, resizing it if need be. |
protected void |
unread_quick()
|
protected void |
unread()
|
void |
unread(int ch)
|
Methods inherited from class java.io.Reader |
---|
mark, markSupported, read, read, ready, skip |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected LineBufferedReader port
protected boolean interactive
protected int nesting
public char[] tokenBuffer
public int tokenBufferLength
Constructor Detail |
---|
public Lexer(LineBufferedReader port)
public Lexer(LineBufferedReader port, SourceMessages messages)
Method Detail |
---|
public char pushNesting(char promptChar)
promptChar
- Used in prompt string to indicate type of nesting.
public void popNesting(char save)
save
- Saved values return by prior pushNestingpublic final LineBufferedReader getPort()
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in class java.io.Reader
java.io.IOException
public int read() throws java.io.IOException
read
in class java.io.Reader
java.io.IOException
public int read(char[] buf, int offset, int length) throws java.io.IOException
read
in class java.io.Reader
java.io.IOException
public void unread(int ch) throws java.io.IOException
java.io.IOException
public int peek() throws java.io.IOException
java.io.IOException
public void skip() throws java.io.IOException
java.io.IOException
protected void unread() throws java.io.IOException
java.io.IOException
protected void unread_quick() throws java.io.IOException
java.io.IOException
public boolean checkNext(char ch) throws java.io.IOException
ch
- The character to match against.
java.io.IOException
protected void skip_quick() throws java.io.IOException
java.io.IOException
public SourceMessages getMessages()
public void setMessages(SourceMessages messages)
public boolean checkErrors(java.io.PrintWriter out, int max)
out
- where to write the error message tomax
- maximum number of messages to print (can be 0)public SourceError getErrors()
public boolean seenErrors()
public void clearErrors()
public void error(char severity, java.lang.String filename, int line, int column, java.lang.String message)
public void error(char severity, java.lang.String message)
public void error(java.lang.String message)
public void fatal(java.lang.String message) throws SyntaxException
SyntaxException
public void eofError(java.lang.String msg) throws SyntaxException
SyntaxException
public void eofError(java.lang.String message, int startLine, int startColumn) throws SyntaxException
SyntaxException
public int readOptionalExponent() throws java.io.IOException
java.io.IOException
public static long readDigitsInBuffer(LineBufferedReader port, int radix)
public java.lang.String getName()
public int getLineNumber()
public int getColumnNumber()
public boolean isInteractive()
public void setInteractive(boolean v)
public void tokenBufferAppend(int ch)
public void mark() throws java.io.IOException
java.io.IOException
public void reset() throws java.io.IOException
reset
in class java.io.Reader
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |