gnu.text
public class Lexer extends Reader
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. |
Constructor Summary | |
---|---|
Lexer(LineBufferedReader port) | |
Lexer(LineBufferedReader port, SourceMessages messages) |
Method Summary | |
---|---|
boolean | checkErrors(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(String msg) |
void | eofError(String message, int startLine, int startColumn) |
void | error(char severity, String filename, int line, int column, String message) |
void | error(char severity, String message) |
void | error(String message) |
void | fatal(String message) |
int | getColumnNumber() |
SourceError | getErrors() |
int | getLineNumber() |
SourceMessages | getMessages() |
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) |
void | skip() |
protected void | skip_quick() |
void | tokenBufferAppend(int ch) Append one character to tokenBuffer, resizing it if need be. |
void | unread(int ch) |
protected void | unread() |
protected void | unread_quick() |
Parameters: out where to write the error message to max maximum number of messages to print (can be 0)
Parameters: ch The character to match against.
Returns: if the character read matches On a match, the position is advanced following that character.
Parameters: save Saved values return by prior pushNesting
Parameters: promptChar Used in prompt string to indicate type of nesting.
Returns: The previous value of promptChar, to be passed to popNesting.
Returns: the digits seen as a non-negative long, or -1 on overflow