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

Function lex_try_number

src/cypher/cypher.c:312–325  ·  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

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

Callers 1

cbm_lexFunction · 0.85

Calls 1

lex_push_nFunction · 0.85

Tested by

no test coverage detected