mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
finish parsing named underscores
This commit is contained in:
parent
0088080636
commit
1e7dcaebd8
2 changed files with 8 additions and 10 deletions
|
@ -1089,14 +1089,12 @@ fn underscore_pattern<'a>() -> impl Parser<'a, Pattern<'a>> {
|
|||
move |arena: &'a Bump, state: State<'a>| {
|
||||
let (_, next_state) = ascii_char(b'_').parse(arena, state)?;
|
||||
|
||||
let (output, final_state) = lowercase_ident().parse(arena, next_state)?;
|
||||
let (output, final_state) = optional(lowercase_ident()).parse(arena, next_state)?;
|
||||
|
||||
let mut name = String::new_in(arena);
|
||||
|
||||
name.push('_');
|
||||
name.push_str(output);
|
||||
|
||||
Ok((Pattern::Underscore(&"_"), final_state))
|
||||
match output {
|
||||
Some(name) => Ok((Pattern::Underscore(name), final_state)),
|
||||
None => Ok((Pattern::Underscore(&"_"), final_state)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue