mirror of
https://github.com/github/semantic.git
synced 2024-11-24 08:54:07 +03:00
Produce a list of named children of a node.
This commit is contained in:
parent
e87459d608
commit
b39bc3e33e
@ -94,6 +94,14 @@ withNode writer = do
|
||||
node <- (mallocForeignPtr :: IO (ForeignPtr TSNode))
|
||||
withForeignPtr node writer
|
||||
|
||||
namedChildren :: Ptr TSNode -> IO [Ptr TSNode]
|
||||
namedChildren node = do
|
||||
count <- ts_node_p_named_child_count node
|
||||
mapM (withNode . getChild) [0..count] where
|
||||
getChild n out = do
|
||||
ts_node_p_named_child node n out
|
||||
return out
|
||||
|
||||
parseModuleFile :: FilePath -> IO (ParseResult HsModule)
|
||||
parseModuleFile file = do
|
||||
contents <- readFile file
|
||||
|
Loading…
Reference in New Issue
Block a user