- Timestamp:
- 10/30/08 00:21:44 (2 months ago)
- Location:
- src/perl6
- Files:
-
- 6 modified
-
Cursor.pmc (modified) (57 diffs)
-
DumpMatch.pm (modified) (1 diff)
-
STD.pm (modified) (19 diffs)
-
STD_syntax_highlight (modified) (2 diffs)
-
gimme5 (modified) (3 diffs)
-
viv (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/perl6/Cursor.pmc
r22815 r22824 94 94 sub new { 95 95 my $class = shift; 96 my $orig = shift() . "\n"; 97 my @memos; 98 $#memos = length $orig; # memos kept by position 99 my %args = ('_pos' => 0, '_from' => 0, '_orig' => \$orig, '_' => \@memos); 96 $::ORIG = shift() . "\n"; # original string 97 $::MEMOS[length $::ORIG] = undef; # memos kept by position 98 my %args = ('_pos' => 0, '_from' => 0); 100 99 while (@_) { 101 100 my $name = shift; … … 103 102 } 104 103 my $self = CORE::bless \%args, ref $class || $class; 105 my $buf = $self->{_orig};106 # $self->deb(" orig ", $$buf) if $DEBUG & DEBUG::cursors;107 104 $self->BUILD; 108 105 $self; … … 172 169 our %lexers; # per language, the cache of lexers, keyed by rule name 173 170 174 # most cursors just copy forward the previous value of the following two items:175 #has $._orig; # per match, the original string we are matching against176 #has StrPos $._from = 0;177 #has StrPos $._to = 0;178 #has StrPos $._pos = 0;179 #has Cursor $._prior;180 181 171 sub from { $_[0]->{_from} } 182 172 sub to { $_[0]->{_to} } 183 173 sub chars { $_[0]->{_to} - $_[0]->{_from} } 184 sub text { substr($ {$_[0]->{_orig}}, $_[0]->{_from}, $_[0]->{_to} - $_[0]->{_from}) }174 sub text { substr($::ORIG, $_[0]->{_from}, $_[0]->{_to} - $_[0]->{_from}) } 185 175 sub pos { $_[0]->{_pos} } 186 176 sub peek { $_[0]->{_peek} } 187 sub orig { $_[0]->{_orig}}177 sub orig { \$::ORIG } 188 178 sub WHAT { ref $_[0] || $_[0] } 189 179 sub bless { CORE::bless $_[1], $_[0]->WHAT } … … 432 422 }; 433 423 $self->highwater($lexer->{DBA}) if $self->{_pos} >= $::HIGHWATER; 434 my $buf = $self->{_orig};435 424 my $P = $self->{_pos}; 436 if ($P == length($ $buf)) {425 if ($P == length($::ORIG)) { 437 426 return sub { return }; 438 427 } 439 pos($ $buf) = $P;440 $ $buf=~ m/\G(\[[\\<>«»]*..|[<>][<>]..|[ -~].|.)/smgc;428 pos($::ORIG) = $P; 429 $::ORIG =~ m/\G(\[[\\<>«»]*..|[<>][<>]..|[ -~].|.)/smgc; 441 430 my $ch2 = $1; 442 431 … … 460 449 }; 461 450 # if (@pats > 10) { 462 # print STDERR "PATS: ",0+@pats," $ch2 ", substr($ $buf,$P+length($ch2), 5), "\n";463 # print "PATS: ",0+@pats," $ch2 ", substr($ $buf,$P+length($ch2), 5), "\n";451 # print STDERR "PATS: ",0+@pats," $ch2 ", substr($::ORIG,$P+length($ch2), 5), "\n"; 452 # print "PATS: ",0+@pats," $ch2 ", substr($::ORIG,$P+length($ch2), 5), "\n"; 464 453 # print join "\n", @pats, ''; 465 454 # } … … 532 521 my $C = shift; 533 522 534 # die "orig disappeared!!!" unless length($ $buf);523 # die "orig disappeared!!!" unless length($::ORIG); 535 524 536 525 return unless $lexer; 537 526 538 527 my $P = $C->{_pos}; 539 pos($ $buf) = $P;528 pos($::ORIG) = $P; 540 529 541 530 if ($DEBUG & DEBUG::lexer) { 542 my $peek = substr($ $buf,$C->{_pos},20);531 my $peek = substr($::ORIG,$C->{_pos},20); 543 532 $peek =~ s/\n/\\n/g; 544 533 $peek =~ s/\t/\\t/g; … … 575 564 if ($l == -1) { 576 565 my $p = $pats[$px]; 577 pos($ $buf) = $P;578 if (($ $buf=~ m/\G$p/gc)) {579 $$rxlens[$px] = $l = pos($ $buf) - $P;566 pos($::ORIG) = $P; 567 if (($::ORIG =~ m/\G$p/gc)) { 568 $$rxlens[$px] = $l = pos($::ORIG) - $P; 580 569 if ($l == $$trylen) { 581 570 push @result, $fates->[$px]; … … 596 585 else { 597 586 my $p = $pats[$px]; 598 pos($ $buf) = $P;599 if ($ $buf=~ m/\G$p/gc) {587 pos($::ORIG) = $P; 588 if ($::ORIG =~ m/\G$p/gc) { 600 589 push @result, $fates->[$px]; 601 590 } … … 616 605 617 606 618 $self->deb("/ running tre match at @{[ pos($ $buf) ]} /") if $DEBUG & DEBUG::lexer;607 $self->deb("/ running tre match at @{[ pos($::ORIG) ]} /") if $DEBUG & DEBUG::lexer; 619 608 $pat =~ s/\$\.\?/\$(?:.?)/; # XXX egregious hack to not interpolate $. 620 609 … … 624 613 my \$C = shift; 625 614 my \$P = \$C->{_pos}; 626 pos(\$ \$buf) = \$P;615 pos(\$::ORIG) = \$P; 627 616 628 617 my \$result; 629 if ( (\$\$buf =~ m\0$pat\0xgc)) {618 if (\$::ORIG =~ m\0$pat\0xgc) { 630 619 END 631 620 <<'END'; $prog; }); … … 649 638 } 650 639 } 651 $C->deb("success at '", substr($ $buf,$C->{_pos},10), "'") if $DEBUG & DEBUG::lexer;640 $C->deb("success at '", substr($::ORIG,$C->{_pos},10), "'") if $DEBUG & DEBUG::lexer; 652 641 } 653 642 my $tried = ""; 654 643 vec($tried,$last-1,1) = 1 if $last; 655 $_[0] = [$tried, pos($ $buf) - $P, []];644 $_[0] = [$tried, pos($::ORIG) - $P, []]; 656 645 } 657 646 $result; … … 722 711 my $lang = @_ && $_[0] ? shift() : ref $self; 723 712 $self->deb("cursor_fresh lang $lang") if $DEBUG & DEBUG::cursors; 724 $r{_} = $self->{_};725 $r{_orig} = $self->{_orig};726 713 $r{_to} = $r{_from} = $r{_pos} = $self->{_pos}; 727 714 $r{_fate} = $self->{_fate}; … … 779 766 my $self = shift; 780 767 delete $self->{_fate}; 781 delete $self->{_};782 # delete $self->{_orig}; # needs some kind of weakening783 # delete $self->{_pos}; # EXPR blows up without this for some reason784 # delete $self->{_reduced};785 768 $self; 786 769 } … … 789 772 my $self = shift; 790 773 delete $self->{_fate}; 791 delete $self->{_};792 delete $self->{_orig}; # needs some kind of weakening793 774 delete $self->{_pos}; # EXPR blows up without this for some reason 794 775 delete $self->{_reduced}; … … 814 795 my $self = shift; 815 796 my %copy = %$self; 816 delete $copy{_};817 797 delete $copy{_reduced}; 818 798 delete $copy{_fate}; 819 delete $copy{_orig};820 799 my $text = STD::Dump(\%copy); 821 800 $text =~ s/^\s*_(?:pos|orig):.*\n//mg; … … 903 882 904 883 if ($DEBUG & DEBUG::cursors) { 905 my $buf = $self->{_orig}; 906 my $peek = substr($$buf,$tpos,20); 884 my $peek = substr($::ORIG,$tpos,20); 907 885 $peek =~ s/\n/\\n/g; 908 886 $peek =~ s/\t/\\t/g; … … 921 899 922 900 if ($DEBUG & DEBUG::cursors) { 923 my $buf = $self->{_orig}; 924 my $peek = substr($$buf,$fpos,20); 901 my $peek = substr($::ORIG,$fpos,20); 925 902 $peek =~ s/\n/\\n/g; 926 903 $peek =~ s/\t/\\t/g; … … 1114 1091 local $CTX = $self->callm if $DEBUG & DEBUG::trace_call; 1115 1092 my $pos = $self->{_pos}; 1116 my $eos = length(${ $self->{_orig}});1093 my $eos = length(${\$::ORIG}); 1117 1094 1118 1095 lazymap( sub { $self->cursor($_[0])->retm() }, LazyRange->new($pos,$eos) ); … … 1123 1100 local $CTX = $self->callm if $DEBUG & DEBUG::trace_call; 1124 1101 my $pos = $self->{_pos}; 1125 my $eos = length(${ $self->{_orig}});1102 my $eos = length(${\$::ORIG}); 1126 1103 1127 1104 lazymap( sub { $self->cursor($_[0])->retm() }, LazyRangeRev->new($eos,$pos) ); … … 1157 1134 my $prev_to = $to->{_to} // 0; 1158 1135 my @all; 1159 my $eos = length(${ $self->{_orig}});1136 my $eos = length(${\$::ORIG}); 1160 1137 for (;;) { 1161 1138 last if $to->{_pos} == $eos; … … 1179 1156 1180 1157 # don't go beyond end of string 1181 return () if $self->{_pos} == length(${ $self->{_orig}});1158 return () if $self->{_pos} == length(${\$::ORIG}); 1182 1159 lazymap( 1183 1160 sub { … … 1206 1183 my $to = $self; 1207 1184 my @all; 1208 my $eos = length(${ $self->{_orig}});1185 my $eos = length(${\$::ORIG}); 1209 1186 for (;;) { 1210 1187 last if $to->{_pos} == $eos; … … 1230 1207 my @result; 1231 1208 # don't go beyond end of string 1232 return () if $self->{_pos} == length(${ $self->{_orig}});1209 return () if $self->{_pos} == length(${\$::ORIG}); 1233 1210 do { 1234 1211 for my $x ($block->($self)) { … … 1257 1234 my $to = $self; 1258 1235 my @all; 1259 my $eos = length(${ $self->{_orig}});1236 my $eos = length(${\$::ORIG}); 1260 1237 for (;;) { 1261 1238 last if $to->{_pos} == $eos; … … 1381 1358 } 1382 1359 local $CTX = $self->callm() if $DEBUG & DEBUG::trace_call; 1383 my @stub = return $self if exists $ $self{_}[$self->{_pos}]{ws};1360 my @stub = return $self if exists $::MEMOS[$self->{_pos}]{ws}; 1384 1361 1385 1362 my $C = $self; 1386 1363 my $startpos = $C->pos; 1387 $ $self{_}[$startpos]{ws} = undef; # exists means we know, undef means no ws before here1364 $::MEMOS[$startpos]{ws} = undef; # exists means we know, undef means no ws before here 1388 1365 1389 1366 $self->_MATCHIFY( 'ws', … … 1408 1385 push @gather, (map { my $C=$_; 1409 1386 (map { my $C=$_; 1410 scalar(do { $ C->{_}[$C->{_pos}]{ws} = $startpos unless $C->{_pos} == $startpos }, $C)1387 scalar(do { $::MEMOS[$C->{_pos}]{ws} = $startpos unless $C->{_pos} == $startpos }, $C) 1411 1388 } $C->_STARr(sub { my $C=shift; 1412 1389 $C->_SPACE() … … 1463 1440 my $P = $self->{_pos} // 0; 1464 1441 my $len = length($s); 1465 my $buf = $self->{_orig}; 1466 if (substr($$buf, $P, $len) eq $s) { 1467 $self->deb("EXACT $s matched @{[substr($$buf,$P,$len)]} at $P $len") if $DEBUG & DEBUG::matchers; 1442 if (substr($::ORIG, $P, $len) eq $s) { 1443 $self->deb("EXACT $s matched @{[substr($::ORIG,$P,$len)]} at $P $len") if $DEBUG & DEBUG::matchers; 1468 1444 my $r = $self->cursor($P+$len); 1469 1445 $r->retm(); 1470 1446 } 1471 1447 else { 1472 $self->deb("EXACT $s didn't match @{[substr($ $buf,$P,$len)]} at $P $len") if $DEBUG & DEBUG::matchers;1448 $self->deb("EXACT $s didn't match @{[substr($::ORIG,$P,$len)]} at $P $len") if $DEBUG & DEBUG::matchers; 1473 1449 return (); 1474 1450 } … … 1480 1456 local $CTX = $self->callm($qr) if $DEBUG & DEBUG::trace_call; 1481 1457 my $P = $self->{_pos} // 0; 1482 my $buf = $self->{_orig}; 1483 pos($$buf) = $P; 1484 if ($$buf =~ /$qr/gc) { 1485 my $len = pos($$buf) - $P; 1486 $self->deb("PATTERN $qr matched @{[substr($$buf,$P,$len)]} at $P $len") if $DEBUG & DEBUG::matchers; 1458 pos($::ORIG) = $P; 1459 if ($::ORIG =~ /$qr/gc) { 1460 my $len = pos($::ORIG) - $P; 1461 $self->deb("PATTERN $qr matched @{[substr($::ORIG,$P,$len)]} at $P $len") if $DEBUG & DEBUG::matchers; 1487 1462 my $r = $self->cursor($P+$len); 1488 1463 $r->retm(); … … 1501 1476 my $s = $self->{$n}->text; 1502 1477 my $len = length($s); 1503 my $buf = $self->{_orig}; 1504 if (substr($$buf, $P, $len) eq $s) { 1505 $self->deb("EXACT $s matched @{[substr($$buf,$P,$len)]} at $P $len") if $DEBUG & DEBUG::matchers; 1478 if (substr($::ORIG, $P, $len) eq $s) { 1479 $self->deb("EXACT $s matched @{[substr($::ORIG,$P,$len)]} at $P $len") if $DEBUG & DEBUG::matchers; 1506 1480 my $r = $self->cursor($P+$len); 1507 1481 $r->retm(); 1508 1482 } 1509 1483 else { 1510 $self->deb("EXACT $s didn't match @{[substr($ $buf,$P,$len)]} at $P $len") if $DEBUG & DEBUG::matchers;1484 $self->deb("EXACT $s didn't match @{[substr($::ORIG,$P,$len)]} at $P $len") if $DEBUG & DEBUG::matchers; 1511 1485 return (); 1512 1486 } … … 1522 1496 my $P = $self->{_pos} // 0; 1523 1497 my $len = length($s); 1524 my $buf = $self->{_orig};1525 1498 if ($i 1526 ? lc substr($ $buf, $P, $len) eq lc $s1527 : substr($ $buf, $P, $len) eq $s1499 ? lc substr($::ORIG, $P, $len) eq lc $s 1500 : substr($::ORIG, $P, $len) eq $s 1528 1501 ) { 1529 $self->deb("SYM $s matched @{[substr($ $buf,$P,$len)]} at $P $len") if $DEBUG & DEBUG::matchers;1502 $self->deb("SYM $s matched @{[substr($::ORIG,$P,$len)]} at $P $len") if $DEBUG & DEBUG::matchers; 1530 1503 my $r = $self->cursor($P+$len); 1531 1504 $r->{sym} = $s; … … 1533 1506 } 1534 1507 else { 1535 $self->deb("SYM $s didn't match @{[substr($ $buf,$P,$len)]} at $P $len") if $DEBUG & DEBUG::matchers;1508 $self->deb("SYM $s didn't match @{[substr($::ORIG,$P,$len)]} at $P $len") if $DEBUG & DEBUG::matchers; 1536 1509 return (); 1537 1510 } … … 1544 1517 my $len = length($s); 1545 1518 my $from = $self->{_from} - $len; 1546 my $buf = $self->{_orig}; 1547 if ($from >= 0 and substr($$buf, $from, $len) eq $s) { 1519 if ($from >= 0 and substr($::ORIG, $from, $len) eq $s) { 1548 1520 my $r = $self->cursor_rev($from); 1549 1521 $r->retm(); … … 1558 1530 local $CTX = $self->callm(0+@_) if $DEBUG & DEBUG::trace_call; 1559 1531 my $P = $self->{_pos} // 0; 1560 my $buf = $self->{_orig};1561 1532 my @array = sort { length($b) <=> length($a) } @_; # XXX suboptimal 1562 1533 my @result = (); 1563 1534 for my $s (@array) { 1564 1535 my $len = length($s); 1565 if (substr($ $buf, $P, $len) eq $s) {1566 $self->deb("ARRAY elem $s matched @{[substr($ $buf,$P,$len)]} at $P $len") if $DEBUG & DEBUG::matchers;1536 if (substr($::ORIG, $P, $len) eq $s) { 1537 $self->deb("ARRAY elem $s matched @{[substr($::ORIG,$P,$len)]} at $P $len") if $DEBUG & DEBUG::matchers; 1567 1538 my $r = $self->cursor($P+$len); 1568 1539 push @result, $r->retm(''); … … 1574 1545 sub _ARRAY_rev { my $self = shift; 1575 1546 local $CTX = $self->callm(0+@_) if $DEBUG & DEBUG::trace_call; 1576 my $buf = $self->{_orig};1577 1547 my @array = sort { length($b) <=> length($a) } @_; # XXX suboptimal 1578 1548 my @result = (); … … 1580 1550 my $len = length($s); 1581 1551 my $from = $self->{_from} = $len; 1582 if (substr($ $buf, $from, $len) eq $s) {1583 $self->deb("ARRAY_rev elem $s matched @{[substr($ $buf,$from,$len)]} at $from $len") if $DEBUG & DEBUG::matchers;1552 if (substr($::ORIG, $from, $len) eq $s) { 1553 $self->deb("ARRAY_rev elem $s matched @{[substr($::ORIG,$from,$len)]} at $from $len") if $DEBUG & DEBUG::matchers; 1584 1554 my $r = $self->cursor_rev($from); 1585 1555 push @result, $r->retm(''); … … 1592 1562 local $CTX = $self->callm if $DEBUG & DEBUG::trace_call; 1593 1563 my $P = $self->{_pos}; 1594 my $buf = $self->{_orig}; 1595 my $char = substr($$buf, $P, 1); 1564 my $char = substr($::ORIG, $P, 1); 1596 1565 if ($char =~ /^\d$/) { 1597 1566 my $r = $self->cursor($P+1); … … 1611 1580 return (); 1612 1581 } 1613 my $buf = $self->{_orig}; 1614 my $char = substr($$buf, $from, 1); 1582 my $char = substr($::ORIG, $from, 1); 1615 1583 if ($char =~ /^\d$/) { 1616 1584 my $r = $self->cursor_rev($from); … … 1626 1594 local $CTX = $self->callm if $DEBUG & DEBUG::trace_call; 1627 1595 my $P = $self->{_pos}; 1628 my $buf = $self->{_orig}; 1629 my $char = substr($$buf, $P, 1); 1596 my $char = substr($::ORIG, $P, 1); 1630 1597 if ($char =~ /^\w$/) { 1631 1598 my $r = $self->cursor($P+1); … … 1645 1612 return (); 1646 1613 } 1647 my $buf = $self->{_orig}; 1648 my $char = substr($$buf, $from, 1); 1614 my $char = substr($::ORIG, $from, 1); 1649 1615 if ($char =~ /^\w$/) { 1650 1616 my $r = $self->cursor_rev($from); … … 1660 1626 local $CTX = $self->callm if $DEBUG & DEBUG::trace_call; 1661 1627 my $P = $self->{_pos}; 1662 my $buf = $self->{_orig}; 1663 my $char = substr($$buf, $P, 1); 1628 my $char = substr($::ORIG, $P, 1); 1664 1629 if ($char =~ /^[[:alpha:]_]$/) { 1665 1630 my $r = $self->cursor($P+1); … … 1678 1643 return (); 1679 1644 } 1680 my $buf = $self->{_orig}; 1681 my $char = substr($$buf, $from, 1); 1645 my $char = substr($::ORIG, $from, 1); 1682 1646 if ($char =~ /^[_[:alpha:]]$/) { 1683 1647 my $r = $self->cursor_rev($from); … … 1692 1656 local $CTX = $self->callm if $DEBUG & DEBUG::trace_call; 1693 1657 my $P = $self->{_pos}; 1694 my $buf = $self->{_orig}; 1695 my $char = substr($$buf, $P, 1); 1658 my $char = substr($::ORIG, $P, 1); 1696 1659 if ($char =~ /^\s$/) { 1697 1660 my $r = $self->cursor($P+1); … … 1711 1674 return (); 1712 1675 } 1713 my $buf = $self->{_orig}; 1714 my $char = substr($$buf, $from, 1); 1676 my $char = substr($::ORIG, $from, 1); 1715 1677 if ($char =~ /^\s$/) { 1716 1678 my $r = $self->cursor_rev($from); … … 1726 1688 local $CTX = $self->callm if $DEBUG & DEBUG::trace_call; 1727 1689 my $P = $self->{_pos}; 1728 my $buf = $self->{_orig}; 1729 my $char = substr($$buf, $P, 1); 1690 my $char = substr($::ORIG, $P, 1); 1730 1691 if ($char =~ /^[ \t\r]$/ or ($char =~ /^\s$/ and $char !~ /^[\n\f\0x0b\x{2028}\x{2029}]$/)) { 1731 1692 my $r = $self->cursor($P+1); … … 1745 1706 return (); 1746 1707 } 1747 my $buf = $self->{_orig}; 1748 my $char = substr($$buf, $from, 1); 1708 my $char = substr($::ORIG, $from, 1); 1749 1709 if ($char =~ /^[ \t\r]$/ or ($char =~ /^\s$/ and $char !~ /^[\n\f\0x0b\x{2028}\x{2029}]$/)) { 1750 1710 my $r = $self->cursor_rev($from); … … 1760 1720 local $CTX = $self->callm if $DEBUG & DEBUG::trace_call; 1761 1721 my $P = $self->{_pos}; 1762 my $buf = $self->{_orig}; 1763 my $char = substr($$buf, $P, 1); 1722 my $char = substr($::ORIG, $P, 1); 1764 1723 if ($char =~ /^[\n\f\x0b\x{2028}\x{2029}]$/) { 1765 1724 my $r = $self->cursor($P+1); … … 1779 1738 return (); 1780 1739 } 1781 my $buf = $self->{_orig}; 1782 my $char = substr($$buf, $from, 1); 1740 my $char = substr($::ORIG, $from, 1); 1783 1741 if ($char =~ /^[\n\f\x0b\x{2028}\x{2029}]$/) { 1784 1742 my $r = $self->cursor_rev($from); … … 1796 1754 local $CTX = $self->callm if $DEBUG & DEBUG::trace_call; 1797 1755 my $P = $self->{_pos}; 1798 my $buf = $self->{_orig}; 1799 my $char = substr($$buf, $P, 1); 1756 my $char = substr($::ORIG, $P, 1); 1800 1757 if ($char =~ /$cc/) { 1801 1758 my $r = $self->cursor($P+1); … … 1817 1774 return (); 1818 1775 } 1819 my $buf = $self->{_orig}; 1820 my $char = substr($$buf, $from, 1); 1776 my $char = substr($::ORIG, $from, 1); 1821 1777 if ($char =~ /$cc/) { 1822 1778 my $r = $self->cursor_rev($from); … … 1832 1788 local $CTX = $self->callm if $DEBUG & DEBUG::trace_call; 1833 1789 my $P = $self->{_pos}; 1834 my $buf = $self->{_orig}; 1835 if ($P < length($$buf)) { 1790 if ($P < length($::ORIG)) { 1836 1791 $self->cursor($P+1)->retm(); 1837 1792 } … … 1866 1821 local $CTX = $self->callm if $DEBUG & DEBUG::trace_call; 1867 1822 my $P = $self->{_pos}; 1868 my $buf = $self->{_orig}; 1869 if ($P == 0 or substr($$buf, $P-1, 1) =~ /^[\n\f\x0b\x{2028}\x{2029}]$/) { 1823 if ($P == 0 or substr($::ORIG, $P-1, 1) =~ /^[\n\f\x0b\x{2028}\x{2029}]$/) { 1870 1824 $self->cursor($P)->retm(); 1871 1825 } … … 1879 1833 local $CTX = $self->callm if $DEBUG & DEBUG::trace_call; 1880 1834 my $P = $self->{_pos}; 1881 my $buf = $self->{_orig}; 1882 if ($P == length($$buf)) { 1835 if ($P == length($::ORIG)) { 1883 1836 $self->cursor($P)->retm(); 1884 1837 } … … 1892 1845 local $CTX = $self->callm if $DEBUG & DEBUG::trace_call; 1893 1846 my $P = $self->{_pos}; 1894 my $buf = $self->{_orig}; 1895 if ($P == length($$buf) or substr($$buf, $P, 1) =~ /^(?:\r\n|[\n\f\x0b\x{2028}\x{2029}])$/) { 1847 if ($P == length($::ORIG) or substr($::ORIG, $P, 1) =~ /^(?:\r\n|[\n\f\x0b\x{2028}\x{2029}])$/) { 1896 1848 $self->cursor($P)->retm(); 1897 1849 } … … 1905 1857 local $CTX = $self->callm if $DEBUG & DEBUG::trace_call; 1906 1858 my $P = $self->{_pos}; 1907 my $buf = $self->{_orig}; 1908 pos($$buf) = $P - 1; 1909 if ($$buf =~ /\w\b/) { 1859 pos($::ORIG) = $P - 1; 1860 if ($::ORIG =~ /\w\b/) { 1910 1861 $self->cursor($P)->retm(); 1911 1862 } … … 1919 1870 local $CTX = $self->callm if $DEBUG & DEBUG::trace_call; 1920 1871 my $P = $self->{_pos}; 1921 my $buf = $self->{_orig}; 1922 pos($$buf) = $P; 1923 if ($$buf =~ /\b(?=\w)/) { 1872 pos($::ORIG) = $P; 1873 if ($::ORIG =~ /\b(?=\w)/) { 1924 1874 $self->cursor($P)->retm(); 1925 1875 } … … 1933 1883 local $CTX = $self->callm if $DEBUG & DEBUG::trace_call; 1934 1884 my $P = $self->{_pos}; 1935 my $buf = $self->{_orig}; 1936 pos($$buf) = $P; 1937 if ($$buf =~ /\b(?=\w)/) { 1885 pos($::ORIG) = $P; 1886 if ($::ORIG =~ /\b(?=\w)/) { 1938 1887 $self->cursor($P)->retm(); 1939 1888 } … … 1961 1910 my $P = $self->{_pos}; 1962 1911 my $F = $self->{_from}; 1963 my $buf = $self->{_orig}; 1964 $self->{FIRST} = substr($$buf, $F, $P - $F); 1912 $self->{FIRST} = substr($::ORIG, $F, $P - $F); 1965 1913 $self->deb("Commit branch to $P") if $DEBUG & DEBUG::matchers; 1966 1914 $self, LazyMap->new(sub { $self->deb("ABORTBRANCH") if $DEBUG & DEBUG::trace_call; die "ABORTBRANCH" }, $self); -
src/perl6/DumpMatch.pm
r22656 r22824 90 90 local %seen; 91 91 traverse_match($r,$name,0,$events,$opt); 92 process_events($ {$r->{_orig}},$events,$opt);92 process_events($::ORIG,$events,$opt); 93 93 } 94 94 1; -
src/perl6/STD.pm
r22811 r22824 11 11 my $IN_DECL is context<rw>; 12 12 my %ROUTINES;
