mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 05:49:08 +00:00
Parse !
suffixes as an Expr::TaskAwaitBang instead of using suffix field in ident
This commit is contained in:
parent
4b4aee3c1a
commit
6080c12ca8
8 changed files with 94 additions and 89 deletions
|
@ -388,6 +388,12 @@ impl<'a> Accessor<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
||||
pub enum Suffix<'a> {
|
||||
Accessor(Accessor<'a>),
|
||||
TaskAwaitBang,
|
||||
}
|
||||
|
||||
/// a `.foo` or `.1` accessor function
|
||||
fn chomp_accessor(buffer: &[u8], pos: Position) -> Result<Accessor, BadIdent> {
|
||||
// assumes the leading `.` has been chomped already
|
||||
|
@ -529,16 +535,16 @@ fn chomp_identifier_chain<'a>(
|
|||
chomped += width as usize;
|
||||
|
||||
// Parse any `!` suffixes
|
||||
let mut suffixed = 0;
|
||||
while let Ok((ch, width)) = char::from_utf8_slice_start(&buffer[chomped..]) {
|
||||
if ch == '!' {
|
||||
suffixed += 1;
|
||||
chomped += width;
|
||||
} else {
|
||||
// we're done
|
||||
break;
|
||||
}
|
||||
}
|
||||
let suffixed = 0;
|
||||
// while let Ok((ch, width)) = char::from_utf8_slice_start(&buffer[chomped..]) {
|
||||
// if ch == '!' {
|
||||
// suffixed += 1;
|
||||
// chomped += width;
|
||||
// } else {
|
||||
// // we're done
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
let ident = Ident::Access {
|
||||
module_name,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue