|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.raritantechnologies.vqlparser.Lexer
This class implements a small scanner (aka lexical analyzer or lexer). Creates
a series of Node objects that represent
query tokens.
In addition to the scanner proper (called first via init() then with next_token() to get each Symbol) this class provides simple error and warning routines and keeps a count of errors and warnings that is publicly accessible.
| Field Summary | |
protected int |
absolute_position
Character position in entire query. |
protected boolean |
at_eof
State of the query stream: at end of file |
protected char[] |
buf
build the token here. |
protected int |
buffer_position
Character position in the token buffer. |
protected static int |
BUFSIZ
|
protected int |
current_line
Current line number for use in error messages. |
protected int |
current_position
Character position in current line. |
protected static int |
EOF_CHAR
EOF constant. |
int |
error_count
Count of total errors detected so far. |
protected SymbolTable |
keywords
Symbol table holding keywords. |
protected int |
level
Parenthesis level |
protected int |
next_char
First character of lookahead. |
protected int |
next_char2
second character of lookahead. |
protected java.io.Reader |
reader_in
|
protected java.io.InputStream |
stream_in
Stream containing query to be parsed |
int |
warning_count
Count of warnings issued so far |
| Constructor Summary | |
Lexer(java.io.InputStream lexIn)
This constructor takes an inputStream as a parameter. |
|
Lexer(java.io.Reader lexIn)
This constructor takes a Reader as a parameter. |
|
Lexer(java.lang.String vqlString)
|
|
| Method Summary | |
protected void |
advance()
Advance the scanner one character in the input stream. |
Node |
debug_next_token()
Debugging version of next_token(). |
void |
emit_error(java.lang.String message)
Emit an error message. |
void |
emit_warn(java.lang.String message)
Emit a warning message. |
int |
getLevel()
Access to the level. |
protected boolean |
id_char(int ch)
Determine if a character is ok for the middle of an id. |
protected boolean |
id_start_char(int ch)
Determine if a character is ok to start an id. |
Node |
next_token()
Return one Node. |
protected Node |
real_next_token()
The actual routine to return one Node. |
protected void |
swallow_comment()
Handle swallowing up a comment. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected static final int EOF_CHAR
protected static final int BUFSIZ
protected java.io.InputStream stream_in
protected java.io.Reader reader_in
protected boolean at_eof
protected SymbolTable keywords
protected int next_char
protected int next_char2
protected char[] buf
protected int level
protected int current_line
protected int current_position
protected int absolute_position
protected int buffer_position
public int error_count
public int warning_count
| Constructor Detail |
public Lexer(java.lang.String vqlString)
throws java.io.IOException
public Lexer(java.io.InputStream lexIn)
throws java.io.IOException
public Lexer(java.io.Reader lexIn)
throws java.io.IOException
| Method Detail |
protected void advance()
throws java.io.IOException
java.io.IOExceptionpublic int getLevel()
public void emit_error(java.lang.String message)
message - the message to print.public void emit_warn(java.lang.String message)
message - the message to print.protected boolean id_start_char(int ch)
ch - the character in question.protected boolean id_char(int ch)
ch - the character in question.
protected void swallow_comment()
throws java.io.IOException
java.io.IOException
public Node next_token()
throws java.io.IOException
java.io.IOException
public Node debug_next_token()
throws java.io.IOException
java.io.IOException
protected Node real_next_token()
throws java.io.IOException
java.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||