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

Tree-sitter grammar: support Function Type Reference #5373

Merged
merged 4 commits into from
May 19, 2024

Conversation

OceanOak
Copy link
Collaborator

@OceanOak OceanOak commented May 19, 2024

Changelog:

Tree-sitter-darklang
- Update the grammar to support function type reference

#5321

@OceanOak OceanOak marked this pull request as ready for review May 19, 2024 09:10
Comment on lines +861 to +874
fn_type_reference: $ =>
prec.right(
seq(
$.type_reference,
repeat1(
prec.left(
seq(
field("symbol_arrow", alias("->", $.symbol)),
$.type_reference,
),
),
),
),
),
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 fit more naturally like this:

Suggested change
fn_type_reference: $ =>
prec.right(
seq(
$.type_reference,
repeat1(
prec.left(
seq(
field("symbol_arrow", alias("->", $.symbol)),
$.type_reference,
),
),
),
),
),
fn_type_reference: $ =>
prec.right(
seq(
repeat1(
prec.left(
seq(
$.type_reference,
field("symbol_arrow", alias("->", $.symbol)),
),
),
),
$.type_reference,
),
),

Feel free to disregard or leave for another PR, though

Copy link
Member

@StachuDotNet StachuDotNet left a comment

Choose a reason for hiding this comment

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

I'll merge as-is; if you'd like to refactor to the suggested grammar change, OK to do so in a follow-up PR. Maybe just adding a cleanup note would be good :)

@StachuDotNet StachuDotNet merged commit 68f05dc into darklang:main May 19, 2024
9 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.

2 participants