mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 21:39:07 +00:00
Implement tuple accessors after records/tuples
This commit is contained in:
parent
a1432d1a14
commit
56470c838d
9 changed files with 106 additions and 61 deletions
|
@ -100,6 +100,17 @@ pub fn lowercase_ident<'a>() -> impl Parser<'a, &'a str, ()> {
|
|||
}
|
||||
}
|
||||
|
||||
/// This is a tuple accessor, e.g. "1" in `.1`
|
||||
pub fn integer_ident<'a>() -> impl Parser<'a, &'a str, ()> {
|
||||
move |_, state: State<'a>, _min_indent: u32| match chomp_integer_part(state.bytes()) {
|
||||
Err(progress) => Err((progress, ())),
|
||||
Ok(ident) => {
|
||||
let width = ident.len();
|
||||
Ok((MadeProgress, ident, state.advance(width)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn tag_name<'a>() -> impl Parser<'a, &'a str, ()> {
|
||||
move |arena, state: State<'a>, min_indent: u32| {
|
||||
uppercase_ident().parse(arena, state, min_indent)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue