updated
authorChristian Urban <christian.urban@kcl.ac.uk>
Thu, 10 Nov 2022 23:49:29 +0000
changeset 896 b7a6436c7758
parent 895 2f5a87ecdc81
child 897 904de68a27a4
updated
progs/parser-combinators/comb1.sc
--- a/progs/parser-combinators/comb1.sc	Thu Nov 10 23:44:35 2022 +0000
+++ b/progs/parser-combinators/comb1.sc	Thu Nov 10 23:49:29 2022 +0000
@@ -104,13 +104,10 @@
 // A parser for palindromes (just returns them as string)
 lazy val Pal : Parser[String, String] = {
   ((p"a" ~ Pal) ~ p"a").map{ case ((x, y), z) => s"$x$y$z" } || 
-  (p"b" ~ Pal ~ p"b").map{ case ((x, y), z) => s"$x$y$z" } || 
-  p"a" || p"b" || p""
+   (p"b" ~ Pal ~ p"b").map{ case ((x, y), z) => s"$x$y$z" } || 
+    p"a" || p"b" || p""
 }  
 
-def foo(x: Int) = 
-   println(s"$x + $x = ${x + x}")
-
 // examples
 Pal.parse_all("abaaaba")
 Pal.parse("abaaaba")