1
1
mirror of https://github.com/github/semantic.git synced 2024-11-28 01:47:01 +03:00

Move the productions into toTerm.

This commit is contained in:
Rob Rix 2015-11-25 11:12:16 -05:00
parent 9c3151da19
commit 3744714c59

View File

@ -76,14 +76,14 @@ parseTreeSitterFile file = do
unfoldM (toTerm document) (root, "program"))
ts_document_free document
free source
putStrLn $ "cSizeOf " ++ show (cSizeOf document) where
keyedProductions = Data.Set.fromList [ "object" ]
fixedProductions = Data.Set.fromList [ "pair", "rel_op", "math_op", "bool_op", "bitwise_op", "type_op", "math_assignment", "assignment", "subscript_access", "member_access", "new_expression", "function_call", "function", "ternary" ]
putStrLn $ "cSizeOf " ++ show (cSizeOf document)
toTerm :: Ptr TSDocument -> (Ptr TSNode, String) -> IO (Info, Syntax String (Ptr TSNode, String))
toTerm document (node, category) = do
name <- ts_node_p_name node document
return (Info (Range { start = 0, end = 0 }) $ Data.Set.fromList [ category ], Leaf "")
return (Info (Range { start = 0, end = 0 }) $ Data.Set.fromList [ category ], Leaf "") where
keyedProductions = Data.Set.fromList [ "object" ]
fixedProductions = Data.Set.fromList [ "pair", "rel_op", "math_op", "bool_op", "bitwise_op", "type_op", "math_assignment", "assignment", "subscript_access", "member_access", "new_expression", "function_call", "function", "ternary" ]
withNode :: (Ptr TSNode -> IO a) -> IO a
withNode writer = do