lib/attentive/tokens/regexp.rb in attentive-0.2.0 vs lib/attentive/tokens/regexp.rb in attentive-0.3.0
- old
+ new
@@ -19,15 +19,15 @@
match_data = regexp.match(cursor.to_s)
return false unless match_data
# Find the first token following the match
new_character_index = cursor.offset + match_data.to_s.length
- cursor_pos = cursor.tokens.index { |token| token.pos >= new_character_index }
+ cursor_pos = cursor.tokens.index { |token| token.begin >= new_character_index }
cursor_pos = cursor.tokens.length unless cursor_pos
# If the match ends in the middle of a token, treat it as a mismatch
match_end_token = cursor.tokens[cursor_pos - 1]
- return false if match_end_token.pos + match_end_token.length > new_character_index
+ return false if match_end_token.begin + match_end_token.length > new_character_index
# Advance the cursor to the first token after the regexp match
cursor.advance cursor_pos - cursor.pos
# Return the MatchData as a hash