Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove FieldKind from DSL v2 #687

Merged

Conversation

OmarTawfik
Copy link
Contributor

Makes the grammar a lot simpler, since it is no longer needed after enums were simplified in #610

Copy link

changeset-bot bot commented Dec 2, 2023

⚠️ No Changeset found

Latest commit: c9bb63f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@OmarTawfik OmarTawfik force-pushed the remove-field-kinds-from-dsl branch from 18b0386 to 8018cea Compare December 3, 2023 14:36
@OmarTawfik OmarTawfik marked this pull request as ready for review December 3, 2023 14:36
@OmarTawfik OmarTawfik requested a review from a team as a code owner December 3, 2023 14:36
@OmarTawfik OmarTawfik enabled auto-merge December 3, 2023 14:36
Makes the grammar a lot simpler, since it is no longer needed after enums were simplified in NomicFoundation#610
@OmarTawfik OmarTawfik force-pushed the remove-field-kinds-from-dsl branch from 8018cea to 427b8b8 Compare December 4, 2023 12:14
Copy link
Contributor

@Xanewok Xanewok left a comment

Choose a reason for hiding this comment

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

Left one question, otherwise looks good. Thanks for keeping the old MemberAccess!

)]
operators = [
PrecedenceOperator(
model = BinaryLeftAssociative,
Copy link
Contributor

Choose a reason for hiding this comment

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

We introduced UsingOperator above for cases like these (and below). Should we do it here as well?

Copy link
Contributor Author

@OmarTawfik OmarTawfik Dec 4, 2023

Choose a reason for hiding this comment

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

UsingOperator is used in a comma separated list, and it means something on its own.

The others here are part of a parent expression, and I didn't want to wrap it in an unnecessary parent. It cannot exist in any other place in the grammar.

WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

Do you mean UsingDeconstructionSymbol? UsingOperator was introduced in this PR IIUC and only used in UsingAlias.

I agree with the unnecessary wrapping argument though. The win in this PR was to remove the redundant Required/Optional elsewhere but in cases like these we're replacing 15 lines with 50. Do you think we could simplify this somehow in the future?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My bad. I mixed the two. I think this change made the syntax more coincise in the 98% of the cases, and worth it to sacrifice a few extra lines in the remaining 2%. As far as the output is concerned, it will eventually be identical (once migration is complete).

But happy to reconsider if you feel otherwise.

@OmarTawfik OmarTawfik requested a review from Xanewok December 4, 2023 14:55
Copy link
Contributor

@Xanewok Xanewok left a comment

Choose a reason for hiding this comment

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

LGTM, left a comment about a possible future improvement. Thanks!

)]
operators = [
PrecedenceOperator(
model = BinaryLeftAssociative,
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you mean UsingDeconstructionSymbol? UsingOperator was introduced in this PR IIUC and only used in UsingAlias.

I agree with the unnecessary wrapping argument though. The win in this PR was to remove the redundant Required/Optional elsewhere but in cases like these we're replacing 15 lines with 50. Do you think we could simplify this somehow in the future?

@OmarTawfik OmarTawfik added this pull request to the merge queue Dec 4, 2023
Merged via the queue into NomicFoundation:main with commit 0e38580 Dec 4, 2023
1 check passed
@OmarTawfik OmarTawfik deleted the remove-field-kinds-from-dsl branch December 4, 2023 20:17
github-merge-queue bot pushed a commit that referenced this pull request Dec 9, 2023
Part of #638

This PR:
- Removes the `PrecedenceExpression::rule_name` in favour of using the
name directly for its rule/node kind
- Deduplicates the individual precedence expressions in the parser
codegen (regressed in
#687 (comment))
- Allows to parse individual precedence expressions and adds rule kinds
for them
- ... so we can remove `ProductionKind` in favour of the now-complete
`RuleKind`

I can split this up but since all of this is interconnected, it made
sense to work on them at the same time and submit work that solves all
of the aforementioned issues.

---------

Co-authored-by: Omar Tawfik <[email protected]>
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