Implement the rematch target parser.
This commit is contained in:
parent
0014dfc21f
commit
66ae70e790
@ -53,7 +53,25 @@ pub fn rematch_target<'r, 's>(
|
||||
target: &'r Vec<Object<'s>>,
|
||||
input: &'s str,
|
||||
) -> Res<&'s str, Vec<Object<'s>>> {
|
||||
todo!()
|
||||
let mut remaining = input;
|
||||
let mut new_matches = Vec::with_capacity(target.len());
|
||||
for original_object in target {
|
||||
match original_object {
|
||||
// TODO: The rest of the minimal set of objects.
|
||||
Object::PlainText(plaintext) => {
|
||||
let (new_remaining, new_match) = plaintext.rematch_object(context, remaining)?;
|
||||
remaining = new_remaining;
|
||||
new_matches.push(new_match);
|
||||
|
||||
}
|
||||
_ => {
|
||||
return Err(nom::Err::Error(CustomError::MyError(MyError(
|
||||
"OnlyMinimalSetObjectsAllowed",
|
||||
))));
|
||||
}
|
||||
};
|
||||
}
|
||||
Ok((remaining, new_matches))
|
||||
}
|
||||
|
||||
#[tracing::instrument(ret, level = "debug")]
|
||||
|
Loading…
x
Reference in New Issue
Block a user