progs/scala/tests.scala
changeset 169 072a701bb153
parent 168 6b0a1976f89a
child 195 c2d36c3cf8ad
--- a/progs/scala/tests.scala	Fri May 06 11:33:21 2016 +0100
+++ b/progs/scala/tests.scala	Sun May 08 09:32:50 2016 +0100
@@ -31,18 +31,17 @@
   def Regex() : Rexp = {
     val t = Term();
     if (more() && peek() == '|') {
-      eat ('|') ;
-      val r = Regex();
-      ALT(t, r) 
+      eat ('|') ; 
+      ALT(t, Regex()) 
     } 
     else t
   }
 
   def Term() : Rexp = {
-    var f : Rexp = if (more() && peek() != ')' && peek() != '|') Factor() else ZERO;
+    var f : Rexp = 
+      if (more() && peek() != ')' && peek() != '|') Factor() else ZERO;
     while (more() && peek() != ')' && peek() != '|') {
-      var nextf = Factor();
-      f = SEQ(f, nextf) ;
+      f = SEQ(f, Factor()) ;
     }
 
     f