1
1
mirror of https://github.com/github/semantic.git synced 2024-12-25 07:55:12 +03:00

Unpack the node and category another layer deep.

This commit is contained in:
Rob Rix 2015-11-25 15:02:11 -05:00
parent 0b735a697d
commit d6860a8934

View File

@ -87,7 +87,15 @@ toTerm document contents (node, category) = do
name <- ts_node_p_name node document
children <- namedChildren node
range <- range node
return (Info range $ Data.Set.fromList [ category ], Leaf $ substring range contents) where
annotation <- return . Info range $ Data.Set.fromList [ category ]
case children of
_ -> return (annotation, Leaf $ substring range contents)
where
nodeAndCategory :: Ptr TSNode -> IO (Ptr TSNode, String)
nodeAndCategory node = do
name <- ts_node_p_name node document
name <- peekCString name
return (node, name)
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" ]