Fix end conditions for subscript and superscript.

This commit is contained in:
Tom Alexander 2023-09-07 03:40:14 -04:00
parent 76a81b73ac
commit 69512f559a
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -1,5 +1,6 @@
use nom::branch::alt;
use nom::bytes::complete::tag;
use nom::bytes::complete::take_while;
use nom::character::complete::anychar;
use nom::character::complete::one_of;
use nom::combinator::map;
@ -9,6 +10,7 @@ use nom::combinator::peek;
use nom::combinator::recognize;
use nom::combinator::verify;
use nom::multi::many_till;
use nom::sequence::tuple;
use super::object_parser::standard_set_object;
use super::org_source::BracketDepth;
@ -143,7 +145,10 @@ fn script_alphanum_character<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, Org
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn end_script_alphanum_character<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, OrgSource<'s>> {
let (remaining, final_char) = recognize(verify(anychar, |c| c.is_alphanumeric()))(input)?;
peek(not(script_alphanum_character))(remaining)?;
peek(tuple((
take_while(|c| r#",.\"#.contains(c)),
not(script_alphanum_character),
)))(remaining)?;
Ok((remaining, final_char))
}