mirror of
https://github.com/github/semantic.git
synced 2024-12-22 14:21:31 +03:00
Add a character predicate to test for word characters.
This commit is contained in:
parent
9c1dd640f5
commit
4fae286cf0
@ -22,6 +22,8 @@ rangesOfWordsFrom startIndex string = case break Char.isSpace string of
|
||||
(word, rest) -> (Range startIndex $ startIndex + length word) : rangesOfWordsAfterWhitespace (startIndex + length word) rest
|
||||
where
|
||||
rangesOfWordsAfterWhitespace startIndex string | (whitespace, rest) <- break (not . Char.isSpace) string = rangesOfWordsFrom (startIndex + length whitespace) rest
|
||||
isWord c = Char.isLetter c || Char.isNumber c || Char.isMark c || Char.generalCategory c == Char.ConnectorPunctuation
|
||||
|
||||
|
||||
instance Ord Range where
|
||||
a <= b = start a <= start b
|
||||
|
Loading…
Reference in New Issue
Block a user