1
1
mirror of https://github.com/github/semantic.git synced 2024-11-29 02:44:36 +03:00

Move pack into getSubstring

This commit is contained in:
joshvera 2015-12-30 17:36:41 -05:00
parent 943514f235
commit 6790640915

View File

@ -21,6 +21,6 @@ constructorForProductions keyed fixed source info@(Info range categories) = (inf
construct children | not . Set.null $ Set.intersection fixed categories = Fixed $ fmap snd children
construct children | not . Set.null $ Set.intersection keyed categories = Keyed . Map.fromList $ assignKey <$> children
construct children = Indexed $ snd <$> children
assignKey ("pair", node@(_ :< Fixed (key : _))) = (pack $ getSubstring key, node)
assignKey (_, node) = (pack $ getSubstring node, node)
getSubstring (Info range _ :< _) = toList $ slice range source
assignKey ("pair", node@(_ :< Fixed (key : _))) = (getSubstring key, node)
assignKey (_, node) = (getSubstring node, node)
getSubstring (Info range _ :< _) = pack . toList $ slice range source