tree-sitter-cfengine 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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Ole Herman Schumacher Elgesem
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,52 @@
1
+ Metadata-Version: 2.1
2
+ Name: tree-sitter-cfengine
3
+ Version: 1.0.2
4
+ Summary: CFEngine grammar for tree-sitter
5
+ Author-email: Ole Herman Schumacher Elgesem <oleherman93@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/tree-sitter/tree-sitter-cfengine
8
+ Keywords: incremental,parsing,tree-sitter,c
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.23; extra == "core"
19
+
20
+ # Tree sitter grammar for CFEngine policy language
21
+
22
+ This tree-sitter grammar parses CFEngine policy language and turns it into an abstract syntax tree.
23
+ It is used to provide syntax highlighting in the Zed editor, via this extension:
24
+
25
+ https://github.com/olehermanse/zed-cfengine
26
+
27
+ The grammar currently supports all major features of the language, including:
28
+
29
+ - Bundle blocks
30
+ - Body blocks
31
+ - Promise type definition blocks
32
+ - Promise types, class guards, promises, stakeholders (promisees)
33
+ - Macros
34
+ - Function calls
35
+ - Lists, strings, expansions (with `$()` and `@()`)
36
+
37
+ ## Todos
38
+
39
+ - Using the grammar for linting / syntax checking (language server)
40
+ - Highlighting inside strings and comments
41
+ - Recognizing when there is JSON inside policy
42
+ - Class guards which are quoted strings
43
+ - Using the grammar for code indentation
44
+ - Using the grammar for extensions to other editors
45
+
46
+ Before contributing for the first time, it's recommended to go through the tree-sitter tutorial for getting familiar with how everything works:
47
+
48
+ https://tree-sitter.github.io/tree-sitter/creating-parsers
49
+
50
+ Inspired by Lars Erik Wik's initial implementation available here:
51
+
52
+ https://github.com/larsewi/tree-sitter-cfengine
@@ -0,0 +1,33 @@
1
+ # Tree sitter grammar for CFEngine policy language
2
+
3
+ This tree-sitter grammar parses CFEngine policy language and turns it into an abstract syntax tree.
4
+ It is used to provide syntax highlighting in the Zed editor, via this extension:
5
+
6
+ https://github.com/olehermanse/zed-cfengine
7
+
8
+ The grammar currently supports all major features of the language, including:
9
+
10
+ - Bundle blocks
11
+ - Body blocks
12
+ - Promise type definition blocks
13
+ - Promise types, class guards, promises, stakeholders (promisees)
14
+ - Macros
15
+ - Function calls
16
+ - Lists, strings, expansions (with `$()` and `@()`)
17
+
18
+ ## Todos
19
+
20
+ - Using the grammar for linting / syntax checking (language server)
21
+ - Highlighting inside strings and comments
22
+ - Recognizing when there is JSON inside policy
23
+ - Class guards which are quoted strings
24
+ - Using the grammar for code indentation
25
+ - Using the grammar for extensions to other editors
26
+
27
+ Before contributing for the first time, it's recommended to go through the tree-sitter tutorial for getting familiar with how everything works:
28
+
29
+ https://tree-sitter.github.io/tree-sitter/creating-parsers
30
+
31
+ Inspired by Lars Erik Wik's initial implementation available here:
32
+
33
+ https://github.com/larsewi/tree-sitter-cfengine
@@ -0,0 +1,5 @@
1
+ "CFEngine grammar for tree-sitter"
2
+
3
+ from ._binding import language
4
+
5
+ __all__ = ["language"]
@@ -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_cfengine(void);
6
+
7
+ static PyObject* _binding_language(PyObject *self, PyObject *args) {
8
+ return PyLong_FromVoidPtr(tree_sitter_cfengine());
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
+ }
@@ -0,0 +1,52 @@
1
+ Metadata-Version: 2.1
2
+ Name: tree-sitter-cfengine
3
+ Version: 1.0.2
4
+ Summary: CFEngine grammar for tree-sitter
5
+ Author-email: Ole Herman Schumacher Elgesem <oleherman93@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/tree-sitter/tree-sitter-cfengine
8
+ Keywords: incremental,parsing,tree-sitter,c
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.23; extra == "core"
19
+
20
+ # Tree sitter grammar for CFEngine policy language
21
+
22
+ This tree-sitter grammar parses CFEngine policy language and turns it into an abstract syntax tree.
23
+ It is used to provide syntax highlighting in the Zed editor, via this extension:
24
+
25
+ https://github.com/olehermanse/zed-cfengine
26
+
27
+ The grammar currently supports all major features of the language, including:
28
+
29
+ - Bundle blocks
30
+ - Body blocks
31
+ - Promise type definition blocks
32
+ - Promise types, class guards, promises, stakeholders (promisees)
33
+ - Macros
34
+ - Function calls
35
+ - Lists, strings, expansions (with `$()` and `@()`)
36
+
37
+ ## Todos
38
+
39
+ - Using the grammar for linting / syntax checking (language server)
40
+ - Highlighting inside strings and comments
41
+ - Recognizing when there is JSON inside policy
42
+ - Class guards which are quoted strings
43
+ - Using the grammar for code indentation
44
+ - Using the grammar for extensions to other editors
45
+
46
+ Before contributing for the first time, it's recommended to go through the tree-sitter tutorial for getting familiar with how everything works:
47
+
48
+ https://tree-sitter.github.io/tree-sitter/creating-parsers
49
+
50
+ Inspired by Lars Erik Wik's initial implementation available here:
51
+
52
+ https://github.com/larsewi/tree-sitter-cfengine
@@ -0,0 +1,15 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ setup.py
5
+ bindings/python/tree_sitter_cfengine/__init__.py
6
+ bindings/python/tree_sitter_cfengine/__init__.pyi
7
+ bindings/python/tree_sitter_cfengine/binding.c
8
+ bindings/python/tree_sitter_cfengine/py.typed
9
+ bindings/python/tree_sitter_cfengine.egg-info/PKG-INFO
10
+ bindings/python/tree_sitter_cfengine.egg-info/SOURCES.txt
11
+ bindings/python/tree_sitter_cfengine.egg-info/dependency_links.txt
12
+ bindings/python/tree_sitter_cfengine.egg-info/not-zip-safe
13
+ bindings/python/tree_sitter_cfengine.egg-info/requires.txt
14
+ bindings/python/tree_sitter_cfengine.egg-info/top_level.txt
15
+ src/parser.c
@@ -0,0 +1,2 @@
1
+ _binding
2
+ tree_sitter_cfengine
@@ -0,0 +1,32 @@
1
+ [build-system]
2
+ requires = ["setuptools>=42", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "tree-sitter-cfengine"
7
+ description = "CFEngine grammar for tree-sitter"
8
+ version = "1.0.2"
9
+ keywords = ["incremental", "parsing", "tree-sitter", "c"]
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 = "Ole Herman Schumacher Elgesem", email = "oleherman93@gmail.com" }
19
+ ]
20
+ requires-python = ">=3.9"
21
+ license.text = "MIT"
22
+ readme = "README.md"
23
+
24
+ [project.urls]
25
+ Homepage = "https://github.com/tree-sitter/tree-sitter-cfengine"
26
+
27
+ [project.optional-dependencies]
28
+ core = ["tree-sitter~=0.23"]
29
+
30
+ [tool.cibuildwheel]
31
+ build = "cp39-*"
32
+ build-frontend = "build"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -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_cfengine", "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_cfengine": ["*.pyi", "py.typed"],
30
+ "tree_sitter_cfengine.queries": ["*.scm"],
31
+ },
32
+ ext_package="tree_sitter_cfengine",
33
+ ext_modules=[
34
+ Extension(
35
+ name="_binding",
36
+ sources=[
37
+ "bindings/python/tree_sitter_cfengine/binding.c",
38
+ "src/parser.c",
39
+ # NOTE: if your language uses an external scanner, add it here.
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
+ )