chiark
/
gitweb
/
~ianmdlvl
/
secnet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Syntax: Support &:local+global !...
[secnet.git]
/
generate
diff --git
a/generate
b/generate
index f571fa19d196efc9aa62299a487a095f0dba2724..15e2235d68000c14306eeb477e215c27717cbc92 100755
(executable)
--- a/
generate
+++ b/
generate
@@
-153,6
+153,7
@@
END
}
our %varref;
}
our %varref;
+our %varref_exp;
our ($dir_prefix, $dir_suffix, $dir_name,
$var_prefix, $var_prefix_name);
our ($dir_prefix, $dir_suffix, $dir_name,
$var_prefix, $var_prefix_name);
@@
-262,6
+263,7
@@
sub process_input_mk ($$$$) {
# accurate, since it is only going to be used for advice to the user.
my $note_varref = sub {
my ($vn,$amp) = @_;
# accurate, since it is only going to be used for advice to the user.
my $note_varref = sub {
my ($vn,$amp) = @_;
+ return if $varref_exp{$vn}{$amp};
$varref{$vn}{$amp}{"$f:$."} = 1;
};
$varref{$vn}{$amp}{"$f:$."} = 1;
};
@@
-294,8
+296,9
@@
sub process_input_mk ($$$$) {
next;
} elsif (s#^\s*$esc\:local\+global\s+(\S.*)$##) {
foreach my $vn (split /\s+/, $1) {
next;
} elsif (s#^\s*$esc\:local\+global\s+(\S.*)$##) {
foreach my $vn (split /\s+/, $1) {
- $vn =~ s{^$esc}{};
- $varref{$vn}{NoWarn} = 1;
+ my $pos = !($vn =~ s{^!}{});
+ my $amp = $vn =~ s{^$esc}{};
+ $varref_exp{$vn}{!!$amp} = $pos;
}
next;
} elsif (s#^\s*$esc\:(?=(-?)include|macro)##) {
}
next;
} elsif (s#^\s*$esc\:(?=(-?)include|macro)##) {
@@
-361,10
+364,10
@@
sub process_input_mk ($$$$) {
elsif (s{^\$\-}{}) { $ddbl=undef; }
elsif (s{^\$\+}{}) { $ddbl=1; }
elsif (s{^\$\(}{}) {
elsif (s{^\$\-}{}) { $ddbl=undef; }
elsif (s{^\$\+}{}) { $ddbl=1; }
elsif (s{^\$\(}{}) {
- ddbl_only($&); oud "\$
(
";
+ ddbl_only($&); oud "\$
{
";
$note_varref->($2,!!$1) if m{^($esc)?([^()\$]+\))};
}
$note_varref->($2,!!$1) if m{^($esc)?([^()\$]+\))};
}
- elsif (s{^\$(\d+)}{}) { ddbl_only($&); oud "\$
($1)
"; }
+ elsif (s{^\$(\d+)}{}) { ddbl_only($&); oud "\$
{$1}
"; }
elsif (s{^\$\{}{}) {
err 'macro invocation cannot be re-$-doubled' if $ddbl;
od '${eval ${call ';
elsif (s{^\$\{}{}) {
err 'macro invocation cannot be re-$-doubled' if $ddbl;
od '${eval ${call ';
@@
-435,6
+438,8
@@
sub process_subtree ($$) {
#use Data::Dumper;
#print STDERR Dumper(\@_);
#use Data::Dumper;
#print STDERR Dumper(\@_);
+ local %varref_exp;
+
my $dir_prefix = dir_prefix($path);
# ^ this is the only var which we need before we come back from
# the recursion.
my $dir_prefix = dir_prefix($path);
# ^ this is the only var which we need before we come back from
# the recursion.
@@
-526,7
+531,6
@@
sub print_varref_warnings () {
foreach my $vn (sort keys %varref) {
my $vv = $varref{$vn};
next unless $vv->{''} && $vv->{1};
foreach my $vn (sort keys %varref) {
my $vv = $varref{$vn};
next unless $vv->{''} && $vv->{1};
- next if $vv->{NoWarn};
wrncore 'local+global', "saw both $vn and &$vn" or return;
foreach my $amp ('', 1) {
printf STDERR " saw %s%s at %s\n",
wrncore 'local+global', "saw both $vn and &$vn" or return;
foreach my $amp ('', 1) {
printf STDERR " saw %s%s at %s\n",