diff options
author | Araq <rumpf_a@web.de> | 2015-08-21 01:34:46 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2015-08-21 01:34:46 +0200 |
commit | a2bb7d4c71e0804dd57c8e4d7ba16cf61ab184f1 (patch) | |
tree | 246954555f94057bcb2176d105824542314bc58c | |
parent | 9659540b18b9bd76ea027c83a10077103fcc6318 (diff) | |
download | Nim-a2bb7d4c71e0804dd57c8e4d7ba16cf61ab184f1.tar.gz |
simplify nimscript.nim
-rw-r--r-- | compiler/main.nim | 2 | ||||
-rw-r--r-- | lib/system/nimscript.nim | 25 | ||||
-rw-r--r-- | todo.txt | 8 |
3 files changed, 10 insertions, 25 deletions
diff --git a/compiler/main.nim b/compiler/main.nim index baf1c5208..7c043eb72 100644 --- a/compiler/main.nim +++ b/compiler/main.nim @@ -355,7 +355,7 @@ proc mainCommand* = gGlobalOptions.incl(optCaasEnabled) msgs.gErrorMax = high(int) # do not stop after first error serve(mainCommand) - of "nop": discard + of "nop", "help": discard else: rawMessage(errInvalidCommandX, command) diff --git a/lib/system/nimscript.nim b/lib/system/nimscript.nim index 013b2cbc0..c714f88ee 100644 --- a/lib/system/nimscript.nim +++ b/lib/system/nimscript.nim @@ -144,28 +144,13 @@ template task*(name: untyped; description: string; body: untyped): untyped = proc `name Task`() = body let cmd = getCommand() - if cmd.len == 0 or cmd ==? "help" or cmd == "nop": - setCommand "nop" + if cmd.len == 0 or cmd ==? "help": + setCommand "help" writeTask(astToStr(name), description) elif cmd ==? astToStr(name): setCommand "nop" `name Task`() -type - VersionReq* = distinct string ## Describes a version requirement. - -template v*(name: string{lit}): VersionReq = VersionReq(name) -template special*(name: string): VersionReq = VersionReq(name) -template `<`*(v: VersionReq): VersionReq = VersionReq("<" & string(v)) -template `<=`*(v: VersionReq): VersionReq = VersionReq("<=" & string(v)) -template `>`*(v: VersionReq): VersionReq = VersionReq(">" & string(v)) -template `>=`*(v: VersionReq): VersionReq = VersionReq(">=" & string(v)) -template `&`*(a, b: VersionReq): VersionReq = - VersionReq(string(a) & " & " & string(b)) - -const - anyVersion* = VersionReq("*") - var packageName* = "" version*, author*, description*, license*, srcdir*, @@ -173,7 +158,7 @@ var skipDirs*, skipFiles*, skipExt*, installDirs*, installFiles*, installExt*, bin*: seq[string] - requiresData*: seq[(string, VersionReq)] + requiresData*: seq[string] -proc requires*(name: string; v: VersionReq) = - requiresData.add((name, v)) +proc requires*(deps: varargs[string]) = + for d in deps: requiresData.add(d) diff --git a/todo.txt b/todo.txt index ee30894da..3089dfbbe 100644 --- a/todo.txt +++ b/todo.txt @@ -15,10 +15,6 @@ version 0.11.4 - add "all threads are blocked" detection to 'spawn' - Deprecate ``immediate`` for templates and macros -- make 'nil' work for 'add': - - resizeString - - incrSeq - - addChar version 1.0 @@ -36,6 +32,10 @@ version 1.0 - split docgen into separate tool - special rule for ``[]=``, items, pairs - BUG: echo with template `$`*(info: TLineInfo): expr = toFileLineCol(info) +- make 'nil' work for 'add': + - resizeString + - incrSeq + - addChar Concurrency |