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{^ (["'])( (?: [^\\] | \\ \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 {
- die;
+ m{^.{0,10}};
+ die "cannot tokenise \`$&'";
}
}
}
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;
}
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;