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:
parent
f27f35c683
commit
253c461b12
@ -63,13 +63,13 @@ parseTreeSitterFile file = do
|
|||||||
source <- newCString contents
|
source <- newCString contents
|
||||||
ts_document_set_input_string document source
|
ts_document_set_input_string document source
|
||||||
ts_document_parse document
|
ts_document_parse document
|
||||||
term <- alloca $ parse document contents
|
term <- parse document contents
|
||||||
ts_document_free document
|
ts_document_free document
|
||||||
free source
|
free source
|
||||||
putStrLn $ "hooray"
|
putStrLn $ "hooray"
|
||||||
|
|
||||||
parse :: Ptr TSDocument -> String -> Ptr TSNode -> IO (Term String Info)
|
parse :: Ptr TSDocument -> String -> IO (Term String Info)
|
||||||
parse document contents root = do
|
parse document contents = alloca $ \root -> do
|
||||||
ts_document_root_node_p document root
|
ts_document_root_node_p document root
|
||||||
toTerm root where
|
toTerm root where
|
||||||
toTerm :: Ptr TSNode -> IO (Term String Info)
|
toTerm :: Ptr TSNode -> IO (Term String Info)
|
||||||
|
Loading…
Reference in New Issue
Block a user