Commits

gabriele renzi  committed 67e237f

generalize if and unless

  • Participants
  • Parent commits 25da8d8

Comments (0)

Files changed (3)

File src/parser/actions.pm

     if $k eq 'open' {
       #fugly
       our $?ACT := ""~$<roman>;
-      # todop ignored?
       $past.push(PAST::Op.new( :inline("act_"~$?ACT~":")));
     }
     else {
 
 method test($/, $k) {
   my $test := PAST::Var.new(:name('the_condition'),:scope('package'));
-  make PAST::Op.new( $test, $($<branch>), :pasttype($k));
+  make PAST::Op.new( $test, $($<sentence>), :pasttype($k));
 }
 
 method computation($/, $key) {

File src/parser/grammar.pg

   | <negative_comparative> {*} #= worse
 }
 rule test {
-  | 'if so,' <branch>  {*} #= if
-  | 'if not,' <branch> {*} #= unless
+  | 'if so,' <sentence>  {*} #= if
+  | 'if not,' <sentence> {*} #= unless
 }
 rule computation {
   |<binary> {*} #= binary

File t/14-test-with-sentence.t

+
+Testing conditional assignment and generalized sentence.
+
+romeo, someont.
+juliet, someont.
+
+        act i: foo.
+Scene I : no special characters. 
+[ENTER romeo and juliet]
+
+juliet: plan  twice a evil thing. proove a thing.
+
+Juliet: Is a mighty king better than a cow?
+
+Romeo: If so, proove a pretty king.
+
+
+  Scene II: 3 .
+
+
+Juliet: Is a king better than a pretty king?
+
+Romeo: If so, you are the sum of a pretty thing and a rose. proove yourself.
+
+  Scene III: closing at three.
+
+juliet: proove a pretty pretty thing.
+
+ 
+