progs/parser-combinators/comb1.sc
changeset 849 3d5ecb8f1f2f
parent 828 bdcaecdee9eb
child 850 ea320c9427d2
--- a/progs/parser-combinators/comb1.sc	Tue Nov 02 14:40:06 2021 +0000
+++ b/progs/parser-combinators/comb1.sc	Thu Nov 11 15:58:22 2021 +0000
@@ -103,11 +103,14 @@
 
 // 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"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""
 }  
 
+def foo(x: Int) = 
+   println(s"$x + $x = ${x + x}")
+
 // examples
 Pal.parse_all("abaaaba")
 Pal.parse("abaaaba")