| 78 | } |
| 79 | |
| 80 | static void lex_push_n(cbm_lex_result_t *r, cbm_token_type_t type, const char *start, size_t len, |
| 81 | int pos) { |
| 82 | if (r->count >= r->capacity) { |
| 83 | r->capacity = r->capacity ? r->capacity * PAIR_LEN : CBM_SZ_32; |
| 84 | r->tokens = safe_realloc(r->tokens, r->capacity * sizeof(cbm_token_t)); |
| 85 | } |
| 86 | r->tokens[r->count++] = |
| 87 | (cbm_token_t){.type = type, .text = heap_strndup(start, len), .pos = pos}; |
| 88 | } |
| 89 | |
| 90 | /* Parse a string literal (with escape handling) into the token list. |
| 91 | * *pos points at the character after the opening quote; updated past closing quote. */ |
no test coverage detected