public class Lexer extends Object
Constructor and Description |
---|
Lexer(String s)
Creates a new lexical analyzer for the specified SQL statement.
|
Modifier and Type | Method and Description |
---|---|
void |
eatDelim(char delimiter)
Throws an exception if the current token is not the specified delimiter.
|
String |
eatId()
Throws an exception if the current token is not an identifier.
|
void |
eatKeyword(String keyword)
Throws an exception if the current token is not the specified keyword.
|
double |
eatNumericConstant()
Throws an exception if the current token is not an integer.
|
String |
eatStringConstant()
Throws an exception if the current token is not a string.
|
boolean |
matchDelim(char delimiter)
Returns true if the current token is the specified delimiter character.
|
boolean |
matchId()
Returns true if the current token is a legal identifier.
|
boolean |
matchKeyword(String keyword)
Returns true if the current token is the specified keyword.
|
boolean |
matchNumericConstant()
Returns true if the current token is a numeric value.
|
boolean |
matchStringConstant()
Returns true if the current token is a string.
|
public Lexer(String s)
s
- the SQL statementpublic boolean matchDelim(char delimiter)
delimiter
- a character denoting the delimiterpublic boolean matchNumericConstant()
public boolean matchStringConstant()
public boolean matchKeyword(String keyword)
keyword
- the keyword stringpublic boolean matchId()
public void eatDelim(char delimiter)
delimiter
- a character denoting the delimiterpublic double eatNumericConstant()
public String eatStringConstant()
public void eatKeyword(String keyword)
keyword
- the keyword stringpublic String eatId()
Copyright © 2022 VanillaDB Organization. All rights reserved.