Skip to content

Commit

Permalink
fix: flat node structure for else if
Browse files Browse the repository at this point in the history
  • Loading branch information
ribru17 committed Mar 20, 2024
1 parent 371fd0b commit 5ee98ef
Show file tree
Hide file tree
Showing 5 changed files with 84,891 additions and 80,015 deletions.
8 changes: 8 additions & 0 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -824,11 +824,19 @@ module.exports = grammar({
'if',
field('condition', $.parenthesized_expression),
field('consequence', $._statement),
repeat(field('alternative', $.else_if_clause)),
optional(field('alternative', $.else_clause)),
)),

else_clause: $ => seq('else', $._statement),

else_if_clause: $ => prec(1, seq(
'else',
'if',
field('condition', $.parenthesized_expression),
field('consequence', $._statement),
)),

switch_statement: $ => seq(
'switch',
field('condition', $.parenthesized_expression),
Expand Down
44 changes: 44 additions & 0 deletions src/grammar.json

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

32 changes: 31 additions & 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 5ee98ef

Please sign in to comment.