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

Function lex_skip_whitespace_comments

src/cypher/cypher.c:325–354  ·  view source on GitHub ↗

Skip whitespace and comments. Returns true if something was skipped. */

Source from the content-addressed store, hash-verified

323
324/* Skip whitespace and comments. Returns true if something was skipped. */
325static bool lex_skip_whitespace_comments(const char *input, int len, int *i) {
326 if (isspace((unsigned char)input[*i])) {
327 (*i)++;
328 return true;
329 }
330 if (*i + SKIP_ONE < len && input[*i] == '/' && input[*i + SKIP_ONE] == '/') {
331 while (*i < len && input[*i] != '\n') {
332 (*i)++;
333 }
334 return true;
335 }
336 /* SQL-style -- single-line comment */
337 if (*i + SKIP_ONE < len && input[*i] == '-' && input[*i + SKIP_ONE] == '-') {
338 while (*i < len && input[*i] != '\n') {
339 (*i)++;
340 }
341 return true;
342 }
343 if (*i + SKIP_ONE < len && input[*i] == '/' && input[*i + SKIP_ONE] == '*') {
344 *i += PAIR_LEN;
345 while (*i + SKIP_ONE < len && !(input[*i] == '*' && input[*i + SKIP_ONE] == '/')) {
346 (*i)++;
347 }
348 if (*i + SKIP_ONE < len) {
349 *i += PAIR_LEN;
350 }
351 return true;
352 }
353 return false;
354}
355
356int cbm_lex(const char *input, cbm_lex_result_t *out) {
357 memset(out, 0, sizeof(*out));

Callers 1

cbm_lexFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected