mirror of
https://github.com/github/semantic.git
synced 2024-12-26 00:12:29 +03:00
Unpack the node and category another layer deep.
This commit is contained in:
parent
0b735a697d
commit
d6860a8934
10
app/Main.hs
10
app/Main.hs
@ -87,7 +87,15 @@ 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
|
||||||
range <- range 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" ]
|
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" ]
|
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" ]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user