Changeset 22486 for src/perl6

Show
Ignore:
Timestamp:
10/02/08 19:20:32 (2 months ago)
Author:
lwall
Message:

[STD] more ACTIONS infrastructure, can now set $ACTIONS to a class in which
methods are called according to reduction tag.

Location:
src/perl6
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • src/perl6/Cursor.pmc

    r22484 r22486  
    19461946    my $F = $self->{_from}; 
    19471947    $self->{_reduced} = $tag; 
     1948    if ($::ACTIONS) { 
     1949        eval { $::ACTIONS->$tag($self) } 
     1950    } 
    19481951    $self->deb("REDUCE $tag from $F to $P") if $DEBUG & DEBUG::matchers; 
    19491952#    $self->whats; 
  • src/perl6/STD.pm

    r22414 r22486  
    11grammar STD:ver<6.0.0.alpha>:auth<http://perl.org>; 
    22 
     3# should some of these be parser instance attributes? 
    34my $LANG is context; 
    45my $PKGDECL is context = ""; 
     
    78my $GOAL is context = "(eof)"; 
    89my $PARSER is context<rw>; 
     10my $ACTIONS is context<rw>; 
    911my $IN_DECL is context<rw>; 
    1012my %ROUTINES; 
     
    1416   'foo' <.ws> 'bar' <.ws> 'baz' 
    1517} 
    16  
    17 =begin things todo 
    18  
    19     add more suppositions and figure out exact error continuation semantics 
    20     think about longest-token-defeating {*} that maybe should be <?{ {*}; 1}> 
    21     add parsing this file to sanity tests :) 
    22     evaluate "is context<rw>" for reentrancy brokenness 
    23  
    24 =end things todo 
    2518 
    2619=begin comment overview 
     
    4841symbol will be used by default. 
    4942 
    50 Note that rules with only one action need no #= comment, so the identifier 
    51 of the following stub is just "TOP". 
     43Note that rules automatically get an implicit {*} at their return, so 
     44for the TOP rule the implicit action name is also simply "TOP". 
    5245 
    5346Another nod toward preprocessing is that blocks that contain nested braces 
     
    5548understand Perl 6 code. 
    5649 
    57 This grammar also assumes transitive longest-token semantics, though 
    58 we make a feeble attempt to order rules so a procedural interpretation 
    59 of alternation can usually produce a correct parse.  (This will tend 
    60 to become less true over time.) 
     50This grammar relies on transitive longest-token semantics, though 
     51initially we made a feeble attempt to order rules so a procedural 
     52interpretation of alternation could usually produce a correct parse. 
     53(This is becoming less true over time.) 
    6154 
    6255=end comment overview 
  • src/perl6/gimme5

    r22475 r22486  
    11751175            $key .= " $2"; 
    11761176        } 
     1177        $key =~ s/ +/_/g; 
    11771178        ws(); 
    11781179        $key =~ s/(['\\])/\\$1/g;