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

@ -37,7 +37,7 @@ impl<'a> Formattable<'a> for Pattern<'a> {
| Pattern::NonBase10Literal { .. }
| Pattern::FloatLiteral(_)
| Pattern::StrLiteral(_)
| Pattern::Underscore
| Pattern::Underscore(_)
| Pattern::Malformed(_)
| Pattern::QualifiedIdentifier { .. } => false,
}
@ -128,7 +128,7 @@ impl<'a> Formattable<'a> for Pattern<'a> {
StrLiteral(literal) => {
todo!("Format string literal: {:?}", literal);
}
Underscore => buf.push('_'),
Underscore(name) => buf.push_str(name),
// Space
SpaceBefore(sub_pattern, spaces) => {