Switching to a new context variable.

This commit is contained in:
Tom Alexander 2022-12-03 23:43:36 -05:00
parent c568920da8
commit 96aca6b537
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -54,12 +54,13 @@ where
{ {
move |mut i: I| { move |mut i: I| {
let mut ret = Vec::new(); let mut ret = Vec::new();
let current_context = context;
loop { loop {
let len = i.input_len(); let len = i.input_len();
match till_matcher(context, i.clone()) { match till_matcher(current_context, i.clone()) {
Ok((remaining, finish)) => return Ok((remaining, (ret, finish))), Ok((remaining, finish)) => return Ok((remaining, (ret, finish))),
Err(nom::Err::Error(_)) => { Err(nom::Err::Error(_)) => {
match many_matcher(context, i.clone()) { match many_matcher(current_context, i.clone()) {
Err(nom::Err::Error(err)) => { Err(nom::Err::Error(err)) => {
return Err(nom::Err::Error(E::append(i, ErrorKind::ManyTill, err))) return Err(nom::Err::Error(E::append(i, ErrorKind::ManyTill, err)))
} }
@ -74,6 +75,7 @@ where
} }
ret.push(many_elem); ret.push(many_elem);
// TODO: make new context
i = remaining; i = remaining;
} }
} }