From 23047ce673309f327869363f16e77926448db133 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 30 Sep 2018 21:07:42 +0100 Subject: i18n: i18n-diff-auditor: more debug Signed-off-by: Ian Jackson --- i18n-diff-auditor | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'i18n-diff-auditor') diff --git a/i18n-diff-auditor b/i18n-diff-auditor index f40c8e9..e8c86fe 100755 --- a/i18n-diff-auditor +++ b/i18n-diff-auditor @@ -178,19 +178,25 @@ sub semiparse ($) { return @o; } +our @analysed_x; +our @analysed_y; + sub analyse_chunk_core () { die "plain deletion\n" unless defined $after; die "plain insertion\n" unless defined $before; my @xs = semiparse $before; my @ys = semiparse $after; + @analysed_x = @analysed_y = (); my $next_something = sub { - my ($ary,$var,$what) = @_; + my ($ary,$anal,$var,$what) = @_; die "ran out of $what\n" unless @$ary; - $$var = shift @$ary; + my $r = shift @$ary; + push @$anal, $r->{P}; + $$var = $r; }; my ($x,$y); - my $next_x = sub { $next_something->(\@xs, \$x, 'before'); }; - my $next_y = sub { $next_something->(\@ys, \$y, 'after' ); }; + my $next_x = sub { $next_something->(\@xs, \@analysed_x, \$x, 'before'); }; + my $next_y = sub { $next_something->(\@ys, \@analysed_y, \$y, 'after' ); }; for (;;) { last unless @xs or @ys; $next_x->(); @@ -228,7 +234,7 @@ sub analyse_chunk_core () { my ($lit, $what) = @_; my $xl = substr($xs, 0, length($lit)); if ($xl ne $lit) { - debug $ichunkstart, "not exactly x: $xl"; + debug $ichunkstart, "not exactly x: $xs"; debug $ichunkstart, "not exactly y: $lit"; my $next = @ys ? $ys[0]{P} : '(end)'; die "string contents mismatch near $what before $next\n"; @@ -359,6 +365,8 @@ for ($ifilehead = 0; l_ok $ifilehead; $ifilehead++) { $ichunkend = $i; eval { analyse_chunk(); 1; }; if (length $@) { + debug $ichunkstart, "done x: @analysed_x"; + debug $ichunkstart, "done y: @analysed_y"; push @report, { M => $@, S => $ichunkstart, E => $ichunkend }; -- cgit v1.2.3