module TreeSitter.Tree
( Tree
, withRootNode
, ts_tree_delete
, ts_tree_root_node_p
) where
import Foreign
import TreeSitter.Node
data Tree
withRootNode :: Ptr Tree -> (Ptr Node -> IO a) -> IO a
withRootNode :: Ptr Tree -> (Ptr Node -> IO a) -> IO a
withRootNode Ptr Tree
tree Ptr Node -> IO a
action = (Ptr Node -> IO a) -> IO a
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr Node -> IO a) -> IO a) -> (Ptr Node -> IO a) -> IO a
forall a b. (a -> b) -> a -> b
$ \ Ptr Node
ptr -> do
Ptr Tree -> Ptr Node -> IO ()
ts_tree_root_node_p Ptr Tree
tree Ptr Node
ptr
Ptr Node -> IO a
action Ptr Node
ptr
foreign import ccall safe "ts_tree_delete" ts_tree_delete :: Ptr Tree -> IO ()
foreign import ccall unsafe "src/bridge.c ts_tree_root_node_p" ts_tree_root_node_p :: Ptr Tree -> Ptr Node -> IO ()