Skip to content

Commit

Permalink
Merge pull request #91 from seart-group/language/combined-prs
Browse files Browse the repository at this point in the history
  • Loading branch information
dabico committed Dec 3, 2023
2 parents 70626e5 + 5026e42 commit 50aca83
Show file tree
Hide file tree
Showing 16 changed files with 312 additions and 5 deletions.
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

0 comments on commit 50aca83

Please sign in to comment.