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

Split type variables from definables in grammar #234

Open
dmitrii-ubskii opened this issue Oct 3, 2022 · 0 comments
Open

Split type variables from definables in grammar #234

dmitrii-ubskii opened this issue Oct 3, 2022 · 0 comments

Comments

@dmitrii-ubskii
Copy link
Member

dmitrii-ubskii commented Oct 3, 2022

Problem to Solve

Currently the variable_type and type_constraint parser rules are shared between the match and define queries. That leads to us requiring to perform extra validation during the construction of define and match query objects. A define query isn't allowed to contain variables, and, conversely, each pattern in a match query must contain a variable.

Proposed Solution

Have separate parser rules for variable-free definitions and variable-bound type constraints. E.g.:

- definable = { variable_type | schema_rule | schema_rule_declaration }
+ definable = { type_definition | schema_rule | schema_rule_declaration }
+ type_definition = { label ~ type_spec ~ ( "," ~ type_spec )* }
+ type_spec = { ABSTRACT | ... }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant