schoebel/mars

marsadm does not ignore end-of-line backslashes in macros

dhrmn opened this issue · 3 comments

dhrmn commented

The support for end-of-line backslashes in macros for easier formatting/indentation is no longer there.

For instance,

%if{\
  %res\
}{}{}

is no longer equivalent to

%if{%res}{}{}

Note, that macros being dumped with marsadm dump-all-macros also include end-of-line backslashes.

dhrmn commented

Easy patch:

diff --git a/userspace/marsadm b/userspace/marsadm
index 005e3181..85f2b146 100755
--- a/userspace/marsadm
+++ b/userspace/marsadm
@@ -436,7 +436,7 @@ sub call_hook {
 
 # syntactic scanning / parsing
 
-my $match_comment = qr'#[^\n]*|//\h[^\n]*|/\*(?:[^*]|\*[^/])*\*/';
+my $match_comment = qr'#[^\n]*|//\h[^\n]*|/\*(?:[^*]|\*[^/])*\*/|\\\n\s*';
 my $match_nobrace = qr'(?:[^{}\\]|\\.)*'s;
 my $match_inner = $match_nobrace;
 my $match_brace = qr"\{$match_inner\}"s;

Hi dhrmn,

please send me a pull request for your patch (here on github), or email the patch to me.

I am just in the process of releasing mars0.1astable113, and if it doesn't break anything, I will include it (likely in a few hours), and possibly slightly change its short log line to fit my informal naming conventions.

I am also exited to learn that somebody outside of 1&1 actually uses the macro processor.

Thanks and cheers.

Thomas

I think this patch was added as 18319ee so I guess the issue can be closed?