mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 19:58:18 +00:00
Parse list patterns
This commit is contained in:
parent
02a76bb8bd
commit
4d35ab9957
10 changed files with 305 additions and 7 deletions
|
@ -40,7 +40,10 @@ impl<'a> Formattable for Pattern<'a> {
|
|||
| Pattern::Underscore(_)
|
||||
| Pattern::Malformed(_)
|
||||
| Pattern::MalformedIdent(_, _)
|
||||
| Pattern::QualifiedIdentifier { .. } => false,
|
||||
| Pattern::QualifiedIdentifier { .. }
|
||||
| Pattern::ListRest => false,
|
||||
|
||||
Pattern::List(patterns) => patterns.iter().any(|p| p.is_multiline()),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -158,6 +161,8 @@ impl<'a> Formattable for Pattern<'a> {
|
|||
buf.push('_');
|
||||
buf.push_str(name);
|
||||
}
|
||||
List(..) => todo!(),
|
||||
ListRest => todo!(),
|
||||
|
||||
// Space
|
||||
SpaceBefore(sub_pattern, spaces) => {
|
||||
|
|
|
@ -748,7 +748,9 @@ impl<'a> RemoveSpaces<'a> for Pattern<'a> {
|
|||
}
|
||||
Pattern::SpaceBefore(a, _) => a.remove_spaces(arena),
|
||||
Pattern::SpaceAfter(a, _) => a.remove_spaces(arena),
|
||||
Pattern::SingleQuote(a) => Pattern::NumLiteral(a),
|
||||
Pattern::SingleQuote(a) => Pattern::SingleQuote(a),
|
||||
Pattern::List(pats) => Pattern::List(pats.remove_spaces(arena)),
|
||||
Pattern::ListRest => Pattern::ListRest,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue