Skip to content

Commit 841e2f5

Browse files
committed
feat: use $ to force a pattern
1 parent d7ac422 commit 841e2f5

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

grammar.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ module.exports = grammar({
4949

5050
supertypes: $ => [
5151
$.expr,
52-
$._pattern,
52+
$.pattern,
5353
$._type,
5454
],
5555

@@ -141,7 +141,17 @@ module.exports = grammar({
141141

142142
tuple_type: $ => tuple($._type, false),
143143

144-
_pattern: $ => choice(
144+
pattern: $ => choice(
145+
$.pat_type,
146+
$._pattern,
147+
),
148+
149+
_pattern: $ => seq(
150+
optional('$'),
151+
$._pat,
152+
),
153+
154+
_pat: $ => choice(
145155
$.underscore,
146156
$.pat_ident,
147157
),

0 commit comments

Comments
 (0)