Fixed deprecation warnings.
@@ -154,11 +154,11 @@ i.eval PRELUDE, "<prelude>"
else: try: i.eval customPrelude.readFile, customPrelude - except: + except CatchableError: logging.warn("Unable to process custom prelude code in $1" % customPrelude) try: i.eval MINRC.readFile() - except: + except CatchableError: error "An error occurred evaluating the .minrc file." proc interpret*(i: In, s: Stream) =@@ -167,7 +167,7 @@ i.open(s, i.filename)
discard i.parser.getToken() try: i.interpret() - except: + except CatchableError: discard i.close()@@ -176,7 +176,7 @@ i.open(newStringStream(s), i.filename)
discard i.parser.getToken() try: result = i.interpret() - except: + except CatchableError: discard i.close()@@ -210,7 +210,7 @@ logging.notice(cmd)
discard execShellCmd(cmd) else: result = result.concat(i.compileFile(main)) - except: + except CatchableError: discard i.close()@@ -234,7 +234,7 @@ var fileLines = newSeq[string](0)
var contents = "" try: fileLines = fn.readFile().splitLines() - except: + except CatchableError: logging.fatal("Cannot read from file: " & fn) quit(3) if fileLines[0].len >= 2 and fileLines[0][0..1] == "#!":@@ -430,4 +430,4 @@ if isatty(stdin):
minRepl() quit(0) else: - minStream newFileStream(stdin), "stdin", op + minStream newFileStream(stdin), "stdin", op
@@ -14,7 +14,7 @@ installDirs = @["minpkg"]
# Dependencies -requires "nim >= 1.6.2, zippy >= 0.5.6" +requires "nim >= 1.6.12, zippy >= 0.5.6" before install: exec "nimble install -y nifty"
@@ -156,7 +156,7 @@ try:
i2.withScope(): for v in q.qVal: i2.push v - except: + except CatchableError: i.currSym = i2.currSym i.trace = i2.trace raise@@ -169,7 +169,7 @@ i2.scope = i.scope
try: i2.withScope(): i2.push v - except: + except CatchableError: i.currSym = i2.currSym i.trace = i2.trace raise@@ -222,7 +222,7 @@ var v2 = v
i2.dequote(v2) else: i2.push v - except: + except CatchableError: i.currSym = i2.currSym i.trace = i2.trace raise@@ -307,7 +307,7 @@ i.trace = @[]
raise MinTrappedException(msg: msg) except MinTrappedException: raise - except: + except CatchableError: let msg = getCurrentExceptionMsg() i.stack = i.stackcopy i.error(msg)@@ -382,7 +382,7 @@ var fileLines = newSeq[string](0)
var contents = "" try: fileLines = s.readFile().splitLines() - except: + except CatchableError: fatal("Cannot read from file: " & s) if fileLines[0].len >= 2 and fileLines[0][0..1] == "#!": contents = ";;\n" & fileLines[1..fileLines.len-1].join("\n")@@ -404,7 +404,7 @@ var fileLines = newSeq[string](0)
var contents = "" try: fileLines = s.readFile().splitLines() - except: + except CatchableError: fatal("Cannot read from file: " & s) if fileLines[0].len >= 2 and fileLines[0][0..1] == "#!": contents = ";;\n" & fileLines[1..fileLines.len-1].join("\n")@@ -429,4 +429,4 @@ proc parse*(i: In, s: string, name="<parse>"): MinValue =
return i.eval(s, name, true) proc read*(i: In, s: string): MinValue = - return i.load(s, true) + return i.load(s, true)
@@ -87,7 +87,7 @@ i.dequote(filter)
var check = i.pop if check.isBool and check.boolVal == true: res.add e - except: + except CatchableError: discard i.push res.newVal@@ -138,4 +138,4 @@ var cll = i.dget(data, collection)
i.ddel(cll, id) i.push ds - def.finalize("dstore") + def.finalize("dstore")
@@ -139,7 +139,7 @@ let answer = ed.readLine("Enter your choice ($1 - $2): " % ["1", $c])
var choice: int try: choice = answer.parseInt - except: + except CatchableError: choice = 0 if choice <= 0 or choice > c: echo "Invalid choice."@@ -180,4 +180,4 @@ discard f.open(a.strVal, fmAppend)
f.write(b.strVal) f.close() - def.finalize("io") + def.finalize("io")
@@ -253,7 +253,7 @@ var p: MinOperatorProc = proc (i: In) =
var inVals: seq[MinValue] try: inVals = i.expect(inExpects, generics) - except: + except CatchableError: generics = origGenerics raise i.withScope():@@ -410,7 +410,7 @@ if pair.len == 1 and pair[0].len == 0:
continue i.dset(dict, pair[0].strip, pair[1].strip.newVal) i.push(dict) - except: + except CatchableError: raiseInvalid("Invalid/unsupported YAML object (only dictionaries with string values are supported)") def.symbol("to-yaml") do (i: In):@@ -427,7 +427,7 @@ if value.kind != minString:
raiseInvalid(err) yaml &= "$1: $2\n" % [key.strVal, value.strVal] i.push(yaml.strip.newVal) - except: + except CatchableError: raiseInvalid(err) def.symbol("loglevel") do (i: In):@@ -740,7 +740,7 @@ return
let e = (MinRuntimeError)getCurrentException() i.push e.data i.dequote(catch) - except: + except CatchableError: if not hasCatch: return let e = getCurrentException()@@ -1143,4 +1143,4 @@
def.symbol("><") do (i: In): i.pushSym("infix-dequote") - def.finalize("ROOT") + def.finalize("ROOT")
@@ -51,7 +51,7 @@ let second: SecondRange = i.dget(dict, "second").intVal.int
let timezone = i.dget(dict, "timezone").intVal.int let tinfo = dateTime(year, month, monthday, hour, minute, second, 0, utc()) i.push (tinfo + timezone.seconds).toTime.toUnix.int.newVal - except: + except CatchableError: raiseInvalid("An invalid timeinfo dictionary was provided.") def.symbol("datetime") do (i: In):@@ -75,4 +75,4 @@ else:
time = t.floatVal.int64.fromUnix i.push time.local.format(s.getString).newVal - def.finalize("time") + def.finalize("time")