Skip to content

Parse errors carry line:col (#407, first increment)#438

Merged
InauguralPhysicist merged 1 commit into
mainfrom
feat/error-columns-407
Jul 5, 2026
Merged

Parse errors carry line:col (#407, first increment)#438
InauguralPhysicist merged 1 commit into
mainfrom
feat/error-columns-407

Conversation

@InauguralPhysicist

Copy link
Copy Markdown
Collaborator

What

The lexer already tracked columns on every token; the parser threw them away. This surfaces them:

  • Human: Parse error line 6:9: expected ':', got newline
  • --lint --json: the E002 element gains a 1-based "column" field
  • LSP: the diagnostic range now starts at that column instead of 0

How (no blast radius)

Threaded via a new eigs_record_first_error_at(line, col, msg) — only the two parser emitters opt in. The 2-arg eigs_record_first_error (12 other callers in compiler/lexer) delegates with col=0, so nothing else changes. New g_first_error_col state field + bridge macro.

Contract + tests

docs/DIAGNOSTICS.md records the --json contract change (E002 gains "column"). test_lint.sh asserts both the human line:col and the E002 "column". One examples/errors/ expectation updated to the new format (it was the only test pinning the old line N: string).

Scope

This is the first increment of #407. Per-warning column spans, runtime-error columns, and caret/underline rendering remain — hence Advances, not Closes.

Gates: suite 2519/2519; ASan clean; LSP-ASan 64/64 (eigenlsp range change).

Advances #407

🤖 Generated with Claude Code

The lexer already tracked columns on every token; the parser threw them away.
Now the two parser diagnostics surface them:

- human output: `Parse error line 6:9: expected ':', got newline`;
- `--lint --json`: the `E002` element gains a 1-based `"column"` field;
- the LSP diagnostic range starts at that column instead of 0.

Threaded via a new `eigs_record_first_error_at(line, col, msg)` so only the
parser opts in — the 2-arg `eigs_record_first_error` (12 other callers,
compiler/lexer) delegates with col=0, no blast radius. New `g_first_error_col`
state field + bridge macro.

docs/DIAGNOSTICS.md records the `--json` contract change; test_lint.sh asserts
both the human `line:col` and the E002 `"column"`. Per-warning spans,
runtime-error columns, and caret rendering are the rest of #407.

Suite 2519/2519; ASan + LSP-ASan (64/64) clean.

Advances #407

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@InauguralPhysicist InauguralPhysicist merged commit b52191c into main Jul 5, 2026
16 of 17 checks passed
@InauguralPhysicist InauguralPhysicist deleted the feat/error-columns-407 branch July 5, 2026 05:06
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