Skip to content

parser: extend Pratt error spans to cover subexpressions#50

Open
Franklin-Qi wants to merge 1 commit into
uutils:mainfrom
Franklin-Qi:feature-task#42-Parser-extend-spans-during-Pratt-parsing-for-better-error-report
Open

parser: extend Pratt error spans to cover subexpressions#50
Franklin-Qi wants to merge 1 commit into
uutils:mainfrom
Franklin-Qi:feature-task#42-Parser-extend-spans-during-Pratt-parsing-for-better-error-report

Conversation

@Franklin-Qi

Copy link
Copy Markdown
Contributor
  • Track an anchor at the start of each Pratt subexpression and report errors from that anchor through the offending token, instead of highlighting only the final token.

  • Apply this to assignment/index/place errors, prefix operators, unclosed parentheses and brackets, and related Pratt paths. Keep narrow spans for non-associative operators (e.g. chained = ).

  • Add unit tests that assert the highlighted source snippets for common parse failures.

Closes: #42

- Track an anchor at the start of each Pratt subexpression and report errors from that anchor through the offending token, instead of highlighting only the final token.

- Apply this to assignment/index/place errors, prefix operators, unclosed parentheses and brackets, and related Pratt paths. Keep narrow spans for non-associative operators (e.g. chained = ).

- Add unit tests that assert the highlighted source snippets for common parse failures.

Closes: uutils#42
@Alonely0

Copy link
Copy Markdown
Collaborator

At first glance, this looks great, ty! After merging the tests PR, there are some trivial merge conflicts, do you mind fixing them and rebasing? As with the other PR, I will review this on Friday or this weekend :)

@Alonely0 Alonely0 self-requested a review June 17, 2026 10:05
@Franklin-Qi

Copy link
Copy Markdown
Contributor Author

At first glance, this looks great, ty! After merging the tests PR, there are some trivial merge conflicts, do you mind fixing them and rebasing? As with the other PR, I will review this on Friday or this weekend :)

Thank you for your review. I would be happy to resolve this conflict.

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.

Parser: extend spans during Pratt parsing for better error reports.

2 participants