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

Function lex_skip_whitespace_comments

src/cypher/cypher.c:327–356  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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

Callers 1

cbm_lexFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected