diff options
author | Nicholas Clark <nick@ccl4.org> | 2011-09-16 12:19:15 +0200 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2011-09-21 10:40:57 +0200 |
commit | f4ca0be2c78f0bfb6a1cba6fc3b9557e88395b33 (patch) | |
tree | 46accca6a8117168d6220fc65946fe5831ef97c4 /Porting/checkcfgvar.pl | |
parent | 705822126c5e218f2fe40097f9f1a204474e864b (diff) | |
download | perl-f4ca0be2c78f0bfb6a1cba6fc3b9557e88395b33.tar.gz |
In checkcfgvar.pl, split the configure.com code out.
The configure.com handling is actually sufficiently different that it's
simpler to do it in its own loop. The two regexs for config.sh-style parsing
can be merged. Use non-capturing parens for the parts of regexs that don't
need to be captured.
Diffstat (limited to 'Porting/checkcfgvar.pl')
-rwxr-xr-x | Porting/checkcfgvar.pl | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/Porting/checkcfgvar.pl b/Porting/checkcfgvar.pl index 5c3bc2e333..d288f3cdad 100755 --- a/Porting/checkcfgvar.pl +++ b/Porting/checkcfgvar.pl @@ -83,32 +83,29 @@ for my $cfg (sort @CFG) { my %cfg; open my $fh, '<', $cfg; - while (<$fh>) { - next if /^\#/ || /^\s*$/ || /^\:/; - if ($cfg eq 'configure.com') { + + if ($cfg eq 'configure.com') { + ++$cfg{startperl}; # Cheat. + + while (<$fh>) { + next if /^\#/ || /^\s*$/ || /^\:/; s/(\s*!.*|\s*)$//; # remove trailing comments or whitespace - next if ! /^\$\s+WC "(\w+)='(.*)'"$/; - } - # foo='bar' - # foo=bar - if (/^(\w+)='(.*)'$/) { - $cfg{$1}++; + ++$cfg{$1} if /^\$\s+WC "(\w+)='(?:.*)'"$/; } - elsif (/^(\w+)=(.*)$/) { - $cfg{$1}++; - } - elsif (/^\$\s+WC "(\w+)='(.*)'"$/) { - $cfg{$1}++; - } else { - warn "$cfg:$.:$_"; + } else { + while (<$fh>) { + next if /^\#/ || /^\s*$/ || /^\:/; + # foo='bar' + # foo=bar + if (/^(\w+)=('?)(?:.*)\2$/) { + ++$cfg{$1}; + } else { + warn "$cfg:$.:$_"; + } } } close $fh; - if ($cfg eq 'configure.com') { - $cfg{startperl}++; # Cheat. - } - my $problems; for my $v (@MASTER_CFG) { exists $cfg{$v} and next; |