MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / sqlv_skip_dollar

Function sqlv_skip_dollar

internal/cbm/sql_values.c:94–121  ·  view source on GitHub ↗

$tag$ ... $tag$ (PostgreSQL). Returns false, consuming nothing, when the `$` * does not open a dollar quote ($1 parameters, a lone $). */

Source from the content-addressed store, hash-verified

92/* $tag$ ... $tag$ (PostgreSQL). Returns false, consuming nothing, when the `$`
93 * does not open a dollar quote ($1 parameters, a lone $). */
94static 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. */
124static bool sqlv_skip_comment(sqlv_scan_t *sc) {

Callers 1

sqlv_skip_any_quotedFunction · 0.85

Calls 2

sqlv_word_charFunction · 0.85
sqlv_stepFunction · 0.85

Tested by

no test coverage detected