gzah
January 18, 2021, 9:13am
1
I am asking this question, since every time I try to compile a Scala class file, the compiler response is
error: object parsing is not a member of package util
I have included the dependencies as below :
libraryDependencies += "org.scala-lang.modules" %% "scala-parser-combinators" % "1.1.2"
Could anybody help me tackle this query please ?
Thanks a lot and good day,
Gianluca Zahra
gzah
January 18, 2021, 10:02am
2
The full error is :
error: object parsing is not a member of package util
import scala.util.parsing.combinator.RegexParsers
^
Thanks
Based on what you provided there’s no obvious reason why this shouldn’t work.
Could you give some more information such as
build.sbt file
directory structure of your project
command used to compile
1 Like
gzah
January 18, 2021, 12:49pm
4
Build.sbt file :
scalaVersion := "2.13.4"
libraryDependencies += "org.scala-lang" % "scala-library" % "2.13.4"
libraryDependencies += "org.scala-lang" % "scala-compiler" % "2.13.4"
libraryDependencies += "org.scala-lang.modules" %% "scala-parser-combinators" % "1.1.2"
Directory :
src/main/scala/Lexer.scala
src/main/scala/Token.scala
Command used to compile:
scalac Token.scala
scalac Lexer.scala
Thanks a lot and good day
The idea of using a build tool like sbt is to let it manage low level tools like scalac .
The moment you run scalac foo
everything you added you your build.sbt
is just meaningless.
Use sbt compile
which will compile all the classes in your project.
2 Likes
cbley
January 18, 2021, 1:28pm
6
Besides to what @BalmungSan said, you don’t need to manage the scala-library manually in sbt, it does this automatically for you.
ThisBuild / scalaVersion := "2.13.4"
libraryDependencies += "org.scala-lang.modules" %% "scala-parser-combinators" % "1.1.2"
Is all you need.
2 Likes
gzah
January 18, 2021, 2:18pm
7
Thanks all.
I’ll try that and I update you with the issue.
Thanks a lot and good day