| 395 | } |
| 396 | |
| 397 | static void sqlv_scan_file(sqlv_scan_t *sc, sqlv_ranges_t *ex) { |
| 398 | sqlv_stmt_t st = {false, false, 0}; |
| 399 | while (sc->i < sc->len && !ex->failed) { |
| 400 | if (sqlv_skip_comment(sc)) { |
| 401 | continue; |
| 402 | } |
| 403 | char c = sc->s[sc->i]; |
| 404 | if (sqlv_skip_any_quoted(sc)) { |
| 405 | st.started = true; |
| 406 | continue; |
| 407 | } |
| 408 | if (sqlv_word_char(c)) { |
| 409 | sqlv_on_word(sc, &st, ex); |
| 410 | continue; |
| 411 | } |
| 412 | if (c == ';') { |
| 413 | st = (sqlv_stmt_t){false, false, 0}; |
| 414 | } else if (c == '(') { |
| 415 | st.depth++; |
| 416 | } else if (c == ')' && st.depth > 0) { |
| 417 | st.depth--; |
| 418 | } |
| 419 | if (!isspace((unsigned char)c) && c != ';') { |
| 420 | st.started = true; |
| 421 | } |
| 422 | sqlv_step(sc); |
| 423 | } |
| 424 | } |
| 425 | |
| 426 | bool cbm_sql_values_kept_ranges(const char *src, uint32_t len, CBMSqlKeptRanges *out) { |
| 427 | out->items = NULL; |
no test coverage detected