Testing: fix search_local() for detecting callbacks and references.mv

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22121 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
John Ralls
2012-03-25 16:52:31 +00:00
parent 2066c1d991
commit 663c9f9d5b

View File

@@ -123,14 +123,21 @@ sub search_local {
my $comment = 0;
my $line;
my ($calls, $callbacks, $refs) = (0, 0, 0);
my $call_re = qr{\b$name\s*\(\w*[,)]};
my $callback_re = qr{\([^)]*$name(?>!\s*\()};
my $ref_re = qr{(?<=\=)\s*$name(?>!\s*\()};
my $call_re = qr/\b$name\b\s*\([^{]*$/;
my $callback_re = qr{\b$name\s*[,)]};
my $ref_re = qr{=\s*\b$name\b(?!\s*\()};
my $body = 0;
while (my $line = <INFILE>) {
chomp $line;
while ($line =~ /{/g) {
++$body;
}
while ($line =~ /}/g) {
--$body;
}
($line, $comment) = strip_comments($line, $comment);
++ $calls if $line =~ /$call_re/;
++ $callbacks if $line =~ /$callback_re/;
++ $calls if $body && $line =~ /$call_re/;
++ $callbacks if $body && $line =~ /$callback_re/;
++ $refs if $line =~ /$ref_re/;
}