tree-sitter-carve 0.1.3__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_carve-0.1.3/LICENSE +21 -0
- tree_sitter_carve-0.1.3/MANIFEST.in +10 -0
- tree_sitter_carve-0.1.3/PKG-INFO +74 -0
- tree_sitter_carve-0.1.3/README.md +55 -0
- tree_sitter_carve-0.1.3/bindings/python/tree_sitter_carve/__init__.py +5 -0
- tree_sitter_carve-0.1.3/bindings/python/tree_sitter_carve/__init__.pyi +1 -0
- tree_sitter_carve-0.1.3/bindings/python/tree_sitter_carve/binding.c +27 -0
- tree_sitter_carve-0.1.3/bindings/python/tree_sitter_carve/py.typed +0 -0
- tree_sitter_carve-0.1.3/bindings/python/tree_sitter_carve.egg-info/PKG-INFO +74 -0
- tree_sitter_carve-0.1.3/bindings/python/tree_sitter_carve.egg-info/SOURCES.txt +22 -0
- tree_sitter_carve-0.1.3/bindings/python/tree_sitter_carve.egg-info/dependency_links.txt +1 -0
- tree_sitter_carve-0.1.3/bindings/python/tree_sitter_carve.egg-info/not-zip-safe +1 -0
- tree_sitter_carve-0.1.3/bindings/python/tree_sitter_carve.egg-info/requires.txt +3 -0
- tree_sitter_carve-0.1.3/bindings/python/tree_sitter_carve.egg-info/top_level.txt +2 -0
- tree_sitter_carve-0.1.3/pyproject.toml +29 -0
- tree_sitter_carve-0.1.3/setup.cfg +4 -0
- tree_sitter_carve-0.1.3/setup.py +57 -0
- tree_sitter_carve-0.1.3/src/grammar.json +7914 -0
- tree_sitter_carve-0.1.3/src/node-types.json +4547 -0
- tree_sitter_carve-0.1.3/src/parser.c +207283 -0
- tree_sitter_carve-0.1.3/src/scanner.c +6843 -0
- tree_sitter_carve-0.1.3/src/tree_sitter/alloc.h +54 -0
- tree_sitter_carve-0.1.3/src/tree_sitter/array.h +290 -0
- tree_sitter_carve-0.1.3/src/tree_sitter/parser.h +265 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Jonas Hietala
|
|
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,10 @@
|
|
|
1
|
+
# setup.py's ext_modules names src/parser.c and src/scanner.c, and setuptools
|
|
2
|
+
# carries ext_modules SOURCES into an sdist by itself - the 0.1.3 rehearsal
|
|
3
|
+
# copied exactly those two and nothing else from src/. It does not carry
|
|
4
|
+
# HEADERS, and this extension compiles with include_dirs=["src"], so the sdist
|
|
5
|
+
# it produced was missing src/tree_sitter/parser.h, array.h and alloc.h and
|
|
6
|
+
# could not have been built by anyone who downloaded it.
|
|
7
|
+
#
|
|
8
|
+
# The npm tarball never had this problem because package.json lists "src/**" in
|
|
9
|
+
# files. Nothing granted the sdist the equivalent until now.
|
|
10
|
+
graft src
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tree-sitter-carve
|
|
3
|
+
Version: 0.1.3
|
|
4
|
+
Summary: Carve grammar for tree-sitter
|
|
5
|
+
License: MIT
|
|
6
|
+
Project-URL: Homepage, https://github.com/markup-carve/tree-sitter-carve
|
|
7
|
+
Keywords: incremental,parsing,tree-sitter,carve
|
|
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.21; extra == "core"
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
# tree-sitter-carve
|
|
21
|
+
|
|
22
|
+
Tree-sitter grammar for [Carve](https://markup-carve.github.io/carve/), a
|
|
23
|
+
post-Markdown lightweight markup language with visual mnemonics.
|
|
24
|
+
|
|
25
|
+
This grammar is built from the proven Djot Tree-sitter scanner architecture and
|
|
26
|
+
changes the public syntax to Carve:
|
|
27
|
+
|
|
28
|
+
- `/italic/`, `*bold*`, and `/*bold italic*/`
|
|
29
|
+
- `=highlight=`, plus the braced-only `{^superscript^}` and `{,subscript,}`
|
|
30
|
+
(a bare `^` or `,` is literal text)
|
|
31
|
+
- `$` + backtick math spans, and `$$` + backtick display math spans
|
|
32
|
+
- `:name[content]` inline extensions, `@mentions`, `#tags`, and `:emoji:`
|
|
33
|
+
- `%%` line comments, trailing inline `%%` comments, and `%%%` fenced comments
|
|
34
|
+
- Djot-style blocks retained where Carve keeps them: headings, lists, tables,
|
|
35
|
+
fenced code, links, images, attributes, footnotes, captions, and divs
|
|
36
|
+
|
|
37
|
+
## Development
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
git clone --recurse-submodules https://github.com/markup-carve/tree-sitter-carve
|
|
41
|
+
npm install
|
|
42
|
+
npm run generate
|
|
43
|
+
npm test
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
If you cloned without `--recurse-submodules`, fetch the shared spec corpus with
|
|
47
|
+
`git submodule update --init`.
|
|
48
|
+
|
|
49
|
+
### Shared-corpus conformance
|
|
50
|
+
|
|
51
|
+
The canonical Carve spec corpus is vendored as a git submodule at `spec/`
|
|
52
|
+
(`spec/tests/corpus/NN-slug.crv`). Two checks run it against this grammar:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
npm run test:coverage # every spec category is classified (covered or skip)
|
|
56
|
+
npm run test:conformance # every covered category parses with no ERROR/MISSING
|
|
57
|
+
npm run test:corpus # both, in order
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
`test/coverage.json` is the coverage matrix. A category is `covered` when the
|
|
61
|
+
grammar parses every one of its corpus inputs cleanly; otherwise it is listed in
|
|
62
|
+
`skip` with a reason recording the unmodeled construct. Adding a new spec
|
|
63
|
+
category (after bumping the submodule) fails `test:coverage` until it is
|
|
64
|
+
classified, which is intentional: it forces a decision rather than silently
|
|
65
|
+
dropping coverage.
|
|
66
|
+
|
|
67
|
+
## Status
|
|
68
|
+
|
|
69
|
+
Initial grammar. It is intended for editor support and structural parsing. The
|
|
70
|
+
Carve conformance corpus remains the source of truth for renderer behavior.
|
|
71
|
+
|
|
72
|
+
## License
|
|
73
|
+
|
|
74
|
+
MIT
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# tree-sitter-carve
|
|
2
|
+
|
|
3
|
+
Tree-sitter grammar for [Carve](https://markup-carve.github.io/carve/), a
|
|
4
|
+
post-Markdown lightweight markup language with visual mnemonics.
|
|
5
|
+
|
|
6
|
+
This grammar is built from the proven Djot Tree-sitter scanner architecture and
|
|
7
|
+
changes the public syntax to Carve:
|
|
8
|
+
|
|
9
|
+
- `/italic/`, `*bold*`, and `/*bold italic*/`
|
|
10
|
+
- `=highlight=`, plus the braced-only `{^superscript^}` and `{,subscript,}`
|
|
11
|
+
(a bare `^` or `,` is literal text)
|
|
12
|
+
- `$` + backtick math spans, and `$$` + backtick display math spans
|
|
13
|
+
- `:name[content]` inline extensions, `@mentions`, `#tags`, and `:emoji:`
|
|
14
|
+
- `%%` line comments, trailing inline `%%` comments, and `%%%` fenced comments
|
|
15
|
+
- Djot-style blocks retained where Carve keeps them: headings, lists, tables,
|
|
16
|
+
fenced code, links, images, attributes, footnotes, captions, and divs
|
|
17
|
+
|
|
18
|
+
## Development
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
git clone --recurse-submodules https://github.com/markup-carve/tree-sitter-carve
|
|
22
|
+
npm install
|
|
23
|
+
npm run generate
|
|
24
|
+
npm test
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
If you cloned without `--recurse-submodules`, fetch the shared spec corpus with
|
|
28
|
+
`git submodule update --init`.
|
|
29
|
+
|
|
30
|
+
### Shared-corpus conformance
|
|
31
|
+
|
|
32
|
+
The canonical Carve spec corpus is vendored as a git submodule at `spec/`
|
|
33
|
+
(`spec/tests/corpus/NN-slug.crv`). Two checks run it against this grammar:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm run test:coverage # every spec category is classified (covered or skip)
|
|
37
|
+
npm run test:conformance # every covered category parses with no ERROR/MISSING
|
|
38
|
+
npm run test:corpus # both, in order
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
`test/coverage.json` is the coverage matrix. A category is `covered` when the
|
|
42
|
+
grammar parses every one of its corpus inputs cleanly; otherwise it is listed in
|
|
43
|
+
`skip` with a reason recording the unmodeled construct. Adding a new spec
|
|
44
|
+
category (after bumping the submodule) fails `test:coverage` until it is
|
|
45
|
+
classified, which is intentional: it forces a decision rather than silently
|
|
46
|
+
dropping coverage.
|
|
47
|
+
|
|
48
|
+
## Status
|
|
49
|
+
|
|
50
|
+
Initial grammar. It is intended for editor support and structural parsing. The
|
|
51
|
+
Carve conformance corpus remains the source of truth for renderer behavior.
|
|
52
|
+
|
|
53
|
+
## License
|
|
54
|
+
|
|
55
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
def language() -> int: ...
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#include <Python.h>
|
|
2
|
+
|
|
3
|
+
typedef struct TSLanguage TSLanguage;
|
|
4
|
+
|
|
5
|
+
TSLanguage *tree_sitter_carve(void);
|
|
6
|
+
|
|
7
|
+
static PyObject* _binding_language(PyObject *self, PyObject *args) {
|
|
8
|
+
return PyLong_FromVoidPtr(tree_sitter_carve());
|
|
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,74 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tree-sitter-carve
|
|
3
|
+
Version: 0.1.3
|
|
4
|
+
Summary: Carve grammar for tree-sitter
|
|
5
|
+
License: MIT
|
|
6
|
+
Project-URL: Homepage, https://github.com/markup-carve/tree-sitter-carve
|
|
7
|
+
Keywords: incremental,parsing,tree-sitter,carve
|
|
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.21; extra == "core"
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
# tree-sitter-carve
|
|
21
|
+
|
|
22
|
+
Tree-sitter grammar for [Carve](https://markup-carve.github.io/carve/), a
|
|
23
|
+
post-Markdown lightweight markup language with visual mnemonics.
|
|
24
|
+
|
|
25
|
+
This grammar is built from the proven Djot Tree-sitter scanner architecture and
|
|
26
|
+
changes the public syntax to Carve:
|
|
27
|
+
|
|
28
|
+
- `/italic/`, `*bold*`, and `/*bold italic*/`
|
|
29
|
+
- `=highlight=`, plus the braced-only `{^superscript^}` and `{,subscript,}`
|
|
30
|
+
(a bare `^` or `,` is literal text)
|
|
31
|
+
- `$` + backtick math spans, and `$$` + backtick display math spans
|
|
32
|
+
- `:name[content]` inline extensions, `@mentions`, `#tags`, and `:emoji:`
|
|
33
|
+
- `%%` line comments, trailing inline `%%` comments, and `%%%` fenced comments
|
|
34
|
+
- Djot-style blocks retained where Carve keeps them: headings, lists, tables,
|
|
35
|
+
fenced code, links, images, attributes, footnotes, captions, and divs
|
|
36
|
+
|
|
37
|
+
## Development
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
git clone --recurse-submodules https://github.com/markup-carve/tree-sitter-carve
|
|
41
|
+
npm install
|
|
42
|
+
npm run generate
|
|
43
|
+
npm test
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
If you cloned without `--recurse-submodules`, fetch the shared spec corpus with
|
|
47
|
+
`git submodule update --init`.
|
|
48
|
+
|
|
49
|
+
### Shared-corpus conformance
|
|
50
|
+
|
|
51
|
+
The canonical Carve spec corpus is vendored as a git submodule at `spec/`
|
|
52
|
+
(`spec/tests/corpus/NN-slug.crv`). Two checks run it against this grammar:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
npm run test:coverage # every spec category is classified (covered or skip)
|
|
56
|
+
npm run test:conformance # every covered category parses with no ERROR/MISSING
|
|
57
|
+
npm run test:corpus # both, in order
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
`test/coverage.json` is the coverage matrix. A category is `covered` when the
|
|
61
|
+
grammar parses every one of its corpus inputs cleanly; otherwise it is listed in
|
|
62
|
+
`skip` with a reason recording the unmodeled construct. Adding a new spec
|
|
63
|
+
category (after bumping the submodule) fails `test:coverage` until it is
|
|
64
|
+
classified, which is intentional: it forces a decision rather than silently
|
|
65
|
+
dropping coverage.
|
|
66
|
+
|
|
67
|
+
## Status
|
|
68
|
+
|
|
69
|
+
Initial grammar. It is intended for editor support and structural parsing. The
|
|
70
|
+
Carve conformance corpus remains the source of truth for renderer behavior.
|
|
71
|
+
|
|
72
|
+
## License
|
|
73
|
+
|
|
74
|
+
MIT
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
MANIFEST.in
|
|
3
|
+
README.md
|
|
4
|
+
pyproject.toml
|
|
5
|
+
setup.py
|
|
6
|
+
bindings/python/tree_sitter_carve/__init__.py
|
|
7
|
+
bindings/python/tree_sitter_carve/__init__.pyi
|
|
8
|
+
bindings/python/tree_sitter_carve/binding.c
|
|
9
|
+
bindings/python/tree_sitter_carve/py.typed
|
|
10
|
+
bindings/python/tree_sitter_carve.egg-info/PKG-INFO
|
|
11
|
+
bindings/python/tree_sitter_carve.egg-info/SOURCES.txt
|
|
12
|
+
bindings/python/tree_sitter_carve.egg-info/dependency_links.txt
|
|
13
|
+
bindings/python/tree_sitter_carve.egg-info/not-zip-safe
|
|
14
|
+
bindings/python/tree_sitter_carve.egg-info/requires.txt
|
|
15
|
+
bindings/python/tree_sitter_carve.egg-info/top_level.txt
|
|
16
|
+
src/grammar.json
|
|
17
|
+
src/node-types.json
|
|
18
|
+
src/parser.c
|
|
19
|
+
src/scanner.c
|
|
20
|
+
src/tree_sitter/alloc.h
|
|
21
|
+
src/tree_sitter/array.h
|
|
22
|
+
src/tree_sitter/parser.h
|
|
@@ -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-carve"
|
|
7
|
+
description = "Carve grammar for tree-sitter"
|
|
8
|
+
version = "0.1.3"
|
|
9
|
+
keywords = ["incremental", "parsing", "tree-sitter", "carve"]
|
|
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/markup-carve/tree-sitter-carve"
|
|
23
|
+
|
|
24
|
+
[project.optional-dependencies]
|
|
25
|
+
core = ["tree-sitter~=0.21"]
|
|
26
|
+
|
|
27
|
+
[tool.cibuildwheel]
|
|
28
|
+
build = "cp38-*"
|
|
29
|
+
build-frontend = "build"
|
|
@@ -0,0 +1,57 @@
|
|
|
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_carve", "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 = "cp38", "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_carve": ["*.pyi", "py.typed"],
|
|
30
|
+
"tree_sitter_carve.queries": ["*.scm"],
|
|
31
|
+
},
|
|
32
|
+
ext_package="tree_sitter_carve",
|
|
33
|
+
ext_modules=[
|
|
34
|
+
Extension(
|
|
35
|
+
name="_binding",
|
|
36
|
+
sources=[
|
|
37
|
+
"bindings/python/tree_sitter_carve/binding.c",
|
|
38
|
+
"src/parser.c",
|
|
39
|
+
"src/scanner.c",
|
|
40
|
+
],
|
|
41
|
+
extra_compile_args=(
|
|
42
|
+
["-std=c11"] if system() != 'Windows' else []
|
|
43
|
+
),
|
|
44
|
+
define_macros=[
|
|
45
|
+
("Py_LIMITED_API", "0x03080000"),
|
|
46
|
+
("PY_SSIZE_T_CLEAN", None)
|
|
47
|
+
],
|
|
48
|
+
include_dirs=["src"],
|
|
49
|
+
py_limited_api=True,
|
|
50
|
+
)
|
|
51
|
+
],
|
|
52
|
+
cmdclass={
|
|
53
|
+
"build": Build,
|
|
54
|
+
"bdist_wheel": BdistWheel
|
|
55
|
+
},
|
|
56
|
+
zip_safe=False
|
|
57
|
+
)
|