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

Add type grammar #89

Merged
merged 1 commit into from Mar 29, 2024
Merged

Add type grammar #89

merged 1 commit into from Mar 29, 2024

Conversation

314eter
Copy link
Collaborator

@314eter 314eter commented Mar 23, 2024

Closes #84.

}
})

// Make 'type' the first rule
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need this extra magic?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Without this, we'd have to reuse the compilation_unit entrypoint of the ocaml grammar, so 'a would be parsed as

(compilation_unit (type_variable))

instead of

(type (type_variable))

The tree-sitter extension mechanism is not really made for changing the entrypoint of a grammar, but for overriding some rules to create a variation of the same grammar.

@314eter 314eter merged commit 61110c1 into tree-sitter:master Mar 29, 2024
17 checks passed
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.

Allow standalone type expressions
2 participants