chiark / gitweb /
i18n: i18n-diff-auditor: debugging changes
[dgit.git] / i18n-diff-auditor
index 5630d7e8dc192b7082ba6a66fcdf6d71c2845daf..85392c0992b200cd238423ceb982d17ce2a601c0 100755 (executable)
@@ -122,6 +122,7 @@ sub qp ($) {
 sub semiparse ($) {
     ($_) = @_;
     my @o;
+    #my $in = $_;
     # entries contain
     #   T     type
     #   E     exact input text (does not contain here doc contents)
@@ -138,9 +139,9 @@ sub semiparse ($) {
            push @o, { T => 'heredoc', Q => $q, Delim => $d,
                       E => $&, P => "<<$q$d$q" };
            s{^
-                (             .* \n    )
-                ( (?: (?! $d) .* \n )* )
-                          $d     \n
+                (                 .* \n     )
+                ( (?: (?! $d \n ) .* \n )*? )
+                          $d         \n
               }{ $1 }xe or die "missing end of here doc $d\n";
            $o[$#o]{V} = $2;
        } elsif (s{^ (["'])( (?: [^\\'"]
@@ -282,10 +283,12 @@ sub analyse_chunk_core () {
                $xs = substr($xs, length($lit));
            };
            for (;;) {
+               #print STDERR Dumper($fmt, $xs, \@xs, @ys);
                if ($fmt !~ m{\%[^\%]}) {
                    $exactly->($fmt, '(tail)');
                    $fmt = '';
-                   die "text deleted from end of string\n" if length $xs;
+                   die "text deleted from end of string: ".qp($xs)."\n"
+                       if length $xs;
                    last;
                }
                $exactly->($`, '(literal)');