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 new language bindings #91

Merged
merged 30 commits into from
Dec 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
ad9197e
Added language submodule: gitattributes
dabico Dec 1, 2023
0f68365
Adding `GITATTRIBUTES` enum value to `Language`
dabico Dec 1, 2023
2fd0bd2
Adding additional test case for `Language#associatedWith`
dabico Dec 1, 2023
f33eecd
Added language submodule: gitignore
dabico Dec 1, 2023
70cf381
Adding `GITIGNORE` enum value to `Language`
dabico Dec 1, 2023
6709b3d
Adding additional test case for `Language#associatedWith`
dabico Dec 1, 2023
db6f379
Added language submodule: HCL
dabico Dec 1, 2023
166e899
Adding `HCL` enum value to `Language`
dabico Dec 1, 2023
64584d5
Added language submodule: Thrift
dabico Dec 2, 2023
d88bf93
Adding `THRIFT` enum value to `Language`
dabico Dec 2, 2023
bc2627a
Added language submodule: Twig
dabico Dec 2, 2023
3bc8b24
Adding `TWIG` enum value to `Language`
dabico Dec 2, 2023
9c51bae
Added language submodule: Verilog
dabico Dec 2, 2023
a0b21cf
Adding `VERILOG` enum value to `Language`
dabico Dec 2, 2023
442ce51
Added language submodule: XML
dabico Dec 3, 2023
605a3d8
Adding `XML` enum value to `Language`
dabico Dec 3, 2023
acd89e1
Update build.py
dabico Dec 3, 2023
61e963f
Added language submodule: DTD
dabico Dec 3, 2023
de3a29d
Adding `DTD` enum value to `Language`
dabico Dec 3, 2023
d9eec79
Update build.py
dabico Dec 3, 2023
617c320
Added language submodule: Zig
dabico Dec 3, 2023
a09edb9
Adding `ZIG` enum value to `Language`
dabico Dec 3, 2023
37480f4
Merge branch 'language/gitignore' into language/combined-prs
dabico Dec 3, 2023
93b9d3a
Merge branch 'language/hcl' into language/combined-prs
dabico Dec 3, 2023
99183b5
Merge branch 'language/thrift' into language/combined-prs
dabico Dec 3, 2023
24d0b62
Merge branch 'language/twig' into language/combined-prs
dabico Dec 3, 2023
9379984
Merge branch 'language/verilog' into language/combined-prs
dabico Dec 3, 2023
5cb6b17
Merge branch 'language/xml' into language/combined-prs
dabico Dec 3, 2023
0c34333
Merge branch 'language/zig' into language/combined-prs
dabico Dec 3, 2023
5026e42
Changing position of `tree-sitter-pascal` submodule in config file
dabico Dec 3, 2023
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
33 changes: 30 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
[submodule "tree-sitter-dot"]
path = tree-sitter-dot
url = https://github.com/rydesun/tree-sitter-dot.git
[submodule "tree-sitter-dtd"]
path = tree-sitter-dtd
url = https://github.com/ObserverOfTime/tree-sitter-xml.git
[submodule "tree-sitter-elixir"]
path = tree-sitter-elixir
url = https://github.com/elixir-lang/tree-sitter-elixir.git
Expand All @@ -49,6 +52,12 @@
[submodule "tree-sitter-fortran"]
path = tree-sitter-fortran
url = https://github.com/stadelmanma/tree-sitter-fortran.git
[submodule "tree-sitter-gitattributes"]
path = tree-sitter-gitattributes
url = https://github.com/ObserverOfTime/tree-sitter-gitattributes.git
[submodule "tree-sitter-gitignore"]
path = tree-sitter-gitignore
url = https://github.com/shunsambongi/tree-sitter-gitignore.git
[submodule "tree-sitter-go"]
path = tree-sitter-go
url = https://github.com/tree-sitter/tree-sitter-go.git
Expand All @@ -58,6 +67,9 @@
[submodule "tree-sitter-haskell"]
path = tree-sitter-haskell
url = https://github.com/tree-sitter/tree-sitter-haskell.git
[submodule "tree-sitter-hcl"]
path = tree-sitter-hcl
url = https://github.com/MichaHoffmann/tree-sitter-hcl.git
[submodule "tree-sitter-html"]
path = tree-sitter-html
url = https://github.com/tree-sitter/tree-sitter-html.git
Expand Down Expand Up @@ -94,6 +106,9 @@
[submodule "tree-sitter-ocaml"]
path = tree-sitter-ocaml
url = https://github.com/tree-sitter/tree-sitter-ocaml.git
[submodule "tree-sitter-pascal"]
path = tree-sitter-pascal
url = https://github.com/Isopod/tree-sitter-pascal.git
[submodule "tree-sitter-php"]
path = tree-sitter-php
url = https://github.com/tree-sitter/tree-sitter-php.git
Expand Down Expand Up @@ -127,18 +142,30 @@
[submodule "tree-sitter-swift"]
path = tree-sitter-swift
url = https://github.com/alex-pinkus/tree-sitter-swift.git
[submodule "tree-sitter-thrift"]
path = tree-sitter-thrift
url = https://github.com/duskmoon314/tree-sitter-thrift.git
[submodule "tree-sitter-toml"]
path = tree-sitter-toml
url = https://github.com/ikatyang/tree-sitter-toml.git
[submodule "tree-sitter-tsx"]
path = tree-sitter-tsx
url = https://github.com/tree-sitter/tree-sitter-typescript.git
[submodule "tree-sitter-twig"]
path = tree-sitter-twig
url = https://github.com/gbprod/tree-sitter-twig.git
[submodule "tree-sitter-typescript"]
path = tree-sitter-typescript
url = https://github.com/tree-sitter/tree-sitter-typescript.git
[submodule "tree-sitter-verilog"]
path = tree-sitter-verilog
url = https://github.com/tree-sitter/tree-sitter-verilog.git
[submodule "tree-sitter-xml"]
path = tree-sitter-xml
url = https://github.com/ObserverOfTime/tree-sitter-xml.git
[submodule "tree-sitter-yaml"]
path = tree-sitter-yaml
url = https://github.com/ikatyang/tree-sitter-yaml.git
[submodule "tree-sitter-pascal"]
path = tree-sitter-pascal
url = https://github.com/Isopod/tree-sitter-pascal.git
[submodule "tree-sitter-zig"]
path = tree-sitter-zig
url = https://github.com/maxxnino/tree-sitter-zig
6 changes: 5 additions & 1 deletion build.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,18 @@ def build(repositories, output_path="libjava-tree-sitter", system=None, arch=Non

compiler = new_c_compiler()
for repository in repositories:
if repository == "tree-sitter-markdown":
if repository == "tree-sitter-dtd":
src_path = path(repository, "tree-sitter-dtd", "src")
elif repository == "tree-sitter-markdown":
src_path = path(repository, repository, "src")
elif repository == "tree-sitter-ocaml":
src_path = path(repository, "ocaml", "src")
elif repository == "tree-sitter-tsx":
src_path = path(repository, "tsx", "src")
elif repository == "tree-sitter-typescript":
src_path = path(repository, "typescript", "src")
elif repository == "tree-sitter-xml":
src_path = path(repository, "tree-sitter-xml", "src")
else:
src_path = path(repository, "src")
source_paths.append(path(src_path, "parser.c"))
Expand Down
27 changes: 27 additions & 0 deletions lib/ch_usi_si_seart_treesitter.h
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,9 @@ TSLanguage* tree_sitter_dart();
#ifdef TS_LANGUAGE_DOT
TSLanguage* tree_sitter_dot();
#endif
#ifdef TS_LANGUAGE_DTD
TSLanguage* tree_sitter_dtd();
#endif
#ifdef TS_LANGUAGE_ELIXIR
TSLanguage* tree_sitter_elixir();
#endif
Expand All @@ -299,6 +302,12 @@ TSLanguage* tree_sitter_erlang();
#ifdef TS_LANGUAGE_FORTRAN
TSLanguage* tree_sitter_fortran();
#endif
#ifdef TS_LANGUAGE_GITATTRIBUTES
TSLanguage* tree_sitter_gitattributes();
#endif
#ifdef TS_LANGUAGE_GITIGNORE
TSLanguage* tree_sitter_gitignore();
#endif
#ifdef TS_LANGUAGE_GO
TSLanguage* tree_sitter_go();
#endif
Expand All @@ -308,6 +317,9 @@ TSLanguage* tree_sitter_graphql();
#ifdef TS_LANGUAGE_HASKELL
TSLanguage* tree_sitter_haskell();
#endif
#ifdef TS_LANGUAGE_HCL
TSLanguage* tree_sitter_hcl();
#endif
#ifdef TS_LANGUAGE_HTML
TSLanguage* tree_sitter_html();
#endif
Expand Down Expand Up @@ -380,18 +392,33 @@ TSLanguage* tree_sitter_svelte();
#ifdef TS_LANGUAGE_SWIFT
TSLanguage* tree_sitter_swift();
#endif
#ifdef TS_LANGUAGE_THRIFT
TSLanguage* tree_sitter_thrift();
#endif
#ifdef TS_LANGUAGE_TOML
TSLanguage* tree_sitter_toml();
#endif
#ifdef TS_LANGUAGE_TSX
TSLanguage* tree_sitter_tsx();
#endif
#ifdef TS_LANGUAGE_TWIG
TSLanguage* tree_sitter_twig();
#endif
#ifdef TS_LANGUAGE_TYPESCRIPT
TSLanguage* tree_sitter_typescript();
#endif
#ifdef TS_LANGUAGE_VERILOG
TSLanguage* tree_sitter_verilog();
#endif
#ifdef TS_LANGUAGE_XML
TSLanguage* tree_sitter_xml();
#endif
#ifdef TS_LANGUAGE_YAML
TSLanguage* tree_sitter_yaml();
#endif
#ifdef TS_LANGUAGE_ZIG
TSLanguage* tree_sitter_zig();
#endif

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

JNIEXPORT jlong JNICALL Java_ch_usi_si_seart_treesitter_Language_dtd(
JNIEnv* env, jclass self) {
#ifdef TS_LANGUAGE_DTD
return (jlong)tree_sitter_dtd();
#else
return (jlong)ch_usi_si_seart_treesitter_Language_INVALID;
#endif
}

JNIEXPORT jlong JNICALL Java_ch_usi_si_seart_treesitter_Language_elixir(
JNIEnv* env, jclass self) {
#ifdef TS_LANGUAGE_ELIXIR
Expand Down Expand Up @@ -148,6 +157,24 @@ JNIEXPORT jlong JNICALL Java_ch_usi_si_seart_treesitter_Language_fortran(
#endif
}

JNIEXPORT jlong JNICALL Java_ch_usi_si_seart_treesitter_Language_gitattributes(
JNIEnv* env, jclass self) {
#ifdef TS_LANGUAGE_GITATTRIBUTES
return (jlong)tree_sitter_gitattributes();
#else
return (jlong)ch_usi_si_seart_treesitter_Language_INVALID;
#endif
}

JNIEXPORT jlong JNICALL Java_ch_usi_si_seart_treesitter_Language_gitignore(
JNIEnv* env, jclass self) {
#ifdef TS_LANGUAGE_GITIGNORE
return (jlong)tree_sitter_gitignore();
#else
return (jlong)ch_usi_si_seart_treesitter_Language_INVALID;
#endif
}

JNIEXPORT jlong JNICALL Java_ch_usi_si_seart_treesitter_Language_go(
JNIEnv* env, jclass self) {
#ifdef TS_LANGUAGE_GO
Expand Down Expand Up @@ -175,6 +202,15 @@ JNIEXPORT jlong JNICALL Java_ch_usi_si_seart_treesitter_Language_haskell(
#endif
}

JNIEXPORT jlong JNICALL Java_ch_usi_si_seart_treesitter_Language_hcl(
JNIEnv* env, jclass self) {
#ifdef TS_LANGUAGE_HCL
return (jlong)tree_sitter_hcl();
#else
return (jlong)ch_usi_si_seart_treesitter_Language_INVALID;
#endif
}

JNIEXPORT jlong JNICALL Java_ch_usi_si_seart_treesitter_Language_html(
JNIEnv* env, jclass self) {
#ifdef TS_LANGUAGE_HTML
Expand Down Expand Up @@ -391,6 +427,15 @@ JNIEXPORT jlong JNICALL Java_ch_usi_si_seart_treesitter_Language_swift(
#endif
}

JNIEXPORT jlong JNICALL Java_ch_usi_si_seart_treesitter_Language_thrift(
JNIEnv* env, jclass self) {
#ifdef TS_LANGUAGE_THRIFT
return (jlong)tree_sitter_thrift();
#else
return (jlong)ch_usi_si_seart_treesitter_Language_INVALID;
#endif
}

JNIEXPORT jlong JNICALL Java_ch_usi_si_seart_treesitter_Language_toml(
JNIEnv* env, jclass self) {
#ifdef TS_LANGUAGE_TOML
Expand All @@ -409,6 +454,15 @@ JNIEXPORT jlong JNICALL Java_ch_usi_si_seart_treesitter_Language_tsx(
#endif
}

JNIEXPORT jlong JNICALL Java_ch_usi_si_seart_treesitter_Language_twig(
JNIEnv* env, jclass self) {
#ifdef TS_LANGUAGE_TWIG
return (jlong)tree_sitter_twig();
#else
return (jlong)ch_usi_si_seart_treesitter_Language_INVALID;
#endif
}

JNIEXPORT jlong JNICALL Java_ch_usi_si_seart_treesitter_Language_typescript(
JNIEnv* env, jclass self) {
#ifdef TS_LANGUAGE_TYPESCRIPT
Expand All @@ -418,6 +472,24 @@ JNIEXPORT jlong JNICALL Java_ch_usi_si_seart_treesitter_Language_typescript(
#endif
}

JNIEXPORT jlong JNICALL Java_ch_usi_si_seart_treesitter_Language_verilog(
JNIEnv* env, jclass self) {
#ifdef TS_LANGUAGE_VERILOG
return (jlong)tree_sitter_verilog();
#else
return (jlong)ch_usi_si_seart_treesitter_Language_INVALID;
#endif
}

JNIEXPORT jlong JNICALL Java_ch_usi_si_seart_treesitter_Language_xml(
JNIEnv* env, jclass self) {
#ifdef TS_LANGUAGE_XML
return (jlong)tree_sitter_xml();
#else
return (jlong)ch_usi_si_seart_treesitter_Language_INVALID;
#endif
}

JNIEXPORT jlong JNICALL Java_ch_usi_si_seart_treesitter_Language_yaml(
JNIEnv* env, jclass self) {
#ifdef TS_LANGUAGE_YAML
Expand All @@ -427,6 +499,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
Loading