Parse errors carry line:col (#407, first increment)#438
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The lexer already tracked columns on every token; the parser threw them away. This surfaces them:
Parse error line 6:9: expected ':', got newline--lint --json: theE002element gains a 1-based"column"fieldHow (no blast radius)
Threaded via a new
eigs_record_first_error_at(line, col, msg)— only the two parser emitters opt in. The 2-argeigs_record_first_error(12 other callers in compiler/lexer) delegates withcol=0, so nothing else changes. Newg_first_error_colstate field + bridge macro.Contract + tests
docs/DIAGNOSTICS.mdrecords the--jsoncontract change (E002 gains"column").test_lint.shasserts both the humanline:coland theE002"column". Oneexamples/errors/expectation updated to the new format (it was the only test pinning the oldline 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