date and boolean data types added
This commit is contained in:
18
lexer.cpp
18
lexer.cpp
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user