progs/scala/re-basic.scala
changeset 238 2dc1647eab9e
parent 178 2835d13be702
child 293 1a4e5b94293b
--- a/progs/scala/re-basic.scala	Mon Mar 13 14:54:12 2017 +0000
+++ b/progs/scala/re-basic.scala	Fri Mar 17 19:47:42 2017 +0000
@@ -4,6 +4,7 @@
 import scala.language.reflectiveCalls
 import scala.annotation.tailrec   
 import scala.io.Source
+import scala.util._
 
 abstract class Rexp 
 case object ZERO extends Rexp
@@ -141,7 +142,7 @@
   case c::cs => inj(r, c, lex(der(c, r), cs))
 }
 
-def lexing(r: Rexp, s: String) : Val = lex(r, s.toList)
+def lexing(r: Rexp, s: String) : Try[Val] = Try(lex(r, s.toList))
 
 // Examples