Author: chromatic
Date: Mon Jun 11 01:49:48 2007
New Revision: 18926

Modified:
   trunk/languages/perl6/src/PAST/Grammar.tg
   trunk/languages/perl6/src/parser/grammar_rules.pg
   trunk/languages/perl6/src/pmc/perl6str.pmc

Log:
[Perl 6] Pass the first test in t/01-sanity/07-ref.t.

This is a little bit of a hack, because the type_name token isn't always 
appropriate.  I'm not sure where the right place for the logic is, however.

Getting the other two tests to pass may require creating a P6Bool PMC.  The 
Boolean PMC is almost appropriate.

Modified: trunk/languages/perl6/src/PAST/Grammar.tg
==============================================================================
--- trunk/languages/perl6/src/PAST/Grammar.tg   (original)
+++ trunk/languages/perl6/src/PAST/Grammar.tg   Mon Jun 11 01:49:48 2007
@@ -583,6 +583,14 @@
     .return (past)
 }
 
+transform past (Perl6::Grammar::type_name) :language('PIR') {
+    .local pmc cpast
+    $S0 = node
+    cpast = new 'PAST::Val'
+    cpast.'init'('node'=>node, 'vtype'=>'.Perl6Str', 'name'=>$S0, 
'ctype'=>'s~')
+    .return (cpast)
+}
+
 
 transform past (Perl6::Grammar::subroutine) :language('PIR') {
     .local pmc outerblock, symtable

Modified: trunk/languages/perl6/src/parser/grammar_rules.pg
==============================================================================
--- trunk/languages/perl6/src/parser/grammar_rules.pg   (original)
+++ trunk/languages/perl6/src/parser/grammar_rules.pg   Mon Jun 11 01:49:48 2007
@@ -149,6 +149,7 @@
     | <quote_term>
     | <number>
     | <integer>
+    | <type_name>
     | <listop>
     | <circumfix>
     ] <postop>*
@@ -172,7 +173,7 @@
     | $<KEY>:=[\{] <?ws> <expression>? <?ws> $<KEY_CLOSE>:=[\}]
 }
 
-token methodop { <ident> [ <!postop> <listop_expression> ]? }
+token methodop { <ident> }
 token listop { <ident> [ <!postop> <listop_expression> ]? }
 
 token circumfix {
@@ -223,6 +224,8 @@
     \d+[_\d+]* [ \. \d+[_\d+]* [ <[Ee]> <[+\-]>? \d+ ]? ]
 }
 
+token type_name { [ <'::'> ? <[A..Z]> <[0..9a..z_]>* ]+ }
+
 token quote_term {
     |    $<KEY>:=[']    <quote_expression> '
     |    $<KEY>:=["]    <quote_expression> "

Modified: trunk/languages/perl6/src/pmc/perl6str.pmc
==============================================================================
--- trunk/languages/perl6/src/pmc/perl6str.pmc  (original)
+++ trunk/languages/perl6/src/pmc/perl6str.pmc  Mon Jun 11 01:49:48 2007
@@ -157,6 +157,10 @@
         return sign * f;
     }
 
+    METHOD STRING* WHAT() {
+        return string_from_const_cstring(INTERP, "Str", 3);
+    }
+
 }
 
 /*

Reply via email to