$tag$ ... $tag$ (PostgreSQL). Returns false, consuming nothing, when the `$` * does not open a dollar quote ($1 parameters, a lone $). */
| 92 | /* $tag$ ... $tag$ (PostgreSQL). Returns false, consuming nothing, when the `$` |
| 93 | * does not open a dollar quote ($1 parameters, a lone $). */ |
| 94 | static bool sqlv_skip_dollar(sqlv_scan_t *sc) { |
| 95 | uint32_t t = sc->i + 1; |
| 96 | if (t < sc->len && isdigit((unsigned char)sc->s[t])) { |
| 97 | return false; |
| 98 | } |
| 99 | while (t < sc->len && sc->s[t] != '$' && sqlv_word_char(sc->s[t])) { |
| 100 | t++; |
| 101 | } |
| 102 | if (t >= sc->len || sc->s[t] != '$') { |
| 103 | return false; |
| 104 | } |
| 105 | uint32_t tag_len = t - sc->i + 1; /* the opener, both dollars included */ |
| 106 | const char *tag = sc->s + sc->i; |
| 107 | for (uint32_t k = 0; k < tag_len; k++) { |
| 108 | sqlv_step(sc); |
| 109 | } |
| 110 | while (sc->i < sc->len) { |
| 111 | if (sc->s[sc->i] == '$' && sc->len - sc->i >= tag_len && |
| 112 | memcmp(sc->s + sc->i, tag, tag_len) == 0) { |
| 113 | for (uint32_t k = 0; k < tag_len; k++) { |
| 114 | sqlv_step(sc); |
| 115 | } |
| 116 | return true; |
| 117 | } |
| 118 | sqlv_step(sc); |
| 119 | } |
| 120 | return true; |
| 121 | } |
| 122 | |
| 123 | /* Consume one comment starting at the cursor; false if there is none. */ |
| 124 | static bool sqlv_skip_comment(sqlv_scan_t *sc) { |
no test coverage detected