all repos — min @ 190fe7d067beab63a5504b08c9086711d717922e

A small but practical concatenative programming language.

Updates
h3rald h3rald@h3rald.com
Wed, 30 Dec 2020 12:10:42 +0100
commit

190fe7d067beab63a5504b08c9086711d717922e

parent

49d5bd853a05be2751ea2eb685f73cff8f3e2241

1 files changed, 19 insertions(+), 3 deletions(-)

jump to
M core/interpreter.nimcore/interpreter.nim

@@ -229,9 +229,20 @@

proc push*(i: In, val: MinValue) {.gcsafe, extern:"min_exported_symbol_$1".}= if val.kind == minSymbol: i.debug(val) + if not i.evaluating: + #echo val, ":", val.filename, ":", val.line, ":", val.column + if val.line == 0 and val.column == 0 and val.filename == "": + # Simbol was added via min code, get data from previous min symbol + var nval = deepCopy(val) + let pval = i.trace[i.trace.len-1] + nval.symVal = pval.symVal & " > " & nval.symVal + nval.filename = pval.filename + nval.column = pval.column + nval.line = pval.line + i.currSym = nval + else: + i.currSym = val i.trace.add val - if not i.evaluating: - i.currSym = val let symbol = val.symVal if symbol == "return": raise MinReturnException(msg: "return symbol found")

@@ -276,6 +287,7 @@ template handleErrors*(i: In, body: untyped) =

try: body except MinRuntimeError: + echo "runtime" let msg = getCurrentExceptionMsg() i.stack = i.stackcopy error("$1:$2,$3 $4" % [i.currSym.filename, $i.currSym.line, $i.currSym.column, msg])

@@ -283,11 +295,15 @@ i.stackTrace()

i.trace = @[] raise MinTrappedException(msg: msg) except MinTrappedException: + echo "trapped" raise except: let msg = getCurrentExceptionMsg() i.stack = i.stackcopy - i.error(msg) + echo "generic " + #echo("$1:$2,$3 $4" % [i.currSym.filename, $i.currSym.line, $i.currSym.column, msg]) + #i.error(msg) + error("$1:$2,$3 $4" % [i.currSym.filename, $i.currSym.line, $i.currSym.column, msg]) i.stackTrace() i.trace = @[] raise MinTrappedException(msg: msg)