mirror of
https://github.com/github/semantic.git
synced 2025-01-03 04:51:57 +03:00
🔥 rangesAndWordsAfterWhitespace.
This commit is contained in:
parent
8990db2b79
commit
9e01666d7d
@ -20,7 +20,6 @@ rangesAndWordsFrom startIndex string = case break (not . isWord) string of
|
|||||||
([], rest) | (whitespace, rest) <- break isWord rest -> rangesAndWordsFrom (startIndex + length whitespace) rest
|
([], 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
|
(word, rest) -> (Range startIndex $ startIndex + length word, word) : case break isWord rest of (whitespace, rest) -> rangesAndWordsFrom (startIndex + length word + length whitespace) rest
|
||||||
where
|
where
|
||||||
rangesAndWordsAfterWhitespace startIndex string | (whitespace, rest) <- break isWord string = rangesAndWordsFrom (startIndex + length whitespace) rest
|
|
||||||
-- | Is this a word character?
|
-- | Is this a word character?
|
||||||
-- | Word characters are defined as in [Ruby’s `\p{Word}` syntax](http://ruby-doc.org/core-2.1.1/Regexp.html#class-Regexp-label-Character+Properties), i.e.:
|
-- | Word characters are defined as in [Ruby’s `\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_
|
-- | > A member of one of the following Unicode general category _Letter_, _Mark_, _Number_, _Connector_Punctuation_
|
||||||
|
Loading…
Reference in New Issue
Block a user