added $* for subexes

This commit is contained in:
Araq 2014-09-24 03:01:16 +02:00
commit dfd7390277
2 changed files with 5 additions and 0 deletions

View file

@ -16,10 +16,12 @@ Notation meaning
``$name`` use named argument, you can wrap the named argument ``$name`` use named argument, you can wrap the named argument
in curly braces (eg. ``${name}``) to separate it from in curly braces (eg. ``${name}``) to separate it from
the next characters. the next characters.
``$$`` produces a single ``$``
``$1`` use first argument ``$1`` use first argument
``$-1`` use last argument ``$-1`` use last argument
``${1..3}`` use arguments 1 to 3 ``${1..3}`` use arguments 1 to 3
``${..}`` use all arguments ``${..}`` use all arguments
``$*`` use all arguments (same as ``${..}``)
``${#..}`` use all remaining arguments ``${#..}`` use all remaining arguments
``${..-2}`` use all arguments except the last argument ``${..-2}`` use all arguments except the last argument
``${$1}`` use argument X where ``X = parseInt(arg[1])`` ``${$1}`` use argument X where ``X = parseInt(arg[1])``

View file

@ -196,6 +196,9 @@ proc scanDollar(p: var TFormatParser, a: openarray[string], s: var string) =
of '$': of '$':
emitChar p, s, '$' emitChar p, s, '$'
inc i inc i
of '*':
for j in 0..a.high: emitStr p, s, a[j]
inc i
of '{': of '{':
call: call:
let (x, y) = scanSlice(p, a) let (x, y) = scanSlice(p, a)