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

Function lex_skip_whitespace_comments

src/cypher/cypher.c:335–364  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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

Callers 1

cbm_lexFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected