Skip to content

Commit

Permalink
fix: properly handle do in alternative bolcks
Browse files Browse the repository at this point in the history
  • Loading branch information
amaanq committed May 19, 2024
1 parent f25b8c5 commit a195747
Show file tree
Hide file tree
Showing 6 changed files with 283,482 additions and 282,915 deletions.
3 changes: 3 additions & 0 deletions bindings/rust/build.rs

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

15 changes: 12 additions & 3 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,10 @@ module.exports = grammar({
)),
optional($.tag),
field('condition', $.expression),
field('consequence', choice($.block, seq('do', $.statement))),
choice(
field('consequence', $.block),
seq('do', field('consequence', $.statement)),
),
repeat($.else_if_clause),
optional($.else_clause),
)),
Expand All @@ -384,12 +387,18 @@ module.exports = grammar({
';',
)),
field('condition', $.expression),
field('consequence', choice($.block)),
choice(
field('consequence', $.block),
seq('do', field('consequence', $.statement)),
),
),

else_clause: $ => seq(
'else',
field('consequence', $.block),
choice(
field('consequence', $.block),
seq('do', field('consequence', $.statement)),
),
),

when_statement: $ => prec.right(seq(
Expand Down
109 changes: 76 additions & 33 deletions src/grammar.json

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

10 changes: 3 additions & 7 deletions 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 a195747

Please sign in to comment.