1
1
mirror of https://github.com/github/semantic.git synced 2025-01-03 04:51:57 +03:00

🔥 rangesAndWordsAfterWhitespace.

This commit is contained in:
Rob Rix 2015-12-14 15:56:57 -05:00
parent 8990db2b79
commit 9e01666d7d

View File

@ -20,7 +20,6 @@ rangesAndWordsFrom startIndex string = case break (not . isWord) string of
([], rest) | (whitespace, rest) <- break isWord rest -> rangesAndWordsFrom (startIndex + length whitespace) rest
(word, rest) -> (Range startIndex $ startIndex + length word, word) : case break isWord rest of (whitespace, rest) -> rangesAndWordsFrom (startIndex + length word + length whitespace) rest
where
rangesAndWordsAfterWhitespace startIndex string | (whitespace, rest) <- break isWord string = rangesAndWordsFrom (startIndex + length whitespace) rest
-- | Is this a word character?
-- | Word characters are defined as in [Rubys `\p{Word}` syntax](http://ruby-doc.org/core-2.1.1/Regexp.html#class-Regexp-label-Character+Properties), i.e.:
-- | > A member of one of the following Unicode general category _Letter_, _Mark_, _Number_, _Connector_Punctuation_