1
1
mirror of https://github.com/github/semantic.git synced 2024-12-29 18:06:14 +03:00

Assign non-pairs a key from their substrings.

This commit is contained in:
Rob Rix 2015-12-14 18:36:46 -05:00
parent 09ec17cbb6
commit c6e5f89dfe

View File

@ -76,7 +76,7 @@ documentToTerm document contents = alloca $ \root -> do
_ | member name fixedProductions -> Fixed $ fmap snd children _ | member name fixedProductions -> Fixed $ fmap snd children
_ | otherwise -> Indexed $ fmap snd children) _ | otherwise -> Indexed $ fmap snd children)
where assignKey ("pair", node) = ("pair", node) where assignKey ("pair", node) = ("pair", node)
assignKey (name, node) = (name, node) assignKey (_, node@(Info range _ :< _)) = (substring range contents, node)
withNamedChildren :: Ptr TSNode -> (Ptr TSNode -> IO (String, a)) -> IO [(String, a)] withNamedChildren :: Ptr TSNode -> (Ptr TSNode -> IO (String, a)) -> IO [(String, a)]
withNamedChildren node transformNode = do withNamedChildren node transformNode = do