Skip to content

Commit

Permalink
fix where clauses in type aliases and allow empty where clauses (#259)
Browse files Browse the repository at this point in the history
* parse where clauses in type identifiers before the =

* allow empty where clauses

* chore: tree-sitter generate
  • Loading branch information
m4rch3n1ng authored Mar 6, 2025
1 parent 5ebbba1 commit 5edb201
Show file tree
Hide file tree
Showing 5 changed files with 107,670 additions and 105,480 deletions.
7 changes: 5 additions & 2 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ module.exports = grammar({
'type',
field('name', $._type_identifier),
field('type_parameters', optional($.type_parameters)),
optional($.where_clause),
'=',
field('type', $._type),
optional($.where_clause),
Expand Down Expand Up @@ -465,8 +466,10 @@ module.exports = grammar({

where_clause: $ => prec.right(seq(
'where',
sepBy1(',', $.where_predicate),
optional(','),
optional(seq(
sepBy1(',', $.where_predicate),
optional(','),
)),
)),

where_predicate: $ => seq(
Expand Down
79 changes: 52 additions & 27 deletions src/grammar.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/node-types.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 5edb201

Please sign in to comment.