Support todo keywords with fast access.

This commit is contained in:
Tom Alexander 2023-09-14 02:24:06 -04:00
parent 830097b0a9
commit 32b19d68d0
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -44,9 +44,17 @@ pub(crate) fn todo_keywords<'s>(input: &'s str) -> Res<&'s str, (Vec<&'s str>, V
}
fn todo_keyword_word<'s>(input: &'s str) -> Res<&'s str, &'s str> {
verify(take_till(|c| " \t\r\n|".contains(c)), |result: &str| {
let (remaining, keyword) = verify(take_till(|c| "( \t\r\n|".contains(c)), |result: &str| {
!result.is_empty()
})(input)
})(input)?;
let (remaining, _) = opt(tuple((
tag("("),
take_till(|c| "() \t\r\n|".contains(c)),
tag(")"),
)))(remaining)?;
Ok((remaining, keyword))
}
#[cfg(test)]
mod tests {