diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2014-03-09 00:02:03 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2014-03-09 00:02:03 -0800 |
commit | 01504b7436608a7501bb06f4f1b965607ceb1345 (patch) | |
tree | 648006cb0b462d91b5e32a92d70d5e160a89a476 /configure | |
parent | 7a3e541d24ea5d15ff7ee28a3505a9f33fd049f8 (diff) | |
download | txr-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 'configure')
0 files changed, 0 insertions, 0 deletions