summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--compiler/nimeval.nim9
1 files changed, 7 insertions, 2 deletions
diff --git a/compiler/nimeval.nim b/compiler/nimeval.nim
index f1ac884f7..d03b99ba3 100644
--- a/compiler/nimeval.nim
+++ b/compiler/nimeval.nim
@@ -11,7 +11,8 @@
 import
   ast, astalgo, modules, passes, condsyms,
   options, sem, semdata, llstream, vm, vmdef,
-  modulegraphs, idents, os, pathutils, passaux
+  modulegraphs, idents, os, pathutils, passaux,
+  scriptconfig
 
 type
   Interpreter* = ref object ## Use Nim as an interpreter with this object
@@ -126,7 +127,9 @@ proc destroyInterpreter*(i: Interpreter) =
   ## destructor.
   discard "currently nothing to do."
 
-proc runRepl*(r: TLLRepl; searchPaths: openArray[string]) =
+proc runRepl*(r: TLLRepl;
+              searchPaths: openArray[string];
+              supportNimscript: bool) =
   var conf = newConfigRef()
   var cache = newIdentCache()
   var graph = newModuleGraph(cache, conf)
@@ -139,11 +142,13 @@ proc runRepl*(r: TLLRepl; searchPaths: openArray[string]) =
   conf.errorMax = high(int)
   initDefines(conf.symbols)
   defineSymbol(conf.symbols, "nimscript")
+  if supportNimscript: defineSymbol(conf.symbols, "nimconfig")
   when hasFFI: defineSymbol(graph.config.symbols, "nimffi")
   registerPass(graph, verbosePass)
   registerPass(graph, semPass)
   registerPass(graph, evalPass)
   var m = graph.makeStdinModule()
   incl(m.flags, sfMainModule)
+  if supportNimscript: graph.vm = setupVM(m, cache, "stdin", graph)
   graph.compileSystemModule()
   processModule(graph, m, llStreamOpenStdIn(r))