Handle nesting of brackets.
This commit is contained in:
parent
885fefd060
commit
fa97124186
@ -113,17 +113,14 @@ fn babel_call_call<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, OrgSource<'s>
|
|||||||
|
|
||||||
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||||
fn inside_header<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, OrgSource<'s>> {
|
fn inside_header<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, OrgSource<'s>> {
|
||||||
let (remaining, _) = tag("[")(input)?;
|
let (remaining, contents) = balanced_bracket(
|
||||||
|
|i| tag("[")(i),
|
||||||
let contents_start = remaining;
|
|i| peek(tag("]"))(i),
|
||||||
let (remaining, contents) = opt(recognize(many_till(
|
|i| recognize(tuple((space0, org_line_ending)))(i),
|
||||||
anychar,
|
|i| tag("]")(i),
|
||||||
alt((
|
|s| s.get_bracket_depth(),
|
||||||
peek(recognize(one_of("]"))),
|
)(input)?;
|
||||||
recognize(tuple((space0, org_line_ending))),
|
let (contents_start, _) = tag("[")(input)?;
|
||||||
)),
|
|
||||||
)))(remaining)?;
|
|
||||||
let (remaining, _) = tag("]")(remaining)?;
|
|
||||||
Ok((remaining, contents.unwrap_or(contents_start.take(0))))
|
Ok((remaining, contents.unwrap_or(contents_start.take(0))))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,30 +133,6 @@ fn arguments<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, Option<OrgSource<'s
|
|||||||
|i| tag(")")(i),
|
|i| tag(")")(i),
|
||||||
|s| s.get_parenthesis_depth(),
|
|s| s.get_parenthesis_depth(),
|
||||||
)(input)
|
)(input)
|
||||||
|
|
||||||
// impl_balanced_bracket(
|
|
||||||
// input,
|
|
||||||
// |i| tag("(")(i),
|
|
||||||
// |i| peek(tag(")"))(i),
|
|
||||||
// |i| recognize(tuple((space0, org_line_ending)))(i),
|
|
||||||
// |i| tag(")")(i),
|
|
||||||
// |s| s.get_parenthesis_depth(),
|
|
||||||
// )
|
|
||||||
|
|
||||||
// let (remaining, _) = tag("(")(input)?;
|
|
||||||
|
|
||||||
// let (remaining, contents) = opt(verify(
|
|
||||||
// recognize(many_till(
|
|
||||||
// anychar,
|
|
||||||
// alt((
|
|
||||||
// peek(recognize(one_of(")"))),
|
|
||||||
// recognize(tuple((space0, org_line_ending))),
|
|
||||||
// )),
|
|
||||||
// )),
|
|
||||||
// |s| s.len() > 0,
|
|
||||||
// ))(remaining)?;
|
|
||||||
// let (remaining, _) = tag(")")(remaining)?;
|
|
||||||
// Ok((remaining, contents))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user