From e36c3e76d81cd2dc6d157234bc60b6c9bd156e0d Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 28 Dec 2019 23:01:49 +0000 Subject: [PATCH] generate: Fix &${ } end condition It is quite wrong to use $ddbl, which might be adjusted by &$- &$+. We must maintain a separate counter. Signed-off-by: Ian Jackson --- generate | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/generate b/generate index cfb6642..f5c416d 100755 --- a/generate +++ b/generate @@ -216,6 +216,7 @@ sub process_input_mk ($$$$) { local $ddbl; my @nest = (['']); + my $evalcall_brackets; my $push_nest = sub { my ($nk, $nndbl, $what) = @_; @@ -256,11 +257,11 @@ sub process_input_mk ($$$$) { od $1; if ($2 eq '{') { od $2; - $ddbl++; + $evalcall_brackets++; next; } elsif ($2 eq '}') { od $2; - next if --$ddbl; + next if --$evalcall_brackets; $pop_nest->('eval'); od '}'; next; @@ -284,6 +285,7 @@ sub process_input_mk ($$$$) { elsif (s{^\$\{}{}) { err 'macro invocation cannot be re-$-doubled' if $ddbl; od '${eval ${call '; + $evalcall_brackets = 1; $push_nest->('eval',1, '&${...}'); } elsif (s{^([~^]?)(?=[ \t])}{}) { my $prefix = $pfxmap{$1} // die "internal error ($1?)"; -- 2.30.2