Do not capture trailing whitespace on the final macro arg.
This commit is contained in:
parent
b9ead09dde
commit
9bdec391f1
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user