Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tree-sitter/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
### v0.9.0.4

* Add binding to `ts_node_string`.
* Add `isMissing` flag for nodes.
* Add bindings for the edit API.

Expand Down
2 changes: 2 additions & 0 deletions tree-sitter/src/TreeSitter/Node.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module TreeSitter.Node
, TSPoint(..)
, TSNode(..)
, FieldId(..)
, ts_node_string_p
, ts_node_copy_child_nodes
, ts_node_poke_p

Expand Down Expand Up @@ -171,3 +172,4 @@ instance Monad Struct where
foreign import ccall unsafe "src/bridge.c ts_node_copy_child_nodes" ts_node_copy_child_nodes :: Ptr TSNode -> Ptr Node -> IO ()
-- NB: this leaves the field name as NULL.
foreign import ccall unsafe "src/bridge.c ts_node_poke_p" ts_node_poke_p :: Ptr TSNode -> Ptr Node -> IO ()
foreign import ccall unsafe "src/bridge.c ts_node_string_p" ts_node_string_p :: Ptr Node -> IO CString
5 changes: 5 additions & 0 deletions tree-sitter/src/bridge.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,8 @@ uint32_t ts_tree_cursor_copy_child_nodes(TSTreeCursor *cursor, Node *outChildNod
}
return count;
}

char *ts_node_string_p(TSNode *self) {
assert(self != NULL);
return ts_node_string(*self);
}
Loading