Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add language binding: tree-sitter-zig #90

Merged
merged 2 commits into from
Dec 3, 2023
Merged
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
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@
[submodule "tree-sitter-yaml"]
path = tree-sitter-yaml
url = https://github.com/ikatyang/tree-sitter-yaml.git
[submodule "tree-sitter-zig"]
path = tree-sitter-zig
url = https://github.com/maxxnino/tree-sitter-zig
[submodule "tree-sitter-pascal"]
path = tree-sitter-pascal
url = https://github.com/Isopod/tree-sitter-pascal.git
3 changes: 3 additions & 0 deletions lib/ch_usi_si_seart_treesitter.h
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,9 @@ TSLanguage* tree_sitter_typescript();
#ifdef TS_LANGUAGE_YAML
TSLanguage* tree_sitter_yaml();
#endif
#ifdef TS_LANGUAGE_ZIG
TSLanguage* tree_sitter_zig();
#endif

#ifdef __cplusplus
}
Expand Down
9 changes: 9 additions & 0 deletions lib/ch_usi_si_seart_treesitter_Language.cc
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,15 @@ JNIEXPORT jlong JNICALL Java_ch_usi_si_seart_treesitter_Language_yaml(
#endif
}

JNIEXPORT jlong JNICALL Java_ch_usi_si_seart_treesitter_Language_zig(
JNIEnv* env, jclass self) {
#ifdef TS_LANGUAGE_ZIG
return (jlong)tree_sitter_zig();
#else
return (jlong)ch_usi_si_seart_treesitter_Language_INVALID;
#endif
}

JNIEXPORT jint JNICALL Java_ch_usi_si_seart_treesitter_Language_version(
JNIEnv* env, jclass self, jlong id) {
return (jint)ts_language_version((const TSLanguage *)id);
Expand Down
8 changes: 8 additions & 0 deletions lib/ch_usi_si_seart_treesitter_Language.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion src/main/java/ch/usi/si/seart/treesitter/Language.java
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,14 @@ public enum Language {
*
* @see <a href="https://github.com/ikatyang/tree-sitter-yaml">tree-sitter-yaml</a>
*/
YAML(yaml(), "yaml", "yml");
YAML(yaml(), "yaml", "yml"),

/**
* Zig programming language.
*
* @see <a href="https://github.com/maxxnino/tree-sitter-zig">tree-sitter-zig</a>
*/
ZIG(zig(), "zig");

private static native long ada();
private static native long bash();
Expand Down Expand Up @@ -421,6 +428,7 @@ public enum Language {
private static native long tsx();
private static native long typescript();
private static native long yaml();
private static native long zig();

/**
* Validates an enum value to ensure it is not null and has a valid (nonzero) identifier.
Expand Down Expand Up @@ -563,6 +571,7 @@ public String toString() {
case SCHEME:
case SVELTE:
case SWIFT:
case ZIG:
return capitalize(name());
/*
* Space-Delimited Capital Case
Expand Down
1 change: 1 addition & 0 deletions tree-sitter-zig
Submodule tree-sitter-zig added at 0d0870