Changeset 22599 for src/perl6

Show
Ignore:
Timestamp:
10/14/08 00:57:05 (6 weeks ago)
Author:
lwall
Message:

[STD] fix circularity bug in unary and binary ops
[viv] more progress in ~ delimiters through

Location:
src/perl6
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • src/perl6/Cursor.pmc

    r22550 r22599  
    19581958 
    19591959sub _COMMITBRANCH { my $self = shift; 
     1960    $self->{LAST} = shift() if @_; 
    19601961    local $CTX = $self->callm if $DEBUG & DEBUG::trace_call; 
    19611962    my $P = $self->{_pos}; 
     1963    my $F = $self->{_from}; 
     1964    my $buf = $self->{_orig}; 
     1965    $self->{FIRST} = substr($$buf, $F, $P - $F); 
    19621966    $self->deb("Commit branch to $P") if $DEBUG & DEBUG::matchers; 
    19631967    $self, LazyMap->new(sub { $self->deb("ABORTBRANCH") if $DEBUG & DEBUG::trace_call; die "ABORTBRANCH" }, $self); 
  • src/perl6/STD.pm

    r22585 r22599  
    26712671    | <?> { $kind = '!' } 
    26722672    ] 
    2673  
    26742673    <.ws> 
     2674 
    26752675    $<subsig> = [ 
    2676     | '[' ~ ']' <signature> 
    2677     | <?before '{'> <!{ $+GOAL eq '{'}> 
    2678       '{' ~ '}' <signature> 
     2676        '[' ~ ']' <signature> 
     2677        <.ws> 
    26792678    ]* 
    26802679 
     
    32333232    | :dba('argument list') '(' ~ ')' <semilist> {*}              #= func args 
    32343233    | :dba('argument list') <.unsp> '.'? '(' ~ ')' <semilist> {*} #= func args 
    3235     | {} [<?before \s> <!{ $istype }> <.ws> <!infixstopper> <arglist> { $listopish = 1 }]? 
     3234    | {} [<?before \s> <!{ $istype }> <.ws> <!infixstopper> <listopargs=arglist> { $listopish = 1 }]? 
    32363235    ] 
    32373236 
     
    32393238    [ 
    32403239    || <?{ $listopish }> 
    3241     || ':' <?before \s> <arglist>    # either switch to listopiness 
     3240    || ':' <?before \s> <listopargs=arglist>    # either switch to listopiness 
    32423241    || {{ $<O> = {}; }}   # or allow adverbs (XXX needs hoisting?) 
    32433242    ] 
     
    34513450 
    34523451                self.deb($op.dump) if $*DEBUG +& DEBUG::EXPR; 
    3453                 $op<arg> = (pop @termstack).cleanup; 
    3454                 $op<_from> = $op<arg><_from> 
    3455                     if $op<_from> > $op<arg><_from>; 
    3456                 $op<_to> = $op<arg><_to> 
    3457                     if $op<_to> < $op<arg><_to>; 
    3458                 $op<_arity> = 'UNARY'; 
    3459                 push @termstack, $op._REDUCE('EXPR'); 
     3452                my $nop = $op.cursor_fresh(); 
     3453                $nop<_from> = $op<_from>; 
     3454                $nop<_to> = $op<_to>; 
     3455                $nop<_pos> = $op<_pos>; 
     3456                $nop<arg> = (pop @termstack).cleanup; 
     3457                if ($nop<arg><_from> < $nop<_from>) { 
     3458                    $nop<_from> = $nop<arg><_from>; 
     3459                } 
     3460                if ($nop<arg><_to> > $nop<_to>) { 
     3461                    $nop<_to> = $nop<arg><_to>; 
     3462                } 
     3463                $nop<_arity> = 'UNARY'; 
     3464                push @termstack, $nop._REDUCE('EXPR'); 
    34603465            } 
    34613466            default { 
     
    34653470 
    34663471                self.deb($op.dump) if $*DEBUG +& DEBUG::EXPR; 
    3467                 $op<right> = (pop @termstack).cleanup; 
    3468                 $op<left> = (pop @termstack).cleanup; 
    3469                 $op<_from> = $op<left><_from>; 
    3470                 $op<_to> = $op<right><_to>; 
    3471                 $op<_arity> = 'BINARY'; 
    3472                 push @termstack, $op._REDUCE('EXPR'); 
     3472                my $nop = $op.cursor_fresh(); 
     3473                $nop<right> = (pop @termstack).cleanup; 
     3474                $nop<left> = (pop @termstack).cleanup; 
     3475                $nop<_from> = $nop<left><_from>; 
     3476                $nop<_to> = $nop<right><_to>; 
     3477                $nop<_arity> = 'BINARY'; 
     3478                push @termstack, $nop._REDUCE('EXPR'); 
    34733479            } 
    34743480        } 
  • src/perl6/viv

    r22585 r22599  
    275275} 
    276276 
    277 { package VAST::AddSym; our @ISA = 'VAST::Base'; 
     277{ package VAST::PreSym; our @ISA = 'VAST::Base'; 
    278278    sub emit_p6 { my $self = shift; 
    279279        my $text = $self->get_ws; 
    280280        $text .= $self->{sym}; 
    281281        $text .= $self->SUPER::emit_p6(@_); 
     282        $text; 
     283    } 
     284} 
     285 
     286{ package VAST::CircumSym; our @ISA = 'VAST::Base'; 
     287    sub emit_p6 { my $self = shift; 
     288        my $text = $self->get_ws; 
     289        $text .= $self->{sym}[0]; 
     290        $text .= $self->SUPER::emit_p6(@_); 
     291        $text .= $self->{sym}[1]; 
     292        $text; 
     293    } 
     294} 
     295 
     296{ package VAST::FirstLast; our @ISA = 'VAST::Base'; 
     297    sub emit_p6 { my $self = shift; 
     298        my $text = $self->get_ws; 
     299        $text .= $self->{FIRST}; 
     300        $text .= $self->SUPER::emit_p6(@_); 
     301        $text .= $self->{LAST}; 
    282302        $text; 
    283303    } 
     
    364384} 
    365385 
    366 { package VAST::scope_declarator; our @ISA = 'VAST::AddSym'; } 
    367 { package VAST::statement_control; our @ISA = 'VAST::AddSym'; } 
    368 { package VAST::version; our @ISA = 'VAST::AddSym'; } 
    369  
    370386{ package VAST::variable_declarator; our @ISA = 'VAST::Base'; 
    371387    sub emit_p6 { my $self = shift; 
     
    379395} 
    380396 
     397{ package VAST::scope_declarator; our @ISA = 'VAST::PreSym'; } 
     398{ package VAST::statement_control; our @ISA = 'VAST::PreSym'; } 
     399{ package VAST::statement_prefix; our @ISA = 'VAST::PreSym'; } 
     400{ package VAST::version; our @ISA = 'VAST::PreSym'; } 
     401 
     402{ package VAST::block; our @ISA = 'VAST::CircumSym'; } 
     403{ package VAST::circumfix; our @ISA = 'VAST::CircumSym'; } 
     404{ package VAST::postcircumfix; our @ISA = 'VAST::CircumSym'; } 
     405{ package VAST::args; our @ISA = 'VAST::FirstLast'; } 
     406 
    381407if ($0 eq __FILE__) { 
    382408    ::MAIN(@ARGV);