tree-sitter-dockerfile-orchard 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.
Files changed (22) hide show
  1. tree_sitter_dockerfile_orchard-0.1.0/LICENSE +22 -0
  2. tree_sitter_dockerfile_orchard-0.1.0/PKG-INFO +50 -0
  3. tree_sitter_dockerfile_orchard-0.1.0/README.md +31 -0
  4. tree_sitter_dockerfile_orchard-0.1.0/bindings/python/tree_sitter_dockerfile_orchard/__init__.py +43 -0
  5. tree_sitter_dockerfile_orchard-0.1.0/bindings/python/tree_sitter_dockerfile_orchard/__init__.pyi +17 -0
  6. tree_sitter_dockerfile_orchard-0.1.0/bindings/python/tree_sitter_dockerfile_orchard/binding.c +35 -0
  7. tree_sitter_dockerfile_orchard-0.1.0/bindings/python/tree_sitter_dockerfile_orchard/py.typed +0 -0
  8. tree_sitter_dockerfile_orchard-0.1.0/bindings/python/tree_sitter_dockerfile_orchard.egg-info/PKG-INFO +50 -0
  9. tree_sitter_dockerfile_orchard-0.1.0/bindings/python/tree_sitter_dockerfile_orchard.egg-info/SOURCES.txt +15 -0
  10. tree_sitter_dockerfile_orchard-0.1.0/bindings/python/tree_sitter_dockerfile_orchard.egg-info/dependency_links.txt +1 -0
  11. tree_sitter_dockerfile_orchard-0.1.0/bindings/python/tree_sitter_dockerfile_orchard.egg-info/not-zip-safe +1 -0
  12. tree_sitter_dockerfile_orchard-0.1.0/bindings/python/tree_sitter_dockerfile_orchard.egg-info/requires.txt +3 -0
  13. tree_sitter_dockerfile_orchard-0.1.0/bindings/python/tree_sitter_dockerfile_orchard.egg-info/top_level.txt +2 -0
  14. tree_sitter_dockerfile_orchard-0.1.0/pyproject.toml +29 -0
  15. tree_sitter_dockerfile_orchard-0.1.0/queries/highlights.scm +58 -0
  16. tree_sitter_dockerfile_orchard-0.1.0/setup.cfg +4 -0
  17. tree_sitter_dockerfile_orchard-0.1.0/setup.py +78 -0
  18. tree_sitter_dockerfile_orchard-0.1.0/src/parser.c +8584 -0
  19. tree_sitter_dockerfile_orchard-0.1.0/src/scanner.c +318 -0
  20. tree_sitter_dockerfile_orchard-0.1.0/src/tree_sitter/alloc.h +54 -0
  21. tree_sitter_dockerfile_orchard-0.1.0/src/tree_sitter/array.h +336 -0
  22. tree_sitter_dockerfile_orchard-0.1.0/src/tree_sitter/parser.h +286 -0
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Camden Cheek
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.
22
+
@@ -0,0 +1,50 @@
1
+ Metadata-Version: 2.4
2
+ Name: tree-sitter-dockerfile-orchard
3
+ Version: 0.1.0
4
+ Summary: A tree-sitter module for the Dockerfile grammar
5
+ Author-email: Camden Cheek <camden@ccheek.com>
6
+ License: ISC
7
+ Project-URL: Homepage, https://codeberg.org/grammar-orchard/tree-sitter-dockerfile-orchard
8
+ Keywords: incremental,parsing,tree-sitter,dockerfile-orchard
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Topic :: Software Development :: Compilers
11
+ Classifier: Topic :: Text Processing :: Linguistic
12
+ Classifier: Typing :: Typed
13
+ Requires-Python: >=3.10
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-dockerfile-orchard
21
+
22
+ [![crates][crates]](https://crates.io/crates/tree-sitter-dockerfile-orchard)
23
+ [![pypi][pypi]](https://pypi.org/project/tree-sitter-dockerfile-orchard)
24
+ [![npm][npm]](https://www.npmjs.com/package/tree-sitter-dockerfile-orchard)
25
+
26
+ This is a tree-sitter grammar for Dockerfile.
27
+
28
+ ### Using it
29
+
30
+ You can obtain this parser in various formats:
31
+ * as an archive from [the Releases page](/grammar-orchard/tree-sitter-dockerfile-orchard/releases), which contains all the generated files (bindings, parser code)
32
+ * as a Rust crate: `cargo add tree-sitter-dockerfile-orchard`
33
+ * as a Python package: `pip install tree-sitter-dockerfile-orchard`
34
+ * as an NPM package: `npm install tree-sitter-dockerfile-orchard`
35
+
36
+ ### Contributing
37
+
38
+ Contributions are welcome, so are co-maintainers.
39
+
40
+ Unlike many grammar repositories, this one does not track generated files.
41
+ After cloning this repository, you'll need to run `tree-sitter generate` to obtain the parser.
42
+ If you want to use it via bindings, you'll also need to run `tree-sitter init`.
43
+
44
+ ### Origin
45
+
46
+ This project was forked from https://github.com/camdencheek/tree-sitter-dockerfile, to [ease the use of and collaboration on this grammar](https://codeberg.org/grammar-orchard#for-contributors).
47
+
48
+ [crates]: https://img.shields.io/crates/v/tree-sitter-dockerfile-orchard?logo=rust
49
+ [pypi]: https://img.shields.io/pypi/v/tree-sitter-dockerfile-orchard?logo=pypi&logoColor=ffd242
50
+ [npm]: https://img.shields.io/npm/v/tree-sitter-dockerfile-orchard?logo=npm
@@ -0,0 +1,31 @@
1
+ # tree-sitter-dockerfile-orchard
2
+
3
+ [![crates][crates]](https://crates.io/crates/tree-sitter-dockerfile-orchard)
4
+ [![pypi][pypi]](https://pypi.org/project/tree-sitter-dockerfile-orchard)
5
+ [![npm][npm]](https://www.npmjs.com/package/tree-sitter-dockerfile-orchard)
6
+
7
+ This is a tree-sitter grammar for Dockerfile.
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-dockerfile-orchard/releases), which contains all the generated files (bindings, parser code)
13
+ * as a Rust crate: `cargo add tree-sitter-dockerfile-orchard`
14
+ * as a Python package: `pip install tree-sitter-dockerfile-orchard`
15
+ * as an NPM package: `npm install tree-sitter-dockerfile-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/camdencheek/tree-sitter-dockerfile, 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-dockerfile-orchard?logo=rust
30
+ [pypi]: https://img.shields.io/pypi/v/tree-sitter-dockerfile-orchard?logo=pypi&logoColor=ffd242
31
+ [npm]: https://img.shields.io/npm/v/tree-sitter-dockerfile-orchard?logo=npm
@@ -0,0 +1,43 @@
1
+ """A tree-sitter module for the Dockerfile grammar"""
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_dockerfile_orchard(void);
6
+
7
+ static PyObject* _binding_language(PyObject *Py_UNUSED(self), PyObject *Py_UNUSED(args)) {
8
+ return PyCapsule_New(tree_sitter_dockerfile_orchard(), "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
+ }
@@ -0,0 +1,50 @@
1
+ Metadata-Version: 2.4
2
+ Name: tree-sitter-dockerfile-orchard
3
+ Version: 0.1.0
4
+ Summary: A tree-sitter module for the Dockerfile grammar
5
+ Author-email: Camden Cheek <camden@ccheek.com>
6
+ License: ISC
7
+ Project-URL: Homepage, https://codeberg.org/grammar-orchard/tree-sitter-dockerfile-orchard
8
+ Keywords: incremental,parsing,tree-sitter,dockerfile-orchard
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Topic :: Software Development :: Compilers
11
+ Classifier: Topic :: Text Processing :: Linguistic
12
+ Classifier: Typing :: Typed
13
+ Requires-Python: >=3.10
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-dockerfile-orchard
21
+
22
+ [![crates][crates]](https://crates.io/crates/tree-sitter-dockerfile-orchard)
23
+ [![pypi][pypi]](https://pypi.org/project/tree-sitter-dockerfile-orchard)
24
+ [![npm][npm]](https://www.npmjs.com/package/tree-sitter-dockerfile-orchard)
25
+
26
+ This is a tree-sitter grammar for Dockerfile.
27
+
28
+ ### Using it
29
+
30
+ You can obtain this parser in various formats:
31
+ * as an archive from [the Releases page](/grammar-orchard/tree-sitter-dockerfile-orchard/releases), which contains all the generated files (bindings, parser code)
32
+ * as a Rust crate: `cargo add tree-sitter-dockerfile-orchard`
33
+ * as a Python package: `pip install tree-sitter-dockerfile-orchard`
34
+ * as an NPM package: `npm install tree-sitter-dockerfile-orchard`
35
+
36
+ ### Contributing
37
+
38
+ Contributions are welcome, so are co-maintainers.
39
+
40
+ Unlike many grammar repositories, this one does not track generated files.
41
+ After cloning this repository, you'll need to run `tree-sitter generate` to obtain the parser.
42
+ If you want to use it via bindings, you'll also need to run `tree-sitter init`.
43
+
44
+ ### Origin
45
+
46
+ This project was forked from https://github.com/camdencheek/tree-sitter-dockerfile, to [ease the use of and collaboration on this grammar](https://codeberg.org/grammar-orchard#for-contributors).
47
+
48
+ [crates]: https://img.shields.io/crates/v/tree-sitter-dockerfile-orchard?logo=rust
49
+ [pypi]: https://img.shields.io/pypi/v/tree-sitter-dockerfile-orchard?logo=pypi&logoColor=ffd242
50
+ [npm]: https://img.shields.io/npm/v/tree-sitter-dockerfile-orchard?logo=npm
@@ -0,0 +1,15 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ setup.py
5
+ bindings/python/tree_sitter_dockerfile_orchard/__init__.py
6
+ bindings/python/tree_sitter_dockerfile_orchard/__init__.pyi
7
+ bindings/python/tree_sitter_dockerfile_orchard/binding.c
8
+ bindings/python/tree_sitter_dockerfile_orchard/py.typed
9
+ bindings/python/tree_sitter_dockerfile_orchard.egg-info/PKG-INFO
10
+ bindings/python/tree_sitter_dockerfile_orchard.egg-info/SOURCES.txt
11
+ bindings/python/tree_sitter_dockerfile_orchard.egg-info/dependency_links.txt
12
+ bindings/python/tree_sitter_dockerfile_orchard.egg-info/not-zip-safe
13
+ bindings/python/tree_sitter_dockerfile_orchard.egg-info/requires.txt
14
+ bindings/python/tree_sitter_dockerfile_orchard.egg-info/top_level.txt
15
+ src/parser.c
@@ -0,0 +1,29 @@
1
+ [build-system]
2
+ requires = ["setuptools>=62.4.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "tree-sitter-dockerfile-orchard"
7
+ description = "A tree-sitter module for the Dockerfile grammar"
8
+ version = "0.1.0"
9
+ keywords = ["incremental", "parsing", "tree-sitter", "dockerfile-orchard"]
10
+ classifiers = [
11
+ "Intended Audience :: Developers",
12
+ "Topic :: Software Development :: Compilers",
13
+ "Topic :: Text Processing :: Linguistic",
14
+ "Typing :: Typed",
15
+ ]
16
+ authors = [{ name = "Camden Cheek", email = "camden@ccheek.com" }]
17
+ requires-python = ">=3.10"
18
+ license.text = "ISC"
19
+ readme = "README.md"
20
+
21
+ [project.urls]
22
+ Homepage = "https://codeberg.org/grammar-orchard/tree-sitter-dockerfile-orchard"
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
+ [
2
+ "FROM"
3
+ "AS"
4
+ "RUN"
5
+ "CMD"
6
+ "LABEL"
7
+ "EXPOSE"
8
+ "ENV"
9
+ "ADD"
10
+ "COPY"
11
+ "ENTRYPOINT"
12
+ "VOLUME"
13
+ "USER"
14
+ "WORKDIR"
15
+ "ARG"
16
+ "ONBUILD"
17
+ "STOPSIGNAL"
18
+ "HEALTHCHECK"
19
+ "SHELL"
20
+ "MAINTAINER"
21
+ "CROSS_BUILD"
22
+ (heredoc_marker)
23
+ (heredoc_end)
24
+ ] @keyword
25
+
26
+ [
27
+ ":"
28
+ "@"
29
+ ] @operator
30
+
31
+ (comment) @comment
32
+
33
+
34
+ (image_spec
35
+ (image_tag
36
+ ":" @punctuation.special)
37
+ (image_digest
38
+ "@" @punctuation.special))
39
+
40
+ [
41
+ (double_quoted_string)
42
+ (single_quoted_string)
43
+ (json_string)
44
+ (heredoc_line)
45
+ ] @string
46
+
47
+ (expansion
48
+ [
49
+ "$"
50
+ "{"
51
+ "}"
52
+ ] @punctuation.special
53
+ ) @none
54
+
55
+ ((variable) @constant
56
+ (#match? @constant "^[A-Z][A-Z_0-9]*$"))
57
+
58
+
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,78 @@
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
+ from wheel.bdist_wheel import bdist_wheel
9
+
10
+
11
+ class Build(build):
12
+ def run(self):
13
+ if path.isdir("queries"):
14
+ dest = path.join(self.build_lib, "tree_sitter_dockerfile_orchard", "queries")
15
+ self.copy_tree("queries", dest)
16
+ super().run()
17
+
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
+
32
+ class BdistWheel(bdist_wheel):
33
+ def get_tag(self):
34
+ python, abi, platform = super().get_tag()
35
+ if python.startswith("cp") and not get_config_var("Py_GIL_DISABLED"):
36
+ python, abi = "cp310", "abi3"
37
+ return python, abi, platform
38
+
39
+
40
+ class EggInfo(egg_info):
41
+ def find_sources(self):
42
+ super().find_sources()
43
+ self.filelist.recursive_include("queries", "*.scm")
44
+ self.filelist.include("src/tree_sitter/*.h")
45
+ self.filelist.include("src/*.c")
46
+
47
+
48
+ setup(
49
+ packages=find_packages("bindings/python"),
50
+ package_dir={"": "bindings/python"},
51
+ package_data={
52
+ "tree_sitter_dockerfile_orchard": ["*.pyi", "py.typed"],
53
+ "tree_sitter_dockerfile_orchard.queries": ["*.scm"],
54
+ },
55
+ ext_package="tree_sitter_dockerfile_orchard",
56
+ ext_modules=[
57
+ Extension(
58
+ name="_binding",
59
+ sources=[
60
+ "bindings/python/tree_sitter_dockerfile_orchard/binding.c",
61
+ "src/parser.c",
62
+ ],
63
+ define_macros=[
64
+ ("PY_SSIZE_T_CLEAN", None),
65
+ ("TREE_SITTER_HIDE_SYMBOLS", None),
66
+ ],
67
+ include_dirs=["src"],
68
+ py_limited_api=not get_config_var("Py_GIL_DISABLED"),
69
+ )
70
+ ],
71
+ cmdclass={
72
+ "build": Build,
73
+ "build_ext": BuildExt,
74
+ "bdist_wheel": BdistWheel,
75
+ "egg_info": EggInfo,
76
+ },
77
+ zip_safe=False
78
+ )