Skip to content

Commit bdf057c

Browse files
calixtemanmaxbrunsfeld
authored andcommitted
Range pattern can contain ..= #46
1 parent 89b43dc commit bdf057c

File tree

4 files changed

+36048
-35984
lines changed

4 files changed

+36048
-35984
lines changed

corpus/patterns.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ match x {
109109
a @ 1 ... 5 => a,
110110
Some(1 ... 5) => a,
111111
a @ b...c => a,
112+
a @ b..=c => a,
112113
}
113114

114115
---
@@ -128,6 +129,9 @@ match x {
128129
(match_pattern
129130
(tuple_struct_pattern (identifier) (range_pattern (integer_literal) (integer_literal))))
130131
(identifier))
132+
(match_arm
133+
(match_pattern (captured_pattern (identifier) (range_pattern (identifier) (identifier))))
134+
(identifier))
131135
(match_arm
132136
(match_pattern (captured_pattern (identifier) (range_pattern (identifier) (identifier))))
133137
(identifier)))))

grammar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1276,7 +1276,7 @@ module.exports = grammar({
12761276
$._literal_pattern,
12771277
$._path,
12781278
),
1279-
'...',
1279+
choice('...', '..='),
12801280
choice(
12811281
$._literal_pattern,
12821282
$._path,

src/grammar.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7446,8 +7446,17 @@
74467446
]
74477447
},
74487448
{
7449-
"type": "STRING",
7450-
"value": "..."
7449+
"type": "CHOICE",
7450+
"members": [
7451+
{
7452+
"type": "STRING",
7453+
"value": "..."
7454+
},
7455+
{
7456+
"type": "STRING",
7457+
"value": "..="
7458+
}
7459+
]
74517460
},
74527461
{
74537462
"type": "CHOICE",

0 commit comments

Comments
 (0)