From: Ian Jackson Date: Sat, 28 Dec 2019 12:31:49 +0000 (+0000) Subject: Warnings: Track basic $-references X-Git-Tag: subdirmk/0.3~34 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ian/git?p=subdirmk.git;a=commitdiff_plain;h=4d32a95729b7ae70fc1b65017cd26d22707ea33d;ds=sidebyside Warnings: Track basic $-references We must always stop at $'s in the input now. Having stopped at $, we normally just output it and carry on. Ie, we only stop so we can do some inspection: as before, we do this variable tracking as inspection before processing, rather entangled with processing. We can deal reasonably properly with ${ } and $( ). Signed-off-by: Ian Jackson --- diff --git a/generate b/generate index cbc9172..d8183d0 100755 --- a/generate +++ b/generate @@ -270,8 +270,8 @@ sub process_input_mk ($$$$) { err 'cannot $-double &-processed RHS of directive' if $ddbl && defined $buffering_output; unless ($nest[0][0] eq 'eval' - ? s{^(.*?)($esc|[{}])}{} - : s{^(.*?)($esc)}{}) { od $_; last; } + ? s{^(.*?)($esc|\$|[{}])}{} + : s{^(.*?)($esc|\$)}{}) { od $_; last; } od $1; if ($2 eq '{') { od $2; @@ -283,6 +283,14 @@ sub process_input_mk ($$$$) { $pop_nest->('eval'); od '}'; next; + } elsif ($2 eq '$') { + od $2; + if (s{^\$}{}) { od $&; } + elsif (m{^\(($esc)?([^()\$]+)\)} || + m{^\{($esc)?([^{}\$]+)\}}) { + $note_varref->($2,!!$1); + } + next; } if (s{^\\$esc}{}) { od "$$esclitr" } elsif (s{^\\\$}{}) { oud '$' }