From 5adb639948ed2bb6931c5de23d0148bceecb971f Mon Sep 17 00:00:00 2001 From: konqoro Date: Tue, 6 Dec 2016 20:00:21 +0200 Subject: strscans: Fix examples --- lib/pure/strscans.nim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib') 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 -- cgit 1.4.1-2-gfad0