From 69512f559a2734780232adfa31542c052566b66c Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Thu, 7 Sep 2023 03:40:14 -0400 Subject: [PATCH] Fix end conditions for subscript and superscript. --- src/parser/subscript_and_superscript.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/parser/subscript_and_superscript.rs b/src/parser/subscript_and_superscript.rs index e2025e7..c026c6a 100644 --- a/src/parser/subscript_and_superscript.rs +++ b/src/parser/subscript_and_superscript.rs @@ -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, Org #[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))] fn end_script_alphanum_character<'s>(input: OrgSource<'s>) -> Res, 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)) }