some TODOs removed..
This commit is contained in:
15
lexer.cpp
15
lexer.cpp
@@ -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 == "+")
|
||||
|
||||
Reference in New Issue
Block a user