Author: bernhard
Date: Fri Feb  2 14:29:30 2007
New Revision: 16872

Modified:
   trunk/languages/plumhead/src/partridge/PlumheadPAST.tg
   trunk/languages/plumhead/t/arithmetics.t

Log:
[Plumhead partridge]
Support for 'echo 1;'


Modified: trunk/languages/plumhead/src/partridge/PlumheadPAST.tg
==============================================================================
--- trunk/languages/plumhead/src/partridge/PlumheadPAST.tg      (original)
+++ trunk/languages/plumhead/src/partridge/PlumheadPAST.tg      Fri Feb  2 
14:29:30 2007
@@ -95,14 +95,48 @@
     .local pmc past
 
     $P0 = node['DOUBLEQUOTE_STRING']
-    if null $P0 goto handled_doublequote
+    if null $P0 goto no_DOUBLEQUOTE_STRING
     past = tree.'get'('past', $P0, 'Plumhead::Grammar::DOUBLEQUOTE_STRING')
-    handled_doublequote:
+    goto handled_expression
+    no_DOUBLEQUOTE_STRING:
 
     $P0 = node['SINGLEQUOTE_STRING']
-    if null $P0 goto handled_singlequote
+    if null $P0 goto no_SINGLEQUOTE_STRING
     past = tree.'get'('past', $P0, 'Plumhead::Grammar::SINGLEQUOTE_STRING')
-    handled_singlequote:
+    goto handled_expression
+    no_SINGLEQUOTE_STRING:
+
+    $P0 = node['NUMBER']
+    if null $P0 goto no_NUMBER
+    past = tree.'get'('past', $P0, 'Plumhead::Grammar::NUMBER')
+    goto handled_expression
+    no_NUMBER:
+
+    $P0 = node['adding_expression']
+    if null $P0 goto no_adding_expression
+    past = tree.'get'('past', $P0, 'Plumhead::Grammar::expression')
+    goto handled_expression
+    no_adding_expression:
+
+    $P0 = node['multiplying_expression']
+    if null $P0 goto no_multiplying_expression
+    past = tree.'get'('past', $P0, 'Plumhead::Grammar::expression')
+    goto handled_expression
+    no_multiplying_expression:
+
+    $P0 = node['unary_expression']
+    if null $P0 goto no_unary_expression
+    past = tree.'get'('past', $P0, 'Plumhead::Grammar::expression')
+    goto handled_expression
+    no_unary_expression:
+
+    $P0 = node['postfix_expression']
+    if null $P0 goto no_postfix_expression
+    past = tree.'get'('past', $P0, 'Plumhead::Grammar::expression')
+    goto handled_expression
+    no_postfix_expression:
+
+    handled_expression:
 
     .return (past)
 }
@@ -141,3 +175,18 @@
     .return (past)
 }
 
+transform past (Plumhead::Grammar::NUMBER) :language('PIR') {
+
+    .local pmc past_val
+    past_val = new 'PAST::Val'                             
+    .local string val
+    val = node
+    past_val.'init'( 'name' => val, 'vtype' => '.Float', 'ctype' => 'n+' )     
                         
+
+    .local pmc past                                                  
+    past = new 'PAST::Op'
+    past.'init'( past_val, 'node'=> node, 'name' => 'print' )  
+
+    .return (past)
+}
+

Modified: trunk/languages/plumhead/t/arithmetics.t
==============================================================================
--- trunk/languages/plumhead/t/arithmetics.t    (original)
+++ trunk/languages/plumhead/t/arithmetics.t    Fri Feb  2 14:29:30 2007
@@ -35,7 +35,7 @@
         $php_code = <<"END_CODE";
 <?php
 echo $php_code;
-echo "\n";
+echo "\\n";
 ?>
 END_CODE
 

Reply via email to