empty constructor for backwards compatibility
val i: Int = new Eval()(getClass.getResourceAsStream("..."))
val i: Int = new Eval()(new File("..."))
val i: Int = new Eval()("1 + 1") // => 2
same as apply[T], but does not run preprocessors.
same as apply[T], but does not run preprocessors.
same as apply[T], but does not run preprocessors. Will generate a classname of the form Evaluater<unique>, where unique is computed from the jvmID (a random number) and a digest of code
Check if stream is Eval-able.
Check if stream is Eval-able.
CompilerException
if not Eval-able.
Check if files are Eval-able.
Check if files are Eval-able.
CompilerException
if not Eval-able.
Check if code is Eval-able.
Check if code is Eval-able.
CompilerException
if not Eval-able.
Compile an entire source file into the virtual classloader.
Like Eval()
, but doesn't reset the virtual classloader before evaluating.
Like Eval()
, but doesn't reset the virtual classloader before evaluating. So if you've
loaded classes with compile
, they can be referenced/imported in code run by inPlace
.
Preprocessors to run the code through before it is passed to the Scala compiler.
Preprocessors to run the code through before it is passed to the Scala compiler. if you want to add new resolvers, you can do so with new Eval(...) { lazy val preprocessors = {...} }
run preprocessors on our string, returning a String that is the processed source
converts the given file to evaluable source.
converts the given file to evaluable source.
converts the given file to evaluable source. delegates to toSource(code: String)
write the current checksum to a file
Evaluates files, strings, or input streams as Scala code, and returns the result.
If
target
isNone
, the results are compiled to memory (and are therefore ephemeral). Iftarget
isSome(path)
, the path must point to a directory, and classes will be saved into that directory.Eval also supports a limited set of preprocessors. Currently, "limited" means "exactly one": directives of the form
#include <file>
.The flow of evaluation is: - extract a string of code from the file, string, or input stream - run preprocessors on that string - wrap processed code in an
apply
method in a generated class - compile the class - contruct an instance of that class - return the result ofapply()