--- a/progs/comb1.scala Thu Oct 25 06:53:16 2018 +0100
+++ b/progs/comb1.scala Thu Oct 25 18:36:04 2018 +0100
@@ -38,6 +38,7 @@
}
import scala.util.matching.Regex
+
case class RegexParser(reg: Regex) extends Parser[String, String] {
def parse(sb: String) = reg.findPrefixMatchOf(sb) match {
case None => Set()
@@ -51,17 +52,17 @@
// convenience
implicit def string2parser(s: String) = StringParser(s)
-implicit def char2parser(c: Char) = CharParser(c)
+//implicit def char2parser(c: Char) = CharParser(c)
implicit def ParserOps[I<% Seq[_], T](p: Parser[I, T]) = new {
- def || (q : => Parser[I, T]) = new AltParser[I, T](p, q)
+ def | (q : => Parser[I, T]) = new AltParser[I, T](p, q)
def ==>[S] (f: => T => S) = new FunParser[I, T, S](p, f)
def ~[S] (q : => Parser[I, S]) = new SeqParser[I, T, S](p, q)
}
implicit def StringOps(s: String) = new {
- def || (q : => Parser[String, String]) = new AltParser[String, String](s, q)
- def || (r: String) = new AltParser[String, String](s, r)
+ def | (q : => Parser[String, String]) = new AltParser[String, String](s, q)
+ def | (r: String) = new AltParser[String, String](s, r)
def ==>[S] (f: => String => S) = new FunParser[String, String, S](s, f)
def ~[S] (q : => Parser[String, S]) =
new SeqParser[String, String, S](s, q)