chiark
/
gitweb
/
~ianmdlvl
/
dgit-junk.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
fde88b1
)
auditor wip semiparse
author
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Sun, 30 Sep 2018 12:49:46 +0000
(13:49 +0100)
committer
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Sun, 30 Sep 2018 12:49:46 +0000
(13:49 +0100)
i18n-diff-auditor
patch
|
blob
|
history
diff --git
a/i18n-diff-auditor
b/i18n-diff-auditor
index d947a010c1c647c1f12bb202816d4697b47b97e7..8252c3f1ba4d6f9b5517c2b8c08c8a74a25f98be 100755
(executable)
--- a/
i18n-diff-auditor
+++ b/
i18n-diff-auditor
@@
-99,7
+99,7
@@
sub semiparse ($) {
for (;;) {
s{^\s+}{};
if (s{^[\$\@\%][_0-9a-zA-Z]+}{}) {
for (;;) {
s{^\s+}{};
if (s{^[\$\@\%][_0-9a-zA-Z]+}{}) {
- push @o, { T => 'ident',
V
=> $& };
+ push @o, { T => 'ident',
L
=> $& };
} elsif (s{^\<\<('?)([A-Z_]+)\1}{}) {
my ($q,$d) = ($1,$2);
push @o, { T => 'heredoc', Q => $q, Delim => $d };
} elsif (s{^\<\<('?)([A-Z_]+)\1}{}) {
my ($q,$d) = ($1,$2);
push @o, { T => 'heredoc', Q => $q, Delim => $d };
@@
-111,8
+111,17
@@
sub semiparse ($) {
} elsif (s{^ (["'])( (?: [^\\] | \\ \1 )* )}{}x) {
my ($q,$v) = ($1,$2);
push @o, { T => 'string', Q => $q, V => $v };
} elsif (s{^ (["'])( (?: [^\\] | \\ \1 )* )}{}x) {
my ($q,$v) = ($1,$2);
push @o, { T => 'string', Q => $q, V => $v };
+ } elsif (s{^$perlop_re}{}) {
+ push @o, { T => 'op', L => $& };
+ } elsif (s/[[{(]//) {
+ push @o, { T => 'bra', L => $& };
+ } elsif (s/[]})]//) {
+ push @o, { T => 'ket', L => $& };
+ } elsif (!length) {
+ last;
} else {
} else {
- die;
+ m{^.{0,10}};
+ die "cannot tokenise \`$&'";
}
}
}
}
}
}
@@
-122,7
+131,7
@@
sub analyse_chunk () {
die "plain insertion\n" unless defined $before;
my @before = semiparse $before;
my @after = semiparse $after;
die "plain insertion\n" unless defined $before;
my @before = semiparse $before;
my @after = semiparse $after;
- print Dumper($ichunkstart, $ichunkend,
$before, $
after);
+ print Dumper($ichunkstart, $ichunkend,
\@before, \@
after);
flush STDOUT;
}
flush STDOUT;
}
@@
-138,7
+147,11
@@
for ($ifilehead = 0; l_ok $ifilehead; $ifilehead++) {
if (defined $ichunkstart) {
$ichunkend = $i;
eval { analyse_chunk(); 1; };
if (defined $ichunkstart) {
$ichunkend = $i;
eval { analyse_chunk(); 1; };
- # do something with $@
+ if (length $@) {
+ print Dumper($ichunkstart, $ichunkend,
+ $before, $after,
+ $@);
+ }
$ichunkstart = $ichunkend = $before = $after = undef;
}
l_ok $i or last;
$ichunkstart = $ichunkend = $before = $after = undef;
}
l_ok $i or last;