diff options
author | sealmove <47466000+sealmove@users.noreply.github.com> | 2019-03-13 11:21:24 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-03-13 10:21:24 +0100 |
commit | ab872be476f255ea339aa203157462e9700450a6 (patch) | |
tree | b31139d5af2d99b714a3a57ee2e9482d8052fc9f /compiler/nimeval.nim | |
parent | 8ceba8a7f3af9999d39d96cba319bce51c33a0d7 (diff) | |
download | Nim-ab872be476f255ea339aa203157462e9700450a6.tar.gz |
Added nimscript support to repl (#10834)
* added nimscript support to repl * added bool parameter to runRepl en/disabling nimscript support
Diffstat (limited to 'compiler/nimeval.nim')
-rw-r--r-- | compiler/nimeval.nim | 9 |
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)) |