test(cpp): tests para sql_parse, process_state_machine, file_poll_diff
This commit is contained in:
@@ -101,18 +101,25 @@ std::vector<SqlStatement> sql_parse(const std::string& input) {
|
||||
|
||||
switch (m) {
|
||||
case Mode::Normal:
|
||||
if (!stmt_has_content && !std::isspace(static_cast<unsigned char>(c))) {
|
||||
// marca inicio "real" de un statement (despues de skip ws/comments)
|
||||
stmt_line = cur_line;
|
||||
stmt_has_content = true;
|
||||
}
|
||||
if (c == '-' && n == '-') {
|
||||
m = Mode::LineComment;
|
||||
++i;
|
||||
if (n == '\n') ++cur_line; // (no aplica, n es '-')
|
||||
} else if (c == '/' && n == '*') {
|
||||
m = Mode::BlockComment;
|
||||
++i;
|
||||
} else if (!stmt_has_content && !std::isspace(static_cast<unsigned char>(c))) {
|
||||
// marca inicio "real" de un statement (despues de skip ws/comments)
|
||||
stmt_line = cur_line;
|
||||
stmt_has_content = true;
|
||||
// procesar el caracter actual abajo (no es comentario ni ws)
|
||||
if (c == '\'') m = Mode::SingleStr;
|
||||
else if (c == '"') m = Mode::DoubleStr;
|
||||
else if (c == '`') m = Mode::BackTick;
|
||||
else if (c == ';') {
|
||||
flush(i);
|
||||
stmt_start = i + 1;
|
||||
stmt_has_content = false;
|
||||
}
|
||||
} else if (c == '\'') {
|
||||
m = Mode::SingleStr;
|
||||
} else if (c == '"') {
|
||||
|
||||
Reference in New Issue
Block a user