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

[svn:parrot] r34387 - trunk/t/compilers/pge

From:
pmichaud
Date:
December 26, 2008 09:41
Subject:
[svn:parrot] r34387 - trunk/t/compilers/pge
Message ID:
20081226174138.512B5CBA12@x12.develooper.com
Author: pmichaud
Date: Fri Dec 26 09:41:37 2008
New Revision: 34387

Modified:
   trunk/t/compilers/pge/03-optable.t

Log:
[pge]:  Tests for skipkey trait.


Modified: trunk/t/compilers/pge/03-optable.t
==============================================================================
--- trunk/t/compilers/pge/03-optable.t	(original)
+++ trunk/t/compilers/pge/03-optable.t	Fri Dec 26 09:41:37 2008
@@ -7,7 +7,7 @@
 use warnings;
 use lib qw( t . lib ../lib ../../lib ../../../lib );
 use Test::More;
-use Parrot::Test tests => 35;
+use Parrot::Test tests => 37;
 
 optable_output_is( 'a',     'term:a',                                   'Simple term' );
 optable_output_is( 'a+b',   'infix:+(term:a, term:b)',                  'Simple infix' );
@@ -42,6 +42,9 @@
 optable_output_is( '++a', 'prefix:++(term:a)',  'prefix' );
 optable_output_is( '--a', 'prefix:--(term:a)',  'prefix' );
 
+optable_output_is( '-a',  'prefix:-(term:a)',   'prefix ltm');
+optable_output_is( '->a', 'term:->a',           'prefix ltm');
+
 optable_output_is(
     'a*(b+c)',
     'infix:*(term:a, circumfix:( )(infix:+(term:b, term:c)))',
@@ -109,6 +112,7 @@
     optable.'newtok'('prefix:--', 'equiv'=>'prefix:++')
     optable.'newtok'('postfix:++', 'equiv'=>'prefix:++')
     optable.'newtok'('postfix:--', 'equiv'=>'prefix:++')
+    optable.'newtok'('prefix:-', 'equiv'=>'prefix:++')
 
     .local pmc ident
     ident = get_global ['PGE';'Match'], 'ident'
@@ -118,6 +122,11 @@
     optable.'newtok'('postcircumfix:( )', 'looser'=>'term:', 'nows'=>1, 'nullterm'=>1)
     optable.'newtok'('postcircumfix:[ ]', 'equiv'=>'postcircumfix:( )', 'nows'=>1)
 
+    .local pmc arrow
+    $P0 = compreg 'PGE::Perl6Regex'
+    arrow = $P0("'->' <ident>")
+    optable.'newtok'('term:->', 'equiv'=>'term:', 'parsed'=>arrow, 'skipkey'=>0)
+
     .local string test
     test = "<<test>>"
 
@@ -148,6 +157,7 @@
     type = match['type']
     print type
     if type == 'term:' goto print_term
+    if type == 'term:->' goto print_term_arrow
     print '('
     .local pmc iter
     $P0 = match.'list'()
@@ -171,6 +181,10 @@
     goto end
   print_term:
     print match
+    goto end
+  print_term_arrow:
+    $S0 = match['ident']
+    print $S0
   end:
     .return ()
 .end



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