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

Handle the alloca in parse.

This commit is contained in:
Rob Rix 2015-11-26 16:22:01 -05:00
parent f27f35c683
commit 253c461b12

View File

@ -63,13 +63,13 @@ parseTreeSitterFile file = do
source <- newCString contents
ts_document_set_input_string document source
ts_document_parse document
term <- alloca $ parse document contents
term <- parse document contents
ts_document_free document
free source
putStrLn $ "hooray"
parse :: Ptr TSDocument -> String -> Ptr TSNode -> IO (Term String Info)
parse document contents root = do
parse :: Ptr TSDocument -> String -> IO (Term String Info)
parse document contents = alloca $ \root -> do
ts_document_root_node_p document root
toTerm root where
toTerm :: Ptr TSNode -> IO (Term String Info)