refactor(In) Changed all instances of var MinInterpreter to In.
h3rald h3rald@h3rald.com
Sat, 04 Jun 2016 16:35:03 +0200
4 files changed,
17 insertions(+),
17 deletions(-)
M
core/interpreter.nim
→
core/interpreter.nim
@@ -61,11 +61,11 @@ for item in i.stack:
s = s & $item & " " return s -proc debug*(i: var MinInterpreter, value: MinValue) = +proc debug*(i: In, value: MinValue) = if i.debugging: stderr.writeLine("-- " & i.dump & $value) -proc debug*(i: var MinInterpreter, value: string) = +proc debug*(i: In, value: string) = if i.debugging: stderr.writeLine("-- " & value)@@ -111,14 +111,14 @@ else:
stderr.writeLine("$1 [$2,$3] `$4`: Error - $5" % [i.currSym.filename, $i.currSym.line, $i.currSym.column, i.currSym.symVal, msg]) quit(int(status)) -proc open*(i: var MinInterpreter, stream:Stream, filename: string) = +proc open*(i: In, stream:Stream, filename: string) = i.filename = filename i.parser.open(stream, filename) -proc close*(i: var MinInterpreter) = +proc close*(i: In) = i.parser.close(); -proc push*(i: var MinInterpreter, val: MinValue) = +proc push*(i: In, val: MinValue) = i.debug val if val.kind == minSymbol: if not i.evaluating:@@ -156,11 +156,11 @@ return
else: i.stack.add(val) -proc push*(i: var MinInterpreter, q: seq[MinValue]) = +proc push*(i: In, q: seq[MinValue]) = for e in q: i.push e -proc pop*(i: var MinInterpreter): MinValue = +proc pop*(i: In): MinValue = if i.stack.len > 0: return i.stack.pop else:@@ -172,7 +172,7 @@ return i.stack[i.stack.len-1]
else: i.error(errEmptyStack) -proc interpret*(i: var MinInterpreter) = +proc interpret*(i: In) = var val: MinValue while i.parser.token != tkEof: try:@@ -186,7 +186,7 @@ i.newScope(name, q):
for v in q.qVal: i.push v -proc eval*(i: var MinInterpreter, s: string) = +proc eval*(i: In, s: string) = let fn = i.filename try: var i2 = i.copy("eval")@@ -200,7 +200,7 @@ stderr.writeLine getCurrentExceptionMsg()
finally: i.filename = fn -proc load*(i: var MinInterpreter, s: string) = +proc load*(i: In, s: string) = let fn = i.filename try: var i2 = i.copy(s)@@ -214,10 +214,10 @@ stderr.writeLine getCurrentExceptionMsg()
finally: i.filename = fn -proc apply*(i: var MinInterpreter, symbol: string) = +proc apply*(i: In, symbol: string) = i.scope.getSymbol(symbol)(i) -proc copystack*(i: var MinInterpreter): MinStack = +proc copystack*(i: In): MinStack = var s = newSeq[MinValue](0) for i in i.stack: s.add i
M
core/types.nim
→
core/types.nim
@@ -83,8 +83,8 @@ debugging*: bool
evaluating*: bool unsafe*: bool In* = var MinInterpreter - MinOperator* = proc (i: var MinInterpreter) - MinSigil* = proc (i: var MinInterpreter, sym: string) + MinOperator* = proc (i: In) + MinSigil* = proc (i: In, sym: string) MinError* = enum errSystem, errParser,
M
core/utils.nim
→
core/utils.nim
@@ -77,7 +77,7 @@
proc finalize*(scope: ref MinScope) = var mdl = newSeq[MinValue](0).newVal mdl.scope = scope - mdl.scope.previous.symbols[scope.name] = proc(i: var MinInterpreter) = + mdl.scope.previous.symbols[scope.name] = proc(i: In) = i.evaluating = true i.push mdl i.evaluating = false
M
lib/lang.nim
→
lib/lang.nim
@@ -54,7 +54,7 @@ else:
i.error errIncorrect, "The top quotation must contain only one symbol value" return i.debug "[define] " & symbol & " = " & $q1 - i.scope.symbols[symbol] = proc(i: var MinInterpreter) = + i.scope.symbols[symbol] = proc(i: In) = i.push q1.qVal .symbol("bind") do (i: In):@@ -125,7 +125,7 @@ if symbol.len == 1:
if i.scope.getSigil(symbol).isNotNil: i.error errSystem, "Sigil '$1' already exists" % [symbol] return - i.scope.sigils[symbol] = proc(i: var MinInterpreter) = + i.scope.sigils[symbol] = proc(i: In) = i.evaluating = true i.push q2.qVal i.evaluating = false