From: Alexis Laferrière Date: Tue, 1 Sep 2015 14:43:50 +0000 (-0400) Subject: lib/re: mark with FIXME problems with length computations X-Git-Tag: v0.7.8~48^2 X-Git-Url: http://nitlanguage.org lib/re: mark with FIXME problems with length computations Signed-off-by: Alexis Laferrière --- diff --git a/lib/core/re.nit b/lib/core/re.nit index 33ab76c..c37bf25 100644 --- a/lib/core/re.nit +++ b/lib/core/re.nit @@ -380,18 +380,18 @@ class Regex # Found one? if res == 0 then var first_char = bstr.byte_to_char_index(native_match.rm_so) - var last_char = bstr.byte_to_char_index(native_match.rm_eo - native_match.rm_so - 1) + var length_char = bstr.byte_to_char_index(native_match.rm_eo - native_match.rm_so - 1) # FIXME For issue #1684 var match = new Match(text, from + first_char, - last_char + 1) + length_char + 1) # Add sub expressions for i in [1 .. nsub] do first_char = bstr.byte_to_char_index(native_match[i].rm_so) - last_char = bstr.byte_to_char_index(native_match[i].rm_eo - native_match[i].rm_so - 1) + length_char = bstr.byte_to_char_index(native_match[i].rm_eo - native_match[i].rm_so - 1) # FIXME For issue #1684 match.subs.add new Match( text, from + first_char, - last_char + 1) + length_char + 1) end return match