Changeset 21852 for src/perl6

Show
Ignore:
Timestamp:
08/08/08 18:51:11 (4 months ago)
Author:
lwall
Message:

[STD] allow ' and - in ident (but only before a letter)

Location:
src/perl6
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • src/perl6/Cursor.pmc

    r21845 r21852  
    157157    for (;;) { 
    158158        my $retval = eval { 
    159             $self->deb("Calling $class" . '::multitweak'); 
     159            $self->deb("Calling $class" . '::multitweak') if $DEBUG & DEBUG::mixins; 
    160160            &{$class . '::multitweak'}($self,@_); 
    161161        };  
     
    609609                    # Try Real Hard to prevent TRE from recompiling $pat 
    610610                    state $matcher = eval(do { my $prog = <<"END" . 
    611                     \$self->deb("GENERATING"); 
    612611                    sub { 
    613612                        my \$C = shift; 
     
    620619                            my $max = @+ - 1; 
    621620                            my $last = @- - 1;  # ignore '$0' 
    622                             $C->deb("LAST: $last\n"); 
     621                            $C->deb("LAST: $last\n") if $DEBUG & DEBUG::lexer; 
    623622                            $result = $fates->[$last-1]; 
    624623                            for my $x (1 .. $max) { 
     
    652651                    } 
    653652                    else { 
    654                         $self->deb("NO LEXER MATCH"); 
     653                        $self->deb("NO LEXER MATCH") if $DEBUG & DEBUG::lexer; 
    655654                        return; 
    656655                    } 
  • src/perl6/STD.pm

    r21838 r21852  
    441441} 
    442442 
     443token identish { 
     444    <.alpha> \w* 
     445} 
     446 
    443447token ident { 
    444     <.alpha> \w* 
     448    <.identish> [<[ ' \- ]><identish>]* 
    445449} 
    446450 
     
    38423846    return 1 unless defined $p; 
    38433847    my $posprops = self.<_>; 
    3844     my $line = $posprops.[$p]<line>; 
     3848    my $line = $posprops.[$p]<L>; 
    38453849    return $line if $line; 
    38463850    $line = 1; 
    38473851    my $pos = 0; 
    38483852    my $orig = self.orig; 
    3849     my $text = $$orig; 
    3850     while $text ne '' { # XXX needs to recognize #line? 
    3851         $posprops.[$pos++]<line> = $line; 
    3852         $line++ if substr($text,0,1,'') eq "\n"; 
    3853     } 
    3854     return $posprops.[$p]<line> // 0; 
     3853    my @text = split(/^/,$$orig); 
     3854    for @text { 
     3855        $posprops.[$pos++]<L> = $line 
     3856            for 1 .. length($_); 
     3857        $line++; 
     3858    } 
     3859    return $posprops.[$p]<L> // 0; 
    38553860} 
    38563861