summary refs log tree commit diff stats
path: root/lib/core
Commit message (Collapse)AuthorAgeFilesLines
* fixes #1085Araq2014-04-211-1/+1
|
* made large parts of the stdlib gcsafeAraq2014-04-201-37/+40
|
* merged better html links #850Araq2014-04-081-2/+2
|
* failing test case preventing the use of --gc:v2: tsymchoicefieldZahary Karadjov2014-03-241-3/+3
|
* split the inline and closure iterators into different symbol kinds for ↵Zahary Karadjov2014-03-061-1/+1
| | | | easier discrimination between them
* newProc can now be used to construct iterator defs.Dominik Picheta2014-02-121-1/+1
|
* macro tests almost greenAraq2014-02-031-14/+14
|
* next steps for closure iteratorsAraq2014-01-221-2/+2
|
* parser support anon iteratorsAraq2014-01-201-6/+12
|
* Merge branch 'devel' of https://github.com/Araq/Nimrod into develAraq2014-01-131-11/+11
|\
| * Merge branch 'upstream' into develZahary Karadjov2013-12-291-11/+11
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: compiler/ccgutils.nim compiler/msgs.nim compiler/sem.nim compiler/semexprs.nim compiler/seminst.nim compiler/semmagic.nim compiler/semstmts.nim compiler/semtypes.nim compiler/semtypinst.nim compiler/sigmatch.nim compiler/types.nim compiler/vmgen.nim lib/core/macros.nim lib/system.nim tests/reject/tenummix.nim web/news.txt
| | * static params: expr[T] is now static[T]Zahary Karadjov2013-12-191-9/+11
| | | | | | | | | | | | | | | | | | | | | This introduces tyStatic and successfully bootstraps and handles few simple test cases. Static params within macros are no longer treated as PNimrodNodes - they are now equivalent to constants of the designated type.
* | | case consistency improvementsAraq2014-01-111-25/+25
|/ /
* | case consistency part 6Araq2013-12-281-15/+15
| |
* | Merge branch 'master' of https://github.com/Araq/Nimrod into vm2Araq2013-12-231-2/+34
|\ \ | | | | | | | | | | | | Conflicts: web/news.txt
| * \ Merge pull request #764 from gradha/pr_doc_improvementsAndreas Rumpf2013-12-201-0/+32
| |\ \ | | | | | | | | Documentation improvements
| | * | Adds docstring to macros.newIdentDefs.Grzegorz Adam Hankiewicz2013-12-201-0/+28
| | | |
| | * | Adds missing ``code-block`` to macros' docstrings.Grzegorz Adam Hankiewicz2013-12-181-0/+4
| | |/
| * / Update macros.nimBillingsly Wetherfordshire2013-12-201-2/+2
| |/
* | Merge branch 'master' into vm2Araq2013-12-051-1/+1
|\| | | | | | | | | Conflicts: compiler/sem.nim
| * removed 'system.eval'Araq2013-11-271-1/+1
| |
* | new VM is getting stableAraq2013-10-291-1/+7
|/
* support for multiple modules of the same name; niminst supports 'platforms'; ↵Araq2013-09-241-1/+1
| | | | minor bugfixes
* added 'newLit'Araq2013-09-101-1/+21
|
* Merge branch 'type-classes' into upstreamZahary Karadjov2013-09-031-2/+2
|\
| * implemented the using statementZahary Karadjov2013-08-311-1/+1
| |
| * parsing of user defined type classesZahary Karadjov2013-08-231-1/+1
| |
* | tester compiles againAraq2013-08-301-1/+1
|/
* Improved documentation for macros.newProc.Dominik Picheta2013-07-311-0/+3
|
* Added macros.newIfStmt and macros.newVarStmt.Dominik Picheta2013-07-251-1/+23
|
* added macros.genSymAraq2013-07-241-3/+10
|
* bugfix: marshal supports unsigned numbersAraq2013-06-271-2/+10
|
* made macros.dumptree and dumplisp immediate, deprecated the *_imm versionsBillingsly Wetherfordshire2013-06-041-4/+4
|
* don't deprecate macros.! breaks too much codeAraq2013-05-201-28/+30
|
* Update macros.nimBillingsly Wetherfordshire2013-05-191-29/+33
|
* add macro_dsl apiBillingsly Wetherfordshire2013-05-191-0/+233
|
* Update macros.nimBillingsly Wetherfordshire2013-04-251-6/+8
| nil let vm = PCtx(i.graph.vm) vm.registerCallback(pkg & "." & module & "." & name, impl) proc evalScript*(i: Interpreter; scriptStream: PLLStream = nil) = ## This can also be used to *reload* the script. assert i != nil assert i.mainModule != nil, "no main module selected" initStrTable(i.mainModule.semtab(i.graph)) i.mainModule.ast = nil let s = if scriptStream != nil: scriptStream else: llStreamOpen(findFile(i.graph.config, i.scriptName), fmRead) processModule(i.graph, i.mainModule, i.idgen, s) proc findNimStdLib*(): string = ## Tries to find a path to a valid "system.nim" file. ## Returns "" on failure. try: let nimexe = os.findExe("nim") # this can't work with choosenim shims, refs https://github.com/dom96/choosenim/issues/189 # it'd need `nim dump --dump.format:json . | jq -r .libpath` # which we should simplify as `nim dump --key:libpath` if nimexe.len == 0: return "" result = nimexe.splitPath()[0] /../ "lib" if not fileExists(result / "system.nim"): when defined(unix): result = nimexe.expandSymlink.splitPath()[0] /../ "lib" if not fileExists(result / "system.nim"): return "" except OSError, ValueError: return "" proc findNimStdLibCompileTime*(): string = ## Same as `findNimStdLib` but uses source files used at compile time, ## and asserts on error. result = querySetting(libPath) doAssert fileExists(result / "system.nim"), "result:" & result proc createInterpreter*(scriptName: string; searchPaths: openArray[string]; flags: TSandboxFlags = {}, defines = @[("nimscript", "true")], registerOps = true): Interpreter = var conf = newConfigRef() var cache = newIdentCache() var graph = newModuleGraph(cache, conf) connectCallbacks(graph) initDefines(conf.symbols) for define in defines: defineSymbol(conf.symbols, define[0], define[1]) registerPass(graph, semPass) registerPass(graph, evalPass) for p in searchPaths: conf.searchPaths.add(AbsoluteDir p) if conf.libpath.isEmpty: conf.libpath = AbsoluteDir p var m = graph.makeModule(scriptName) incl(m.flags, sfMainModule) var idgen = idGeneratorFromModule(m) var vm = newCtx(m, cache, graph, idgen) vm.mode = emRepl vm.features = flags if registerOps: vm.registerAdditionalOps() # Required to register parts of stdlib modules graph.vm = vm graph.compileSystemModule() result = Interpreter(mainModule: m, graph: graph, scriptName: scriptName, idgen: idgen) proc destroyInterpreter*(i: Interpreter) = ## destructor. discard "currently nothing to do." proc registerErrorHook*(i: Interpreter, hook: proc (config: ConfigRef; info: TLineInfo; msg: string; severity: Severity) {.gcsafe.}) = i.graph.config.structuredErrorHook = hook proc runRepl*(r: TLLRepl; searchPaths: openArray[string]; supportNimscript: bool) = ## deadcode but please don't remove... might be revived var conf = newConfigRef() var cache = newIdentCache() var graph = newModuleGraph(cache, conf) for p in searchPaths: conf.searchPaths.add(AbsoluteDir p) if conf.libpath.isEmpty: conf.libpath = AbsoluteDir p conf.cmd = cmdInteractive # see also `setCmd` conf.setErrorMaxHighMaybe 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) var idgen = idGeneratorFromModule(m) if supportNimscript: graph.vm = setupVM(m, cache, "stdin", graph, idgen) graph.compileSystemModule() processModule(graph, m, idgen, llStreamOpenStdIn(r))