progs/parser-combinators/comb2.sc
changeset 977 1e6eca42d90b
parent 973 f25d338d16c9
--- a/progs/parser-combinators/comb2.sc	Fri Nov 29 18:59:32 2024 +0000
+++ b/progs/parser-combinators/comb2.sc	Mon Feb 03 12:31:28 2025 +0000
@@ -14,7 +14,7 @@
 // it allows writing nested patterns as
 // case x ~ y ~ z => ...
 
-case class ~[+A, +B](x: A, y: B)
+case class ~[+A, +B](x: A, y: B) 
 
 // to make sure the input has an empty-method
 trait IsSeq[I] {
@@ -34,7 +34,7 @@
         if tl.isEmpty) yield hd
 
   // alternative parser
-  def ||(q: => Parser[I, T]) : Parser[I, T] = Parser[I, T] {
+  def ||(q: => Parser[I, T]) : Parser[I, T] = new Parser[I, T] {
     def parse(in: I) = p.parse(in) ++ q.parse(in)
   }