tree-sitter-java-orchard 0.5.7__tar.gz → 0.5.9__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. {tree-sitter-java-orchard-0.5.7 → tree-sitter-java-orchard-0.5.9}/PKG-INFO +20 -3
  2. tree-sitter-java-orchard-0.5.9/README.md +31 -0
  3. tree-sitter-java-orchard-0.5.9/bindings/python/tree_sitter_java_orchard/__init__.py +43 -0
  4. tree-sitter-java-orchard-0.5.9/bindings/python/tree_sitter_java_orchard/__init__.pyi +17 -0
  5. {tree-sitter-java-orchard-0.5.7 → tree-sitter-java-orchard-0.5.9}/bindings/python/tree_sitter_java_orchard.egg-info/PKG-INFO +20 -3
  6. {tree-sitter-java-orchard-0.5.7 → tree-sitter-java-orchard-0.5.9}/pyproject.toml +1 -1
  7. {tree-sitter-java-orchard-0.5.7 → tree-sitter-java-orchard-0.5.9}/setup.py +25 -25
  8. {tree-sitter-java-orchard-0.5.7 → tree-sitter-java-orchard-0.5.9}/src/parser.c +30471 -30229
  9. {tree-sitter-java-orchard-0.5.7 → tree-sitter-java-orchard-0.5.9}/src/tree_sitter/array.h +118 -73
  10. tree-sitter-java-orchard-0.5.7/README.md +0 -14
  11. tree-sitter-java-orchard-0.5.7/bindings/python/tree_sitter_java_orchard/__init__.py +0 -42
  12. tree-sitter-java-orchard-0.5.7/bindings/python/tree_sitter_java_orchard/__init__.pyi +0 -10
  13. {tree-sitter-java-orchard-0.5.7 → tree-sitter-java-orchard-0.5.9}/LICENSE +0 -0
  14. {tree-sitter-java-orchard-0.5.7 → tree-sitter-java-orchard-0.5.9}/bindings/python/tree_sitter_java_orchard/binding.c +0 -0
  15. {tree-sitter-java-orchard-0.5.7 → tree-sitter-java-orchard-0.5.9}/bindings/python/tree_sitter_java_orchard/py.typed +0 -0
  16. {tree-sitter-java-orchard-0.5.7 → tree-sitter-java-orchard-0.5.9}/bindings/python/tree_sitter_java_orchard.egg-info/SOURCES.txt +0 -0
  17. {tree-sitter-java-orchard-0.5.7 → tree-sitter-java-orchard-0.5.9}/bindings/python/tree_sitter_java_orchard.egg-info/dependency_links.txt +0 -0
  18. {tree-sitter-java-orchard-0.5.7 → tree-sitter-java-orchard-0.5.9}/bindings/python/tree_sitter_java_orchard.egg-info/not-zip-safe +0 -0
  19. {tree-sitter-java-orchard-0.5.7 → tree-sitter-java-orchard-0.5.9}/bindings/python/tree_sitter_java_orchard.egg-info/requires.txt +0 -0
  20. {tree-sitter-java-orchard-0.5.7 → tree-sitter-java-orchard-0.5.9}/bindings/python/tree_sitter_java_orchard.egg-info/top_level.txt +0 -0
  21. {tree-sitter-java-orchard-0.5.7 → tree-sitter-java-orchard-0.5.9}/queries/highlights.scm +0 -0
  22. {tree-sitter-java-orchard-0.5.7 → tree-sitter-java-orchard-0.5.9}/queries/tags.scm +0 -0
  23. {tree-sitter-java-orchard-0.5.7 → tree-sitter-java-orchard-0.5.9}/setup.cfg +0 -0
  24. {tree-sitter-java-orchard-0.5.7 → tree-sitter-java-orchard-0.5.9}/src/tree_sitter/alloc.h +0 -0
  25. {tree-sitter-java-orchard-0.5.7 → tree-sitter-java-orchard-0.5.9}/src/tree_sitter/parser.h +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tree-sitter-java-orchard
3
- Version: 0.5.7
3
+ Version: 0.5.9
4
4
  Summary: Java grammar for tree-sitter
