1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 08:54:07 +03:00

Use withNode for the root.

This commit is contained in:
Rob Rix 2015-11-25 09:38:28 -05:00
parent 048b1cb98f
commit a147cffe11

View File

@ -70,8 +70,7 @@ parseTreeSitterFile file = do
source <- newCString contents
ts_document_set_input_string document source
ts_document_parse document
root <- (mallocForeignPtr :: IO (ForeignPtr TSNode))
term <- withForeignPtr root (\root -> do
withNode (\root -> do
ts_document_root_node_p document root
Control.Comonad.Cofree.unfoldM toTerm (root, "program"))
ts_document_free document