use more consistent types

This commit is contained in:
vaclavt
2022-01-16 15:39:29 +01:00
parent 3ce2eb0557
commit 9ebcac9b45
8 changed files with 73 additions and 73 deletions

22
lexer.h
View File

@@ -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