use more consistent types
This commit is contained in:
22
lexer.h
22
lexer.h
@@ -7,7 +7,7 @@
|
||||
|
||||
namespace usql {
|
||||
|
||||
enum class TokenType {
|
||||
enum class TokenType {
|
||||
undef,
|
||||
identifier,
|
||||
plus,
|
||||
@@ -69,17 +69,17 @@ namespace usql {
|
||||
newline,
|
||||
comment,
|
||||
eof
|
||||
};
|
||||
};
|
||||
|
||||
struct Token {
|
||||
struct Token {
|
||||
std::string token_string;
|
||||
TokenType type;
|
||||
|
||||
Token(const std::string &token_str, TokenType typ);
|
||||
};
|
||||
};
|
||||
|
||||
class Lexer {
|
||||
public:
|
||||
class Lexer {
|
||||
public:
|
||||
Lexer();
|
||||
|
||||
void parse(const std::string &code);
|
||||
@@ -108,7 +108,7 @@ namespace usql {
|
||||
|
||||
static bool isArithmeticalOperator(TokenType token_type);
|
||||
|
||||
private:
|
||||
private:
|
||||
TokenType type(const std::string &token);
|
||||
|
||||
static std::string stringLiteral(std::string token);
|
||||
@@ -116,16 +116,16 @@ namespace usql {
|
||||
static std::string typeToString(TokenType token_type);
|
||||
|
||||
|
||||
private:
|
||||
private:
|
||||
std::string m_code_str;
|
||||
std::vector<Token> m_tokens;
|
||||
int m_index = 0;
|
||||
size_t m_index = 0;
|
||||
|
||||
std::regex k_words_regex;
|
||||
std::regex k_int_regex;
|
||||
std::regex k_int_underscored_regex;
|
||||
std::regex k_double_regex;
|
||||
std::regex k_identifier_regex;
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace
|
||||
Reference in New Issue
Block a user