mirror of
https://github.com/github/semantic.git
synced 2025-01-03 04:51:57 +03:00
Extract word & punctuation & space into atoms.
This commit is contained in:
parent
2ba26d8a47
commit
cf072208fd
@ -25,6 +25,9 @@ rangesAndWordsFrom startIndex string =
|
|||||||
Just parsed -> skipAndContinue parsed
|
Just parsed -> skipAndContinue parsed
|
||||||
Nothing -> []
|
Nothing -> []
|
||||||
where
|
where
|
||||||
|
word = parse isWord string
|
||||||
|
punctuation = parse (not . isWordOrSpace) string
|
||||||
|
space = parse Char.isSpace string
|
||||||
takeAndContinue (parsed, rest) = (Range startIndex $ startIndex + length parsed, parsed) : rangesAndWordsFrom (startIndex + length parsed) rest
|
takeAndContinue (parsed, rest) = (Range startIndex $ startIndex + length parsed, parsed) : rangesAndWordsFrom (startIndex + length parsed) rest
|
||||||
skipAndContinue (parsed, rest) = rangesAndWordsFrom (startIndex + length parsed) rest
|
skipAndContinue (parsed, rest) = rangesAndWordsFrom (startIndex + length parsed) rest
|
||||||
parse predicate string = case span predicate string of
|
parse predicate string = case span predicate string of
|
||||||
|
Loading…
Reference in New Issue
Block a user