5
5
  Author-email: Ayman Nadeem <aymannadeem@github.com>
6
6
  License: MIT
@@ -21,11 +21,28 @@ License-File: LICENSE
21
21
  [![pypi][pypi]](https://pypi.org/project/tree-sitter-java-orchard)
22
22
  [![npm][npm]](https://www.npmjs.com/package/tree-sitter-java-orchard)
23
23
 
24
- Java grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter).
25
- Forked from https://github.com/tree-sitter/tree-sitter-java to integrate valuable unreviewed PRs.
24
+ This is a tree-sitter grammar for Java.
25
+
26
+ ### Using it
27
+
28
+ You can obtain this parser in various formats:
29
+ * as an archive from [the Releases page](/grammar-orchard/tree-sitter-java-orchard/releases), which contains all the generated files (bindings, parser code)
30
+ * as a Rust crate: `cargo add tree-sitter-java-orchard`
31
+ * as a Python package: `pip install tree-sitter-java-orchard`
32
+ * as an NPM package: `npm install tree-sitter-java-orchard`
33
+
34
+ ### Contributing
26
35
 
27
36
  Contributions are welcome, so are co-maintainers.
28
37
 
38
+ Unlike many grammar repositories, this one does not track generated files.
39
+ After cloning this repository, you'll need to run `tree-sitter generate` to obtain the parser.
40
+ If you want to use it via bindings, you'll also need to run `tree-sitter init`.
41
+
42
+ ### Origin
43
+
44
+ This project was forked from https://github.com/tree-sitter/tree-sitter-java, to [ease the use of and collaboration on this grammar](https://codeberg.org/grammar-orchard#for-contributors).
45
+
29
46
  [crates]: https://img.shields.io/crates/v/tree-sitter-java-orchard?logo=rust
30
47
  [pypi]: https://img.shields.io/pypi/v/tree-sitter-java-orchard?logo=pypi&logoColor=ffd242
31
48
  [npm]: https://img.shields.io/npm/v/tree-sitter-java-orchard?logo=npm
@@ -0,0 +1,31 @@
1
+ # tree-sitter-java-orchard
2
+
3
+ [![crates][crates]](https://crates.io/crates/tree-sitter-java-orchard)
4
+ [![pypi][pypi]](https://pypi.org/project/tree-sitter-java-orchard)
5
+ [![npm][npm]](https://www.npmjs.com/package/tree-sitter-java-orchard)
6
+
7
+ This is a tree-sitter grammar for Java.
8
+
9
+ ### Using it
10
+
11
+ You can obtain this parser in various formats:
12
+ * as an archive from [the Releases page](/grammar-orchard/tree-sitter-java-orchard/releases), which contains all the generated files (bindings, parser code)
13
+ * as a Rust crate: `cargo add tree-sitter-java-orchard`
14
+ * as a Python package: `pip install tree-sitter-java-orchard`
15
+ * as an NPM package: `npm install tree-sitter-java-orchard`
16
+
17
+ ### Contributing
18
+
19
+ Contributions are welcome, so are co-maintainers.
20
+
21
+ Unlike many grammar repositories, this one does not track generated files.
22
+ After cloning this repository, you'll need to run `tree-sitter generate` to obtain the parser.
23
+ If you want to use it via bindings, you'll also need to run `tree-sitter init`.
24
+
25
+ ### Origin
26
+
27
+ This project was forked from https://github.com/tree-sitter/tree-sitter-java, to [ease the use of and collaboration on this grammar](https://codeberg.org/grammar-orchard#for-contributors).
28
+
29
+ [crates]: https://img.shields.io/crates/v/tree-sitter-java-orchard?logo=rust
30
+ [pypi]: https://img.shields.io/pypi/v/tree-sitter-java-orchard?logo=pypi&logoColor=ffd242
31
+ [npm]: https://img.shields.io/npm/v/tree-sitter-java-orchard?logo=npm
@@ -0,0 +1,43 @@
1
+ """Java grammar for tree-sitter"""
2
+
3
+ from importlib.resources import files as _files
4
+
5
+ from ._binding import language
6
+
7
+
8
+ def _get_query(name, file):
9
+ try:
10
+ query = _files(f"{__package__}") / file
11
+ globals()[name] = query.read_text()
12
+ except FileNotFoundError:
13
+ globals()[name] = None
14
+ return globals()[name]
15
+
16
+
17
+ def __getattr__(name):
18
+ if name == "HIGHLIGHTS_QUERY":
19
+ return _get_query("HIGHLIGHTS_QUERY", "queries/highlights.scm")
20
+ if name == "INJECTIONS_QUERY":
21
+ return _get_query("INJECTIONS_QUERY", "queries/injections.scm")
22
+ if name == "LOCALS_QUERY":
23
+ return _get_query("LOCALS_QUERY", "queries/locals.scm")
24
+ if name == "TAGS_QUERY":
25
+ return _get_query("TAGS_QUERY", "queries/tags.scm")
26
+
27
+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
28
+
29
+
30
+ __all__ = [
31
+ "language",
32
+ "HIGHLIGHTS_QUERY",
33
+ "INJECTIONS_QUERY",
34
+ "LOCALS_QUERY",
35
+ "TAGS_QUERY",
36
+ ]
37
+
38
+
39
+ def __dir__():
40
+ return sorted(__all__ + [
41
+ "__all__", "__builtins__", "__cached__", "__doc__", "__file__",
42
+ "__loader__", "__name__", "__package__", "__path__", "__spec__",
43
+ ])
@@ -0,0 +1,17 @@
1
+ from typing import Final
2
+ from typing_extensions import CapsuleType
3
+
4
+ HIGHLIGHTS_QUERY: Final[str] | None
5
+ """The syntax highlighting query for this grammar."""
6
+
7
+ INJECTIONS_QUERY: Final[str] | None
8
+ """The language injection query for this grammar."""
9
+
10
+ LOCALS_QUERY: Final[str] | None
11
+ """The local variable query for this grammar."""
12
+
13
+ TAGS_QUERY: Final[str] | None
14
+ """The symbol tagging query for this grammar."""
15
+
16
+ def language() -> CapsuleType:
17
+ """The tree-sitter language function for this grammar."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tree-sitter-java-orchard
3
- Version: 0.5.7
3
+ Version: 0.5.9
4
4
  Summary: Java grammar for tree-sitter
5
5
  Author-email: Ayman Nadeem <aymannadeem@github.com>
6
6
  License: MIT
@@ -21,11 +21,28 @@ License-File: LICENSE
21
21
  [![pypi][pypi]](https://pypi.org/project/tree-sitter-java-orchard)
22
22
  [![npm][npm]](https://www.npmjs.com/package/tree-sitter-java-orchard)
23
23
 
24
- Java grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter).
25
- Forked from https://github.com/tree-sitter/tree-sitter-java to integrate valuable unreviewed PRs.
24
+ This is a tree-sitter grammar for Java.
25
+
26
+ ### Using it
27
+
28
+ You can obtain this parser in various formats:
29
+ * as an archive from [the Releases page](/grammar-orchard/tree-sitter-java-orchard/releases), which contains all the generated files (bindings, parser code)
30
+ * as a Rust crate: `cargo add tree-sitter-java-orchard`
31
+ * as a Python package: `pip install tree-sitter-java-orchard`
32
+ * as an NPM package: `npm install tree-sitter-java-orchard`
33
+
34
+ ### Contributing
26
35
 
27
36
  Contributions are welcome, so are co-maintainers.
28
37
 
38
+ Unlike many grammar repositories, this one does not track generated files.
39
+ After cloning this repository, you'll need to run `tree-sitter generate` to obtain the parser.
40
+ If you want to use it via bindings, you'll also need to run `tree-sitter init`.
41
+
42
+ ### Origin
43
+
44
+ This project was forked from https://github.com/tree-sitter/tree-sitter-java, to [ease the use of and collaboration on this grammar](https://codeberg.org/grammar-orchard#for-contributors).
45
+
29
46
  [crates]: https://img.shields.io/crates/v/tree-sitter-java-orchard?logo=rust
30
47
  [pypi]: https://img.shields.io/pypi/v/tree-sitter-java-orchard?logo=pypi&logoColor=ffd242
31
48
  [npm]: https://img.shields.io/npm/v/tree-sitter-java-orchard?logo=npm
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
5
5
  [project]
6
6
  name = "tree-sitter-java-orchard"
7
7
  description = "Java grammar for tree-sitter"
8
- version = "0.5.7"
8
+ version = "0.5.9"
9
9
  keywords = ["incremental", "parsing", "tree-sitter", "java-orchard"]
10
10
  classifiers = [
11
11
  "Intended Audience :: Developers",
@@ -1,31 +1,12 @@
1
1
  from os import path
2
- from platform import system
3
2
  from sysconfig import get_config_var
4
3
 
5
4
  from setuptools import Extension, find_packages, setup
6
5
  from setuptools.command.build import build
6
+ from setuptools.command.build_ext import build_ext
7
7
  from setuptools.command.egg_info import egg_info
8
8
  from wheel.bdist_wheel import bdist_wheel
9
9
 
10
- sources = [
11
- "bindings/python/tree_sitter_java_orchard/binding.c",
12
- "src/parser.c",
13
- ]
14
- if path.exists("src/scanner.c"):
15
- sources.append("src/scanner.c")
16
-
17
- macros: list[tuple[str, str | None]] = [
18
- ("PY_SSIZE_T_CLEAN", None),
19
- ("TREE_SITTER_HIDE_SYMBOLS", None),
20
- ]
21
- if limited_api := not get_config_var("Py_GIL_DISABLED"):
22
- macros.append(("Py_LIMITED_API", "0x030A0000"))
23
-
24
- if system() != "Windows":
25
- cflags = ["-std=c11", "-fvisibility=hidden"]
26
- else:
27
- cflags = ["/std:c11", "/utf-8"]
28
-
29
10
 
30
11
  class Build(build):
31
12
  def run(self):
@@ -35,10 +16,23 @@ class Build(build):
35
16
  super().run()
36
17
 
37
18
 
19
+ class BuildExt(build_ext):
20
+ def build_extension(self, ext: Extension):
21
+ if self.compiler.compiler_type != "msvc":
22
+ ext.extra_compile_args = ["-std=c11", "-fvisibility=hidden"]
23
+ else:
24
+ ext.extra_compile_args = ["/std:c11", "/utf-8"]
25
+ if path.exists("src/scanner.c"):
26
+ ext.sources.append("src/scanner.c")
27
+ if ext.py_limited_api:
28
+ ext.define_macros.append(("Py_LIMITED_API", "0x030A0000"))
29
+ super().build_extension(ext)
30
+
31
+
38
32
  class BdistWheel(bdist_wheel):
39
33
  def get_tag(self):
40
34
  python, abi, platform = super().get_tag()
41
- if python.startswith("cp"):
35
+ if python.startswith("cp") and not get_config_var("Py_GIL_DISABLED"):
42
36
  python, abi = "cp310", "abi3"
43
37
  return python, abi, platform
44
38
 
@@ -61,15 +55,21 @@ setup(
61
55
  ext_modules=[
62
56
  Extension(
63
57
  name="_binding",
64
- sources=sources,
65
- extra_compile_args=cflags,
66
- define_macros=macros,
58
+ sources=[
59
+ "bindings/python/tree_sitter_java_orchard/binding.c",
60
+ "src/parser.c",
61
+ ],
62
+ define_macros=[
63
+ ("PY_SSIZE_T_CLEAN", None),
64
+ ("TREE_SITTER_HIDE_SYMBOLS", None),
65
+ ],
67
66
  include_dirs=["src"],
68
- py_limited_api=limited_api,
67
+ py_limited_api=not get_config_var("Py_GIL_DISABLED"),
69
68
  )
70
69
  ],
71
70
  cmdclass={
72
71
  "build": Build,
72
+ "build_ext": BuildExt,
73
73
  "bdist_wheel": BdistWheel,
74
74
  "egg_info": EggInfo,
75
75
  },