Do not capture trailing whitespace on the final macro arg.
Some checks failed
rust-build Build rust-build has succeeded
rust-foreign-document-test Build rust-foreign-document-test has failed
rust-test Build rust-test has succeeded

This commit is contained in:
Tom Alexander 2023-10-08 16:39:22 -04:00
parent b9ead09dde
commit 9bdec391f1
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -1,11 +1,13 @@
use nom::bytes::complete::tag;
use nom::character::complete::anychar;
use nom::character::complete::space0;
use nom::combinator::not;
use nom::combinator::opt;
use nom::combinator::peek;
use nom::combinator::verify;
use nom::multi::many0;
use nom::multi::separated_list0;
use nom::sequence::tuple;
use super::org_source::OrgSource;
use super::util::maybe_consume_object_trailing_whitespace_if_not_exiting;
@ -67,7 +69,7 @@ fn org_macro_args<'b, 'g, 'r, 's>(
let (remaining, _) = tag("(")(input)?;
let (remaining, args) =
separated_list0(tag(","), parser_with_context!(org_macro_arg)(context))(remaining)?;
let (remaining, _) = tag(")")(remaining)?;
let (remaining, _) = tuple((space0, tag(")")))(remaining)?;
Ok((remaining, args))
}
@ -82,6 +84,10 @@ fn org_macro_arg<'b, 'g, 'r, 's>(
loop {
not(parser_with_context!(exit_matcher_parser)(context))(remaining)?;
not(peek(tag("}}}")))(remaining)?;
if peek(tuple((space0::<OrgSource<'_>, CustomError<_>>, tag(")"))))(remaining).is_ok() {
break;
}
let (new_remaining, next_char) = anychar(remaining)?;
if escaping {
remaining = new_remaining;