From 413c584f08082e25fb599b741c4b5eebef4e365a Mon Sep 17 00:00:00 2001 From: Al Date: Thu, 13 Apr 2017 16:01:46 -0400 Subject: [PATCH] [fix] need to set prev_state to the NULL state in numex parsing after a non-space/non-hyphen is encountered and the previous match, if any, is added to the result array --- src/numex.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/numex.c b/src/numex.c index 1fd09ddb..17013bbd 100644 --- a/src/numex.c +++ b/src/numex.c @@ -744,6 +744,7 @@ numex_result_array *convert_numeric_expressions(char *str, char *lang) { log_debug("last was separator\n"); last_was_separator = false; possible_complete_token = true; + complete_token = false; } else { log_debug("other char\n"); if (result.len > 0 && (!whole_tokens_only || (prev_state.state == NUMEX_SEARCH_STATE_MATCH && is_punct) || (prev_state.state != NUMEX_SEARCH_STATE_MATCH && complete_token))) { @@ -754,6 +755,7 @@ numex_result_array *convert_numeric_expressions(char *str, char *lang) { } result = NULL_NUMEX_RESULT; rule = prev_rule = NUMEX_NULL_RULE; + prev_state = NULL_NUMEX_SEARCH_STATE; last_was_separator = false; possible_complete_token = false; complete_token = false; @@ -1054,4 +1056,3 @@ char *replace_numeric_expressions(char *str, char *lang) { return char_array_to_string(replacement); } -