Packages

Tree-sitter bindings (nif) for elixir. Currently small subset of the tree-sitter api is supported, but happy to accept merge requests/patches

Current section

6 Versions

Jump to

Compare versions

5 files changed
+12 additions
-8 deletions
  @@ -9,7 +9,7 @@ The package can be installed by adding `treesitter` to your list of dependencies
9 9 ```elixir
10 10 def deps do
11 11 [
12 - {:treesitter_elixir, "~> 0.1.0"}
12 + {:treesitter_elixir, "~> 0.1.1"}
13 13 ]
14 14 end
15 15 ```
  @@ -2,7 +2,7 @@
2 2 [{<<"issues">>,<<"https://codeberg.org/edwinvanl/treesitter_elixir/issues">>},
3 3 {<<"source">>,<<"https://codeberg.org/edwinvanl/treesitter_elixir">>}]}.
4 4 {<<"name">>,<<"treesitter_elixir">>}.
5 - {<<"version">>,<<"0.1.0">>}.
5 + {<<"version">>,<<"0.1.1">>}.
6 6 {<<"description">>,
7 7 <<"Tree-sitter bindings (nif) for elixir. Currently small subset of the tree-sitter api is supported, but happy to accept merge requests/patches">>}.
8 8 {<<"elixir">>,<<"~> 1.18">>}.
  @@ -80,7 +80,10 @@ defmodule TreeSitter.Nif do
80 80 raise "NIF not implemented"
81 81 end
82 82
83 - def node_range(_) do
83 + @doc """
84 + Return the start and end index of the bytestring
85 + """
86 + def node_byte_range(_) do
84 87 raise "NIF not implemented"
85 88 end
  @@ -4,8 +4,9 @@ defmodule Treesitter.MixProject do
4 4 def project do
5 5 [
6 6 app: :treesitter_elixir,
7 - description: "Tree-sitter bindings (nif) for elixir. Currently small subset of the tree-sitter api is supported, but happy to accept merge requests/patches",
8 - version: "0.1.0",
7 + description:
8 + "Tree-sitter bindings (nif) for elixir. Currently small subset of the tree-sitter api is supported, but happy to accept merge requests/patches",
9 + version: "0.1.1",
9 10 elixir: "~> 1.18",
10 11 compilers: [:elixir_make] ++ Mix.compilers(),
11 12 start_permanent: Mix.env() == :prod,
  @@ -246,8 +246,8 @@ static ERL_NIF_TERM node_type(ErlNifEnv *env, int argc,
246 246 return type;
247 247 }
248 248
249 - static ERL_NIF_TERM node_range(ErlNifEnv *env, int argc,
250 - const ERL_NIF_TERM argv[]) {
249 + static ERL_NIF_TERM node_byte_range(ErlNifEnv *env, int argc,
250 + const ERL_NIF_TERM argv[]) {
251 251 WRNode *wrap;
252 252 if (!enif_get_resource(env, argv[0], node_resource_type, (void **)&wrap)) {
253 253 return to_error_string(env, "Unable to unwrap tree");
  @@ -294,7 +294,7 @@ static ErlNifFunc nif_funcs[] = {
294 294 {"node_prev_sibling", 1, node_prev_sibling, 0},
295 295 {"node_string", 1, node_string, 0},
296 296 {"node_type", 1, node_type, 0},
297 - {"node_range", 1, node_range, 0},
297 + {"node_byte_range", 1, node_byte_range, 0},
298 298 {"node_point_range", 1, node_point_range, 0}};
299 299
300 300 ERL_NIF_INIT(Elixir.TreeSitter.Nif, nif_funcs, load, NULL, NULL, NULL)