From 214e895d850618f6a2de9cb88937ac64fed61d75 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Tue, 29 Aug 2023 23:42:16 -0400 Subject: [PATCH] Support backslash at the end of a macro. --- src/parser/org_macro.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/parser/org_macro.rs b/src/parser/org_macro.rs index ec0d95d..1900f4a 100644 --- a/src/parser/org_macro.rs +++ b/src/parser/org_macro.rs @@ -10,6 +10,7 @@ use nom::multi::separated_list0; use super::org_source::OrgSource; use super::Context; +use crate::error::CustomError; use crate::error::Res; use crate::parser::object::OrgMacro; use crate::parser::parser_with_context::parser_with_context; @@ -86,6 +87,11 @@ fn org_macro_arg<'r, 's>( } if next_char == '\\' { escaping = true; + if peek(tag::<_, _, CustomError<_>>(")"))(new_remaining).is_ok() { + // Special case for backslash at the end of a macro + remaining = new_remaining; + break; + } } if next_char == ',' || next_char == ')' { break;