summaryrefslogtreecommitdiffstats
path: root/ChangeLog
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2014-03-09 00:02:03 -0800
committerKaz Kylheku <kaz@kylheku.com>2014-03-09 00:02:03 -0800
commit01504b7436608a7501bb06f4f1b965607ceb1345 (patch)
tree648006cb0b462d91b5e32a92d70d5e160a89a476 /ChangeLog
parent7a3e541d24ea5d15ff7ee28a3505a9f33fd049f8 (diff)
downloadtxr-01504b7436608a7501bb06f4f1b965607ceb1345.tar.gz
txr-01504b7436608a7501bb06f4f1b965607ceb1345.tar.bz2
txr-01504b7436608a7501bb06f4f1b965607ceb1345.zip
Issue: match_regex and search_regex were continuing to feed characters
to the regex machine even when there is no transition available. This was due to the broken return value protocol of regex_machine_feed. For instance for the regex / +/ (one or more spaces), after matching some spaces, it would report REGM_INCOMPLETE for additional non-space characters, never reporting REGM_FAIL. * regex.c (regm_result_t): Block comment added, documenting protocol. (regex_machine_feed): Return REGM_FAIL if there are no transitions for the given character, even a partial match has been recorded. This is a signal to stop feeding more characters. At that point, the function can be called with a null character to distinguish the three cases: fail, partial or full match. (search_regex): Now when the search loop gets a REGM_FAIL, it can no longer assume that nothing was matched and the search must restart at the next position. Upon the REGM_FAIL signal, it is necesary to seal the search by feeding in the 0 character. Only if that returns REGM_FAIL is it a no match situation. Otherwise it is actually a match!
Diffstat (limited to 'ChangeLog')
-rw-r--r--ChangeLog21
1 files changed, 21 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 9d535f07..55b06f15 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,26 @@
2014-03-08 Kaz Kylheku <kaz@kylheku.com>
+ Issue: match_regex and search_regex were continuing to feed characters
+ to the regex machine even when there is no transition available. This
+ was due to the broken return value protocol of regex_machine_feed. For
+ instance for the regex / +/ (one or more spaces), after matching some
+ spaces, it would report REGM_INCOMPLETE for additional non-space
+ characters, never reporting REGM_FAIL.
+
+ * regex.c (regm_result_t): Block comment added, documenting protocol.
+ (regex_machine_feed): Return REGM_FAIL if there are no transitions for
+ the given character, even a partial match has been recorded. This is
+ a signal to stop feeding more characters. At that point, the function
+ can be called with a null character to distinguish the three cases:
+ fail, partial or full match.
+ (search_regex): Now when the search loop gets a REGM_FAIL, it can
+ no longer assume that nothing was matched and the search must restart
+ at the next position. Upon the REGM_FAIL signal, it is necesary to
+ seal the search by feeding in the 0 character. Only if that returns
+ REGM_FAIL is it a no match situation. Otherwise it is actually a match!
+
+2014-03-08 Kaz Kylheku <kaz@kylheku.com>
+
Version 85
* txr.c (version): Bumped.