From dfd73902772a0236e09cae534ba98f1a58c194ad Mon Sep 17 00:00:00 2001 From: Araq Date: Wed, 24 Sep 2014 03:01:16 +0200 Subject: [PATCH] added $* for subexes --- doc/subexes.txt | 2 ++ lib/pure/subexes.nim | 3 +++ 2 files changed, 5 insertions(+) diff --git a/doc/subexes.txt b/doc/subexes.txt index 7cad183b95..decf30eefd 100644 --- a/doc/subexes.txt +++ b/doc/subexes.txt @@ -16,10 +16,12 @@ Notation meaning ``$name`` use named argument, you can wrap the named argument in curly braces (eg. ``${name}``) to separate it from the next characters. +``$$`` produces a single ``$`` ``$1`` use first argument ``$-1`` use last argument ``${1..3}`` use arguments 1 to 3 ``${..}`` use all arguments +``$*`` use all arguments (same as ``${..}``) ``${#..}`` use all remaining arguments ``${..-2}`` use all arguments except the last argument ``${$1}`` use argument X where ``X = parseInt(arg[1])`` diff --git a/lib/pure/subexes.nim b/lib/pure/subexes.nim index 452978c09b..c87823926f 100644 --- a/lib/pure/subexes.nim +++ b/lib/pure/subexes.nim @@ -196,6 +196,9 @@ proc scanDollar(p: var TFormatParser, a: openarray[string], s: var string) = of '$': emitChar p, s, '$' inc i + of '*': + for j in 0..a.high: emitStr p, s, a[j] + inc i of '{': call: let (x, y) = scanSlice(p, a)