date and boolean data types added

This commit is contained in:
2021-08-06 22:46:48 +02:00
parent 4b95be1e31
commit 15a065c2aa
17 changed files with 1123 additions and 907 deletions

View File

@@ -45,7 +45,7 @@ namespace usql {
match_str = stringLiteral(match_str);
if (token_type != TokenType::newline)
m_tokens.push_back(Token{match_str, token_type});
m_tokens.emplace_back(match_str, token_type);
}
// DEBUG IT
@@ -56,8 +56,8 @@ namespace usql {
void Lexer::debugTokens() {
int i = 0;
for (std::vector<Token>::iterator it = m_tokens.begin(); it != m_tokens.end(); ++it) {
std::cerr << i << "\t" << it->token_string << std::endl;
for (auto & m_token : m_tokens) {
std::cerr << i << "\t" << m_token.token_string << std::endl;
i++;
}
}
@@ -197,6 +197,10 @@ namespace usql {
return TokenType::keyword_float;
if (token == "varchar")
return TokenType::keyword_varchar;
if (token == "date")
return TokenType::keyword_date;
if (token == "boolean")
return TokenType::keyword_bool;
if (token == "distinct")
return TokenType::keyword_distinct;
if (token == "or")
@@ -244,7 +248,7 @@ namespace usql {
if (!replace) {
return str;
}
std::string out = "";
std::string out;
out.reserve(str.size());
@@ -384,6 +388,12 @@ namespace usql {
case TokenType::keyword_varchar:
txt = "varchar";
break;
case TokenType::keyword_date:
txt = "date";
break;
case TokenType::keyword_bool:
txt = "boolean";
break;
case TokenType::keyword_distinct:
txt = "distinct";
break;