From c328c2da2afae9226fcdfa1ab8c80077fb28f8c5 Mon Sep 17 00:00:00 2001 From: Evan McGee Date: Thu, 9 Oct 2014 10:54:56 -0700 Subject: [PATCH 1/2] Fix for grammar parser returning MATCH_END when existing partial match items remain. --- CHANGELOG.md | 1 + ext/ruby_speech/ruby_speech.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b2b74b..f5438c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ # [develop](https://github.com/benlangfeld/ruby_speech) + * Bugfix: Fix grammar parsing error where MATCH_END is returned even when a partial match exists on a separate item # [2.3.2](https://github.com/benlangfeld/ruby_speech/compare/v2.3.1...v2.3.2) - [2014-04-21](https://rubygems.org/gems/ruby_speech/versions/2.3.2) * Bugfix: String nodes should take non-strings and cast to a string (`#to_s`) diff --git a/ext/ruby_speech/ruby_speech.c b/ext/ruby_speech/ruby_speech.c index ceaa818..867b619 100644 --- a/ext/ruby_speech/ruby_speech.c +++ b/ext/ruby_speech/ruby_speech.c @@ -48,9 +48,10 @@ static int is_match_end(pcre *compiled_regex, const char *input) search = search_set; } search_input[input_size] = *search++; - result = pcre_exec(compiled_regex, NULL, search_input, input_size + 1, 0, 0, + result = pcre_exec(compiled_regex, NULL, search_input, input_size + 1, 0, PCRE_PARTIAL, ovector, sizeof(ovector) / sizeof(ovector[0])); if (result > -1) return 0; + if (result == PCRE_ERROR_PARTIAL) return 0; } return 1; } From 2212dfe462bc7224794515ac33f864cb7f7ce093 Mon Sep 17 00:00:00 2001 From: Evan McGee Date: Thu, 9 Oct 2014 10:54:56 -0700 Subject: [PATCH 2/2] Fix for grammar parser returning MATCH_END when existing partial match items remain. --- CHANGELOG.md | 1 + ext/ruby_speech/ruby_speech.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b2b74b..f5438c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ # [develop](https://github.com/benlangfeld/ruby_speech) + * Bugfix: Fix grammar parsing error where MATCH_END is returned even when a partial match exists on a separate item # [2.3.2](https://github.com/benlangfeld/ruby_speech/compare/v2.3.1...v2.3.2) - [2014-04-21](https://rubygems.org/gems/ruby_speech/versions/2.3.2) * Bugfix: String nodes should take non-strings and cast to a string (`#to_s`) diff --git a/ext/ruby_speech/ruby_speech.c b/ext/ruby_speech/ruby_speech.c index ceaa818..867b619 100644 --- a/ext/ruby_speech/ruby_speech.c +++ b/ext/ruby_speech/ruby_speech.c @@ -48,9 +48,10 @@ static int is_match_end(pcre *compiled_regex, const char *input) search = search_set; } search_input[input_size] = *search++; - result = pcre_exec(compiled_regex, NULL, search_input, input_size + 1, 0, 0, + result = pcre_exec(compiled_regex, NULL, search_input, input_size + 1, 0, PCRE_PARTIAL, ovector, sizeof(ovector) / sizeof(ovector[0])); if (result > -1) return 0; + if (result == PCRE_ERROR_PARTIAL) return 0; } return 1; }