summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2018-10-02 17:09:21 +0100
committerIan Jackson <ijackson@chiark.greenend.org.uk>2018-10-04 02:01:51 +0100
commit1824d2161055a9981df07f379676481d42011225 (patch)
treeb6eb2e9f96a6943551eef2453cb3cf3699b80bd2
parentfcdb956e300aba37722f9c57512c4c0afb2e285f (diff)
i18n: i18n-diff-auditor: Handle printf => print f_
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
-rwxr-xr-xi18n-diff-auditor19
1 files changed, 19 insertions, 0 deletions
diff --git a/i18n-diff-auditor b/i18n-diff-auditor
index a03f0b0..6868ca7 100755
--- a/i18n-diff-auditor
+++ b/i18n-diff-auditor
@@ -268,6 +268,7 @@ sub analyse_chunk_core () {
my $next_x = sub { $next_something->(\@xs, \@analysed_x, \$x, 'before'); };
my $next_y = sub { $next_something->(\@ys, \@analysed_y, \$y, 'after' ); };
our @y_expect_suffix = ();
+ ANALYSE:
for (;;) {
while (my $e = shift @y_expect_suffix) {
$next_y->();
@@ -281,6 +282,24 @@ sub analyse_chunk_core () {
next if $x->{E} eq 'sprintf' and $y->{E} eq 'f_';
next if $x->{E} eq 'die' and $y->{E} eq 'confess';
next if $x->{E} eq 'die' and $y->{E} eq 'fail';
+ foreach my $with_fh (qw(0 1)) {
+ next unless $x->{E} eq 'printf';
+ next unless $y->{E} eq 'print';
+ next unless @xs >= $with_fh;
+ next unless @ys > $with_fh;
+ if ($with_fh) {
+ next unless $xs[0]{E} eq $ys[0]{E};
+ next unless
+ $xs[0]{E} =~ m{^[A-Z]+$} or
+ $xs[0]{T} eq 'ident' && $xs[0]{E} =~ m{^\$};
+ }
+ next unless $ys[$with_fh]{E} eq 'f_';
+ # yay!
+ $next_x->() if $with_fh;
+ $next_y->() if $with_fh;
+ $next_y->(); # f_
+ next ANALYSE;
+ }
if ($y->{E} eq '+'
and @ys >= 3
and $ys[0]{E} eq '('