some TODOs removed..

This commit is contained in:
2021-08-14 11:33:02 +02:00
parent 6921421a65
commit 4665705c3d
10 changed files with 113 additions and 78 deletions

View File

@@ -22,16 +22,15 @@ namespace usql {
}
void Lexer::parse(const std::string &code) {
// TODO handle empty code
m_tokens.clear();
if (code.empty())
throw Exception("empty code");
m_tokens.clear();
m_tokens.reserve(64);
// PERF something like this to preallocate ??
if (code.size() > 100) {
m_tokens.reserve(code.size() / 10);
}
m_code_str = code;
if (!m_code_str.empty() && m_code_str.back() != '\n') {
m_code_str.append("\n"); // TODO temp solution to prevent possible situation when last line is a comment
m_code_str.append("\n"); // temp solution to prevent possible situation when last line is a comment
}
auto words_begin = std::sregex_iterator(m_code_str.begin(), m_code_str.end(), k_words_regex);
@@ -116,7 +115,7 @@ namespace usql {
}
TokenType Lexer::type(const std::string &token) {
// TODO, FIXME 'one is evaluated as identifier
// FIXME 'one is evaluated as identifier
if (token == ";")
return TokenType::semicolon;
if (token == "+")