Skip to content

Make comma-list parsing really robust#403

Merged
mcy merged 5 commits intomainfrom
mcy/parse-expr-followups
Jan 9, 2025
Merged

Make comma-list parsing really robust#403
mcy merged 5 commits intomainfrom
mcy/parse-expr-followups

Conversation

@mcy
Copy link
Member

@mcy mcy commented Dec 19, 2024

This PR adds more diagnostics for comma-delimited list of types and expressions, and ensures that commas are optional pretty much everywhere for generating a valid AST, while at the same time diagnosing all missing and extraneous commas. This ensures a match with the behavior advertised in #393.

Includes a test that exercises various corner cases.

This PR also adds Span.RuneRange and Span.Rune, to aid in constructing suggestion spans.

@mcy mcy requested a review from jhump December 19, 2024 20:29
@mcy mcy requested a review from jhump January 7, 2025 20:06
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be worth a TODO since editions uses identifiers instead of strings for reserved field names. So this means that reserved foo, bar baz will treat baz as a new decl, which is less than ideal.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Figured out a way to resolve this w/o affecting the happy path.

@mcy mcy enabled auto-merge (squash) January 9, 2025 17:59
@mcy mcy merged commit 0baecbe into main Jan 9, 2025
7 checks passed
@mcy mcy deleted the mcy/parse-expr-followups branch January 9, 2025 18:03
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.

2 participants