Skip to content

Commit

Permalink
Allow terminating "," in case_clauses
Browse files Browse the repository at this point in the history
  • Loading branch information
theHamsta committed Dec 14, 2021
1 parent e0ab4cd commit 3c903f0
Show file tree
Hide file tree
Showing 4 changed files with 27,516 additions and 23,449 deletions.
2 changes: 2 additions & 0 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,12 +259,14 @@ module.exports = grammar({
match_statement: $ => seq(
'match',
field('subject', $.expression),
optional(','),
':',
repeat(field('alternative', $.case_clause))),

case_clause: $ => seq(
'case',
commaSep1(field('pattern', choice($.expression, $.list_splat_pattern))),
optional(','),
optional($.if_clause),
':',
field('consequence', $._suite)
Expand Down
12 changes: 12 additions & 0 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,18 @@
}
]
},
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": ","
},
{
"type": "BLANK"
}
]
},
{
"type": "CHOICE",
"members": [
Expand Down
Loading

0 comments on commit 3c903f0

Please sign in to comment.