restore and fix zig bindings #275
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixed and updated to be compatible zig v0.14.1
Changes:
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.