develooper Front page | perl.cvs.parrot | Postings from January 2009

[svn:parrot] r35204 - in branches/rvar2/languages/perl6/src: builtins parser

From:
pmichaud
Date:
January 8, 2009 07:42
Subject:
[svn:parrot] r35204 - in branches/rvar2/languages/perl6/src: builtins parser
Message ID:
20090108154240.B6A1BCB9F9@x12.develooper.com
Author: pmichaud
Date: Thu Jan  8 07:42:39 2009
New Revision: 35204

Modified:
   branches/rvar2/languages/perl6/src/builtins/guts.pir
   branches/rvar2/languages/perl6/src/parser/actions.pm

Log:
[rakudo]:  Make sure grammars are in correct namespace, subclass of Grammar.


Modified: branches/rvar2/languages/perl6/src/builtins/guts.pir
==============================================================================
--- branches/rvar2/languages/perl6/src/builtins/guts.pir	(original)
+++ branches/rvar2/languages/perl6/src/builtins/guts.pir	Thu Jan  8 07:42:39 2009
@@ -394,6 +394,8 @@
     ns = get_hll_namespace nsarray
     if also goto is_also
     metaclass = newclass ns
+    $P0 = box type
+    setprop metaclass, 'pkgtype', $P0
     .return (metaclass)
   is_also:
     metaclass = get_class ns
@@ -437,8 +439,13 @@
     goto roles_it_loop
   roles_it_loop_end:
 
-    # Create proto-object with default parent being Any.
-    p6meta.'register'(metaclass, 'parent'=>'Any')
+    # Create proto-object with default parent being Any or Grammar.
+    $S0 = 'Any'
+    $P0 = getprop 'pkgtype', metaclass
+    if $P0 != 'grammar' goto register
+    $S0 = 'Grammar'
+  register:
+    p6meta.'register'(metaclass, 'parent'=>$S0)
 .end
 
 

Modified: branches/rvar2/languages/perl6/src/parser/actions.pm
==============================================================================
--- branches/rvar2/languages/perl6/src/parser/actions.pm	(original)
+++ branches/rvar2/languages/perl6/src/parser/actions.pm	Thu Jan  8 07:42:39 2009
@@ -2152,8 +2152,12 @@
 method regex_declarator($/) {
     my $sym  := ~$<sym>;
     my $past := $( $<regex_def> );
-    if $sym eq 'token'   { $past.compiler_args( :ratchet(1) ); }
-    elsif $sym eq 'rule' { $past.compiler_args( :s(1), :ratchet(1) ); }
+    if $sym eq 'token'   
+        { $past.compiler_args( :grammar(''), :ratchet(1) ); }
+    elsif $sym eq 'rule' 
+        { $past.compiler_args( :grammar(''), :s(1), :ratchet(1) ); }
+    else                
+        { $past.compiler_args( :grammar('') ); }
     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