perl.cvs.mod_parrot
[Top] [All Lists]

[svn:mod_parrot] r358 - mod_parrot/trunk/patches

Subject: [svn:mod_parrot] r358 - mod_parrot/trunk/patches
From: jhorwitz@xxxxxxxxxxxx
Date: Thu, 10 Jul 2008 09:18:15 -0700 (PDT)
Newsgroups: perl.cvs.mod_parrot

Author: jhorwitz
Date: Thu Jul 10 09:18:14 2008
New Revision: 358

Added:
   mod_parrot/trunk/patches/parrot-r29231-modperl6.patch
Removed:
   mod_parrot/trunk/patches/parrot-r28322-modperl6.patch

Log:
new patch for parrot r29231


Added: mod_parrot/trunk/patches/parrot-r29231-modperl6.patch
==============================================================================
--- (empty file)
+++ mod_parrot/trunk/patches/parrot-r29231-modperl6.patch       Thu Jul 10 
09:18:14 2008
@@ -0,0 +1,143 @@
+Index: languages/perl6/src/builtins/misc.pir
+===================================================================
+--- languages/perl6/src/builtins/misc.pir      (revision 29231)
++++ languages/perl6/src/builtins/misc.pir      (working copy)
+@@ -12,6 +12,19 @@
+     .return($P0)
+ .end
+ 
++.sub 'resolve_sym'
++    .param string ns
++    .param string name
++    .param pmc args :slurpy
++    .local pmc sym
++    .local pmc nskey
++
++    nskey = split '::', ns
++    sym = get_hll_global nskey, name
++
++    .return(sym)
++.end
++
+ # Local Variables:
+ #   mode: pir
+ #   fill-column: 100
+Index: languages/perl6/src/builtins/io.pir
+===================================================================
+--- languages/perl6/src/builtins/io.pir        (revision 29231)
++++ languages/perl6/src/builtins/io.pir        (working copy)
+@@ -70,7 +70,30 @@
+ 
+ .sub 'require'
+     .param pmc filename
++    .local string path
+ 
++    $S0 = substr filename, 0, 1
++    if $S0 == '/' goto eval_file
++
++    .local pmc env
++    .local pmc perl6lib
++    env = new 'Env'
++    $S0 = env['PERL6LIB']
++    unless $S0 goto eval_file
++    perl6lib = split ':', $S0
++    .local pmc iter
++    iter = new 'Iterator', perl6lib
++  iter_start:
++    unless iter goto eval_file
++    $S0 = shift iter
++    $S1 = concat $S0, '/'
++    $S0 = filename
++    path = concat $S1, $S0
++    $I2 = stat path, 0
++    unless $I2 goto iter_start
++    filename = path
++
++  eval_file:
+     .local pmc p6compiler
+     p6compiler = compreg 'Perl6'
+     p6compiler.'evalfiles'(filename)
+Index: languages/perl6/src/parser/actions.pm
+===================================================================
+--- languages/perl6/src/parser/actions.pm      (revision 29231)
++++ languages/perl6/src/parser/actions.pm      (working copy)
+@@ -2191,6 +2191,27 @@
+         $past := build_call( $( $<semilist> ) );
+         $past.name( ~$<ident> );
+     }
++    # call sub with an interpolated namespace
++    # right now we only support this exact form: ::($ns)::name()
++    elsif $key eq 'interpolated func args' {
++        my $resolve_past := PAST::Op.new(
++            :name('resolve_sym'),
++            :pasttype('call'),
++            :node($/)
++        );
++        $resolve_past.unshift(PAST::Val.new(
++            :value( ~$<interpolated_name><name><ident>[0] )
++        ));
++        $resolve_past.unshift(
++            $( $<interpolated_name><interpolated_ident>[0]<EXPR> )
++        );
++        $past := build_call( $( $<semilist> ) );
++        $past.unshift($resolve_past);
++
++        # build_call will set 'name' for us.  we reset that to 0 so the
++        # sub call invokes the first PAST argument ($resolve_past) instead
++        $past.name(0);
++    }
+     elsif $key eq 'listop args' {
+         $past := build_call( $( $<arglist> ) );
+         $past.name( ~$<ident> );
+Index: languages/perl6/src/parser/grammar.pg
+===================================================================
+--- languages/perl6/src/parser/grammar.pg      (revision 29231)
++++ languages/perl6/src/parser/grammar.pg      (working copy)
+@@ -532,6 +532,8 @@
+     [
+     | 'VAR(' <variable> ')' {*}                  #= VAR
+     | <typename> {*}                             #= typename
++    | <interpolated_name> <.unsp>? '.'?
++      '(' <semilist> ')' {*}                     #= interpolated func args
+     | <ident=named_0ary>
+         [
+         | <.unsp>? '.'? '(' <semilist> ')' {*}   #= func args
+@@ -641,10 +643,10 @@
+ }
+ 
+ token circumfix {
+-    | '(' <statementlist> ')' {*}                #= ( )
+-    | '[' <statementlist> ']' {*}                #= [ ]
+-    | <?before '{' | <lambda> > <pblock> {*}     #= { }
+-    | <sigil> '(' <semilist> ')' {*}             #= $( )
++    | '(' <statementlist> ')' {*}                   #= ( )
++    | '[' <statementlist> ']' {*}                   #= [ ]
++    | <?before '{' | <lambda> > <pblock> {*}        #= { }
++    | <sigil=variable_sigil> '(' <semilist> ')' {*} #= $( )
+ }
+ 
+ token variable {
+@@ -656,6 +658,8 @@
+ 
+ token sigil { '$' | '@' | '%' | '&' | '::' }
+ 
++token variable_sigil { '$' | '@' | '%' }
++
+ token twigil { <[.!^:*+?=]> }
+ 
+ token name {
+@@ -755,6 +759,14 @@
+     {*}
+ }
+ 
++token interpolated_name {
++    [ '::' <interpolated_ident> ]+ '::' <name>
++}
++
++token interpolated_ident {
++    <?after '::' > '(' <EXPR> ')'
++}
++
+ token name {
+     <ident> [ '::' <ident> ]*
+     {*}

<Prev in Thread] Current Thread [Next in Thread>
  • [svn:mod_parrot] r358 - mod_parrot/trunk/patches, jhorwitz <=