Skip to content

feat(diagnostics): source excerpt + caret for column-carrying parse errors (#407 increment 2)#466

Merged
InauguralPhysicist merged 2 commits into
mainfrom
fix-407-caret-increment
Jul 7, 2026
Merged

feat(diagnostics): source excerpt + caret for column-carrying parse errors (#407 increment 2)#466
InauguralPhysicist merged 2 commits into
mainfrom
fix-407-caret-increment

Conversation

@InauguralPhysicist

Copy link
Copy Markdown
Collaborator

First-hour-experience increment of #407: the column-carrying parse errors now underline the offending column.

Parse error line 1:9: expected ':', got newline
     1 | if x > 0
       |         ^
1 parse error(s) — aborting
  • Wired in the script runner, --lint, and the REPL (callers register the unit's raw source around parse(); eval/import/LSP parse paths unchanged — no source registered, no excerpt).
  • Additive by contract: the Parse error line N:C: ... message line is byte-unchanged, so every substring assertion (EM checks, consumer greps, test_lint E002) keeps working. Tab alignment preserved; >200-char lines truncate.
  • EM24/EM25 pin the excerpt line and the caret column; DIAGNOSTICS.md example updated.
  • Remaining Runtime-error carets + token-precise LSP ranges (residual of #407) #407 scope (per-warning spans, runtime-error columns, LSP token-precise ranges) stays open on the issue — this is increment two of the arc, not the close.

Gates: release 2596/2596, ASan+UBSan detect_leaks=1 2596/2596.

Part of #407

🤖 Generated with Claude Code

…rrors (#407 increment 2)

The two structured parse-error sites (expected-X-got-Y and the #326
one-statement-per-line check) now print a one-line source excerpt with a
caret under the offending column, in the script runner, --lint, and the
REPL (callers register the unit's raw source around parse; eval/import/
LSP paths stay unchanged — NULL source, no excerpt). Additive by design:
the 'Parse error line N:C: ...' message is byte-unchanged, so every
substring-matching test and consumer grep keeps working; tab alignment
preserved in the caret line; pathological lines truncate at 200 chars.

Remaining #407 scope (per-warning spans, runtime-error columns) stays
open on the issue.

EM24/EM25 pin the excerpt and the caret column. Gates: release
2596/2596, ASan+UBSan detect_leaks=1 2596/2596.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The mini-libc has fprintf but no fputc — the freestanding symbol gate
caught it (stage 2: one non-HAL residue). col <= 200 by the excerpt
guards, so a stack pad buffer + single fprintf is exact.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@InauguralPhysicist InauguralPhysicist merged commit 16617d7 into main Jul 7, 2026
17 checks passed
@InauguralPhysicist InauguralPhysicist deleted the fix-407-caret-increment branch July 7, 2026 04:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant