Commit 5f21a7c
⚡ Bolt: Zero-allocation string evaluation for DelimTokenType and expected matching
Refactored `DelimTokenType` and `Tokenizer` logic to eliminate redundant `String` allocations during token identification and checking.
- Introduced `as_str()` returning `&'static str` for `DelimTokenType` variants.
- Refactored `check_op` and `fmt::Display` to use `as_str()` instead of `string()`.
- Refactored `Tokenizer::expect` to use `as_str()` without changing its token consumption semantics.
- Added tests to preserve `check_op` and `Tokenizer::expect` coverage.
Co-authored-by: ashyanSpada <22587148+ashyanSpada@users.noreply.github.com>1 parent 7c210fe commit 5f21a7c
1 file changed
Lines changed: 14 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
57 | 56 | | |
58 | 57 | | |
59 | 58 | | |
| |||
67 | 66 | | |
68 | 67 | | |
69 | 68 | | |
70 | | - | |
71 | 69 | | |
72 | 70 | | |
73 | 71 | | |
| |||
281 | 279 | | |
282 | 280 | | |
283 | 281 | | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
284 | 296 | | |
285 | 297 | | |
286 | 298 | | |
| |||
0 commit comments