Reputation: 67
I'm trying to run a file from the Textbook using but my IDE tells me it can't resolve the RegexParsers
when I try to extend it. Below is the code from the textbook. I added the import
statement which my IDE tells me is unused.
import scala.util.parsing.combinator._
class ExprParser extends RegexParsers {
val number = "[0-9]+".r
def expr: Parser[Any] = term ~ opt(("+" | "-") ~ expr)
def term: Parser[Any] = factor ~ rep("*" ~ factor)
def factor: Parser[Any] = number | "(" ~ expr ~ ")"
}
Upvotes: 2
Views: 329
Reputation: 67
Ok so I solved this myself and I'll leave it up for anybody having a similar issue add
libraryDependencies += "org.scala-lang.modules" %% "scala-parser-combinators" % "1.0.5"
to your build.sbt file then click import project in the top right
Upvotes: 3