Changeset 22824 for src

Show
Ignore:
Timestamp:
10/30/08 00:21:44 (2 months ago)
Author:
lwall
Message:

[STD,Cursor,etc] shrink Cursor footprint by removing constant attributes:

the original string is now just $+ORIG
the positional memoization array is now @+MEMOS

Location:
src/perl6
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • src/perl6/Cursor.pmc

    r22815 r22824  
    9494sub new { 
    9595    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); 
    10099    while (@_) { 
    101100        my $name = shift; 
     
    103102    } 
    104103    my $self = CORE::bless \%args, ref $class || $class; 
    105     my $buf = $self->{_orig}; 
    106 #    $self->deb(" orig ", $$buf) if $DEBUG & DEBUG::cursors; 
    107104    $self->BUILD; 
    108105    $self; 
     
    172169our %lexers;       # per language, the cache of lexers, keyed by rule name 
    173170 
    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 against 
    176 #has StrPos $._from = 0; 
    177 #has StrPos $._to = 0; 
    178 #has StrPos $._pos = 0; 
    179 #has Cursor $._prior; 
    180  
    181171sub from { $_[0]->{_from} } 
    182172sub to { $_[0]->{_to} } 
    183173sub chars { $_[0]->{_to} - $_[0]->{_from} } 
    184 sub text { substr(${$_[0]->{_orig}}, $_[0]->{_from}, $_[0]->{_to} - $_[0]->{_from}) } 
     174sub text { substr($::ORIG, $_[0]->{_from}, $_[0]->{_to} - $_[0]->{_from}) } 
    185175sub pos { $_[0]->{_pos} } 
    186176sub peek { $_[0]->{_peek} } 
    187 sub orig { $_[0]->{_orig} } 
     177sub orig { \$::ORIG } 
    188178sub WHAT { ref $_[0] || $_[0] } 
    189179sub bless { CORE::bless $_[1], $_[0]->WHAT } 
     
    432422    }; 
    433423    $self->highwater($lexer->{DBA}) if $self->{_pos} >= $::HIGHWATER; 
    434     my $buf = $self->{_orig}; 
    435424    my $P = $self->{_pos}; 
    436     if ($P == length($$buf)) { 
     425    if ($P == length($::ORIG)) { 
    437426        return sub { return }; 
    438427    } 
    439     pos($$buf) = $P; 
    440     $$buf =~ m/\G(\[[\\<>«»]*..|[<>][<>]..|[ -~].|.)/smgc; 
     428    pos($::ORIG) = $P; 
     429    $::ORIG =~ m/\G(\[[\\<>«»]*..|[<>][<>]..|[ -~].|.)/smgc; 
    441430    my $ch2 = $1; 
    442431 
     
    460449            }; 
    461450#           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"; 
    464453#               print join "\n", @pats, ''; 
    465454#           } 
     
    532521                my $C = shift; 
    533522 
    534                 # die "orig disappeared!!!" unless length($$buf); 
     523                # die "orig disappeared!!!" unless length($::ORIG); 
    535524 
    536525                return unless $lexer; 
    537526 
    538527                my $P = $C->{_pos}; 
    539                 pos($$buf) = $P; 
     528                pos($::ORIG) = $P; 
    540529 
    541530                if ($DEBUG & DEBUG::lexer) { 
    542                     my $peek = substr($$buf,$C->{_pos},20); 
     531                    my $peek = substr($::ORIG,$C->{_pos},20); 
    543532                    $peek =~ s/\n/\\n/g; 
    544533                    $peek =~ s/\t/\\t/g; 
     
    575564                                if ($l == -1) { 
    576565                                    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; 
    580569                                        if ($l == $$trylen) { 
    581570                                            push @result, $fates->[$px]; 
     
    596585                                    else { 
    597586                                        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) { 
    600589                                            push @result, $fates->[$px]; 
    601590                                        } 
     
    616605 
    617606 
    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; 
    619608                    $pat =~ s/\$\.\?/\$(?:.?)/;   # XXX egregious hack to not interpolate $. 
    620609 
     
    624613                        my \$C = shift; 
    625614                        my \$P = \$C->{_pos}; 
    626                         pos(\$\$buf) = \$P; 
     615                        pos(\$::ORIG) = \$P; 
    627616 
    628617                        my \$result; 
    629                         if ((\$\$buf =~ m\0$pat\0xgc)) { 
     618                        if (\$::ORIG =~ m\0$pat\0xgc) { 
    630619END 
    631620<<'END'; $prog; }); 
     
    649638                                    } 
    650639                                } 
    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; 
    652641                            } 
    653642                            my $tried = ""; 
    654643                            vec($tried,$last-1,1) = 1 if $last; 
    655                             $_[0] = [$tried, pos($$buf) - $P, []]; 
     644                            $_[0] = [$tried, pos($::ORIG) - $P, []]; 
    656645                        } 
    657646                        $result; 
     
    722711    my $lang = @_ && $_[0] ? shift() : ref $self; 
    723712    $self->deb("cursor_fresh lang $lang") if $DEBUG & DEBUG::cursors; 
    724     $r{_} = $self->{_}; 
    725     $r{_orig} = $self->{_orig}; 
    726713    $r{_to} = $r{_from} = $r{_pos} = $self->{_pos}; 
    727714    $r{_fate} = $self->{_fate}; 
     
    779766    my $self = shift; 
    780767    delete $self->{_fate}; 
    781     delete $self->{_}; 
    782 #    delete $self->{_orig};     # needs some kind of weakening 
    783 #    delete $self->{_pos};      # EXPR blows up without this for some reason 
    784 #    delete $self->{_reduced}; 
    785768    $self; 
    786769} 
     
    789772    my $self = shift; 
    790773    delete $self->{_fate}; 
    791     delete $self->{_}; 
    792     delete $self->{_orig};      # needs some kind of weakening 
    793774    delete $self->{_pos};       # EXPR blows up without this for some reason 
    794775    delete $self->{_reduced}; 
     
    814795    my $self = shift; 
    815796    my %copy = %$self; 
    816     delete $copy{_}; 
    817797    delete $copy{_reduced}; 
    818798    delete $copy{_fate}; 
    819     delete $copy{_orig}; 
    820799    my $text = STD::Dump(\%copy); 
    821800    $text =~ s/^\s*_(?:pos|orig):.*\n//mg; 
     
    903882 
    904883    if ($DEBUG & DEBUG::cursors) { 
    905         my $buf = $self->{_orig}; 
    906         my $peek = substr($$buf,$tpos,20); 
     884        my $peek = substr($::ORIG,$tpos,20); 
    907885        $peek =~ s/\n/\\n/g; 
    908886        $peek =~ s/\t/\\t/g; 
     
    921899 
    922900    if ($DEBUG & DEBUG::cursors) { 
    923         my $buf = $self->{_orig}; 
    924         my $peek = substr($$buf,$fpos,20); 
     901        my $peek = substr($::ORIG,$fpos,20); 
    925902        $peek =~ s/\n/\\n/g; 
    926903        $peek =~ s/\t/\\t/g; 
     
    11141091    local $CTX = $self->callm if $DEBUG & DEBUG::trace_call; 
    11151092    my $pos = $self->{_pos}; 
    1116     my $eos = length(${$self->{_orig}}); 
     1093    my $eos = length(${\$::ORIG}); 
    11171094 
    11181095    lazymap( sub { $self->cursor($_[0])->retm() }, LazyRange->new($pos,$eos) ); 
     
    11231100    local $CTX = $self->callm if $DEBUG & DEBUG::trace_call; 
    11241101    my $pos = $self->{_pos}; 
    1125     my $eos = length(${$self->{_orig}}); 
     1102    my $eos = length(${\$::ORIG}); 
    11261103 
    11271104    lazymap( sub { $self->cursor($_[0])->retm() }, LazyRangeRev->new($eos,$pos) ); 
     
    11571134    my $prev_to = $to->{_to} // 0; 
    11581135    my @all; 
    1159     my $eos = length(${$self->{_orig}}); 
     1136    my $eos = length(${\$::ORIG}); 
    11601137    for (;;) { 
    11611138      last if $to->{_pos} == $eos; 
     
    11791156 
    11801157    # don't go beyond end of string 
    1181     return () if $self->{_pos} == length(${$self->{_orig}}); 
     1158    return () if $self->{_pos} == length(${\$::ORIG}); 
    11821159    lazymap( 
    11831160        sub { 
     
    12061183    my $to = $self; 
    12071184    my @all; 
    1208     my $eos = length(${$self->{_orig}}); 
     1185    my $eos = length(${\$::ORIG}); 
    12091186    for (;;) { 
    12101187      last if $to->{_pos} == $eos; 
     
    12301207    my @result; 
    12311208    # don't go beyond end of string 
    1232     return () if $self->{_pos} == length(${$self->{_orig}}); 
     1209    return () if $self->{_pos} == length(${\$::ORIG}); 
    12331210    do { 
    12341211        for my $x ($block->($self)) { 
     
    12571234    my $to = $self; 
    12581235    my @all; 
    1259     my $eos = length(${$self->{_orig}}); 
     1236    my $eos = length(${\$::ORIG}); 
    12601237    for (;;) { 
    12611238      last if $to->{_pos} == $eos; 
     
    13811358    } 
    13821359    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}; 
    13841361 
    13851362    my $C = $self; 
    13861363    my $startpos = $C->pos; 
    1387     $$self{_}[$startpos]{ws} = undef;   # exists means we know, undef means no ws  before here 
     1364    $::MEMOS[$startpos]{ws} = undef;    # exists means we know, undef means no ws  before here 
    13881365 
    13891366    $self->_MATCHIFY( 'ws', 
     
    14081385                    push @gather, (map { my $C=$_; 
    14091386                        (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) 
    14111388                        } $C->_STARr(sub { my $C=shift; 
    14121389                            $C->_SPACE() 
     
    14631440    my $P = $self->{_pos} // 0; 
    14641441    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; 
    14681444        my $r = $self->cursor($P+$len); 
    14691445        $r->retm(); 
    14701446    } 
    14711447    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; 
    14731449        return (); 
    14741450    } 
     
    14801456    local $CTX = $self->callm($qr) if $DEBUG & DEBUG::trace_call; 
    14811457    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; 
    14871462        my $r = $self->cursor($P+$len); 
    14881463        $r->retm(); 
     
    15011476    my $s = $self->{$n}->text; 
    15021477    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; 
    15061480        my $r = $self->cursor($P+$len); 
    15071481        $r->retm(); 
    15081482    } 
    15091483    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; 
    15111485        return (); 
    15121486    } 
     
    15221496    my $P = $self->{_pos} // 0; 
    15231497    my $len = length($s); 
    1524     my $buf = $self->{_orig}; 
    15251498    if ($i 
    1526         ? lc substr($$buf, $P, $len) eq lc $s 
    1527         : substr($$buf, $P, $len) eq $s 
     1499        ? lc substr($::ORIG, $P, $len) eq lc $s 
     1500        : substr($::ORIG, $P, $len) eq $s 
    15281501    ) { 
    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; 
    15301503        my $r = $self->cursor($P+$len); 
    15311504        $r->{sym} = $s; 
     
    15331506    } 
    15341507    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; 
    15361509        return (); 
    15371510    } 
     
    15441517    my $len = length($s); 
    15451518    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) { 
    15481520        my $r = $self->cursor_rev($from); 
    15491521        $r->retm(); 
     
    15581530    local $CTX = $self->callm(0+@_) if $DEBUG & DEBUG::trace_call; 
    15591531    my $P = $self->{_pos} // 0; 
    1560     my $buf = $self->{_orig}; 
    15611532    my @array = sort { length($b) <=> length($a) } @_;  # XXX suboptimal 
    15621533    my @result = (); 
    15631534    for my $s (@array) { 
    15641535        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; 
    15671538            my $r = $self->cursor($P+$len); 
    15681539            push @result, $r->retm(''); 
     
    15741545sub _ARRAY_rev { my $self = shift; 
    15751546    local $CTX = $self->callm(0+@_) if $DEBUG & DEBUG::trace_call; 
    1576     my $buf = $self->{_orig}; 
    15771547    my @array = sort { length($b) <=> length($a) } @_;  # XXX suboptimal 
    15781548    my @result = (); 
     
    15801550        my $len = length($s); 
    15811551        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; 
    15841554            my $r = $self->cursor_rev($from); 
    15851555            push @result, $r->retm(''); 
     
    15921562    local $CTX = $self->callm if $DEBUG & DEBUG::trace_call; 
    15931563    my $P = $self->{_pos}; 
    1594     my $buf = $self->{_orig}; 
    1595     my $char = substr($$buf, $P, 1); 
     1564    my $char = substr($::ORIG, $P, 1); 
    15961565    if ($char =~ /^\d$/) { 
    15971566        my $r = $self->cursor($P+1); 
     
    16111580        return (); 
    16121581    } 
    1613     my $buf = $self->{_orig}; 
    1614     my $char = substr($$buf, $from, 1); 
     1582    my $char = substr($::ORIG, $from, 1); 
    16151583    if ($char =~ /^\d$/) { 
    16161584        my $r = $self->cursor_rev($from); 
     
    16261594    local $CTX = $self->callm if $DEBUG & DEBUG::trace_call; 
    16271595    my $P = $self->{_pos}; 
    1628     my $buf = $self->{_orig}; 
    1629     my $char = substr($$buf, $P, 1); 
     1596    my $char = substr($::ORIG, $P, 1); 
    16301597    if ($char =~ /^\w$/) { 
    16311598        my $r = $self->cursor($P+1); 
     
    16451612        return (); 
    16461613    } 
    1647     my $buf = $self->{_orig}; 
    1648     my $char = substr($$buf, $from, 1); 
     1614    my $char = substr($::ORIG, $from, 1); 
    16491615    if ($char =~ /^\w$/) { 
    16501616        my $r = $self->cursor_rev($from); 
     
    16601626    local $CTX = $self->callm if $DEBUG & DEBUG::trace_call; 
    16611627    my $P = $self->{_pos}; 
    1662     my $buf = $self->{_orig}; 
    1663     my $char = substr($$buf, $P, 1); 
     1628    my $char = substr($::ORIG, $P, 1); 
    16641629    if ($char =~ /^[[:alpha:]_]$/) { 
    16651630        my $r = $self->cursor($P+1); 
     
    16781643        return (); 
    16791644    } 
    1680     my $buf = $self->{_orig}; 
    1681     my $char = substr($$buf, $from, 1); 
     1645    my $char = substr($::ORIG, $from, 1); 
    16821646    if ($char =~ /^[_[:alpha:]]$/) { 
    16831647        my $r = $self->cursor_rev($from); 
     
    16921656    local $CTX = $self->callm if $DEBUG & DEBUG::trace_call; 
    16931657    my $P = $self->{_pos}; 
    1694     my $buf = $self->{_orig}; 
    1695     my $char = substr($$buf, $P, 1); 
     1658    my $char = substr($::ORIG, $P, 1); 
    16961659    if ($char =~ /^\s$/) { 
    16971660        my $r = $self->cursor($P+1); 
     
    17111674        return (); 
    17121675    } 
    1713     my $buf = $self->{_orig}; 
    1714     my $char = substr($$buf, $from, 1); 
     1676    my $char = substr($::ORIG, $from, 1); 
    17151677    if ($char =~ /^\s$/) { 
    17161678        my $r = $self->cursor_rev($from); 
     
    17261688    local $CTX = $self->callm if $DEBUG & DEBUG::trace_call; 
    17271689    my $P = $self->{_pos}; 
    1728     my $buf = $self->{_orig}; 
    1729     my $char = substr($$buf, $P, 1); 
     1690    my $char = substr($::ORIG, $P, 1); 
    17301691    if ($char =~ /^[ \t\r]$/ or ($char =~ /^\s$/ and $char !~ /^[\n\f\0x0b\x{2028}\x{2029}]$/)) { 
    17311692        my $r = $self->cursor($P+1); 
     
    17451706        return (); 
    17461707    } 
    1747     my $buf = $self->{_orig}; 
    1748     my $char = substr($$buf, $from, 1); 
     1708    my $char = substr($::ORIG, $from, 1); 
    17491709    if ($char =~ /^[ \t\r]$/ or ($char =~ /^\s$/ and $char !~ /^[\n\f\0x0b\x{2028}\x{2029}]$/)) { 
    17501710        my $r = $self->cursor_rev($from); 
     
    17601720    local $CTX = $self->callm if $DEBUG & DEBUG::trace_call; 
    17611721    my $P = $self->{_pos}; 
    1762     my $buf = $self->{_orig}; 
    1763     my $char = substr($$buf, $P, 1); 
     1722    my $char = substr($::ORIG, $P, 1); 
    17641723    if ($char =~ /^[\n\f\x0b\x{2028}\x{2029}]$/) { 
    17651724        my $r = $self->cursor($P+1); 
     
    17791738        return (); 
    17801739    } 
    1781     my $buf = $self->{_orig}; 
    1782     my $char = substr($$buf, $from, 1); 
     1740    my $char = substr($::ORIG, $from, 1); 
    17831741    if ($char =~ /^[\n\f\x0b\x{2028}\x{2029}]$/) { 
    17841742        my $r = $self->cursor_rev($from); 
     
    17961754    local $CTX = $self->callm if $DEBUG & DEBUG::trace_call; 
    17971755    my $P = $self->{_pos}; 
    1798     my $buf = $self->{_orig}; 
    1799     my $char = substr($$buf, $P, 1); 
     1756    my $char = substr($::ORIG, $P, 1); 
    18001757    if ($char =~ /$cc/) { 
    18011758        my $r = $self->cursor($P+1); 
     
    18171774        return (); 
    18181775    } 
    1819     my $buf = $self->{_orig}; 
    1820     my $char = substr($$buf, $from, 1); 
     1776    my $char = substr($::ORIG, $from, 1); 
    18211777    if ($char =~ /$cc/) { 
    18221778        my $r = $self->cursor_rev($from); 
     
    18321788    local $CTX = $self->callm if $DEBUG & DEBUG::trace_call; 
    18331789    my $P = $self->{_pos}; 
    1834     my $buf = $self->{_orig}; 
    1835     if ($P < length($$buf)) { 
     1790    if ($P < length($::ORIG)) { 
    18361791        $self->cursor($P+1)->retm(); 
    18371792    } 
     
    18661821    local $CTX = $self->callm if $DEBUG & DEBUG::trace_call; 
    18671822    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}]$/) { 
    18701824        $self->cursor($P)->retm(); 
    18711825    } 
     
    18791833    local $CTX = $self->callm if $DEBUG & DEBUG::trace_call; 
    18801834    my $P = $self->{_pos}; 
    1881     my $buf = $self->{_orig}; 
    1882     if ($P == length($$buf)) { 
     1835    if ($P == length($::ORIG)) { 
    18831836        $self->cursor($P)->retm(); 
    18841837    } 
     
    18921845    local $CTX = $self->callm if $DEBUG & DEBUG::trace_call; 
    18931846    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}])$/) { 
    18961848        $self->cursor($P)->retm(); 
    18971849    } 
     
    19051857    local $CTX = $self->callm if $DEBUG & DEBUG::trace_call; 
    19061858    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/) { 
    19101861        $self->cursor($P)->retm(); 
    19111862    } 
     
    19191870    local $CTX = $self->callm if $DEBUG & DEBUG::trace_call; 
    19201871    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)/) { 
    19241874        $self->cursor($P)->retm(); 
    19251875    } 
     
    19331883    local $CTX = $self->callm if $DEBUG & DEBUG::trace_call; 
    19341884    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)/) { 
    19381887        $self->cursor($P)->retm(); 
    19391888    } 
     
    19611910    my $P = $self->{_pos}; 
    19621911    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); 
    19651913    $self->deb("Commit branch to $P") if $DEBUG & DEBUG::matchers; 
    19661914    $self, LazyMap->new(sub { $self->deb("ABORTBRANCH") if $DEBUG & DEBUG::trace_call; die "ABORTBRANCH" }, $self); 
  • src/perl6/DumpMatch.pm

    r22656 r22824  
    9090    local %seen; 
    9191    traverse_match($r,$name,0,$events,$opt); 
    92     process_events(${$r->{_orig}},$events,$opt); 
     92    process_events($::ORIG,$events,$opt); 
    9393} 
    94941; 
  • src/perl6/STD.pm

    r22811 r22824  
    1111my $IN_DECL is context<rw>; 
    1212my %ROUTINES;