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

Function lex_try_number

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

317
318/* Try to lex a number starting at position i. Returns true if matched. */
319static bool lex_try_number(const char *input, int len, int *i, cbm_lex_result_t *out) {
320 char c = input[*i];
321 if (!isdigit((unsigned char)c) &&
322 !(c == '.' && *i + SKIP_ONE < len && isdigit((unsigned char)input[*i + SKIP_ONE]))) {
323 return false;
324 }
325 int start = *i;
326 while (*i < len && (isdigit((unsigned char)input[*i]) ||
327 (input[*i] == '.' && *i + SKIP_ONE < len && input[*i + SKIP_ONE] != '.'))) {
328 (*i)++;
329 }
330 lex_push_n(out, TOK_NUMBER, input + start, *i - start, start);
331 return true;
332}
333
334/* Skip whitespace and comments. Returns true if something was skipped. */
335static 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