Legend:
- Unmodified
- Added
- Removed
-
src/perl6/Cursor.pmc
r21973 r21975 102 102 $args{'_' . $name} = shift; 103 103 } 104 my $self = bless \%args, ref $class || $class;104 my $self = CORE::bless \%args, ref $class || $class; 105 105 my $buf = $self->{_orig}; 106 106 # $self->deb(" orig ", $$buf) if $DEBUG & DEBUG::cursors; … … 186 186 sub peek { $_[0]->{_peek} } 187 187 sub orig { $_[0]->{_orig} } 188 sub WHAT { ref $_[0] } 188 sub WHAT { ref $_[0] || $_[0] } 189 sub bless { CORE::bless $_[1], $_[0]->WHAT } 189 190 190 191 sub item { exists $_[0]->{''} ? $_[0]->{''} : $_[0]->text } … … 692 693 sub new { my $self = shift; 693 694 my %args = @_; 694 bless \%args, $self;695 CORE::bless \%args, $self; 695 696 } 696 697 … … 708 709 my %r = %$self; 709 710 $r{_peek} = 1; 710 bless \%r, ref $self;711 CORE::bless \%r, ref $self; 711 712 } 712 713 … … 720 721 $r{_fate} = $self->{_fate}; 721 722 $r{_herelang} = $self->{_herelang} if $self->{_herelang}; 722 bless \%r, ref $lang || $lang;723 CORE::bless \%r, ref $lang || $lang; 723 724 } 724 725 … … 727 728 my %r = %$self; 728 729 $r{_herelang} = $self; 729 bless \%r, 'STD::Q';730 CORE::bless \%r, 'STD::Q'; 730 731 } 731 732 … … 835 836 $r{_pos} = $r{_to} = $submatch->{_to}; 836 837 delete $r{_fate}; 837 bless \%r, ref $self; # return new match cursor for parent838 CORE::bless \%r, ref $self; # return new match cursor for parent 838 839 } 839 840 … … 874 875 } 875 876 } 876 return ( bless \%r, ref $self), $tag, $try, $relex;877 return (CORE::bless \%r, ref $self), $tag, $try, $relex; 877 878 } 878 879 … … 887 888 $r{_pos} = $tpos; 888 889 889 bless \%r, ref $self;890 CORE::bless \%r, ref $self; 890 891 } 891 892 … … 905 906 $r{_pos} = $tpos; 906 907 907 bless \%r, ref $self;908 CORE::bless \%r, ref $self; 908 909 } 909 910 … … 923 924 $r{_to} = $self->{_from}; 924 925 925 bless \%r, ref $self;926 CORE::bless \%r, ref $self; 926 927 } 927 928 … … 1296 1297 1297 1298 local $CTX = $self->callm if $DEBUG & DEBUG::trace_call; 1298 lazymap(sub { bless($_[0],ref($self))->retm() },1299 lazymap(sub { CORE::bless($_[0],ref($self))->retm() }, 1299 1300 $block->($self)); 1300 1301 } … … 1305 1306 local $CTX = $self->callm if $DEBUG & DEBUG::trace_call; 1306 1307 my ($val) = $block->($self) or return (); 1307 bless($val,ref($self))->retm();1308 CORE::bless($val,ref($self))->retm(); 1308 1309 } 1309 1310 -
src/perl6/STD.pm
r21973 r21975 8 8 my $PARSER is context<rw>; 9 9 my $IN_DECL is context<rw>; 10 my %ROUTINES; 10 11 11 12 # random rule for debugging, please ignore … … 95 96 Buf buf buf1 buf2 buf4 buf8 buf16 buf32 buf64 96 97 97 Bit Bool True False98 Bit Bool 98 99 bit bool 99 100 … … 106 107 KitchenSink 107 108 ]; 109 push @typenames, "True", "False"; # in quotes lest gimme5 translate them 108 110 109 111 my %typenames; … … 123 125 %typenames{$qualname} = $qualname; 124 126 %typenames{$shortname} = $qualname; 127 } 128 129 # XXX likewise for routine defs 130 131 my @routinenames = qw[ 132 WHAT WHICH VAR 133 die exit warn eval temp 134 callsame callwith nextsame nextwith lastcall 135 defined undefine item list slice 136 join split substr index chars pack unpack uc ucfirst lc lcfirst 137 say print open close printf sprintf slurp unlink 138 elems grep map sort push reverse take splice 139 zip each roundrobin caller 140 return leave pop shift unshift reduce 141 keys values hash 142 sqrt floor ceil 143 any all none one 144 plan is ok dies_ok lives_ok skip todo pass flunk force_todo use_ok isa_ok 145 cmp_ok diag is_deeply isnt like skip_rest unlike nonce skip_rest eval_dies_okay 146 ]; 147 push @routinenames, "HOW", "fail"; 148 149 # if True ref False unless length bless delete exists 150 151 my %routinenames; 152 %routinenames{@routinenames} = (1 xx @routinenames); 153 154 method is_routine ($name) { 155 return True if %routinenames{$name}; 156 return True if %typenames{$name}; 157 #return True if GLOBAL::{$name}.:exists; 158 return False; 159 } 160 161 method add_routine ($name) { 162 %routinenames{$name} = 1; 125 163 } 126 164 … … 482 520 <statementlist> 483 521 [ <?unitstopper> || <.panic: "Can't understand next input--giving up"> ] 522 # "CHECK" time... 523 {{ 524 my %UNKNOWN; 525 for keys(%ROUTINES) { 526 next if $¢.is_routine($_); 527 %UNKNOWN{$_} = %ROUTINES{$_}; 528 } 529 if %UNKNOWN { 530 warn "Unknown routines:\n"; 531 for sort keys(%UNKNOWN) { 532 warn "\t$_ called at ", %UNKNOWN{$_}, "\n"; 533 } 534 } 535 }} 484 536 } 485 537 … … 582 634 # this could either be a statement that follows a declaration 583 635 # or a statement that is within the block of a code declaration 584 <!!{ bless $¢, ref $PARSER; }>636 <!!{ $¢ = $+PARSER.bless($¢); }> 585 637 586 638 [ … … 1541 1593 # XXX too soon 1542 1594 [ <colonpair>+ { $¢.add_macro($<name>) if $+IN_DECL; } ]? 1595 { $¢.add_routine($<name>.text) if $+IN_DECL; } 1543 1596 } 1544 1597 … … 2376 2429 :my $IN_DECL is context<rw> = 1; 2377 2430 [ '&'<deflongname>? | <deflongname> ]? [ <multisig> | <trait> ]* 2378 <!!{ bless $¢, ref $PARSER; }> 2379 { $IN_DECL = 0; } 2431 <!{ 2432 $¢ = $+PARSER.bless($¢); 2433 $IN_DECL = 0; 2434 }> 2380 2435 <block> 2381 2436 } … … 2407 2462 :my $IN_DECL is context<rw> = 1; 2408 2463 [ '&'<deflongname>? | <deflongname> ]? [ <multisig> | <trait> ]* 2409 <!!{ bless $¢, ref $PARSER; }> 2410 { $IN_DECL = 0; } 2464 <!{ 2465 $¢ = $+PARSER.bless($¢); 2466 $IN_DECL = 0; 2467 }> 2411 2468 <block> 2412 2469 } … … 2626 2683 2627 2684 token term:sym<next> ( --> Term) 2628 { <sym> » <.ws> <termish>? }2685 { <sym> » <.ws> [<!stdstopper> <termish>]? } 2629 2686 2630 2687 token term:sym<last> ( --> Term) 2631 { <sym> » <.ws> <termish>? }2688 { <sym> » <.ws> [<!stdstopper> <termish>]? } 2632 2689 2633 2690 token term:sym<redo> ( --> Term) 2634 { <sym> » <.ws> <termish>? }2691 { <sym> » <.ws> [<!stdstopper> <termish>]? } 2635 2692 2636 2693 token term:sym<goto> ( --> Term) … … 3075 3132 :my $i; 3076 3133 $i = <identifier> <args( $¢.is_type($i.text) )> 3134 {{ %ROUTINES{$i.text} ~= $¢.lineof($¢.pos) ~ ' ' }} 3077 3135 } 3078 3136 … … 3864 3922 for @text { 3865 3923 $posprops.[$pos++]<L> = $line 3866 for 1 .. length($_);3924 for 1 .. chars($_); 3867 3925 $line++; 3868 3926 } -
src/perl6/gimme5
r21973 r21975 182 182 $f =~ s/^\bdefault\s+\{// and $t .= qq/else {/, next; 183 183 $f =~ s/^\btemp\b// and $t .= qq/local/, next; 184 $f =~ s/^\bchars\( \b// and $t .= qq/length(/, next;184 $f =~ s/^\bchars\(// and $t .= qq/length(/, next; 185 185 186 186 # the following must do partial rescan of final expression … … 1565 1565 local $NEEDMATCH = 0; 1566 1566 %NEEDSEMI = (); 1567 my $text ;1567 my $text = ''; 1568 1568 for my $line (split /^/,$$self{text}) { 1569 1569 if ($line =~ /^(\s*).*?given/) { … … 1579 1579 $text .= $line; 1580 1580 } 1581 $text = ::un6($text) ;1581 $text = ::un6($text) // ''; 1582 1582 my $ctx = $$self{context}; 1583 1583 $text = 'my $M = $C; ' . $text . ';' if $NEEDMATCH;
