Skip to content

Conversation

@nvlled
Copy link

@nvlled nvlled commented Jul 24, 2025

Fixed and updated to be compatible zig v0.14.1

Changes:

  1. use the latest commit of master branch
  2. return anyopaque pointer for language()
  3. move test on separate file
  4. replace deprecated fields and tags
  5. check if files exist before adding to the build

In (1), the latest release of zig-tree-sitter does not yet use the enum literal for the package name, but the recent commits fixed it, so use the latest commit (b4b72c9) of the master branch for now until they make a new release.

(2) and (3) fixes the error:

bindings/zig/root.zig:1:1: error: file exists in modules 'tree-sitter' and 'tree-sitter0'

Initially, I thought this is because the test module and tree-sitter-c module both uses bindings/zig/root.zig as the root_source_file. But even removing the test module, the error still persists when this project is used as a dependency on another project. The solution is to avoid exporting any references to zig-tree-sitter symbols, which could be conflicting to the user's own zig-tree-sitter dependency.

(4) replaces the deprecated .C with .c, and addSharedLibrary/addStaticLibrary with addLibrary. Note that since this package depends on the zig-tree-sitter that still uses the removed deprecated tags and methods, this won't build with current dev versions of zig (i.e. writergate).

(5) The zig files on tree-sitter-c is used as template for the project generator, and the some files or directories are optional and may not exist. So add a check first to avoid a failing build.

Fixed and updated to be compatible zig v0.14.1

Changes:
1. use the latest commit of master branch
2. return anyopaque pointer for language()
3. move test on separate file
4. replace deprecated fields and tags
5. check if files exist before adding to the build

In (1), the latest release of zig-tree-sitter does not yet
use the enum literal for the package name, but the recent commits
fixed it, so use the latest commit (b4b72c9) of the master branch
for now until they make a new release.

(2) and (3) fixes the error:

  `bindings/zig/root.zig:1:1: error: file exists in modules 'tree-sitter' and 'tree-sitter0'`

Initially, I thought this is because the test module and tree-sitter-c
module both uses bindings/zig/root.zig as the root_source_file. But even
removing the test module, the error still persists when this project is used
as a dependency on another project. The solution is to avoid exporting
any references to zig-tree-sitter symbols, which could be conflicting
to the user's own zig-tree-sitter dependency.

(4) replaces the deprecated .C with .c, and addSharedLibrary/addStaticLibrary
with addLibrary. Note that since this package depends on the zig-tree-sitter
that still uses the removed deprecated tags and methods, this won't
build with current dev versions of zig (i.e. writergate).

(5) The zig files on tree-sitter-c is used as template for
the project generator, and the some files or directories are optional
and may not exist. So add a check first to avoid a failing build.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant