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

Function lex_try_number

src/cypher/cypher.c:311–324  ·  view source on GitHub ↗

Try to lex a number starting at position i. Returns true if matched. */

Source from the content-addressed store, hash-verified

309
310/* Try to lex a number starting at position i. Returns true if matched. */
311static bool lex_try_number(const char *input, int len, int *i, cbm_lex_result_t *out) {
312 char c = input[*i];
313 if (!isdigit((unsigned char)c) &&
314 !(c == '.' && *i + SKIP_ONE < len && isdigit((unsigned char)input[*i + SKIP_ONE]))) {
315 return false;
316 }
317 int start = *i;
318 while (*i < len && (isdigit((unsigned char)input[*i]) ||
319 (input[*i] == '.' && *i + SKIP_ONE < len && input[*i + SKIP_ONE] != '.'))) {
320 (*i)++;
321 }
322 lex_push_n(out, TOK_NUMBER, input + start, *i - start, start);
323 return true;
324}
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) {

Callers 1

cbm_lexFunction · 0.85

Calls 1

lex_push_nFunction · 0.85

Tested by

no test coverage detected