summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2018-09-30 21:07:42 +0100
committerIan Jackson <ijackson@chiark.greenend.org.uk>2018-10-01 00:54:38 +0100
commit23047ce673309f327869363f16e77926448db133 (patch)
tree1f4b37dce8edf283fcb4657693c47294dcb67cce
parent357f88dd77ad0e34975250b3314c64d8ea53bdad (diff)
i18n: i18n-diff-auditor: more debug
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
-rwxr-xr-xi18n-diff-auditor18
1 files changed, 13 insertions, 5 deletions
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 };