Created
August 30, 2013 08:05
-
-
Save labra/6387424 to your computer and use it in GitHub Desktop.
REPL loop in Scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.tools.nsc.Settings | |
import scala.tools.nsc.interpreter.ILoop | |
object TestConsole extends App { | |
val settings = new Settings | |
settings.usejavacp.value = true | |
settings.deprecation.value = true | |
new SampleILoop().process(settings) | |
} | |
class SampleILoop extends ILoop { | |
override def prompt = "==> " | |
addThunk { | |
intp.beQuietDuring { | |
intp.addImports("java.lang.Math._") | |
} | |
} | |
override def printWelcome() { | |
echo("\n" + " Wellcome to a simple REPL ") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment