Parse ! suffixes as an Expr::TaskAwaitBang instead of using suffix field in ident

This commit is contained in:
Joshua Warner 2024-04-23 20:58:32 -07:00 committed by Luke Boswell
parent 4b4aee3c1a
commit 6080c12ca8
No known key found for this signature in database
GPG key ID: F6DB3C9DB47377B0
8 changed files with 94 additions and 89 deletions

View file

@ -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,