Author: bernhard
Date: Thu Feb  8 14:16:23 2007
New Revision: 16929

Added:
   trunk/languages/PIR/t/pirstat.t   (contents, props changed)
Modified:
   trunk/languages/PIR/lib/pir.pg
   trunk/languages/PIR/t/assign.t   (props changed)
   trunk/languages/PIR/t/branch.t   (props changed)
   trunk/languages/PIR/t/call.t   (props changed)
   trunk/languages/PIR/t/compunit.t   (props changed)
   trunk/languages/PIR/t/exotic.t   (props changed)
   trunk/languages/PIR/t/sym.t   (props changed)
   trunk/languages/PIR/t/whitespace.t   (props changed)

Log:
[languages/PIR]
* added support for .globalconst directive
* added tests for this, and for few other instr in new test file
* update manifest
* set svn:keywords for languages/PIT/t*.t

Courtesy of Klaas Jan Stol


Modified: trunk/languages/PIR/lib/pir.pg
==============================================================================
--- trunk/languages/PIR/lib/pir.pg      (original)
+++ trunk/languages/PIR/lib/pir.pg      Thu Feb  8 14:16:23 2007
@@ -161,6 +161,7 @@
     <local_decl>
   | <lexical_decl>
   | <const_def>
+  | <globalconst_def>
   | <conditional_stat>
   | <assignment_stat>
   | <open_namespace>
@@ -169,7 +170,7 @@
   | <sub_invocation>
   | <macro_invocation>
   | <jump_stat>  
-  | <source_info>
+  | <source_info>  
 }
 
 rule macro_invocation {
@@ -217,8 +218,16 @@
 ## Const definitions, a check is done for the constant type and
 ## the type of the constant value.
 ##
+
 rule const_def {
-  <'.const'>
+       <'.const'> <const_def_tail>
+}
+
+rule globalconst_def {
+       <'.globalconst'> <const_def_tail>
+}
+
+rule const_def_tail {  
   [ [ int <const_assign>
       [ <int_constant>    | <syntax_error: integer constant expected> ]
     ]
@@ -840,6 +849,7 @@
   | <'.endnamespace'>
   | <'.eom'>  
   | <'.get_results'>
+  | <'.globalconst'>
   | <'.global'>
   | <'.HLL_map'>
   | <'.HLL'>

Added: trunk/languages/PIR/t/pirstat.t
==============================================================================
--- (empty file)
+++ trunk/languages/PIR/t/pirstat.t     Thu Feb  8 14:16:23 2007
@@ -0,0 +1,48 @@
+#!perl
+
+use strict;
+use warnings;
+use lib qw(t . lib ../lib ../../lib ../../../lib);
+use Parrot::Test tests => 3;
+use Test::More;
+
+language_output_is( 'PIR_PGE', <<'CODE', <<'OUT', 'globalconst' );
+
+.sub main
+       .globalconst int x = 42
+       .globalconst num pi = 3.14
+       .globalconst string hi = "hello"        
+.end
+
+CODE
+"parse" => PMC 'PIRGrammar' { ... }
+Parse successful!
+OUT
+
+language_output_is( 'PIR_PGE', <<'CODE', <<'OUT', 'namespace' );
+
+.sub main
+       .namespace x
+       .endnamespace x
+       
+       .namespace y
+.end
+
+CODE
+"parse" => PMC 'PIRGrammar' { ... }
+Parse successful!
+OUT
+
+language_output_is( 'PIR_PGE', <<'CODE', <<'OUT', 'const' );
+
+.sub main
+       .const int x = 42
+       .const num pi = 3.14
+       .const string hi = "hello"
+.end
+
+CODE
+"parse" => PMC 'PIRGrammar' { ... }
+Parse successful!
+OUT
+

Reply via email to