Moved sigils from prelude to respective modules.
h3rald h3rald@h3rald.com
Wed, 22 Mar 2017 22:12:15 +0100
3 files changed,
27 insertions(+),
22 deletions(-)
M
lib/min_lang.nim
→
lib/min_lang.nim
@@ -225,13 +225,18 @@ name = rawName.getString
var op = i.scope.getSymbol(name) i.apply(op) i.reqQuotation mdl - info("[import] Importing: $1 ($2 symbols)" % [name, $mdl.scope.symbols.len]) + info("[import] Importing: $1 ($2 symbols, $3 sigils)" % [name, $mdl.scope.symbols.len, $mdl.scope.sigils.len]) debug("[import] Scope: $1" % i.scope.fullname) for sym, val in mdl.scope.symbols.pairs: if i.scope.symbols.hasKey(sym) and i.scope.symbols[sym].sealed: raiseUndefined("Attempting to redefine sealed symbol '$1' on scope '$2'" % [sym, i.scope.name]) i.debug "[import] $1:$2" % [i.scope.fullname, sym] i.scope.symbols[sym] = val + for sig, val in mdl.scope.sigils.pairs: + if i.scope.sigils.hasKey(sig) and i.scope.sigils[sig].sealed: + raiseUndefined("Attempting to redefine sealed sigil '$1' on scope '$2'" % [sig, i.scope.name]) + i.debug "[import] $1:$2" % [i.scope.fullname, sig] + i.scope.sigils[sig] = val .symbol("eval") do (i: In): var s: MinValue@@ -775,15 +780,6 @@
.sigil("~") do (i: In): i.push("delete".newSym) - .sigil("$") do (i: In): - i.push("getenv".newSym) - - .sigil("!") do (i: In): - i.push("system".newSym) - - .sigil("&") do (i: In): - i.push("run".newSym) - .sigil("@") do (i: In): i.push("bind".newSym)@@ -819,15 +815,6 @@
.symbol("@") do (i: In): i.push("define".newSym) - .symbol("!") do (i: In): - i.push("system".newSym) - - .symbol("&") do (i: In): - i.push("run".newSym) - - .symbol("$") do (i: In): - i.push("getenv".newSym) - .symbol("^") do (i: In): i.push("call".newSym)@@ -839,8 +826,5 @@ i.push("quote".newSym)
.symbol("->") do (i: In): i.push("unquote".newSym) - - .symbol("=~") do (i: In): - i.push("regex".newSym) .finalize()
M
lib/min_str.nim
→
lib/min_str.nim
@@ -139,4 +139,7 @@ i.push 0.float.newVal
else: raiseInvalid("Cannot convert a quotation to float.") + .symbol("=~") do (i: In): + i.push("regex".newSym) + .finalize()
M
lib/min_sys.nim
→
lib/min_sys.nim
@@ -182,4 +182,22 @@ var files, file: MinValue
i.reqStringLikeAndQuotation file, files miniz.zip(files.qVal.mapIt(it.getString), file.getString) + .symbol("$") do (i: In): + i.push("getenv".newSym) + + .symbol("!") do (i: In): + i.push("system".newSym) + + .symbol("&") do (i: In): + i.push("run".newSym) + + .sigil("$") do (i: In): + i.push("getenv".newSym) + + .sigil("!") do (i: In): + i.push("system".newSym) + + .sigil("&") do (i: In): + i.push("run".newSym) + .finalize()