Commit 5df9a6c
Fix index-out-of-range panic in wrapError at EOF (#272)
`wrapError` walks `p.lexer.input[i]` for `i < int(p.Pos())` to compute the
error line/column. At EOF `p.Pos()` can exceed `len(input)`, so on input like
`CREATE--` (a trailing comment leaves the position past the end) it panics
with "index out of range".
Clamp the loop bound to `len(p.lexer.input)`.
Add `CREATE--` to TestParser_InvalidSyntax to reproduce: it panicked before
the fix and now returns a proper error.
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>1 parent 4d7ccd6 commit 5df9a6c
2 files changed
Lines changed: 9 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
384 | 384 | | |
385 | 385 | | |
386 | 386 | | |
387 | | - | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
388 | 394 | | |
389 | 395 | | |
390 | 396 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
189 | | - | |
| 189 | + | |
| 190 | + | |
190 | 191 | | |
191 | 192 | | |
192 | 193 | | |
| |||
0 commit comments