chiark / gitweb /
i18n: i18n-diff-auditor: more debug
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 30 Sep 2018 20:07:42 +0000 (21:07 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 30 Sep 2018 23:54:38 +0000 (00:54 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
i18n-diff-auditor

index f40c8e97e7ec0f94685b76c55815df04f248f46f..e8c86fec55426a63c3d784eafa8a3c4cf84e4fc2 100755 (executable)
@@ -178,19 +178,25 @@ sub semiparse ($) {
     return @o;
 }          
 
     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;
 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 $next_something = sub {
-       my ($ary,$var,$what) = @_;
+       my ($ary,$anal,$var,$what) = @_;
        die "ran out of $what\n" unless @$ary;
        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 ($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->();
     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) {
                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";
                    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 $@) {
                    $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 };
                        push @report, { M => $@,
                                        S => $ichunkstart,
                                        E => $ichunkend };