1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 00:42:33 +03:00

Offset leaves’ ranges to get the substrings.

This commit is contained in:
Rob Rix 2015-12-14 12:40:08 -05:00
parent bac6b696a5
commit 8acc962ad2

View File

@ -70,7 +70,7 @@ replaceLeavesWithWordBranches source term = replaceIn source 0 term
Fixed f -> Fixed $ replaceIn (substring range source) (start range) <$> f
Keyed k -> Keyed $ replaceIn (substring range source) (start range) <$> k
_ -> syntax
makeLeaf source startIndex lineRange categories range = Info range lineRange categories :< Leaf (substring range source)
makeLeaf source startIndex lineRange categories range = Info range lineRange categories :< Leaf (substring (offsetRange (negate startIndex) range) source)
rangesOfWordsFrom :: Int -> String -> [Range]
rangesOfWordsFrom startIndex string = case break Char.isSpace string of