1
1
mirror of https://github.com/github/semantic.git synced 2024-12-26 00:12:29 +03:00

Pass the contents of the file to toTerm.

This commit is contained in:
Rob Rix 2015-11-25 12:53:48 -05:00
parent ba3e2d8256
commit 40a0bc0b91

View File

@ -77,13 +77,13 @@ parseTreeSitterFile file = do
ts_document_parse document ts_document_parse document
withAlloc (\root -> do withAlloc (\root -> do
ts_document_root_node_p document root ts_document_root_node_p document root
unfoldM (toTerm document) (root, "program")) unfoldM (toTerm document contents) (root, "program"))
ts_document_free document ts_document_free document
free source free source
putStrLn $ "cSizeOf " ++ show (cSizeOf document) putStrLn $ "cSizeOf " ++ show (cSizeOf document)
toTerm :: Ptr TSDocument -> (Ptr TSNode, String) -> IO (Info, Syntax String (Ptr TSNode, String)) toTerm :: Ptr TSDocument -> String -> (Ptr TSNode, String) -> IO (Info, Syntax String (Ptr TSNode, String))
toTerm document (node, category) = do toTerm document contents (node, category) = do
name <- ts_node_p_name node document name <- ts_node_p_name node document
children <- namedChildren node children <- namedChildren node
return (Info (Range { start = 0, end = 0 }) $ Data.Set.fromList [ category ], Leaf "") where return (Info (Range { start = 0, end = 0 }) $ Data.Set.fromList [ category ], Leaf "") where