- Timestamp:
- 11/06/08 17:25:00 (2 months ago)
- Location:
- src/perl6
- Files:
-
- 2 modified
-
Cursor.pmc (modified) (11 diffs)
-
tryfile (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/perl6/Cursor.pmc
r22896 r22899 364 364 } 365 365 } 366 elsif ($1 eq 'p') { 367 if ($p =~ s/^(\w{1,2})//) { 368 $f .= $1; 369 } 370 elsif ($p =~ s/^(\{\w+\})//) { 371 $f .= $1; 372 } 373 } 374 elsif ($1 eq 'b') { 375 return 1; 376 } 366 377 return 1 if $p =~ s/^[*?]//; 367 378 return 0 unless $c =~ /^$f/; … … 412 423 my $p = shift; 413 424 my $len = 0; 414 while ($p ne '' and $p ne '.?') {425 while ($p ne '') { 415 426 return -1 if $p =~ /^[*+?(|]/; 416 427 return -1 if $p =~ /^\{[\d,]+\}/; … … 422 433 $len++, next if $p =~ s/^\d+//; 423 434 $len++, next if $p =~ s/^x[\da-fA-F]{1,4}//; 435 $len++, next if $p =~ s/^p[a-zA-Z]{1,2}//; 424 436 return -1; 425 437 } … … 613 625 @pats = grep { canmatch($_, $ch2) } @{ 614 626 $lexer->{FASTPATS} //= [ 615 map { my $x = $_; $x =~ s/\(\?#::\)//g; $x =~ s/\t/.?\t/; $x} @{$lexer->{PATS}}627 map { my $x = $_; $x =~ s/\(\?#::\)//g; $x } @{$lexer->{PATS}} 616 628 ] 617 629 }; … … 679 691 for my $i (0..@$fates-1) { 680 692 $self->deb("\t", $i, ': ', $fates->[$i][3]) if $DEBUG & DEBUG::autolexer; 681 }682 for my $pat (@pats) {683 $pat =~ s/\.\?$//; # ltm backoff doesn't need tre workaround684 $pat =~ s/\\>/\\b/g; # perl regex doesn't use \>685 693 } 686 694 … … 735 743 if ($l == -1) { 736 744 my $p = $pats[$px]; 745 $self->deb("Trying $p at $P\n") if $DEBUG & DEBUG::fixed_length; 737 746 pos($::ORIG) = $P; 738 if (($::ORIG =~ m/\G$p/gc)) { 747 if (($::ORIG =~ m/\G($p)/msgc)) { 748 $self->deb("Got $1\n") if $DEBUG & DEBUG::fixed_length; 739 749 $$rxlens[$px] = $l = pos($::ORIG) - $P; 740 750 if ($l == $$trylen) { … … 1635 1645 my $P = $self->{_pos}; 1636 1646 my $char = substr($::ORIG, $P, 1); 1637 if ($char =~ /^[ [:alpha:]_]$/) {1647 if ($char =~ /^[_[:alpha:]\pL]$/) { 1638 1648 my $r = $self->cursor($P+1); 1639 1649 return $r->retm(); … … 1652 1662 } 1653 1663 my $char = substr($::ORIG, $from, 1); 1654 if ($char =~ /^[_[:alpha:] ]$/) {1664 if ($char =~ /^[_[:alpha:]\pL]$/) { 1655 1665 my $r = $self->cursor_rev($from); 1656 1666 return $r->retm(); … … 2084 2094 ::qm($fixed); 2085 2095 } 2086 $fixed =~ s/([ [:alpha:]])/'[' . $1 . chr(ord($1)^32) . ']'/eg if $self->{i};2096 $fixed =~ s/([a-zA-Z])/'[' . $1 . chr(ord($1)^32) . ']'/eg if $self->{i}; 2087 2097 $fixed; 2088 2098 } … … 2120 2130 } 2121 2131 elsif ($_ eq '»' or $_ eq '>>') { 2122 return '\ >';2132 return '\b'; 2123 2133 } 2124 2134 elsif ($_ eq '«' or $_ eq '<<') { 2125 return '\ <';2135 return '\b'; 2126 2136 } 2127 2137 elsif ($_ eq '::' or $_ eq ':::' or $_ eq '.*?') { … … 2156 2166 Encode::_utf8_on($sym); 2157 2167 my $text = ::qm($sym); 2158 $text =~ s/( [[:alpha:]])/'[' . lc($1) . uc($1) . ']'/eg if $self->{i};2168 $text =~ s/(\pL)/'[' . lc($1) . uc($1) . ']'/eg if $self->{i}; 2159 2169 return $text; 2160 2170 } 2161 2171 elsif ($_ eq 'alpha') { 2162 2172 $fakepos++; 2163 return '[_[:alpha:] ]'; # XXX not unicodey2173 return '[_[:alpha:]\pL]'; 2164 2174 } 2165 2175 my $lexer; -
src/perl6/tryfile
r22858 r22899 5 5 use YAML::XS; 6 6 use Encode; 7 8 my $failures = 0; 7 9 8 10 if (not @ARGV) { … … 16 18 STD->parsefile($file); 17 19 }; 18 warn $@ if $@; 20 if ($@) { 21 warn $@; 22 $failures++; 23 } 19 24 } 25 26 exit $failures;
