all repos — min @ 8876e02c1389e598033a11722624798e99c8d3cb

A small but practical concatenative programming language.

Merge branch 'next' of github.com:h3rald/min into next
h3rald h3rald@h3rald.com
Wed, 23 Dec 2020 03:55:37 +0100
commit

8876e02c1389e598033a11722624798e99c8d3cb

parent

71038e1cc11d743b9540aec78db2c3dfe3bdc684

1 files changed, 5 insertions(+), 20 deletions(-)

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

@@ -298,28 +298,12 @@ q = newSeq[MinValue](0).newVal

while i.parser.token != tkEof: if i.trace.len == 0: i.stackcopy = i.stack - try: + handleErrors(i) do: val = i.parser.parseMinValue(i) if parseOnly: q.qVal.add val else: i.push val - except MinRuntimeError: - let msg = getCurrentExceptionMsg() - i.stack = i.stackcopy - error("$1:$2,$3 $4" % [i.currSym.filename, $i.currSym.line, $i.currSym.column, msg]) - i.stackTrace - i.trace = @[] - raise MinTrappedException(msg: msg) - except MinTrappedException: - raise - except: - let msg = getCurrentExceptionMsg() - i.stack = i.stackcopy - i.error(msg) - i.stackTrace - i.trace = @[] - raise MinTrappedException(msg: msg) if parseOnly: return q if i.stack.len > 0:

@@ -368,9 +352,10 @@ result.add "var i = newMinInterpreter(\"$#\")" % i.filename

result.add "i.stdLib()" if ASSETPATH != "": for f in walkDirRec(ASSETPATH): - logging.notice("- Including: $#" % f) - let ef = f.readFile.encode - let asset = "COMPILEDASSETS[\"$#\"] = \"$#\".decode" % [f, ef] + var file = f.replace("\\", "/") + logging.notice("- Including: $#" % file) + let ef = file.readFile.encode + let asset = "COMPILEDASSETS[\"$#\"] = \"$#\".decode" % [file, ef] result.add asset proc eval*(i: In, s: string, name="<eval>", parseOnly=false): MinValue {.discardable, extern:"min_exported_symbol_$1".}=