tree-sitter-perl 1.0.2__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_perl-1.0.2/LICENSE +7 -0
- tree_sitter_perl-1.0.2/PKG-INFO +119 -0
- tree_sitter_perl-1.0.2/README.md +100 -0
- tree_sitter_perl-1.0.2/bindings/python/tree_sitter_perl/__init__.py +43 -0
- tree_sitter_perl-1.0.2/bindings/python/tree_sitter_perl/__init__.pyi +1 -0
- tree_sitter_perl-1.0.2/bindings/python/tree_sitter_perl/binding.c +35 -0
- tree_sitter_perl-1.0.2/bindings/python/tree_sitter_perl/py.typed +0 -0
- tree_sitter_perl-1.0.2/bindings/python/tree_sitter_perl.egg-info/PKG-INFO +119 -0
- tree_sitter_perl-1.0.2/bindings/python/tree_sitter_perl.egg-info/SOURCES.txt +16 -0
- tree_sitter_perl-1.0.2/bindings/python/tree_sitter_perl.egg-info/dependency_links.txt +1 -0
- tree_sitter_perl-1.0.2/bindings/python/tree_sitter_perl.egg-info/not-zip-safe +1 -0
- tree_sitter_perl-1.0.2/bindings/python/tree_sitter_perl.egg-info/requires.txt +3 -0
- tree_sitter_perl-1.0.2/bindings/python/tree_sitter_perl.egg-info/top_level.txt +2 -0
- tree_sitter_perl-1.0.2/pyproject.toml +29 -0
- tree_sitter_perl-1.0.2/setup.cfg +4 -0
- tree_sitter_perl-1.0.2/setup.py +58 -0
- tree_sitter_perl-1.0.2/src/parser.c +639314 -0
- tree_sitter_perl-1.0.2/src/scanner.c +1105 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright 2025 Avishai "Veesh" Goldman
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tree-sitter-perl
|
|
3
|
+
Version: 1.0.2
|
|
4
|
+
Summary: Perl grammar for tree-sitter
|
|
5
|
+
License: MIT
|
|
6
|
+
Project-URL: Homepage, https://github.com/tree-sitter-perl/tree-sitter-perl
|
|
7
|
+
Keywords: incremental,parsing,tree-sitter,perl
|
|
8
|
+
Classifier: Intended Audience :: Developers
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Topic :: Software Development :: Compilers
|
|
11
|
+
Classifier: Topic :: Text Processing :: Linguistic
|
|
12
|
+
Classifier: Typing :: Typed
|
|
13
|
+
Requires-Python: >=3.8
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Provides-Extra: core
|
|
17
|
+
Requires-Dist: tree-sitter~=0.24; extra == "core"
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
# tree-sitter-perl
|
|
21
|
+
|
|
22
|
+
A tree-sitter grammar for Perl. Maintained at https://github.com/tree-sitter-perl/tree-sitter-perl
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
### Package managers
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# npm
|
|
30
|
+
npm install tree-sitter-perl
|
|
31
|
+
|
|
32
|
+
# cargo
|
|
33
|
+
cargo add ts-parser-perl
|
|
34
|
+
|
|
35
|
+
# pip
|
|
36
|
+
pip install tree-sitter-perl
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Neovim
|
|
40
|
+
|
|
41
|
+
A version of this parser is part of the nvim-treesitter plugin.
|
|
42
|
+
|
|
43
|
+
To use a version that has not yet made it into nvim-treesitter:
|
|
44
|
+
```lua
|
|
45
|
+
local parser_config = require "nvim-treesitter.parsers".get_parser_configs()
|
|
46
|
+
parser_config.perl = {
|
|
47
|
+
install_info = {
|
|
48
|
+
url = 'https://github.com/tree-sitter-perl/tree-sitter-perl',
|
|
49
|
+
revision = 'release',
|
|
50
|
+
files = { "src/parser.c", "src/scanner.c" },
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Then `:TSInstall perl`. Copy the queries from the `queries` directory into
|
|
56
|
+
`queries/perl` somewhere in your `runtimepath`.
|
|
57
|
+
|
|
58
|
+
### Emacs
|
|
59
|
+
|
|
60
|
+
As of Emacs 29.1, if you have the tree-sitter library installed:
|
|
61
|
+
|
|
62
|
+
```emacs-lisp
|
|
63
|
+
(setq treesit-language-source-alist
|
|
64
|
+
'((perl . ("https://github.com/tree-sitter-perl/tree-sitter-perl" "release"))))
|
|
65
|
+
(treesit-install-language-grammar 'perl)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### From source
|
|
69
|
+
|
|
70
|
+
Pre-built files are on the `release` branch. We don't store generated files on
|
|
71
|
+
master because the 18MB `parser.c` makes branch switching painful.
|
|
72
|
+
|
|
73
|
+
## Developing
|
|
74
|
+
|
|
75
|
+
### Prerequisites
|
|
76
|
+
|
|
77
|
+
Install the [tree-sitter CLI](https://tree-sitter.github.io/tree-sitter/creating-parsers#installation).
|
|
78
|
+
Node.js v20+ is needed for `tree-sitter generate` (the grammar uses advanced
|
|
79
|
+
regex features for unicode support).
|
|
80
|
+
|
|
81
|
+
### Building
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
tree-sitter generate # generates src/parser.c from grammar.js
|
|
85
|
+
tree-sitter test # runs the test corpus
|
|
86
|
+
cargo test # runs the Rust binding tests
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
If you aren't changing `grammar.js`, you can generate from the checked-in
|
|
90
|
+
`src/grammar.json` with just the tree-sitter CLI (no Node needed):
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
tree-sitter generate src/grammar.json
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Releasing
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
script/bump-version 0.2.0 # syncs version across package.json, Cargo.toml, pyproject.toml
|
|
100
|
+
git add -A && git commit -m 'chore: bump version to 0.2.0'
|
|
101
|
+
git tag v0.2.0
|
|
102
|
+
git push origin master v0.2.0 # tag push triggers publish to npm, crates.io, PyPI, GitHub
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Tests
|
|
106
|
+
|
|
107
|
+
Tests are in `test/corpus/`. Reference:
|
|
108
|
+
https://tree-sitter.github.io/tree-sitter/creating-parsers#command-test
|
|
109
|
+
|
|
110
|
+
### Contributing
|
|
111
|
+
|
|
112
|
+
Pull requests welcome! The grammar is in `grammar.js`. For subtle points,
|
|
113
|
+
please leave comments — the extra bytes go a long way.
|
|
114
|
+
|
|
115
|
+
### Supporting scripts
|
|
116
|
+
|
|
117
|
+
`unicode_ranges.pl` generates unicode ranges for the C and JS sides of the
|
|
118
|
+
parser. Dependencies are in the `cpanfile`. Only needed if working on unicode
|
|
119
|
+
identifiers.
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# tree-sitter-perl
|
|
2
|
+
|
|
3
|
+
A tree-sitter grammar for Perl. Maintained at https://github.com/tree-sitter-perl/tree-sitter-perl
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
### Package managers
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# npm
|
|
11
|
+
npm install tree-sitter-perl
|
|
12
|
+
|
|
13
|
+
# cargo
|
|
14
|
+
cargo add ts-parser-perl
|
|
15
|
+
|
|
16
|
+
# pip
|
|
17
|
+
pip install tree-sitter-perl
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Neovim
|
|
21
|
+
|
|
22
|
+
A version of this parser is part of the nvim-treesitter plugin.
|
|
23
|
+
|
|
24
|
+
To use a version that has not yet made it into nvim-treesitter:
|
|
25
|
+
```lua
|
|
26
|
+
local parser_config = require "nvim-treesitter.parsers".get_parser_configs()
|
|
27
|
+
parser_config.perl = {
|
|
28
|
+
install_info = {
|
|
29
|
+
url = 'https://github.com/tree-sitter-perl/tree-sitter-perl',
|
|
30
|
+
revision = 'release',
|
|
31
|
+
files = { "src/parser.c", "src/scanner.c" },
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Then `:TSInstall perl`. Copy the queries from the `queries` directory into
|
|
37
|
+
`queries/perl` somewhere in your `runtimepath`.
|
|
38
|
+
|
|
39
|
+
### Emacs
|
|
40
|
+
|
|
41
|
+
As of Emacs 29.1, if you have the tree-sitter library installed:
|
|
42
|
+
|
|
43
|
+
```emacs-lisp
|
|
44
|
+
(setq treesit-language-source-alist
|
|
45
|
+
'((perl . ("https://github.com/tree-sitter-perl/tree-sitter-perl" "release"))))
|
|
46
|
+
(treesit-install-language-grammar 'perl)
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### From source
|
|
50
|
+
|
|
51
|
+
Pre-built files are on the `release` branch. We don't store generated files on
|
|
52
|
+
master because the 18MB `parser.c` makes branch switching painful.
|
|
53
|
+
|
|
54
|
+
## Developing
|
|
55
|
+
|
|
56
|
+
### Prerequisites
|
|
57
|
+
|
|
58
|
+
Install the [tree-sitter CLI](https://tree-sitter.github.io/tree-sitter/creating-parsers#installation).
|
|
59
|
+
Node.js v20+ is needed for `tree-sitter generate` (the grammar uses advanced
|
|
60
|
+
regex features for unicode support).
|
|
61
|
+
|
|
62
|
+
### Building
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
tree-sitter generate # generates src/parser.c from grammar.js
|
|
66
|
+
tree-sitter test # runs the test corpus
|
|
67
|
+
cargo test # runs the Rust binding tests
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
If you aren't changing `grammar.js`, you can generate from the checked-in
|
|
71
|
+
`src/grammar.json` with just the tree-sitter CLI (no Node needed):
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
tree-sitter generate src/grammar.json
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Releasing
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
script/bump-version 0.2.0 # syncs version across package.json, Cargo.toml, pyproject.toml
|
|
81
|
+
git add -A && git commit -m 'chore: bump version to 0.2.0'
|
|
82
|
+
git tag v0.2.0
|
|
83
|
+
git push origin master v0.2.0 # tag push triggers publish to npm, crates.io, PyPI, GitHub
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Tests
|
|
87
|
+
|
|
88
|
+
Tests are in `test/corpus/`. Reference:
|
|
89
|
+
https://tree-sitter.github.io/tree-sitter/creating-parsers#command-test
|
|
90
|
+
|
|
91
|
+
### Contributing
|
|
92
|
+
|
|
93
|
+
Pull requests welcome! The grammar is in `grammar.js`. For subtle points,
|
|
94
|
+
please leave comments — the extra bytes go a long way.
|
|
95
|
+
|
|
96
|
+
### Supporting scripts
|
|
97
|
+
|
|
98
|
+
`unicode_ranges.pl` generates unicode ranges for the C and JS sides of the
|
|
99
|
+
parser. Dependencies are in the `cpanfile`. Only needed if working on unicode
|
|
100
|
+
identifiers.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"""A tree-sitter parser, for Perl!"""
|
|
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 @@
|
|
|
1
|
+
def language() -> int: ...
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#include <Python.h>
|
|
2
|
+
|
|
3
|
+
typedef struct TSLanguage TSLanguage;
|
|
4
|
+
|
|
5
|
+
TSLanguage *tree_sitter_perl(void);
|
|
6
|
+
|
|
7
|
+
static PyObject* _binding_language(PyObject *self, PyObject *args) {
|
|
8
|
+
return PyLong_FromVoidPtr(tree_sitter_perl());
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
static struct PyModuleDef_Slot slots[] = {
|
|
12
|
+
#ifdef Py_GIL_DISABLED
|
|
13
|
+
{Py_mod_gil, Py_MOD_GIL_NOT_USED},
|
|
14
|
+
#endif
|
|
15
|
+
{0, NULL}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
static PyMethodDef methods[] = {
|
|
19
|
+
{"language", _binding_language, METH_NOARGS,
|
|
20
|
+
"Get the tree-sitter language for this grammar."},
|
|
21
|
+
{NULL, NULL, 0, NULL}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
static struct PyModuleDef module = {
|
|
25
|
+
.m_base = PyModuleDef_HEAD_INIT,
|
|
26
|
+
.m_name = "_binding",
|
|
27
|
+
.m_doc = NULL,
|
|
28
|
+
.m_size = 0,
|
|
29
|
+
.m_methods = methods,
|
|
30
|
+
.m_slots = slots,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
PyMODINIT_FUNC PyInit__binding(void) {
|
|
34
|
+
return PyModuleDef_Init(&module);
|
|
35
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tree-sitter-perl
|
|
3
|
+
Version: 1.0.2
|
|
4
|
+
Summary: Perl grammar for tree-sitter
|
|
5
|
+
License: MIT
|
|
6
|
+
Project-URL: Homepage, https://github.com/tree-sitter-perl/tree-sitter-perl
|
|
7
|
+
Keywords: incremental,parsing,tree-sitter,perl
|
|
8
|
+
Classifier: Intended Audience :: Developers
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Topic :: Software Development :: Compilers
|
|
11
|
+
Classifier: Topic :: Text Processing :: Linguistic
|
|
12
|
+
Classifier: Typing :: Typed
|
|
13
|
+
Requires-Python: >=3.8
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Provides-Extra: core
|
|
17
|
+
Requires-Dist: tree-sitter~=0.24; extra == "core"
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
# tree-sitter-perl
|
|
21
|
+
|
|
22
|
+
A tree-sitter grammar for Perl. Maintained at https://github.com/tree-sitter-perl/tree-sitter-perl
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
### Package managers
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# npm
|
|
30
|
+
npm install tree-sitter-perl
|
|
31
|
+
|
|
32
|
+
# cargo
|
|
33
|
+
cargo add ts-parser-perl
|
|
34
|
+
|
|
35
|
+
# pip
|
|
36
|
+
pip install tree-sitter-perl
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Neovim
|
|
40
|
+
|
|
41
|
+
A version of this parser is part of the nvim-treesitter plugin.
|
|
42
|
+
|
|
43
|
+
To use a version that has not yet made it into nvim-treesitter:
|
|
44
|
+
```lua
|
|
45
|
+
local parser_config = require "nvim-treesitter.parsers".get_parser_configs()
|
|
46
|
+
parser_config.perl = {
|
|
47
|
+
install_info = {
|
|
48
|
+
url = 'https://github.com/tree-sitter-perl/tree-sitter-perl',
|
|
49
|
+
revision = 'release',
|
|
50
|
+
files = { "src/parser.c", "src/scanner.c" },
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Then `:TSInstall perl`. Copy the queries from the `queries` directory into
|
|
56
|
+
`queries/perl` somewhere in your `runtimepath`.
|
|
57
|
+
|
|
58
|
+
### Emacs
|
|
59
|
+
|
|
60
|
+
As of Emacs 29.1, if you have the tree-sitter library installed:
|
|
61
|
+
|
|
62
|
+
```emacs-lisp
|
|
63
|
+
(setq treesit-language-source-alist
|
|
64
|
+
'((perl . ("https://github.com/tree-sitter-perl/tree-sitter-perl" "release"))))
|
|
65
|
+
(treesit-install-language-grammar 'perl)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### From source
|
|
69
|
+
|
|
70
|
+
Pre-built files are on the `release` branch. We don't store generated files on
|
|
71
|
+
master because the 18MB `parser.c` makes branch switching painful.
|
|
72
|
+
|
|
73
|
+
## Developing
|
|
74
|
+
|
|
75
|
+
### Prerequisites
|
|
76
|
+
|
|
77
|
+
Install the [tree-sitter CLI](https://tree-sitter.github.io/tree-sitter/creating-parsers#installation).
|
|
78
|
+
Node.js v20+ is needed for `tree-sitter generate` (the grammar uses advanced
|
|
79
|
+
regex features for unicode support).
|
|
80
|
+
|
|
81
|
+
### Building
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
tree-sitter generate # generates src/parser.c from grammar.js
|
|
85
|
+
tree-sitter test # runs the test corpus
|
|
86
|
+
cargo test # runs the Rust binding tests
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
If you aren't changing `grammar.js`, you can generate from the checked-in
|
|
90
|
+
`src/grammar.json` with just the tree-sitter CLI (no Node needed):
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
tree-sitter generate src/grammar.json
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Releasing
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
script/bump-version 0.2.0 # syncs version across package.json, Cargo.toml, pyproject.toml
|
|
100
|
+
git add -A && git commit -m 'chore: bump version to 0.2.0'
|
|
101
|
+
git tag v0.2.0
|
|
102
|
+
git push origin master v0.2.0 # tag push triggers publish to npm, crates.io, PyPI, GitHub
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Tests
|
|
106
|
+
|
|
107
|
+
Tests are in `test/corpus/`. Reference:
|
|
108
|
+
https://tree-sitter.github.io/tree-sitter/creating-parsers#command-test
|
|
109
|
+
|
|
110
|
+
### Contributing
|
|
111
|
+
|
|
112
|
+
Pull requests welcome! The grammar is in `grammar.js`. For subtle points,
|
|
113
|
+
please leave comments — the extra bytes go a long way.
|
|
114
|
+
|
|
115
|
+
### Supporting scripts
|
|
116
|
+
|
|
117
|
+
`unicode_ranges.pl` generates unicode ranges for the C and JS sides of the
|
|
118
|
+
parser. Dependencies are in the `cpanfile`. Only needed if working on unicode
|
|
119
|
+
identifiers.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
setup.py
|
|
5
|
+
bindings/python/tree_sitter_perl/__init__.py
|
|
6
|
+
bindings/python/tree_sitter_perl/__init__.pyi
|
|
7
|
+
bindings/python/tree_sitter_perl/binding.c
|
|
8
|
+
bindings/python/tree_sitter_perl/py.typed
|
|
9
|
+
bindings/python/tree_sitter_perl.egg-info/PKG-INFO
|
|
10
|
+
bindings/python/tree_sitter_perl.egg-info/SOURCES.txt
|
|
11
|
+
bindings/python/tree_sitter_perl.egg-info/dependency_links.txt
|
|
12
|
+
bindings/python/tree_sitter_perl.egg-info/not-zip-safe
|
|
13
|
+
bindings/python/tree_sitter_perl.egg-info/requires.txt
|
|
14
|
+
bindings/python/tree_sitter_perl.egg-info/top_level.txt
|
|
15
|
+
src/parser.c
|
|
16
|
+
src/scanner.c
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=42", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "tree-sitter-perl"
|
|
7
|
+
description = "Perl grammar for tree-sitter"
|
|
8
|
+
version = "1.0.2"
|
|
9
|
+
keywords = ["incremental", "parsing", "tree-sitter", "perl"]
|
|
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
|
+
requires-python = ">=3.8"
|
|
18
|
+
license.text = "MIT"
|
|
19
|
+
readme = "README.md"
|
|
20
|
+
|
|
21
|
+
[project.urls]
|
|
22
|
+
Homepage = "https://github.com/tree-sitter-perl/tree-sitter-perl"
|
|
23
|
+
|
|
24
|
+
[project.optional-dependencies]
|
|
25
|
+
core = ["tree-sitter~=0.24"]
|
|
26
|
+
|
|
27
|
+
[tool.cibuildwheel]
|
|
28
|
+
build = "cp310-*"
|
|
29
|
+
build-frontend = "build"
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
from os.path import isdir, join
|
|
2
|
+
from platform import system
|
|
3
|
+
from sysconfig import get_config_var
|
|
4
|
+
|
|
5
|
+
from setuptools import Extension, find_packages, setup
|
|
6
|
+
from setuptools.command.build import build
|
|
7
|
+
from wheel.bdist_wheel import bdist_wheel
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Build(build):
|
|
11
|
+
def run(self):
|
|
12
|
+
if isdir("queries"):
|
|
13
|
+
dest = join(self.build_lib, "tree_sitter_perl", "queries")
|
|
14
|
+
self.copy_tree("queries", dest)
|
|
15
|
+
super().run()
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class BdistWheel(bdist_wheel):
|
|
19
|
+
def get_tag(self):
|
|
20
|
+
python, abi, platform = super().get_tag()
|
|
21
|
+
if python.startswith("cp") and not get_config_var("Py_GIL_DISABLED"):
|
|
22
|
+
python, abi = "cp39", "abi3"
|
|
23
|
+
return python, abi, platform
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
setup(
|
|
27
|
+
packages=find_packages("bindings/python"),
|
|
28
|
+
package_dir={"": "bindings/python"},
|
|
29
|
+
package_data={
|
|
30
|
+
"tree_sitter_perl": ["*.pyi", "py.typed"],
|
|
31
|
+
"tree_sitter_perl.queries": ["*.scm"],
|
|
32
|
+
},
|
|
33
|
+
ext_package="tree_sitter_perl",
|
|
34
|
+
ext_modules=[
|
|
35
|
+
Extension(
|
|
36
|
+
name="_binding",
|
|
37
|
+
sources=[
|
|
38
|
+
"bindings/python/tree_sitter_perl/binding.c",
|
|
39
|
+
"src/parser.c",
|
|
40
|
+
"src/scanner.c",
|
|
41
|
+
],
|
|
42
|
+
extra_compile_args=(
|
|
43
|
+
["-std=c11"] if system() != 'Windows' else []
|
|
44
|
+
),
|
|
45
|
+
define_macros=[
|
|
46
|
+
("Py_LIMITED_API", "0x03080000"),
|
|
47
|
+
("PY_SSIZE_T_CLEAN", None)
|
|
48
|
+
],
|
|
49
|
+
include_dirs=["src"],
|
|
50
|
+
py_limited_api=True,
|
|
51
|
+
)
|
|
52
|
+
],
|
|
53
|
+
cmdclass={
|
|
54
|
+
"build": Build,
|
|
55
|
+
"bdist_wheel": BdistWheel
|
|
56
|
+
},
|
|
57
|
+
zip_safe=False
|
|
58
|
+
)
|