diff options
author | Alexander Foremny <aforemny@posteo.de> | 2023-12-18 02:41:56 +0100 |
---|---|---|
committer | Alexander Foremny <aforemny@posteo.de> | 2023-12-18 05:27:40 +0100 |
commit | 10c764c022b1e46c84a3b4d3743a58bd1072b5a5 (patch) | |
tree | 9e37cf690bbeb8e430ddf4340b08f55c6fa78954 /app/TreeSitter/bridge.c | |
parent | 0d96613d9aa41f93ebb440bb1aa383456b49f28f (diff) |
feat: limit the number of FFI calls for extracting comments
This replaces the tree-sitter bindings with a call to a single C
function that traverses the AST.
We expect the query API to be slower than manually traversing the tree
for this particular use case.
This will be addressed in an upcoming commit.
@prerequisite-for add-languages-elm-shell-nix
Diffstat (limited to 'app/TreeSitter/bridge.c')
-rw-r--r-- | app/TreeSitter/bridge.c | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/app/TreeSitter/bridge.c b/app/TreeSitter/bridge.c deleted file mode 100644 index 904c88e..0000000 --- a/app/TreeSitter/bridge.c +++ /dev/null @@ -1,34 +0,0 @@ -#include "tree_sitter/api.h" -#include "string.h" - -void ts_tree_root_node_p(TSTree *tree, TSNode *node) { - (*node) = ts_tree_root_node(tree); -} - -uint32_t ts_node_named_child_count_p(TSNode *node) { - return ts_node_named_child_count(*node); -} - -uint32_t ts_node_start_byte_p(TSNode *node) { - return ts_node_start_byte(*node); -} - -uint32_t ts_node_end_byte_p(TSNode *node) { - return ts_node_end_byte(*node); -} - -uint32_t ts_node_start_point_p(TSNode *node, TSPoint *point) { - (*point) = ts_node_start_point(*node); -} - -uint32_t ts_node_end_point_p(TSNode *node, TSPoint *point) { - (*point) = ts_node_end_point(*node); -} - -const char* ts_node_type_p(TSNode *node) { - return ts_node_type(*node); -} - -void ts_node_named_child_p(TSNode* self, uint32_t child_index, TSNode* node) { - (*node) = ts_node_named_child(*self, child_index); -} |