summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authordata-man <datamanrb@gmail.com>2018-05-25 18:52:04 +0300
committerdata-man <datamanrb@gmail.com>2018-05-25 18:52:04 +0300
commit856dc4c5c13fb52741de8a2fb124e0d05a553ddb (patch)
tree091f0cc4663fd97ce8c6cc7c277f1f93a74eb888 /lib
parent65365354706f6a54a7d68b90ea07ee7c709e36ef (diff)
downloadNim-856dc4c5c13fb52741de8a2fb124e0d05a553ddb.tar.gz
Fixes for parseUntil when until.len == 0 (or nil)
Diffstat (limited to 'lib')
-rw-r--r--lib/pure/parseutils.nim3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/pure/parseutils.nim b/lib/pure/parseutils.nim
index d77790fe0..d54f1454b 100644
--- a/lib/pure/parseutils.nim
+++ b/lib/pure/parseutils.nim
@@ -197,6 +197,9 @@ proc parseUntil*(s: string, token: var string, until: string,
   ## parses a token and stores it in ``token``. Returns
   ## the number of the parsed characters or 0 in case of an error. A token
   ## consists of any character that comes before the `until`  token.
+  if until.len == 0:
+    token.setLen(0)
+    return 0
   var i = start
   while i < s.len:
     if s[i] == until[0]: