chiark / gitweb /
i18n: i18n-diff-auditor: fix bra and ket regexps
[dgit.git] / i18n-diff-auditor
index c3630b640c75d4c0b00783d9f708b6332f4c76ba..42ebe00d9dbc85f6c1937ad1df92ee89d29921cc 100755 (executable)
@@ -144,9 +144,9 @@ sub semiparse ($) {
                       Q => $q, V => $v};
        } elsif (s{^$perlop_re|^\;}{}) {
            push @o, { T => 'op', E => $&, P => $& };
-       } elsif (s/[[{(]//) {
+       } elsif (s/^[[{(]//) {
            push @o, { T => 'bra', E => $&, P => $& };
-       } elsif (s/[]})]//) {
+       } elsif (s/^[]})]//) {
            push @o, { T => 'ket', E => $&, P => $& };
        } elsif (s/^( [\$\@\%] )( \{ )//x) {
            push @o, { T => 'deref', E => $1, P => $1 },
@@ -309,7 +309,7 @@ sub analyse_chunk_core () {
                        pop @analysed_y;
                        last;
                    }
-                   $xs =~ s{^\s+}{};
+                   $xs =~ s{^\s+}{} if $bras;
                    $exactly->($y->{E}, $y->{P});
                    if ($y->{T} eq 'bra' or $y->{E} eq '?') {
                        $bras++;