Consume one comment starting at the cursor; false if there is none. */
| 122 | |
| 123 | /* Consume one comment starting at the cursor; false if there is none. */ |
| 124 | static bool sqlv_skip_comment(sqlv_scan_t *sc) { |
| 125 | char c = sqlv_at(sc, 0); |
| 126 | char n = sqlv_at(sc, 1); |
| 127 | if ((c == '-' && n == '-') || c == '#') { |
| 128 | while (sc->i < sc->len && sc->s[sc->i] != '\n') { |
| 129 | sqlv_step(sc); |
| 130 | } |
| 131 | return true; |
| 132 | } |
| 133 | if (c == '/' && n == '*') { |
| 134 | sqlv_step(sc); |
| 135 | sqlv_step(sc); |
| 136 | while (sc->i < sc->len && !(sc->s[sc->i] == '*' && sqlv_at(sc, 1) == '/')) { |
| 137 | sqlv_step(sc); |
| 138 | } |
| 139 | if (sc->i < sc->len) { |
| 140 | sqlv_step(sc); |
| 141 | sqlv_step(sc); |
| 142 | } |
| 143 | return true; |
| 144 | } |
| 145 | return false; |
| 146 | } |
| 147 | |
| 148 | /* Skip whitespace and comments. *ws_only (optional) is cleared if a comment was |
| 149 | * among them. */ |
no test coverage detected