diff options
author | konqoro <capoiosct@gmail.com> | 2016-12-06 20:00:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-06 20:00:21 +0200 |
commit | 5adb639948ed2bb6931c5de23d0148bceecb971f (patch) | |
tree | 6693c221bd96bef6d44a0a0e526c3ff2343fe33f /lib | |
parent | 57c4e78bccfb60b584259e8daa9e4025116fd28c (diff) | |
download | Nim-5adb639948ed2bb6931c5de23d0148bceecb971f.tar.gz |
strscans: Fix examples
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pure/strscans.nim | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/pure/strscans.nim b/lib/pure/strscans.nim index 246f018c5..fc400173f 100644 --- a/lib/pure/strscans.nim +++ b/lib/pure/strscans.nim @@ -76,7 +76,7 @@ to a variable (that was passed to the ``scanf`` macro) while ``$[]`` merely optional tokens. -In this example, we define a helper proc ``skipSep`` that skips some separators +In this example, we define a helper proc ``someSep`` that skips some separators which we then use in our scanf pattern to help us in the matching process: .. code-block:: nim @@ -86,14 +86,14 @@ which we then use in our scanf pattern to help us in the matching process: result = 0 while input[start+result] in seps: inc result - if scanf(input, "$w${someSep}$w", key, value): + if scanf(input, "$w$[someSep]$w", key, value): ... It also possible to pass arguments to a user definable matcher: .. code-block:: nim - proc ndigits(input: string; start: int; intVal: var int; n: int): int = + proc ndigits(input: string; intVal: var int; start: int; n: int): int = # matches exactly ``n`` digits. Matchers need to return 0 if nothing # matched or otherwise the number of processed chars. var x = 0 |