fix(quarto-parse-errors): point Q-2-12 'opening *' note at the delimiter (bd-1lpkx)#245
Merged
Merged
Conversation
…ter (bd-1lpkx) For an unclosed single-star emphasis, the "This is the opening '*' mark." diagnostic detail underlined the word preceding the '*' instead of the '*' itself, off by len(preceding word). Root cause is corpus data, not the matcher. The error machinery records, per capture, the (lr_state, sym) of the tree-sitter token at the capture's (row, column, size) in the example, then resolves it at runtime via find_matching_token. Q-2-12.json's "simple" case (content "a *") placed the emphasis-start capture at column 0 — the "a" text run — so the generated table recorded pandoc_str_token1 for every simple-N variant, and the runtime matcher walked back to the most recent text run (the preceding word). Fix: move the capture to column 1, size 2 — the " *" emphasis_delimiter token (the note already sets trimLeadingSpace/trimTrailingSpace, collapsing the span onto the '*'). This mirrors the already-correct stray-ending-star case. Regenerated _autogen-table.json: all 32 Q-2-12 captures now record emphasis_delimiter (0 pandoc_str_token1); the regeneration diff is Q-2-12-only. Scope is narrower than the original triage assumed (verified end-to-end): Q-2-13 (**) and Q-2-5 (_) already point their opening notes at the delimiter in the simple case and need no change. Adds test_emphasis_opening_mark regression test (drives pampa::readers::qmd::read): 'hello world *baz' -> opening detail at byte 12; 'foo *bar' -> byte 4. Failed pre-fix at byte 6 (start of "world"). No snapshot or case-file churn. cargo nextest -p pampa (3776), --workspace (9484), and cargo xtask verify --skip-hub-build all pass. 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.
Summary
For an unclosed single-star emphasis, the
This is the opening '*' mark.diagnostic detail underlined the word preceding the*instead of the*itself (off bylen(preceding word)):Root cause
A corpus-data bug, not the matcher. The error machinery records, per capture, the
(lr_state, sym)of the tree-sitter token at the capture's(row, column, size)in the example, then resolves it at runtime viafind_matching_token.Q-2-12.json'ssimplecase (content"a *") placed theemphasis-startcapture at column 0 — theatext run — so the generated table recordedpandoc_str_token1for everysimple-Nvariant, and the runtime matcher walked back to the most recent text run (the preceding word).Fix
Move the capture to column 1, size 2 — the
" *"emphasis_delimitertoken (the note already setstrimLeadingSpace/trimTrailingSpace, collapsing the span onto the*). This mirrors the already-correctstray-ending-starcase.Regenerated
_autogen-table.json: all 32Q-2-12captures now recordemphasis_delimiter(0pandoc_str_token1). The regeneration diff is Q-2-12-only; no snapshot or case-file churn.Scope (narrower than first assumed)
Verified end-to-end that
Q-2-13(**) andQ-2-5(_) already point their opening notes at the delimiter in the simple case — no change needed.Tests
Adds
test_emphasis_opening_mark(drives the realpampa::readers::qmd::readpath):hello world *baz→ opening detail at byte 12 (the*)foo *bar→ byte 4Failed pre-fix at byte 6 (start of
"world"); passes post-fix.Verification
cargo nextest run -p pampa— 3776 passedcargo nextest run --workspace— 9484 passedcargo xtask verify --skip-hub-build— all steps passedmain*🤖 Generated with Claude Code