mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 22:09:09 +00:00
parse and format pattern as
This commit is contained in:
parent
ea53a50447
commit
e9196f3c0b
13 changed files with 189 additions and 7 deletions
|
@ -702,6 +702,12 @@ pub enum Pattern<'a> {
|
|||
/// Can only occur inside of a [Pattern::List]
|
||||
ListRest,
|
||||
|
||||
As(
|
||||
&'a Loc<Pattern<'a>>,
|
||||
&'a [CommentOrNewline<'a>],
|
||||
Loc<&'a str>,
|
||||
),
|
||||
|
||||
// Space
|
||||
SpaceBefore(&'a Pattern<'a>, &'a [CommentOrNewline<'a>]),
|
||||
SpaceAfter(&'a Pattern<'a>, &'a [CommentOrNewline<'a>]),
|
||||
|
@ -934,6 +940,12 @@ impl<'a> Pattern<'a> {
|
|||
}
|
||||
}
|
||||
ListRest => matches!(other, ListRest),
|
||||
As(pattern, _, identifier) => match other {
|
||||
As(other_pattern, _, other_identifier) => {
|
||||
identifier == other_identifier && pattern.value.equivalent(&other_pattern.value)
|
||||
}
|
||||
_ => false,
|
||||
},
|
||||
MalformedIdent(str_x, _) => {
|
||||
if let MalformedIdent(str_y, _) = other {
|
||||
str_x == str_y
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue