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

[svn:parrot] r34461 - branches/rvar/languages/perl6/src/parser

From:
pmichaud
Date:
December 27, 2008 17:34
Subject:
[svn:parrot] r34461 - branches/rvar/languages/perl6/src/parser
Message ID:
20081228013406.7DFE6CBA12@x12.develooper.com
Author: pmichaud
Date: Sat Dec 27 17:34:04 2008
New Revision: 34461

Modified:
   branches/rvar/languages/perl6/src/parser/actions.pm

Log:
[rakudo]:  Add namespace qualified vars and globals.


Modified: branches/rvar/languages/perl6/src/parser/actions.pm
==============================================================================
--- branches/rvar/languages/perl6/src/parser/actions.pm	(original)
+++ branches/rvar/languages/perl6/src/parser/actions.pm	Sat Dec 27 17:34:04 2008
@@ -2093,7 +2093,21 @@
 }
 
 method variable($/, $key) {
-    my $past := PAST::Var.new( :name(~$/), :node($/) );
+    my $past;
+    if $key eq 'desigilname' {
+        my $sigil      := ~$<sigil>;
+        my $twigil     := ~$<twigil>[0];
+        my @identifier := Perl6::Compiler.parse_name( $<desigilname> );
+        my $name       := $sigil ~ @identifier.pop();
+        $past := PAST::Var.new( :name($name), :node($/) );
+
+        ##  if namespace qualified or has a '*' twigil, it's a package var
+        if @identifier || $twigil eq '*' {
+            $past.namespace(@identifier);
+            $past.scope('package');
+            $past.viviself( container_type($sigil) );
+        }
+    }
     make $past;
 }
 



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