I'm new to Scala and trying to use its excellent library of parser-harvesters. I am trying to compile this code:
import scala.util.parsing.combinator._ ... val r:Parsers#ParseResult[Node] = parser.parseAll(parser.suite,reader) r match { case Success(r, n) => println(r) case Failure(msg, n) => println(msg) case Error(msg, n) => println(msg) } ...
But I keep getting these errors:
TowelParser.scala:97: error: not found: value Success case Success(r, n) => println(r) ^ TowelParser.scala:98: error: not found: value Failure case Failure(msg, n) => println(msg) TowelParser.scala:99: error: object Error is not a case class constructor, nor does it have an unapply/unapplySeq method case Error(msg, n) => println(msg)
I have tried many different things, such as:
case Parsers
and
case Parsers.Success(r, n) => println(r)
and
import scala.util.parsing.combinator.Parsers.Success
But I can not get this to compile. I'm sure there may be something obvious that I am missing, but I have been on it for a while, and google does not seem to have good examples of this.
Thanks!
source share