all repos — min @ f6f3979170a103106e34dfad8bcf85ffbfaeee28

A small but practical concatenative programming language.

Removed more procs that are no longer necessary.
h3rald h3rald@h3rald.com
Wed, 24 Aug 2016 21:26:34 +0200
commit

f6f3979170a103106e34dfad8bcf85ffbfaeee28

parent

e0184c18c1f51c3ad49624641bc8bc31f385ce01

4 files changed, 18 insertions(+), 53 deletions(-)

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

@@ -1,4 +1,4 @@

-import lexbase, critbits, asyncdispatch, asynchttpserver +import lexbase, critbits type MinTokenKind* = enum
M core/utils.nimcore/utils.nim

@@ -1,11 +1,15 @@

-import tables, strutils, macros, critbits, httpclient, json, os, regex -import types, parser, interpreter - -proc cfgfile*(): string = - if hostOS == "windows": - return "HOMEPATH".getEnv / "minconfig.json" - else: - return "HOME".getEnv / "minconfig.json" +import + tables, + strutils, + macros, + critbits, + json, + os, + regex +import + types, + parser, + interpreter proc isSymbol*(s: MinValue): bool = return s.kind == minSymbol

@@ -131,34 +135,12 @@ i.evaluating = true

i.push mdl i.evaluating = false -template `<-`*[T](target, source: var T) = - shallowCopy target, source - template alias*[T](varname: untyped, value: var T) = var varname {.inject.}: type(value) shallowCopy varname, value proc to*(q: MinValue, T: typedesc): T = return cast[T](q.obj) - -proc cfgRead(): JsonNode = - return cfgfile().parseFile - -proc cfgWrite(cfg: JsonNode) = - cfgfile().writeFile(cfg.pretty) - -proc cfgGet*(key: string): JsonNode = - return cfgRead()[key] - -proc cfgSet*(key: string, value: JsonNode) = - var cfg = cfgRead() - cfg[key] = value - cfg.cfgWrite() - -proc cfgDel*(key: string) = - var cfg = cfgRead() - cfg.delete key - cfg.cfgWrite() proc `%`*(c: CritBitTree[string]): JsonNode = result = newJObject()
M lib/min_lang.nimlib/min_lang.nim

@@ -1,4 +1,8 @@

-import critbits, strutils, os, json +import + critbits, + strutils, + os, + json import ../core/types, ../core/parser,

@@ -30,9 +34,6 @@ q.add s.newVal

scope = scope.parent i.push q.newVal - .symbol("config") do (i: In): - echo cfgfile().readFile - .symbol("from-json") do (i: In): var s: MinValue i.reqString s

@@ -382,21 +383,6 @@ i.unquote("<linrec-r1>", r1)

i.linrec(p, t, r1, r2) i.unquote("<linrec-r2>", r2) i.linrec(p, t, r1, r2) - - .symbol("cget") do (i: In): - var s: MinValue - i.reqStringLike s - i.push cfgGet(s.getString).fromJson - - .symbol("cset") do (i: In): - var s: MinValue - i.reqStringLike s - let val = i.pop - cfgSet(s.getString, %val) - - .symbol("cdel") do (i: In): - var s: MinValue - cfgDel(s.getString) .symbol("dget") do (i: In): var d, k: MinValue
M minim.nimminim.nim

@@ -151,9 +151,6 @@ discard

else: discard -if not cfgfile().existsFile: - cfgfile().writeFile("{}") - if REPL: echo "MiNiM v"&version