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

Function lex_try_number

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

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