Skip to content

WIP: Validate node_choices and token_choices #1032

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

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Oct 27, 2022

The python files put structural restrictions on the allowed syntax node kinds for node_choices, token_choices and text_choices but we weren’t enforcing them anywhere during creation of raw nodes.

With #1010 we are actually making use of these restrictions and are failing if the invariant we impose on ourselves are not upheld, which caused #1025.

This is still very much WIP because most test cases are hitting one of the new assertion failures now.


Alternative/additional ideas:

  • We should also have something like SyntaxNodeChoices for raw nodes to enforce the structural node_choices constraints at compile time.
  • It would be really nice if we could also enforce the token_choices and text_choices constraints at compile time but I’m not sure if there’s a good way to model that.

@ahoppen
Copy link
Member Author

ahoppen commented Oct 27, 2022

Closing in favor of #1034

@ahoppen ahoppen closed this Oct 27, 2022
@ahoppen ahoppen deleted the ahoppen/validate-node-and-token-choices branch January 14, 2023 08:27
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.

1 participant