| 88 | } |
| 89 | |
| 90 | static void lex_push_n(cbm_lex_result_t *r, cbm_token_type_t type, const char *start, size_t len, |
| 91 | int pos) { |
| 92 | if (r->count >= r->capacity) { |
| 93 | r->capacity = r->capacity ? r->capacity * PAIR_LEN : CBM_SZ_32; |
| 94 | r->tokens = safe_realloc(r->tokens, r->capacity * sizeof(cbm_token_t)); |
| 95 | } |
| 96 | r->tokens[r->count++] = |
| 97 | (cbm_token_t){.type = type, .text = heap_strndup(start, len), .pos = pos}; |
| 98 | } |
| 99 | |
| 100 | /* Parse a string literal (with escape handling) into the token list. |
| 101 | * *pos points at the character after the opening quote; updated past closing quote. */ |
no test coverage detected