diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-10-26 20:31:12 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-10-26 20:31:12 -0700 |
commit | b766bf96cdd1d3b5065308755c675ad2d5016f56 (patch) | |
tree | c8bf596d7e9acbd39f6a4a1924b19c55892a935a /lib.c | |
parent | e0dbcc3a6455d990c0a0ecde74e279e8f3b53843 (diff) | |
download | txr-b766bf96cdd1d3b5065308755c675ad2d5016f56.tar.gz txr-b766bf96cdd1d3b5065308755c675ad2d5016f56.tar.bz2 txr-b766bf96cdd1d3b5065308755c675ad2d5016f56.zip |
Fix regression: broken tok_where.
* lib.c (tok_where): Check that the regex match
succeeded before destructuring the result with
range_bind.
Diffstat (limited to 'lib.c')
-rw-r--r-- | lib.c | 17 |
1 files changed, 10 insertions, 7 deletions
@@ -4052,17 +4052,20 @@ val tok_where(val str, val tok_regex) for (;;) { val range = range_regex(str, tok_regex, pos, nil); - range_bind (match_start, match_end, range); - if (!match_start) - break; + if (range) { + range_bind (match_start, match_end, range); - iter = list_collect(iter, range); + iter = list_collect(iter, range); - pos = match_end; + pos = match_end; - if (numeq(match_end, match_start)) - pos = plus(pos, one); + if (numeq(match_end, match_start)) + pos = plus(pos, one); + continue; + } + + break; } return out; |