fix(stack) Renamed stack to getstack; added setstack.
h3rald h3rald@h3rald.com
Sun, 29 May 2016 17:20:46 +0200
4 files changed,
16 insertions(+),
6 deletions(-)
M
core/interpreter.nim
→
core/interpreter.nim
@@ -201,9 +201,12 @@
proc eval*(i: var MinInterpreter, s: string) = let fn = i.filename try: - i.open(newStringStream(s), "eval") - discard i.parser.getToken() - i.interpret() + var i2 = i.copy("eval") + i2.open(newStringStream(s), "eval") + discard i2.parser.getToken() + i2.interpret() + i.stack = i2.stack + i.scope = i2.scope except: stderr.writeLine getCurrentExceptionMsg() finally:
M
lib/lang.nim
→
lib/lang.nim
@@ -220,9 +220,14 @@
.symbol("dump") do (i: In): echo i.dump - .symbol("stack") do (i: In): - var s = i.stack - i.push s + .symbol("getstack") do (i: In): + i.push i.stack.newVal + + .symbol("setstack") do (i: In): + let q = i.pop + if not q.isQuotation: + i.error errNoQuotation + i.stack = q.qVal # Operations on quotations or strings
M
lib/prelude.min
→
lib/prelude.min
@@ -12,6 +12,7 @@
; Common sigils (bind) (:) sigil (let) (.) sigil +(delete) (~) sigil (getenv) ($) sigil (system) (!) sigil (run) (&) sigil
M
tests/io.min
→
tests/io.min
@@ -11,3 +11,4 @@ "test.txt" fread "TEST - TEST" ==) assert
"test.txt" rm report + clear