Changeset 21792 for src/perl6

Show
Ignore:
Timestamp:
08/05/08 21:14:18 (4 months ago)
Author:
lwall
Message:

[STD] let EXPR parse term after infix with a rule specified by the infix op

(considered other kludges but this preserves 1-pass parsing)
switch , parsing to using this mechanism plus <nulltermish>
fix .= parsing by forcing <dottyop> as next term

[pre_post.t] can't leave the space out between "is Foo" and the class block

or it is interpreted as an arg to the Foo pseudo-adverb

Location:
src/perl6
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • src/perl6/LazyMap.pm

    r21405 r21792  
    4747 
    4848sub iter { 
     49    no warnings 'recursion'; 
    4950    my $self = shift; 
    5051    my $lazies = $self->{L}; 
  • src/perl6/STD.pm

    r21789 r21792  
    123123constant %item_assignment = (:prec<i=>, :assoc<right>); 
    124124constant %loose_unary     = (:prec<h=>); 
    125 constant %comma           = (:prec<g=>, :assoc<list>, :nullok); 
     125constant %comma           = (:prec<g=>, :assoc<list>, :nextterm<nulltermish>); 
    126126constant %list_infix      = (:prec<f=>, :assoc<list>,  :assign); 
    127127constant %list_assignment = (:prec<i=>, :sub<e=>, :assoc<right>); 
     
    737737} 
    738738 
     739token nulltermish { 
     740    [ 
     741    | <?stdstopper> 
     742    | <termish>? 
     743    ] 
     744} 
     745 
    739746token termish { 
    740747    [ 
     
    29322939# XXX need to do something to turn subcall into method call here... 
    29332940token infix:sym<.=> ( --> Item_assignment) 
    2934     { <sym> } 
     2941    { <sym> <.ws> { $<O><nextterm> = 'dottyop' } } 
    29352942 
    29362943token infix:sym« => » ( --> Item_assignment) 
     
    31593166    my @termstack; 
    31603167    my @opstack; 
    3161     my $nullok = 0; 
     3168    my $termish = 'termish'; 
    31623169 
    31633170    push @opstack, { 'O' => item %terminator, 'sym' => '' };         # (just a sentinel value) 
     
    32443251        self.deb("In loop, at ", $here.pos) if $*DEBUG +& DEBUG::EXPR; 
    32453252        my $oldpos = $here.pos; 
    3246         my @t = $here.termish();       # eats ws too 
    3247  
    3248         if not @t or not $here = @t[0] or $here.pos == $oldpos { 
    3249             last if $nullok; 
     3253        my @t = $here.$termish;       # presumed to eat trailing ws too 
     3254 
     3255        if not @t or not $here = @t[0] or ($here.pos == $oldpos and $termish eq 'termish') { 
    32503256            return (); 
    32513257            # $here.panic("Failed to parse a required term"); 
    32523258        } 
     3259        $termish = 'termish'; 
    32533260 
    32543261        # interleave prefix and postfix, pretend they're infixish 
     
    33283335            } 
    33293336        } 
    3330         $nullok = 1 if $inO<nullok>; 
     3337        $termish = $inO<nextterm> if $inO<nextterm>; 
    33313338        push @opstack, $infix; 
    33323339    }