tree-sitter-rust 0.23.0__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.
- tree_sitter_rust-0.23.0/LICENSE +21 -0
- tree_sitter_rust-0.23.0/PKG-INFO +64 -0
- tree_sitter_rust-0.23.0/README.md +45 -0
- tree_sitter_rust-0.23.0/bindings/python/tree_sitter_rust/__init__.py +37 -0
- tree_sitter_rust-0.23.0/bindings/python/tree_sitter_rust/__init__.pyi +7 -0
- tree_sitter_rust-0.23.0/bindings/python/tree_sitter_rust/binding.c +27 -0
- tree_sitter_rust-0.23.0/bindings/python/tree_sitter_rust/py.typed +0 -0
- tree_sitter_rust-0.23.0/bindings/python/tree_sitter_rust.egg-info/PKG-INFO +64 -0
- tree_sitter_rust-0.23.0/bindings/python/tree_sitter_rust.egg-info/SOURCES.txt +16 -0
- tree_sitter_rust-0.23.0/bindings/python/tree_sitter_rust.egg-info/dependency_links.txt +1 -0
- tree_sitter_rust-0.23.0/bindings/python/tree_sitter_rust.egg-info/not-zip-safe +1 -0
- tree_sitter_rust-0.23.0/bindings/python/tree_sitter_rust.egg-info/requires.txt +3 -0
- tree_sitter_rust-0.23.0/bindings/python/tree_sitter_rust.egg-info/top_level.txt +2 -0
- tree_sitter_rust-0.23.0/pyproject.toml +33 -0
- tree_sitter_rust-0.23.0/setup.cfg +4 -0
- tree_sitter_rust-0.23.0/setup.py +62 -0
- tree_sitter_rust-0.23.0/src/parser.c +192569 -0
- tree_sitter_rust-0.23.0/src/scanner.c +393 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017 Maxim Sokolov
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: tree-sitter-rust
|
|
3
|
+
Version: 0.23.0
|
|
4
|
+
Summary: Rust grammar for tree-sitter
|
|
5
|
+
Author-email: Max Brunsfeld <maxbrunsfeld@gmail.com>, Amaan Qureshi <amaanq12@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/tree-sitter/tree-sitter-rust
|
|
8
|
+
Keywords: incremental,parsing,tree-sitter,rust
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Topic :: Software Development :: Compilers
|
|
12
|
+
Classifier: Topic :: Text Processing :: Linguistic
|
|
13
|
+
Classifier: Typing :: Typed
|
|
14
|
+
Requires-Python: >=3.9
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
Provides-Extra: core
|
|
18
|
+
Requires-Dist: tree-sitter~=0.21; extra == "core"
|
|
19
|
+
|
|
20
|
+
# tree-sitter-rust
|
|
21
|
+
|
|
22
|
+
[![CI][ci]](https://github.com/tree-sitter/tree-sitter-rust/actions/workflows/ci.yml)
|
|
23
|
+
[![discord][discord]](https://discord.gg/w7nTvsVJhm)
|
|
24
|
+
[![matrix][matrix]](https://matrix.to/#/#tree-sitter-chat:matrix.org)
|
|
25
|
+
[![crates][crates]](https://crates.io/crates/tree-sitter-rust)
|
|
26
|
+
[![npm][npm]](https://www.npmjs.com/package/tree-sitter-rust)
|
|
27
|
+
[![pypi][pypi]](https://pypi.org/project/tree-sitter-rust)
|
|
28
|
+
|
|
29
|
+
Rust grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter).
|
|
30
|
+
|
|
31
|
+
## Features
|
|
32
|
+
|
|
33
|
+
- **Speed** — When initially parsing a file, `tree-sitter-rust` takes around two to three times
|
|
34
|
+
as long as rustc's hand-written parser.
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
$ wc -l examples/ast.rs
|
|
38
|
+
2157 examples/ast.rs
|
|
39
|
+
|
|
40
|
+
$ rustc -Z unpretty=ast-tree -Z time-passes examples/ast.rs | head -n0
|
|
41
|
+
time: 0.002; rss: 55MB -> 60MB ( +5MB) parse_crate
|
|
42
|
+
|
|
43
|
+
$ tree-sitter parse examples/ast.rs --quiet --time
|
|
44
|
+
examples/ast.rs 6.48 ms 9908 bytes/ms
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
But if you _edit_ the file after parsing it, tree-sitter can generally _update_
|
|
48
|
+
the previous existing syntax tree to reflect your edit in less than a millisecond,
|
|
49
|
+
thanks to its incremental parsing system.
|
|
50
|
+
|
|
51
|
+
## References
|
|
52
|
+
|
|
53
|
+
- [The Rust Reference](https://doc.rust-lang.org/reference/) — While Rust does
|
|
54
|
+
not have a specification, the reference tries to describe its working in detail.
|
|
55
|
+
It tends to be out of date.
|
|
56
|
+
- [Keywords](https://doc.rust-lang.org/stable/book/appendix-01-keywords.html) and
|
|
57
|
+
[Operators and Symbols](https://doc.rust-lang.org/stable/book/appendix-02-operators.html).
|
|
58
|
+
|
|
59
|
+
[ci]: https://img.shields.io/github/actions/workflow/status/tree-sitter/tree-sitter-rust/ci.yml?logo=github&label=CI
|
|
60
|
+
[discord]: https://img.shields.io/discord/1063097320771698699?logo=discord&label=discord
|
|
61
|
+
[matrix]: https://img.shields.io/matrix/tree-sitter-chat%3Amatrix.org?logo=matrix&label=matrix
|
|
62
|
+
[npm]: https://img.shields.io/npm/v/tree-sitter-rust?logo=npm
|
|
63
|
+
[crates]: https://img.shields.io/crates/v/tree-sitter-rust?logo=rust
|
|
64
|
+
[pypi]: https://img.shields.io/pypi/v/tree-sitter-rust?logo=pypi&logoColor=ffd242
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# tree-sitter-rust
|
|
2
|
+
|
|
3
|
+
[![CI][ci]](https://github.com/tree-sitter/tree-sitter-rust/actions/workflows/ci.yml)
|
|
4
|
+
[![discord][discord]](https://discord.gg/w7nTvsVJhm)
|
|
5
|
+
[![matrix][matrix]](https://matrix.to/#/#tree-sitter-chat:matrix.org)
|
|
6
|
+
[![crates][crates]](https://crates.io/crates/tree-sitter-rust)
|
|
7
|
+
[![npm][npm]](https://www.npmjs.com/package/tree-sitter-rust)
|
|
8
|
+
[![pypi][pypi]](https://pypi.org/project/tree-sitter-rust)
|
|
9
|
+
|
|
10
|
+
Rust grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter).
|
|
11
|
+
|
|
12
|
+
## Features
|
|
13
|
+
|
|
14
|
+
- **Speed** — When initially parsing a file, `tree-sitter-rust` takes around two to three times
|
|
15
|
+
as long as rustc's hand-written parser.
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
$ wc -l examples/ast.rs
|
|
19
|
+
2157 examples/ast.rs
|
|
20
|
+
|
|
21
|
+
$ rustc -Z unpretty=ast-tree -Z time-passes examples/ast.rs | head -n0
|
|
22
|
+
time: 0.002; rss: 55MB -> 60MB ( +5MB) parse_crate
|
|
23
|
+
|
|
24
|
+
$ tree-sitter parse examples/ast.rs --quiet --time
|
|
25
|
+
examples/ast.rs 6.48 ms 9908 bytes/ms
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
But if you _edit_ the file after parsing it, tree-sitter can generally _update_
|
|
29
|
+
the previous existing syntax tree to reflect your edit in less than a millisecond,
|
|
30
|
+
thanks to its incremental parsing system.
|
|
31
|
+
|
|
32
|
+
## References
|
|
33
|
+
|
|
34
|
+
- [The Rust Reference](https://doc.rust-lang.org/reference/) — While Rust does
|
|
35
|
+
not have a specification, the reference tries to describe its working in detail.
|
|
36
|
+
It tends to be out of date.
|
|
37
|
+
- [Keywords](https://doc.rust-lang.org/stable/book/appendix-01-keywords.html) and
|
|
38
|
+
[Operators and Symbols](https://doc.rust-lang.org/stable/book/appendix-02-operators.html).
|
|
39
|
+
|
|
40
|
+
[ci]: https://img.shields.io/github/actions/workflow/status/tree-sitter/tree-sitter-rust/ci.yml?logo=github&label=CI
|
|
41
|
+
[discord]: https://img.shields.io/discord/1063097320771698699?logo=discord&label=discord
|
|
42
|
+
[matrix]: https://img.shields.io/matrix/tree-sitter-chat%3Amatrix.org?logo=matrix&label=matrix
|
|
43
|
+
[npm]: https://img.shields.io/npm/v/tree-sitter-rust?logo=npm
|
|
44
|
+
[crates]: https://img.shields.io/crates/v/tree-sitter-rust?logo=rust
|
|
45
|
+
[pypi]: https://img.shields.io/pypi/v/tree-sitter-rust?logo=pypi&logoColor=ffd242
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"""Rust 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
|
+
query = _files(f"{__package__}.queries") / file
|
|
10
|
+
globals()[name] = query.read_text()
|
|
11
|
+
return globals()[name]
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def __getattr__(name):
|
|
15
|
+
if name == "HIGHLIGHTS_QUERY":
|
|
16
|
+
return _get_query("HIGHLIGHTS_QUERY", "highlights.scm")
|
|
17
|
+
if name == "INJECTIONS_QUERY":
|
|
18
|
+
return _get_query("INJECTIONS_QUERY", "injections.scm")
|
|
19
|
+
if name == "TAGS_QUERY":
|
|
20
|
+
return _get_query("TAGS_QUERY", "tags.scm")
|
|
21
|
+
|
|
22
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
__all__ = [
|
|
26
|
+
"language",
|
|
27
|
+
"HIGHLIGHTS_QUERY",
|
|
28
|
+
"INJECTIONS_QUERY",
|
|
29
|
+
"TAGS_QUERY",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def __dir__():
|
|
34
|
+
return sorted(__all__ + [
|
|
35
|
+
"__all__", "__builtins__", "__cached__", "__doc__", "__file__",
|
|
36
|
+
"__loader__", "__name__", "__package__", "__path__", "__spec__",
|
|
37
|
+
])
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#include <Python.h>
|
|
2
|
+
|
|
3
|
+
typedef struct TSLanguage TSLanguage;
|
|
4
|
+
|
|
5
|
+
TSLanguage *tree_sitter_rust(void);
|
|
6
|
+
|
|
7
|
+
static PyObject* _binding_language(PyObject *Py_UNUSED(self), PyObject *Py_UNUSED(args)) {
|
|
8
|
+
return PyCapsule_New(tree_sitter_rust(), "tree_sitter.Language", NULL);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
static PyMethodDef methods[] = {
|
|
12
|
+
{"language", _binding_language, METH_NOARGS,
|
|
13
|
+
"Get the tree-sitter language for this grammar."},
|
|
14
|
+
{NULL, NULL, 0, NULL}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
static struct PyModuleDef module = {
|
|
18
|
+
.m_base = PyModuleDef_HEAD_INIT,
|
|
19
|
+
.m_name = "_binding",
|
|
20
|
+
.m_doc = NULL,
|
|
21
|
+
.m_size = -1,
|
|
22
|
+
.m_methods = methods
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
PyMODINIT_FUNC PyInit__binding(void) {
|
|
26
|
+
return PyModule_Create(&module);
|
|
27
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: tree-sitter-rust
|
|
3
|
+
Version: 0.23.0
|
|
4
|
+
Summary: Rust grammar for tree-sitter
|
|
5
|
+
Author-email: Max Brunsfeld <maxbrunsfeld@gmail.com>, Amaan Qureshi <amaanq12@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/tree-sitter/tree-sitter-rust
|
|
8
|
+
Keywords: incremental,parsing,tree-sitter,rust
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Topic :: Software Development :: Compilers
|
|
12
|
+
Classifier: Topic :: Text Processing :: Linguistic
|
|
13
|
+
Classifier: Typing :: Typed
|
|
14
|
+
Requires-Python: >=3.9
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
Provides-Extra: core
|
|
18
|
+
Requires-Dist: tree-sitter~=0.21; extra == "core"
|
|
19
|
+
|
|
20
|
+
# tree-sitter-rust
|
|
21
|
+
|
|
22
|
+
[![CI][ci]](https://github.com/tree-sitter/tree-sitter-rust/actions/workflows/ci.yml)
|
|
23
|
+
[![discord][discord]](https://discord.gg/w7nTvsVJhm)
|
|
24
|
+
[![matrix][matrix]](https://matrix.to/#/#tree-sitter-chat:matrix.org)
|
|
25
|
+
[![crates][crates]](https://crates.io/crates/tree-sitter-rust)
|
|
26
|
+
[![npm][npm]](https://www.npmjs.com/package/tree-sitter-rust)
|
|
27
|
+
[![pypi][pypi]](https://pypi.org/project/tree-sitter-rust)
|
|
28
|
+
|
|
29
|
+
Rust grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter).
|
|
30
|
+
|
|
31
|
+
## Features
|
|
32
|
+
|
|
33
|
+
- **Speed** — When initially parsing a file, `tree-sitter-rust` takes around two to three times
|
|
34
|
+
as long as rustc's hand-written parser.
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
$ wc -l examples/ast.rs
|
|
38
|
+
2157 examples/ast.rs
|
|
39
|
+
|
|
40
|
+
$ rustc -Z unpretty=ast-tree -Z time-passes examples/ast.rs | head -n0
|
|
41
|
+
time: 0.002; rss: 55MB -> 60MB ( +5MB) parse_crate
|
|
42
|
+
|
|
43
|
+
$ tree-sitter parse examples/ast.rs --quiet --time
|
|
44
|
+
examples/ast.rs 6.48 ms 9908 bytes/ms
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
But if you _edit_ the file after parsing it, tree-sitter can generally _update_
|
|
48
|
+
the previous existing syntax tree to reflect your edit in less than a millisecond,
|
|
49
|
+
thanks to its incremental parsing system.
|
|
50
|
+
|
|
51
|
+
## References
|
|
52
|
+
|
|
53
|
+
- [The Rust Reference](https://doc.rust-lang.org/reference/) — While Rust does
|
|
54
|
+
not have a specification, the reference tries to describe its working in detail.
|
|
55
|
+
It tends to be out of date.
|
|
56
|
+
- [Keywords](https://doc.rust-lang.org/stable/book/appendix-01-keywords.html) and
|
|
57
|
+
[Operators and Symbols](https://doc.rust-lang.org/stable/book/appendix-02-operators.html).
|
|
58
|
+
|
|
59
|
+
[ci]: https://img.shields.io/github/actions/workflow/status/tree-sitter/tree-sitter-rust/ci.yml?logo=github&label=CI
|
|
60
|
+
[discord]: https://img.shields.io/discord/1063097320771698699?logo=discord&label=discord
|
|
61
|
+
[matrix]: https://img.shields.io/matrix/tree-sitter-chat%3Amatrix.org?logo=matrix&label=matrix
|
|
62
|
+
[npm]: https://img.shields.io/npm/v/tree-sitter-rust?logo=npm
|
|
63
|
+
[crates]: https://img.shields.io/crates/v/tree-sitter-rust?logo=rust
|
|
64
|
+
[pypi]: https://img.shields.io/pypi/v/tree-sitter-rust?logo=pypi&logoColor=ffd242
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
setup.py
|
|
5
|
+
bindings/python/tree_sitter_rust/__init__.py
|
|
6
|
+
bindings/python/tree_sitter_rust/__init__.pyi
|
|
7
|
+
bindings/python/tree_sitter_rust/binding.c
|
|
8
|
+
bindings/python/tree_sitter_rust/py.typed
|
|
9
|
+
bindings/python/tree_sitter_rust.egg-info/PKG-INFO
|
|
10
|
+
bindings/python/tree_sitter_rust.egg-info/SOURCES.txt
|
|
11
|
+
bindings/python/tree_sitter_rust.egg-info/dependency_links.txt
|
|
12
|
+
bindings/python/tree_sitter_rust.egg-info/not-zip-safe
|
|
13
|
+
bindings/python/tree_sitter_rust.egg-info/requires.txt
|
|
14
|
+
bindings/python/tree_sitter_rust.egg-info/top_level.txt
|
|
15
|
+
src/parser.c
|
|
16
|
+
src/scanner.c
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=42", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "tree-sitter-rust"
|
|
7
|
+
description = "Rust grammar for tree-sitter"
|
|
8
|
+
version = "0.23.0"
|
|
9
|
+
keywords = ["incremental", "parsing", "tree-sitter", "rust"]
|
|
10
|
+
classifiers = [
|
|
11
|
+
"Intended Audience :: Developers",
|
|
12
|
+
"License :: OSI Approved :: MIT License",
|
|
13
|
+
"Topic :: Software Development :: Compilers",
|
|
14
|
+
"Topic :: Text Processing :: Linguistic",
|
|
15
|
+
"Typing :: Typed",
|
|
16
|
+
]
|
|
17
|
+
authors = [
|
|
18
|
+
{ name = "Max Brunsfeld", email = "maxbrunsfeld@gmail.com" },
|
|
19
|
+
{ name = "Amaan Qureshi", email = "amaanq12@gmail.com" },
|
|
20
|
+
]
|
|
21
|
+
requires-python = ">=3.9"
|
|
22
|
+
license.text = "MIT"
|
|
23
|
+
readme = "README.md"
|
|
24
|
+
|
|
25
|
+
[project.urls]
|
|
26
|
+
Homepage = "https://github.com/tree-sitter/tree-sitter-rust"
|
|
27
|
+
|
|
28
|
+
[project.optional-dependencies]
|
|
29
|
+
core = ["tree-sitter~=0.21"]
|
|
30
|
+
|
|
31
|
+
[tool.cibuildwheel]
|
|
32
|
+
build = "cp39-*"
|
|
33
|
+
build-frontend = "build"
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
from os.path import isdir, join
|
|
2
|
+
from platform import system
|
|
3
|
+
|
|
4
|
+
from setuptools import Extension, find_packages, setup
|
|
5
|
+
from setuptools.command.build import build
|
|
6
|
+
from wheel.bdist_wheel import bdist_wheel
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Build(build):
|
|
10
|
+
def run(self):
|
|
11
|
+
if isdir("queries"):
|
|
12
|
+
dest = join(self.build_lib, "tree_sitter_rust", "queries")
|
|
13
|
+
self.copy_tree("queries", dest)
|
|
14
|
+
super().run()
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class BdistWheel(bdist_wheel):
|
|
18
|
+
def get_tag(self):
|
|
19
|
+
python, abi, platform = super().get_tag()
|
|
20
|
+
if python.startswith("cp"):
|
|
21
|
+
python, abi = "cp39", "abi3"
|
|
22
|
+
return python, abi, platform
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
setup(
|
|
26
|
+
packages=find_packages("bindings/python"),
|
|
27
|
+
package_dir={"": "bindings/python"},
|
|
28
|
+
package_data={
|
|
29
|
+
"tree_sitter_rust": ["*.pyi", "py.typed"],
|
|
30
|
+
"tree_sitter_rust.queries": ["*.scm"],
|
|
31
|
+
},
|
|
32
|
+
ext_package="tree_sitter_rust",
|
|
33
|
+
ext_modules=[
|
|
34
|
+
Extension(
|
|
35
|
+
name="_binding",
|
|
36
|
+
sources=[
|
|
37
|
+
"bindings/python/tree_sitter_rust/binding.c",
|
|
38
|
+
"src/parser.c",
|
|
39
|
+
"src/scanner.c",
|
|
40
|
+
],
|
|
41
|
+
extra_compile_args=[
|
|
42
|
+
"-std=c11",
|
|
43
|
+
"-fvisibility=hidden",
|
|
44
|
+
] if system() != "Windows" else [
|
|
45
|
+
"/std:c11",
|
|
46
|
+
"/utf-8",
|
|
47
|
+
],
|
|
48
|
+
define_macros=[
|
|
49
|
+
("Py_LIMITED_API", "0x03090000"),
|
|
50
|
+
("PY_SSIZE_T_CLEAN", None),
|
|
51
|
+
("TREE_SITTER_HIDE_SYMBOLS", None),
|
|
52
|
+
],
|
|
53
|
+
include_dirs=["src"],
|
|
54
|
+
py_limited_api=True,
|
|
55
|
+
)
|
|
56
|
+
],
|
|
57
|
+
cmdclass={
|
|
58
|
+
"build": Build,
|
|
59
|
+
"bdist_wheel": BdistWheel
|
|
60
|
+
},
|
|
61
|
+
zip_safe=False
|
|
62
|
+
)
|