Skip to content

Commit

Permalink
Refactor to trailingCommaSep1
Browse files Browse the repository at this point in the history
  • Loading branch information
eed3si9n committed Dec 15, 2024
1 parent 690838e commit 709057b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -1072,14 +1072,17 @@ module.exports = grammar({
// TODO: Flatten this.
alternative_pattern: $ => prec.left(-2, seq($._pattern, "|", $._pattern)),

tuple_pattern: $ => seq("(", $._pattern, repeat(seq(",", $._pattern)), ")"),
tuple_pattern: $ => seq(
"(",
trailingCommaSep1($._pattern),
")",
),

named_pattern: $ => prec.left(-1, seq($._identifier, "=", $._pattern)),

named_tuple_pattern: $ => seq(
"(",
$.named_pattern,
repeat(seq(",", $.named_pattern)),
trailingCommaSep1($.named_pattern),
")",
),

Expand Down

0 comments on commit 709057b

Please sign in to comment.