develooper Front page | perl.cvs.parrot | Postings from December 2008

[svn:parrot] r33902 - in branches/assoc: . languages/perl6/config/makefiles languages/perl6/src/classes languages/perl6/src/parser

From:
pmichaud
Date:
December 14, 2008 13:18
Subject:
[svn:parrot] r33902 - in branches/assoc: . languages/perl6/config/makefiles languages/perl6/src/classes languages/perl6/src/parser
Message ID:
20081214211845.6494CCBA12@x12.develooper.com
Author: pmichaud
Date: Sun Dec 14 13:18:42 2008
New Revision: 33902

Added:
   branches/assoc/languages/perl6/src/classes/Associative.pir
      - copied, changed from r33901, /branches/assoc/languages/perl6/src/classes/Positional.pir
Modified:
   branches/assoc/MANIFEST
   branches/assoc/languages/perl6/config/makefiles/root.in
   branches/assoc/languages/perl6/src/parser/actions.pm

Log:
[rakudo]:  Initial Associative implementation.


Modified: branches/assoc/MANIFEST
==============================================================================
--- branches/assoc/MANIFEST	(original)
+++ branches/assoc/MANIFEST	Sun Dec 14 13:18:42 2008
@@ -1,7 +1,7 @@
 # ex: set ro:
 # $Id$
 #
-# generated by tools/dev/mk_manifest_and_skip.pl Sat Dec 13 14:28:34 2008 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Sun Dec 14 21:18:26 2008 UT
 #
 # See tools/dev/install_files.pl for documentation on the
 # format of this file.
@@ -2127,6 +2127,7 @@
 languages/perl6/src/classes/Abstraction.pir                 [perl6]
 languages/perl6/src/classes/Any.pir                         [perl6]
 languages/perl6/src/classes/Array.pir                       [perl6]
+languages/perl6/src/classes/Associative.pir                 [perl6]
 languages/perl6/src/classes/Block.pir                       [perl6]
 languages/perl6/src/classes/Bool.pir                        [perl6]
 languages/perl6/src/classes/Capture.pir                     [perl6]

Modified: branches/assoc/languages/perl6/config/makefiles/root.in
==============================================================================
--- branches/assoc/languages/perl6/config/makefiles/root.in	(original)
+++ branches/assoc/languages/perl6/config/makefiles/root.in	Sun Dec 14 13:18:42 2008
@@ -54,6 +54,7 @@
   src/classes/Abstraction.pir \
   src/classes/Protoobject.pir \
   src/classes/Positional.pir \
+  src/classes/Associative.pir \
   src/classes/Any.pir \
   src/classes/Bool.pir \
   src/classes/Str.pir \

Copied: branches/assoc/languages/perl6/src/classes/Associative.pir (from r33901, /branches/assoc/languages/perl6/src/classes/Positional.pir)
==============================================================================
--- /branches/assoc/languages/perl6/src/classes/Positional.pir	(original)
+++ branches/assoc/languages/perl6/src/classes/Associative.pir	Sun Dec 14 13:18:42 2008
@@ -2,7 +2,7 @@
 
 =head1 NAME
 
-src/classes/Positional.pir - Positional Role
+src/classes/Associative.pir - Associative Role
 
 =head1 DESCRIPTION
 
@@ -12,24 +12,24 @@
 
 .sub '' :anon :load :init
     .local pmc positional
-    positional = '!keyword_role'('Positional')
+    positional = '!keyword_role'('Associative')
 
-    $P0 = get_hll_namespace ['Positional']
-    '!EXPORT'('postcircumfix:[ ]', $P0)
+    $P0 = get_hll_namespace ['Associative']
+    '!EXPORT'('postcircumfix:{ }', $P0)
 .end
 
 =head2 Operators
 
 =over
 
-=item postcircumfix:<[ ]>
+=item postcircumfix:<{ }>
 
 Returns a list element or slice.
 
 =cut
 
-.namespace ['Positional']
-.sub 'postcircumfix:[ ]' :method :multi(_, _)
+.namespace ['Associative']
+.sub 'postcircumfix:{ }' :method :multi(_, _)
     .param pmc args            :slurpy
     .param pmc options         :slurpy :named
     .local pmc result
@@ -40,22 +40,22 @@
     args.'!flatten'()
     $I0 = args.'elems'()
     if $I0 != 1 goto slice
-    $I0 = args[0]
-    result = self[$I0]
+    $S0 = args[0]
+    result = self[$S0]
     unless null result goto end
     result = new 'Failure'
-    self[$I0] = result
+    self[$S0] = result
     goto end
   slice:
     result = new 'List'
   slice_loop:
     unless args goto slice_done
-    $I0 = shift args
+    $S0 = shift args
     .local pmc elem
-    elem = self[$I0]
+    elem = self[$S0]
     unless null elem goto slice_elem
     elem = new 'Failure'
-    self[$I0] = elem
+    self[$S0] = elem
   slice_elem:
     push result, elem
     goto slice_loop

Modified: branches/assoc/languages/perl6/src/parser/actions.pm
==============================================================================
--- branches/assoc/languages/perl6/src/parser/actions.pm	(original)
+++ branches/assoc/languages/perl6/src/parser/actions.pm	Sun Dec 14 13:18:42 2008
@@ -1529,29 +1529,20 @@
         $past := build_call( $( $<semilist> ) );
         $past.node($/);
         $past.name('postcircumfix:[ ]');
-        $past.pasttype('call');
     }
     elsif $key eq '( )' {
         $past := build_call( $( $<semilist> ) );
         $past.node($/);
     }
     elsif $key eq '{ }' {
-        $past := PAST::Var.new(
-            $( $<semilist> ),
-            :scope('keyed'),
-            :vivibase('Perl6Hash'),
-            :viviself('Failure'),
-            :node( $/ )
-        );
+        $past := build_call( $( $<semilist> ) );
+        $past.node($/);
+        $past.name('postcircumfix:{ }');
     }
     elsif $key eq '< >' {
-        $past := PAST::Var.new(
-            $( $<quote_expression> ),
-            :scope('keyed'),
-            :vivibase('Perl6Hash'),
-            :viviself('Failure'),
-            :node( $/ )
-        );
+        $past := build_call( $( $<quote_expression> ) );
+        $past.node($/);
+        $past.name('postcircumfix:{ }');
     }
     else {
         $/.panic("postcircumfix " ~ $key ~ " not yet implemented");



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About