chiark / gitweb /
auditor wip
[dgit-junk.git] / i18n-diff-auditor
index 777bf47ededa166703f847d7290a1c839d394727..393ee59b92de5213163b576e389a95c59a69ab56 100755 (executable)
@@ -11,28 +11,43 @@ sub l_ok ($) {
     1;
 }
 
-sub l ($) { confess unless l_ok $_[0]; };
+sub l ($) {
+    my ($i) = @_;
+    confess $i unless l_ok $i;
+};
 
-our ($ifilehead, $ihunkhead, $ichunk);
+our ($ifilehead, $ihunkhead, $ichunkstart, $ichunkend);
 our ($before, $after);
 
+sub analyse_chunk () {
+    print Dumper($before, $after);
+}
+
 for ($ifilehead = 0; l_ok $ifilehead; $ifilehead++) {
     m{^diff} or next;
     while (l_ok $ifilehead and m{^index|^---|^\Q+++\E}) { }
     $ihunkhead = $ifilehead;
     while (l_ok $ihunkhead) {
-       m{^\@\@} or confess;
-       $ichunk = $ihunkhead + 1;
+       m{^\@\@} or confess "$_ ?";
+       my $i = $ihunkhead + 1;
        for (;;) {
-           l_ok $ichunk or last;
-           
-       while (l_ok $ichunk and 
+           if (!l_ok $i or m{^ } or m{^\@\@}) {
+               if (defined $ichunkstart) {
+                   $ichunkend = $i;
+                   analyse_chunk();
+                   $ichunkstart = $ichunkend = $before = $after = undef;
+               }
+               l_ok $i or last;
+               m{^\@\@} and last;
+           } elif (m{^[-+]}) {
+               my $which = $& eq '-' ? \$before : \$after;
+               $ichunkfirst //= $i;
+               $$which //= '';
+               $$which .= $';
+           } else {
+               confess "$_ ?";
+           }
+       }
+       $ihunkhead = $i;
     }
-       
-    confess unless m{^\@\@};
-          
-
-while (<>){
-    if (m/^diff.*/) {
-       my $headline = 
 }