Maybe we should switch to an owned context.
This commit is contained in:
parent
396813c70a
commit
e222b5a9df
@ -57,13 +57,13 @@ where
|
|||||||
{
|
{
|
||||||
move |mut i: I| {
|
move |mut i: I| {
|
||||||
let mut ret = Vec::new();
|
let mut ret = Vec::new();
|
||||||
let current_context = context;
|
let current_context = context.clone();
|
||||||
loop {
|
loop {
|
||||||
let len = i.input_len();
|
let len = i.input_len();
|
||||||
match till_matcher(current_context, i.clone()) {
|
match till_matcher(¤t_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(current_context, i.clone()) {
|
match many_matcher(¤t_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)))
|
||||||
}
|
}
|
||||||
@ -78,11 +78,11 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret.push(many_elem);
|
ret.push(many_elem);
|
||||||
current_context = current_context.with_additional_node(
|
// current_context = current_context.with_additional_node(
|
||||||
ContextElement::PreviousElementNode(PreviousElementNode {
|
// ContextElement::PreviousElementNode(PreviousElementNode {
|
||||||
element: many_elem.into(),
|
// element: many_elem.into(),
|
||||||
}),
|
// }),
|
||||||
);
|
// );
|
||||||
i = remaining;
|
i = remaining;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user