mirror of
https://github.com/github/semantic.git
synced 2024-12-29 01:42:43 +03:00
Make leaves within the parent’s substring.
This commit is contained in:
parent
dbce74368f
commit
bac6b696a5
@ -65,7 +65,7 @@ replaceLeavesWithWordBranches :: String -> Term String Info -> Term String Info
|
||||
replaceLeavesWithWordBranches source term = replaceIn source 0 term
|
||||
where
|
||||
replaceIn source startIndex (info@(Info range lineRange categories) :< syntax) | range <- offsetRange (negate startIndex) range = info :< case syntax of
|
||||
Leaf _ | ranges <- rangesOfWordsFrom (start range) (substring range source), length ranges > 1 -> Indexed $ makeLeaf source startIndex lineRange categories <$> ranges
|
||||
Leaf _ | ranges <- rangesOfWordsFrom (start range) (substring range source), length ranges > 1 -> Indexed $ makeLeaf (substring range source) startIndex lineRange categories <$> ranges
|
||||
Indexed i -> Indexed $ replaceIn (substring range source) (start range) <$> i
|
||||
Fixed f -> Fixed $ replaceIn (substring range source) (start range) <$> f
|
||||
Keyed k -> Keyed $ replaceIn (substring range source) (start range) <$> k
|
||||
|
Loading…
Reference in New Issue
Block a user