tree-sitter-mlxtran 0.1.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_mlxtran-0.1.0/LICENSE +21 -0
- tree_sitter_mlxtran-0.1.0/PKG-INFO +82 -0
- tree_sitter_mlxtran-0.1.0/README.md +60 -0
- tree_sitter_mlxtran-0.1.0/bindings/python/tree_sitter_mlxtran/__init__.py +43 -0
- tree_sitter_mlxtran-0.1.0/bindings/python/tree_sitter_mlxtran/__init__.pyi +17 -0
- tree_sitter_mlxtran-0.1.0/bindings/python/tree_sitter_mlxtran/binding.c +35 -0
- tree_sitter_mlxtran-0.1.0/bindings/python/tree_sitter_mlxtran/py.typed +0 -0
- tree_sitter_mlxtran-0.1.0/bindings/python/tree_sitter_mlxtran.egg-info/PKG-INFO +82 -0
- tree_sitter_mlxtran-0.1.0/bindings/python/tree_sitter_mlxtran.egg-info/SOURCES.txt +15 -0
- tree_sitter_mlxtran-0.1.0/bindings/python/tree_sitter_mlxtran.egg-info/dependency_links.txt +1 -0
- tree_sitter_mlxtran-0.1.0/bindings/python/tree_sitter_mlxtran.egg-info/not-zip-safe +1 -0
- tree_sitter_mlxtran-0.1.0/bindings/python/tree_sitter_mlxtran.egg-info/requires.txt +3 -0
- tree_sitter_mlxtran-0.1.0/bindings/python/tree_sitter_mlxtran.egg-info/top_level.txt +2 -0
- tree_sitter_mlxtran-0.1.0/pyproject.toml +41 -0
- tree_sitter_mlxtran-0.1.0/queries/highlights.scm +28 -0
- tree_sitter_mlxtran-0.1.0/setup.cfg +4 -0
- tree_sitter_mlxtran-0.1.0/setup.py +82 -0
- tree_sitter_mlxtran-0.1.0/src/parser.c +9782 -0
- tree_sitter_mlxtran-0.1.0/src/scanner.c +70 -0
- tree_sitter_mlxtran-0.1.0/src/tree_sitter/alloc.h +54 -0
- tree_sitter_mlxtran-0.1.0/src/tree_sitter/array.h +336 -0
- tree_sitter_mlxtran-0.1.0/src/tree_sitter/parser.h +286 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Michael Hatherly
|
|
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,82 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tree-sitter-mlxtran
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Tree-sitter grammar for Monolix mlxtran files
|
|
5
|
+
Author-email: Michael Hatherly <michaelhatherly@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/MichaelHatherly/tree-sitter-mlxtran
|
|
8
|
+
Project-URL: Repository, https://github.com/MichaelHatherly/tree-sitter-mlxtran
|
|
9
|
+
Project-URL: Issues, https://github.com/MichaelHatherly/tree-sitter-mlxtran/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/MichaelHatherly/tree-sitter-mlxtran/blob/main/CHANGELOG.md
|
|
11
|
+
Keywords: incremental,parsing,tree-sitter,mlxtran,monolix
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Topic :: Software Development :: Compilers
|
|
14
|
+
Classifier: Topic :: Text Processing :: Linguistic
|
|
15
|
+
Classifier: Typing :: Typed
|
|
16
|
+
Requires-Python: >=3.10
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Provides-Extra: core
|
|
20
|
+
Requires-Dist: tree-sitter~=0.24; extra == "core"
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
# tree-sitter-mlxtran
|
|
24
|
+
|
|
25
|
+
[![CI][ci-badge]](https://github.com/MichaelHatherly/tree-sitter-mlxtran/actions/workflows/ci.yml)
|
|
26
|
+
|
|
27
|
+
A [tree-sitter](https://github.com/tree-sitter/tree-sitter) grammar for
|
|
28
|
+
mlxtran, the model description language used by
|
|
29
|
+
[Monolix](https://monolix.lixoft.com) and the rest of the MonolixSuite.
|
|
30
|
+
|
|
31
|
+
It parses both project files (`.mlxtran`) and the model files they reference,
|
|
32
|
+
which conventionally carry a `.txt` extension.
|
|
33
|
+
|
|
34
|
+
## What it covers
|
|
35
|
+
|
|
36
|
+
- Angle sections (`<MODEL>`) and the square sections they contain (`[LONGITUDINAL]`)
|
|
37
|
+
- `DESCRIPTION:` free text and label blocks such as `input:` or `EQUATION:`
|
|
38
|
+
- Statements: assignments, `if`/`elseif`/`else`, and task calls with keyword arguments
|
|
39
|
+
- Expressions: arithmetic and logical operators, comparisons, calls, derivatives
|
|
40
|
+
(`ddt_Ac`), brace lists with `key = value` pairs and bare hyphenated flags
|
|
41
|
+
|
|
42
|
+
## Usage
|
|
43
|
+
|
|
44
|
+
The grammar ships bindings for C, Rust, Node and Python.
|
|
45
|
+
|
|
46
|
+
```rust
|
|
47
|
+
let mut parser = tree_sitter::Parser::new();
|
|
48
|
+
parser.set_language(&tree_sitter_mlxtran::LANGUAGE.into())?;
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
pip install tree-sitter-mlxtran
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
from tree_sitter import Language, Parser, Query
|
|
57
|
+
import tree_sitter_mlxtran
|
|
58
|
+
|
|
59
|
+
parser = Parser(Language(tree_sitter_mlxtran.language()))
|
|
60
|
+
highlights = Query(Language(tree_sitter_mlxtran.language()),
|
|
61
|
+
tree_sitter_mlxtran.HIGHLIGHTS_QUERY)
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Wheels cover Linux, macOS and Windows on x86-64 and arm64 for CPython 3.10 and
|
|
65
|
+
up. Anywhere else, pip builds from the source distribution, which needs a C
|
|
66
|
+
compiler.
|
|
67
|
+
|
|
68
|
+
## Development
|
|
69
|
+
|
|
70
|
+
```sh
|
|
71
|
+
npm install # install the tree-sitter CLI and dev tooling
|
|
72
|
+
npx tree-sitter generate
|
|
73
|
+
npx tree-sitter test # run the corpus in test/corpus
|
|
74
|
+
npm run lint # check grammar.js
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
`src/parser.c` is generated and committed. CI regenerates it and fails if the
|
|
78
|
+
result differs, so run `tree-sitter generate` after every change to
|
|
79
|
+
`grammar.js`. The CLI version is pinned in both `package.json` and
|
|
80
|
+
`.github/workflows/ci.yml`; keep them in step.
|
|
81
|
+
|
|
82
|
+
[ci-badge]: https://img.shields.io/github/actions/workflow/status/MichaelHatherly/tree-sitter-mlxtran/ci.yml?logo=github&label=CI
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# tree-sitter-mlxtran
|
|
2
|
+
|
|
3
|
+
[![CI][ci-badge]](https://github.com/MichaelHatherly/tree-sitter-mlxtran/actions/workflows/ci.yml)
|
|
4
|
+
|
|
5
|
+
A [tree-sitter](https://github.com/tree-sitter/tree-sitter) grammar for
|
|
6
|
+
mlxtran, the model description language used by
|
|
7
|
+
[Monolix](https://monolix.lixoft.com) and the rest of the MonolixSuite.
|
|
8
|
+
|
|
9
|
+
It parses both project files (`.mlxtran`) and the model files they reference,
|
|
10
|
+
which conventionally carry a `.txt` extension.
|
|
11
|
+
|
|
12
|
+
## What it covers
|
|
13
|
+
|
|
14
|
+
- Angle sections (`<MODEL>`) and the square sections they contain (`[LONGITUDINAL]`)
|
|
15
|
+
- `DESCRIPTION:` free text and label blocks such as `input:` or `EQUATION:`
|
|
16
|
+
- Statements: assignments, `if`/`elseif`/`else`, and task calls with keyword arguments
|
|
17
|
+
- Expressions: arithmetic and logical operators, comparisons, calls, derivatives
|
|
18
|
+
(`ddt_Ac`), brace lists with `key = value` pairs and bare hyphenated flags
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
The grammar ships bindings for C, Rust, Node and Python.
|
|
23
|
+
|
|
24
|
+
```rust
|
|
25
|
+
let mut parser = tree_sitter::Parser::new();
|
|
26
|
+
parser.set_language(&tree_sitter_mlxtran::LANGUAGE.into())?;
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
pip install tree-sitter-mlxtran
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
from tree_sitter import Language, Parser, Query
|
|
35
|
+
import tree_sitter_mlxtran
|
|
36
|
+
|
|
37
|
+
parser = Parser(Language(tree_sitter_mlxtran.language()))
|
|
38
|
+
highlights = Query(Language(tree_sitter_mlxtran.language()),
|
|
39
|
+
tree_sitter_mlxtran.HIGHLIGHTS_QUERY)
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Wheels cover Linux, macOS and Windows on x86-64 and arm64 for CPython 3.10 and
|
|
43
|
+
up. Anywhere else, pip builds from the source distribution, which needs a C
|
|
44
|
+
compiler.
|
|
45
|
+
|
|
46
|
+
## Development
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
npm install # install the tree-sitter CLI and dev tooling
|
|
50
|
+
npx tree-sitter generate
|
|
51
|
+
npx tree-sitter test # run the corpus in test/corpus
|
|
52
|
+
npm run lint # check grammar.js
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
`src/parser.c` is generated and committed. CI regenerates it and fails if the
|
|
56
|
+
result differs, so run `tree-sitter generate` after every change to
|
|
57
|
+
`grammar.js`. The CLI version is pinned in both `package.json` and
|
|
58
|
+
`.github/workflows/ci.yml`; keep them in step.
|
|
59
|
+
|
|
60
|
+
[ci-badge]: https://img.shields.io/github/actions/workflow/status/MichaelHatherly/tree-sitter-mlxtran/ci.yml?logo=github&label=CI
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"""Tree-sitter grammar for Monolix mlxtran files"""
|
|
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."""
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#include <Python.h>
|
|
2
|
+
|
|
3
|
+
typedef struct TSLanguage TSLanguage;
|
|
4
|
+
|
|
5
|
+
TSLanguage *tree_sitter_mlxtran(void);
|
|
6
|
+
|
|
7
|
+
static PyObject* _binding_language(PyObject *Py_UNUSED(self), PyObject *Py_UNUSED(args)) {
|
|
8
|
+
return PyCapsule_New(tree_sitter_mlxtran(), "tree_sitter.Language", NULL);
|
|
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,82 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tree-sitter-mlxtran
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Tree-sitter grammar for Monolix mlxtran files
|
|
5
|
+
Author-email: Michael Hatherly <michaelhatherly@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/MichaelHatherly/tree-sitter-mlxtran
|
|
8
|
+
Project-URL: Repository, https://github.com/MichaelHatherly/tree-sitter-mlxtran
|
|
9
|
+
Project-URL: Issues, https://github.com/MichaelHatherly/tree-sitter-mlxtran/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/MichaelHatherly/tree-sitter-mlxtran/blob/main/CHANGELOG.md
|
|
11
|
+
Keywords: incremental,parsing,tree-sitter,mlxtran,monolix
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Topic :: Software Development :: Compilers
|
|
14
|
+
Classifier: Topic :: Text Processing :: Linguistic
|
|
15
|
+
Classifier: Typing :: Typed
|
|
16
|
+
Requires-Python: >=3.10
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Provides-Extra: core
|
|
20
|
+
Requires-Dist: tree-sitter~=0.24; extra == "core"
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
# tree-sitter-mlxtran
|
|
24
|
+
|
|
25
|
+
[![CI][ci-badge]](https://github.com/MichaelHatherly/tree-sitter-mlxtran/actions/workflows/ci.yml)
|
|
26
|
+
|
|
27
|
+
A [tree-sitter](https://github.com/tree-sitter/tree-sitter) grammar for
|
|
28
|
+
mlxtran, the model description language used by
|
|
29
|
+
[Monolix](https://monolix.lixoft.com) and the rest of the MonolixSuite.
|
|
30
|
+
|
|
31
|
+
It parses both project files (`.mlxtran`) and the model files they reference,
|
|
32
|
+
which conventionally carry a `.txt` extension.
|
|
33
|
+
|
|
34
|
+
## What it covers
|
|
35
|
+
|
|
36
|
+
- Angle sections (`<MODEL>`) and the square sections they contain (`[LONGITUDINAL]`)
|
|
37
|
+
- `DESCRIPTION:` free text and label blocks such as `input:` or `EQUATION:`
|
|
38
|
+
- Statements: assignments, `if`/`elseif`/`else`, and task calls with keyword arguments
|
|
39
|
+
- Expressions: arithmetic and logical operators, comparisons, calls, derivatives
|
|
40
|
+
(`ddt_Ac`), brace lists with `key = value` pairs and bare hyphenated flags
|
|
41
|
+
|
|
42
|
+
## Usage
|
|
43
|
+
|
|
44
|
+
The grammar ships bindings for C, Rust, Node and Python.
|
|
45
|
+
|
|
46
|
+
```rust
|
|
47
|
+
let mut parser = tree_sitter::Parser::new();
|
|
48
|
+
parser.set_language(&tree_sitter_mlxtran::LANGUAGE.into())?;
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
pip install tree-sitter-mlxtran
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
from tree_sitter import Language, Parser, Query
|
|
57
|
+
import tree_sitter_mlxtran
|
|
58
|
+
|
|
59
|
+
parser = Parser(Language(tree_sitter_mlxtran.language()))
|
|
60
|
+
highlights = Query(Language(tree_sitter_mlxtran.language()),
|
|
61
|
+
tree_sitter_mlxtran.HIGHLIGHTS_QUERY)
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Wheels cover Linux, macOS and Windows on x86-64 and arm64 for CPython 3.10 and
|
|
65
|
+
up. Anywhere else, pip builds from the source distribution, which needs a C
|
|
66
|
+
compiler.
|
|
67
|
+
|
|
68
|
+
## Development
|
|
69
|
+
|
|
70
|
+
```sh
|
|
71
|
+
npm install # install the tree-sitter CLI and dev tooling
|
|
72
|
+
npx tree-sitter generate
|
|
73
|
+
npx tree-sitter test # run the corpus in test/corpus
|
|
74
|
+
npm run lint # check grammar.js
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
`src/parser.c` is generated and committed. CI regenerates it and fails if the
|
|
78
|
+
result differs, so run `tree-sitter generate` after every change to
|
|
79
|
+
`grammar.js`. The CLI version is pinned in both `package.json` and
|
|
80
|
+
`.github/workflows/ci.yml`; keep them in step.
|
|
81
|
+
|
|
82
|
+
[ci-badge]: https://img.shields.io/github/actions/workflow/status/MichaelHatherly/tree-sitter-mlxtran/ci.yml?logo=github&label=CI
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
setup.py
|
|
5
|
+
bindings/python/tree_sitter_mlxtran/__init__.py
|
|
6
|
+
bindings/python/tree_sitter_mlxtran/__init__.pyi
|
|
7
|
+
bindings/python/tree_sitter_mlxtran/binding.c
|
|
8
|
+
bindings/python/tree_sitter_mlxtran/py.typed
|
|
9
|
+
bindings/python/tree_sitter_mlxtran.egg-info/PKG-INFO
|
|
10
|
+
bindings/python/tree_sitter_mlxtran.egg-info/SOURCES.txt
|
|
11
|
+
bindings/python/tree_sitter_mlxtran.egg-info/dependency_links.txt
|
|
12
|
+
bindings/python/tree_sitter_mlxtran.egg-info/not-zip-safe
|
|
13
|
+
bindings/python/tree_sitter_mlxtran.egg-info/requires.txt
|
|
14
|
+
bindings/python/tree_sitter_mlxtran.egg-info/top_level.txt
|
|
15
|
+
src/parser.c
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "tree-sitter-mlxtran"
|
|
7
|
+
description = "Tree-sitter grammar for Monolix mlxtran files"
|
|
8
|
+
version = "0.1.0"
|
|
9
|
+
keywords = ["incremental", "parsing", "tree-sitter", "mlxtran", "monolix"]
|
|
10
|
+
classifiers = [
|
|
11
|
+
"Intended Audience :: Developers",
|
|
12
|
+
"Topic :: Software Development :: Compilers",
|
|
13
|
+
"Topic :: Text Processing :: Linguistic",
|
|
14
|
+
"Typing :: Typed",
|
|
15
|
+
]
|
|
16
|
+
authors = [{ name = "Michael Hatherly", email = "michaelhatherly@gmail.com" }]
|
|
17
|
+
requires-python = ">=3.10"
|
|
18
|
+
license = "MIT"
|
|
19
|
+
license-files = ["LICENSE"]
|
|
20
|
+
readme = "README.md"
|
|
21
|
+
|
|
22
|
+
[project.urls]
|
|
23
|
+
Homepage = "https://github.com/MichaelHatherly/tree-sitter-mlxtran"
|
|
24
|
+
Repository = "https://github.com/MichaelHatherly/tree-sitter-mlxtran"
|
|
25
|
+
Issues = "https://github.com/MichaelHatherly/tree-sitter-mlxtran/issues"
|
|
26
|
+
Changelog = "https://github.com/MichaelHatherly/tree-sitter-mlxtran/blob/main/CHANGELOG.md"
|
|
27
|
+
|
|
28
|
+
[project.optional-dependencies]
|
|
29
|
+
core = ["tree-sitter~=0.24"]
|
|
30
|
+
|
|
31
|
+
[tool.cibuildwheel]
|
|
32
|
+
# cp310 builds one abi3 wheel per platform, good for 3.10 and every later
|
|
33
|
+
# CPython. Free-threaded builds cannot use the stable ABI, so 3.14t needs its
|
|
34
|
+
# own wheel.
|
|
35
|
+
build = "cp310-* cp314t-*"
|
|
36
|
+
build-frontend = "build"
|
|
37
|
+
test-requires = "tree-sitter~=0.24"
|
|
38
|
+
test-command = """\
|
|
39
|
+
python -m unittest discover -v -s {project}/bindings/python/tests -t {project}/bindings/python/tests && \
|
|
40
|
+
python -m unittest discover -v -s {project}/bindings/python/dist-tests -t {project}/bindings/python/dist-tests\
|
|
41
|
+
"""
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
; Sections and blocks
|
|
2
|
+
(section_name) @type
|
|
3
|
+
(block_name) @keyword
|
|
4
|
+
|
|
5
|
+
; Assignment and derivative targets
|
|
6
|
+
(assignment target: (identifier) @variable)
|
|
7
|
+
(derivative) @function.macro
|
|
8
|
+
|
|
9
|
+
; Calls
|
|
10
|
+
(call function: (identifier) @function.call)
|
|
11
|
+
|
|
12
|
+
; Attribute keys and bare flags
|
|
13
|
+
(pair key: (identifier) @property)
|
|
14
|
+
(flag) @attribute
|
|
15
|
+
|
|
16
|
+
; Literals
|
|
17
|
+
(number) @number
|
|
18
|
+
(string) @string
|
|
19
|
+
(comment) @comment
|
|
20
|
+
(description_text) @comment
|
|
21
|
+
|
|
22
|
+
; Operators and control keywords
|
|
23
|
+
["+" "-" "*" "/" "^" "==" "!=" "~=" "<=" ">=" "<" ">" "&&" "||" "&" "|" "!" "~" "="] @operator
|
|
24
|
+
["if" "else" "end"] @keyword.control
|
|
25
|
+
|
|
26
|
+
; Punctuation
|
|
27
|
+
["{" "}" "(" ")" "[" "]" "<" ">"] @punctuation.bracket
|
|
28
|
+
"," @punctuation.delimiter
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
from os import path
|
|
2
|
+
from sysconfig import get_config_var
|
|
3
|
+
|
|
4
|
+
from setuptools import Extension, find_packages, setup
|
|
5
|
+
from setuptools.command.build import build
|
|
6
|
+
from setuptools.command.build_ext import build_ext
|
|
7
|
+
from setuptools.command.egg_info import egg_info
|
|
8
|
+
|
|
9
|
+
try:
|
|
10
|
+
from setuptools.command.bdist_wheel import bdist_wheel
|
|
11
|
+
except ImportError:
|
|
12
|
+
from wheel.bdist_wheel import bdist_wheel
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class Build(build):
|
|
16
|
+
def run(self):
|
|
17
|
+
if path.isdir("queries"):
|
|
18
|
+
dest = path.join(self.build_lib, "tree_sitter_mlxtran", "queries")
|
|
19
|
+
self.copy_tree("queries", dest)
|
|
20
|
+
super().run()
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class BuildExt(build_ext):
|
|
24
|
+
def build_extension(self, ext: Extension):
|
|
25
|
+
if self.compiler.compiler_type != "msvc":
|
|
26
|
+
ext.extra_compile_args = ["-std=c11", "-fvisibility=hidden"]
|
|
27
|
+
else:
|
|
28
|
+
ext.extra_compile_args = ["/std:c11", "/utf-8"]
|
|
29
|
+
if path.exists("src/scanner.c"):
|
|
30
|
+
ext.sources.append("src/scanner.c")
|
|
31
|
+
if ext.py_limited_api:
|
|
32
|
+
ext.define_macros.append(("Py_LIMITED_API", "0x030A0000"))
|
|
33
|
+
super().build_extension(ext)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class BdistWheel(bdist_wheel):
|
|
37
|
+
def get_tag(self):
|
|
38
|
+
python, abi, platform = super().get_tag()
|
|
39
|
+
if python.startswith("cp") and not get_config_var("Py_GIL_DISABLED"):
|
|
40
|
+
python, abi = "cp310", "abi3"
|
|
41
|
+
return python, abi, platform
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class EggInfo(egg_info):
|
|
45
|
+
def find_sources(self):
|
|
46
|
+
super().find_sources()
|
|
47
|
+
self.filelist.recursive_include("queries", "*.scm")
|
|
48
|
+
self.filelist.include("src/tree_sitter/*.h")
|
|
49
|
+
self.filelist.include("src/*.c")
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
setup(
|
|
53
|
+
packages=find_packages("bindings/python"),
|
|
54
|
+
package_dir={"": "bindings/python"},
|
|
55
|
+
package_data={
|
|
56
|
+
"tree_sitter_mlxtran": ["*.pyi", "py.typed"],
|
|
57
|
+
"tree_sitter_mlxtran.queries": ["*.scm"],
|
|
58
|
+
},
|
|
59
|
+
ext_package="tree_sitter_mlxtran",
|
|
60
|
+
ext_modules=[
|
|
61
|
+
Extension(
|
|
62
|
+
name="_binding",
|
|
63
|
+
sources=[
|
|
64
|
+
"bindings/python/tree_sitter_mlxtran/binding.c",
|
|
65
|
+
"src/parser.c",
|
|
66
|
+
],
|
|
67
|
+
define_macros=[
|
|
68
|
+
("PY_SSIZE_T_CLEAN", None),
|
|
69
|
+
("TREE_SITTER_HIDE_SYMBOLS", None),
|
|
70
|
+
],
|
|
71
|
+
include_dirs=["src"],
|
|
72
|
+
py_limited_api=not get_config_var("Py_GIL_DISABLED"),
|
|
73
|
+
)
|
|
74
|
+
],
|
|
75
|
+
cmdclass={
|
|
76
|
+
"build": Build,
|
|
77
|
+
"build_ext": BuildExt,
|
|
78
|
+
"bdist_wheel": BdistWheel,
|
|
79
|
+
"egg_info": EggInfo,
|
|
80
|
+
},
|
|
81
|
+
zip_safe=False
|
|
82
|
+
)
|