- unless (s{^(.*?)(\\)?(?=$esc)}{}) { o $_; last; }
- o $1;
- if ($2) { s#^$esc##; o $$esclitr; next; }
- s{^$esc}{} or die "$_ ?";
- if (s{^$esc}{}) { o "$$esclitr$$esclitr" }
- elsif (s{^TARGETS(?:_([0-9a-zA-Z_]+))?(?=\W)}{}) {
- my $t = $1 // 'all';
- o target_varname($var_prefix, $t);
- $targets->{$t} //= [ ];
+ err 'cannot $-double &-processed RHS of directive'
+ if $ddbl && defined $buffering_output;
+ unless ($nest[0][0] eq 'eval'
+ ? s{^(.*?)($esc|\$|[{}])}{}
+ : s{^(.*?)($esc|\$)}{}) { od $_; last; }
+ od $1;
+ if ($2 eq '{') {
+ od $2;
+ $evalcall_brackets++;
+ next;
+ } elsif ($2 eq '}') {
+ od $2;
+ next if --$evalcall_brackets;
+ $pop_nest->('eval');
+ od '}';
+ next;
+ } elsif ($2 eq '$') {
+ od $2;
+ if (s{^\$}{}) { od $&; }
+ elsif (m{^[a-zA-Z]\w}) {
+ wrn 'single-char-var',
+ 'possibly confusing unbracketed single-char $-expansion';
+ }
+ elsif (m{^$esc}) {
+ wrn 'broken-var-ref',
+ 'broken $&... expansion; you probably meant &$';
+ }
+ elsif (m{^\(($esc)?([^()\$]+)\)} ||
+ m{^\{($esc)?([^{}\$]+)\}}) {
+ $note_varref->($2,!!$1);
+ }
+ next;
+ }
+ if (s{^\\$esc}{}) { od "$$esclitr" }
+ elsif (s{^\\\$}{}) { oud '$' }
+ elsif (s{^\\\s+$}{}) { }
+ elsif (s{^$esc}{}) { od "$$esclitr$$esclitr" }
+ elsif (m{^(?=$caps_re)}) { od $var_prefix }
+ elsif (s{^\$([A-Za-z]\w+)}{}) {
+ $note_varref->($1,1);
+ od "\${${var_prefix}$1}";
+ }
+ elsif (s{^([~^]?)(?=$lc_re)}{}) { od $pfxmap{$1} }
+ elsif (s{^_}{}) { od $var_prefix }
+ elsif (s{^=}{}) { od $var_prefix_name }
+ elsif (s{^([~^]?)/}{}) { od $pfxmap{$1} }
+ elsif (s{^\.}{}) { od $dir_name }
+ elsif (s{^([~^])\.}{}) { od $srcdirmap{$1} }
+ elsif (s{^\$\-}{}) { $ddbl=undef; }
+ elsif (s{^\$\+}{}) { $ddbl=1; }
+ elsif (s{^\$\(}{}) {
+ ddbl_only($&); oud "\${";
+ $note_varref->($2,!!$1) if m{^($esc)?([^()\$]+\))};