mirror of
https://github.com/github/semantic.git
synced 2024-12-22 14:21:31 +03:00
Use the Alternative instance for skipping spaces too.
This commit is contained in:
parent
645ae0b6de
commit
44c11647f8
@ -18,12 +18,9 @@ offsetRange i (Range start end) = Range (i + start) (i + end)
|
||||
rangesAndWordsFrom :: Int -> String -> [(Range, String)]
|
||||
rangesAndWordsFrom _ "" = []
|
||||
rangesAndWordsFrom startIndex string =
|
||||
case takeAndContinue <$> (word <|> punctuation) of
|
||||
case takeAndContinue <$> (word <|> punctuation) <|> skipAndContinue <$> space of
|
||||
Just a -> a
|
||||
Nothing ->
|
||||
case space of
|
||||
Just parsed -> skipAndContinue parsed
|
||||
Nothing -> []
|
||||
Nothing -> []
|
||||
where
|
||||
word = parse isWord string
|
||||
punctuation = parse (not . isWordOrSpace) string
|
||||
|
Loading…
Reference in New Issue
Block a user