feat(parse): support capturing a str in Pattern::Underscore

This commit is contained in:
rvcas 2020-11-17 21:53:49 -05:00
parent ce67f28c42
commit 8df5d5c13c
5 changed files with 15 additions and 12 deletions

View file

@ -437,7 +437,7 @@ pub enum Pattern<'a> {
},
FloatLiteral(&'a str),
StrLiteral(StrLiteral<'a>),
Underscore,
Underscore(&'a str),
// Space
SpaceBefore(&'a Pattern<'a>, &'a [CommentOrNewline<'a>]),
@ -554,7 +554,8 @@ impl<'a> Pattern<'a> {
) => string_x == string_y && base_x == base_y && is_negative_x == is_negative_y,
(FloatLiteral(x), FloatLiteral(y)) => x == y,
(StrLiteral(x), StrLiteral(y)) => x == y,
(Underscore, Underscore) => true,
// TODO do we want to compare anything here?
(Underscore(_), Underscore(_)) => true,
// Space
(SpaceBefore(x, _), SpaceBefore(y, _)) => x.equivalent(y),