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

Function lex_skip_whitespace_comments

src/cypher/cypher.c:328–357  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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

Callers 1

cbm_lexFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected