diff options
author | Grzegorz Adam Hankiewicz <gradha@imap.cc> | 2013-07-16 02:00:25 +0200 |
---|---|---|
committer | Grzegorz Adam Hankiewicz <gradha@imap.cc> | 2013-07-16 02:00:25 +0200 |
commit | ec6e26735132fe2a67e4c4bb74f92059d0530ce4 (patch) | |
tree | 89f7d7a7c356f15d01b0aafc350c48c6cb8f401b | |
parent | 67cea2b9b5328e636cc90c85050a0bd6b9811945 (diff) | |
download | Nim-ec6e26735132fe2a67e4c4bb74f92059d0530ce4.tar.gz |
Warns to not modify string findAll is iterating over.
-rw-r--r-- | lib/impure/re.nim | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/impure/re.nim b/lib/impure/re.nim index ef02a3b1d..b92d39bf0 100644 --- a/lib/impure/re.nim +++ b/lib/impure/re.nim @@ -201,7 +201,10 @@ proc find*(s: string, pattern: TRegEx, start = 0): int = return rawMatches[0] iterator findAll*(s: string, pattern: TRegEx, start = 0): string = - ## yields all matching *substrings* of `s` that match `pattern`. + ## Yields all matching *substrings* of `s` that match `pattern`. + ## + ## Note that since this is an iterator you should not modify the string you + ## are iterating over: bad things could happen. var i = int32(start) var rawMatches: array[0..maxSubpatterns * 3 - 1, cint] while true: |