chiark / gitweb /
auditor wip semiparse here doc
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 30 Sep 2018 13:01:53 +0000 (14:01 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 30 Sep 2018 13:01:53 +0000 (14:01 +0100)
i18n-diff-auditor

index d1ae6f1818826d5b1528776ef83debdf2fb66d18..654c323dd4ee308854ba403e3e229b8722204f3a 100755 (executable)
@@ -127,7 +127,7 @@ sub semiparse ($) {
     return @o;
 }          
 
-sub analyse_chunk () {
+sub analyse_chunk_core () {
     die "plain deletion\n" unless defined $after;
     die "plain insertion\n" unless defined $before;
     my @before = semiparse $before;
@@ -136,6 +136,21 @@ sub analyse_chunk () {
     flush STDOUT;
 }
 
+sub analyse_chunk () {
+    for (;;) {
+       eval { analyse_chunk_core(); };
+       return unless length $@;
+       if ($@ =~ m{^missing end of here doc (\S+)\n}) {
+           # fudge this
+           $before .= "\n$1\n";
+           $after .= "\n$1\n";
+           analyse_chunk_core();
+       } else {
+           die $@;
+       }
+    }
+}
+
 for ($ifilehead = 0; l_ok $ifilehead; $ifilehead++) {
     m{^diff} or next;
     while (l_ok $ifilehead and m{^diff|^index|^---|^\Q+++\E}) { $ifilehead++ }