Commit 1b024a4
🪤 fix(parser): handle EOF after augmented
## Summary
The proptest panic fuzzer (added in #133) found that token streams like
`1 not` panic the parser. In
`consume_binary_expression_left_associative`, when a `not` token was
consumed expecting an augmented operator (e.g. `not in`, `not ==`) and
the following token was missing, the error-construction path called
`require_current_token().expect("there has to be a token")` — which
panics on end-of-input.
## Changes
- `ndc_parser/src/parser.rs`: replace the panicking
`require_current_token().expect(...)` calls with a guarded match: emit
`Error::text("unexpected token …")` when a current token exists,
otherwise `Error::end_of_input` using the `not` token's span.
- `tests/proptest/tests/panic.regressions`: persisted seed that proptest
shrunk to `[2] 1 not`, so this case is locked in as a regression.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>not without panicking (#134)1 parent ee5ad8f commit 1b024a4
2 files changed
Lines changed: 13 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
183 | 182 | | |
184 | 183 | | |
185 | 184 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
0 commit comments