tree-sitter-robot 1.0.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_robot-1.0.0/LICENSE +15 -0
- tree_sitter_robot-1.0.0/PKG-INFO +27 -0
- tree_sitter_robot-1.0.0/README.md +8 -0
- tree_sitter_robot-1.0.0/bindings/python/tree_sitter_robot/__init__.py +42 -0
- tree_sitter_robot-1.0.0/bindings/python/tree_sitter_robot/__init__.pyi +10 -0
- tree_sitter_robot-1.0.0/bindings/python/tree_sitter_robot/binding.c +35 -0
- tree_sitter_robot-1.0.0/bindings/python/tree_sitter_robot/py.typed +0 -0
- tree_sitter_robot-1.0.0/bindings/python/tree_sitter_robot.egg-info/PKG-INFO +27 -0
- tree_sitter_robot-1.0.0/bindings/python/tree_sitter_robot.egg-info/SOURCES.txt +15 -0
- tree_sitter_robot-1.0.0/bindings/python/tree_sitter_robot.egg-info/dependency_links.txt +1 -0
- tree_sitter_robot-1.0.0/bindings/python/tree_sitter_robot.egg-info/not-zip-safe +1 -0
- tree_sitter_robot-1.0.0/bindings/python/tree_sitter_robot.egg-info/requires.txt +3 -0
- tree_sitter_robot-1.0.0/bindings/python/tree_sitter_robot.egg-info/top_level.txt +2 -0
- tree_sitter_robot-1.0.0/pyproject.toml +29 -0
- tree_sitter_robot-1.0.0/queries/folds.scm +5 -0
- tree_sitter_robot-1.0.0/queries/highlights.scm +57 -0
- tree_sitter_robot-1.0.0/queries/indents.scm +21 -0
- tree_sitter_robot-1.0.0/setup.cfg +4 -0
- tree_sitter_robot-1.0.0/setup.py +77 -0
- tree_sitter_robot-1.0.0/src/parser.c +10892 -0
- tree_sitter_robot-1.0.0/src/tree_sitter/alloc.h +54 -0
- tree_sitter_robot-1.0.0/src/tree_sitter/array.h +291 -0
- tree_sitter_robot-1.0.0/src/tree_sitter/parser.h +287 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Tomas Sandven
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
10
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
11
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
12
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
13
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
14
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tree-sitter-robot
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Tree-sitter parser for Robot Framework files
|
|
5
|
+
Author: Tomas Sandven
|
|
6
|
+
License: ISC
|
|
7
|
+
Project-URL: Homepage, https://github.com/hubro/tree-sitter-robot
|
|
8
|
+
Keywords: incremental,parsing,tree-sitter,robot
|
|
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
|
+
|
|
21
|
+
[](https://github.com/Hubro/tree-sitter-robot/actions/workflows/test.yaml)
|
|
22
|
+
|
|
23
|
+
# tree-sitter-robot
|
|
24
|
+
|
|
25
|
+
Tree-sitter parser for Robot Framework files.
|
|
26
|
+
|
|
27
|
+
Includes queries for syntax highlighting, indentation and folding.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
|
|
2
|
+
[](https://github.com/Hubro/tree-sitter-robot/actions/workflows/test.yaml)
|
|
3
|
+
|
|
4
|
+
# tree-sitter-robot
|
|
5
|
+
|
|
6
|
+
Tree-sitter parser for Robot Framework files.
|
|
7
|
+
|
|
8
|
+
Includes queries for syntax highlighting, indentation and folding.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"""Tree-sitter parser for Robot Framework 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
|
+
query = _files(f"{__package__}.queries") / file
|
|
10
|
+
globals()[name] = query.read_text()
|
|
11
|
+
return globals()[name]
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def __getattr__(name):
|
|
15
|
+
# NOTE: uncomment these to include any queries that this grammar contains:
|
|
16
|
+
|
|
17
|
+
# if name == "HIGHLIGHTS_QUERY":
|
|
18
|
+
# return _get_query("HIGHLIGHTS_QUERY", "highlights.scm")
|
|
19
|
+
# if name == "INJECTIONS_QUERY":
|
|
20
|
+
# return _get_query("INJECTIONS_QUERY", "injections.scm")
|
|
21
|
+
# if name == "LOCALS_QUERY":
|
|
22
|
+
# return _get_query("LOCALS_QUERY", "locals.scm")
|
|
23
|
+
# if name == "TAGS_QUERY":
|
|
24
|
+
# return _get_query("TAGS_QUERY", "tags.scm")
|
|
25
|
+
|
|
26
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
__all__ = [
|
|
30
|
+
"language",
|
|
31
|
+
# "HIGHLIGHTS_QUERY",
|
|
32
|
+
# "INJECTIONS_QUERY",
|
|
33
|
+
# "LOCALS_QUERY",
|
|
34
|
+
# "TAGS_QUERY",
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def __dir__():
|
|
39
|
+
return sorted(__all__ + [
|
|
40
|
+
"__all__", "__builtins__", "__cached__", "__doc__", "__file__",
|
|
41
|
+
"__loader__", "__name__", "__package__", "__path__", "__spec__",
|
|
42
|
+
])
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
from typing import Final
|
|
2
|
+
|
|
3
|
+
# NOTE: uncomment these to include any queries that this grammar contains:
|
|
4
|
+
|
|
5
|
+
# HIGHLIGHTS_QUERY: Final[str]
|
|
6
|
+
# INJECTIONS_QUERY: Final[str]
|
|
7
|
+
# LOCALS_QUERY: Final[str]
|
|
8
|
+
# TAGS_QUERY: Final[str]
|
|
9
|
+
|
|
10
|
+
def language() -> object: ...
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#include <Python.h>
|
|
2
|
+
|
|
3
|
+
typedef struct TSLanguage TSLanguage;
|
|
4
|
+
|
|
5
|
+
TSLanguage *tree_sitter_robot(void);
|
|
6
|
+
|
|
7
|
+
static PyObject* _binding_language(PyObject *Py_UNUSED(self), PyObject *Py_UNUSED(args)) {
|
|
8
|
+
return PyCapsule_New(tree_sitter_robot(), "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,27 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tree-sitter-robot
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Tree-sitter parser for Robot Framework files
|
|
5
|
+
Author: Tomas Sandven
|
|
6
|
+
License: ISC
|
|
7
|
+
Project-URL: Homepage, https://github.com/hubro/tree-sitter-robot
|
|
8
|
+
Keywords: incremental,parsing,tree-sitter,robot
|
|
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
|
+
|
|
21
|
+
[](https://github.com/Hubro/tree-sitter-robot/actions/workflows/test.yaml)
|
|
22
|
+
|
|
23
|
+
# tree-sitter-robot
|
|
24
|
+
|
|
25
|
+
Tree-sitter parser for Robot Framework files.
|
|
26
|
+
|
|
27
|
+
Includes queries for syntax highlighting, indentation and folding.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
setup.py
|
|
5
|
+
bindings/python/tree_sitter_robot/__init__.py
|
|
6
|
+
bindings/python/tree_sitter_robot/__init__.pyi
|
|
7
|
+
bindings/python/tree_sitter_robot/binding.c
|
|
8
|
+
bindings/python/tree_sitter_robot/py.typed
|
|
9
|
+
bindings/python/tree_sitter_robot.egg-info/PKG-INFO
|
|
10
|
+
bindings/python/tree_sitter_robot.egg-info/SOURCES.txt
|
|
11
|
+
bindings/python/tree_sitter_robot.egg-info/dependency_links.txt
|
|
12
|
+
bindings/python/tree_sitter_robot.egg-info/not-zip-safe
|
|
13
|
+
bindings/python/tree_sitter_robot.egg-info/requires.txt
|
|
14
|
+
bindings/python/tree_sitter_robot.egg-info/top_level.txt
|
|
15
|
+
src/parser.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-robot"
|
|
7
|
+
description = "Tree-sitter parser for Robot Framework files"
|
|
8
|
+
version = "1.0.0"
|
|
9
|
+
keywords = ["incremental", "parsing", "tree-sitter", "robot"]
|
|
10
|
+
classifiers = [
|
|
11
|
+
"Intended Audience :: Developers",
|
|
12
|
+
"Topic :: Software Development :: Compilers",
|
|
13
|
+
"Topic :: Text Processing :: Linguistic",
|
|
14
|
+
"Typing :: Typed",
|
|
15
|
+
]
|
|
16
|
+
authors = [{ name = "Tomas Sandven" }]
|
|
17
|
+
requires-python = ">=3.10"
|
|
18
|
+
license.text = "ISC"
|
|
19
|
+
readme = "README.md"
|
|
20
|
+
|
|
21
|
+
[project.urls]
|
|
22
|
+
Homepage = "https://github.com/hubro/tree-sitter-robot"
|
|
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,57 @@
|
|
|
1
|
+
[
|
|
2
|
+
(comment)
|
|
3
|
+
(extra_text)
|
|
4
|
+
] @comment
|
|
5
|
+
|
|
6
|
+
[
|
|
7
|
+
(section_header)
|
|
8
|
+
(setting_statement)
|
|
9
|
+
(keyword_setting)
|
|
10
|
+
(test_case_setting)
|
|
11
|
+
] @keyword
|
|
12
|
+
|
|
13
|
+
(variable_definition (variable_name) @variable)
|
|
14
|
+
(keyword_definition (name) @function)
|
|
15
|
+
(test_case_definition (name) @function)
|
|
16
|
+
|
|
17
|
+
(keyword_invocation (keyword) @function.call)
|
|
18
|
+
(ellipses) @punctuation.delimiter
|
|
19
|
+
|
|
20
|
+
(text_chunk) @string
|
|
21
|
+
(inline_python_expression) @string.special
|
|
22
|
+
[
|
|
23
|
+
(scalar_variable)
|
|
24
|
+
(list_variable)
|
|
25
|
+
(dictionary_variable)
|
|
26
|
+
] @variable
|
|
27
|
+
|
|
28
|
+
; Control structures
|
|
29
|
+
|
|
30
|
+
[
|
|
31
|
+
"FOR"
|
|
32
|
+
"IN"
|
|
33
|
+
"IN RANGE"
|
|
34
|
+
"IN ENUMERATE"
|
|
35
|
+
"IN ZIP"
|
|
36
|
+
(break_statement)
|
|
37
|
+
(continue_statement)
|
|
38
|
+
] @repeat
|
|
39
|
+
(for_statement "END" @repeat)
|
|
40
|
+
|
|
41
|
+
"WHILE" @repeat
|
|
42
|
+
(while_statement "END" @repeat)
|
|
43
|
+
|
|
44
|
+
[
|
|
45
|
+
"IF"
|
|
46
|
+
"ELSE IF"
|
|
47
|
+
] @conditional
|
|
48
|
+
(if_statement "END" @conditional)
|
|
49
|
+
(if_statement (else_statement "ELSE" @conditional))
|
|
50
|
+
|
|
51
|
+
[
|
|
52
|
+
"TRY"
|
|
53
|
+
"EXCEPT"
|
|
54
|
+
"FINALLY"
|
|
55
|
+
] @exception
|
|
56
|
+
(try_statement "END" @exception)
|
|
57
|
+
(try_statement (else_statement "ELSE" @exception))
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
(keyword_definition) @indent.begin
|
|
2
|
+
(test_case_definition) @indent.begin
|
|
3
|
+
|
|
4
|
+
(for_statement) @indent.begin
|
|
5
|
+
(for_statement "END" @indent.branch)
|
|
6
|
+
(for_statement
|
|
7
|
+
right: (_ (arguments (continuation (ellipses) @indent.branch))))
|
|
8
|
+
|
|
9
|
+
(while_statement) @indent.begin
|
|
10
|
+
(while_statement "END" @indent.branch)
|
|
11
|
+
|
|
12
|
+
(if_statement) @indent.begin
|
|
13
|
+
(if_statement (elseif_statement) @indent.branch)
|
|
14
|
+
(if_statement (else_statement) @indent.branch)
|
|
15
|
+
(if_statement "END" @indent.branch)
|
|
16
|
+
|
|
17
|
+
(try_statement) @indent.begin
|
|
18
|
+
(try_statement (except_statement) @indent.branch)
|
|
19
|
+
(try_statement (finally_statement) @indent.branch)
|
|
20
|
+
(try_statement (else_statement) @indent.branch)
|
|
21
|
+
(try_statement "END" @indent.branch)
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
from os import path
|
|
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 setuptools.command.egg_info import egg_info
|
|
8
|
+
from wheel.bdist_wheel import bdist_wheel
|
|
9
|
+
|
|
10
|
+
sources = [
|
|
11
|
+
"bindings/python/tree_sitter_robot/binding.c",
|
|
12
|
+
"src/parser.c",
|
|
13
|
+
]
|
|
14
|
+
if path.exists("src/scanner.c"):
|
|
15
|
+
sources.append("src/scanner.c")
|
|
16
|
+
|
|
17
|
+
macros: list[tuple[str, str | None]] = [
|
|
18
|
+
("PY_SSIZE_T_CLEAN", None),
|
|
19
|
+
("TREE_SITTER_HIDE_SYMBOLS", None),
|
|
20
|
+
]
|
|
21
|
+
if limited_api := not get_config_var("Py_GIL_DISABLED"):
|
|
22
|
+
macros.append(("Py_LIMITED_API", "0x030A0000"))
|
|
23
|
+
|
|
24
|
+
if system() != "Windows":
|
|
25
|
+
cflags = ["-std=c11", "-fvisibility=hidden"]
|
|
26
|
+
else:
|
|
27
|
+
cflags = ["/std:c11", "/utf-8"]
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class Build(build):
|
|
31
|
+
def run(self):
|
|
32
|
+
if path.isdir("queries"):
|
|
33
|
+
dest = path.join(self.build_lib, "tree_sitter_robot", "queries")
|
|
34
|
+
self.copy_tree("queries", dest)
|
|
35
|
+
super().run()
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class BdistWheel(bdist_wheel):
|
|
39
|
+
def get_tag(self):
|
|
40
|
+
python, abi, platform = super().get_tag()
|
|
41
|
+
if python.startswith("cp"):
|
|
42
|
+
python, abi = "cp310", "abi3"
|
|
43
|
+
return python, abi, platform
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class EggInfo(egg_info):
|
|
47
|
+
def find_sources(self):
|
|
48
|
+
super().find_sources()
|
|
49
|
+
self.filelist.recursive_include("queries", "*.scm")
|
|
50
|
+
self.filelist.include("src/tree_sitter/*.h")
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
setup(
|
|
54
|
+
packages=find_packages("bindings/python"),
|
|
55
|
+
package_dir={"": "bindings/python"},
|
|
56
|
+
package_data={
|
|
57
|
+
"tree_sitter_robot": ["*.pyi", "py.typed"],
|
|
58
|
+
"tree_sitter_robot.queries": ["*.scm"],
|
|
59
|
+
},
|
|
60
|
+
ext_package="tree_sitter_robot",
|
|
61
|
+
ext_modules=[
|
|
62
|
+
Extension(
|
|
63
|
+
name="_binding",
|
|
64
|
+
sources=sources,
|
|
65
|
+
extra_compile_args=cflags,
|
|
66
|
+
define_macros=macros,
|
|
67
|
+
include_dirs=["src"],
|
|
68
|
+
py_limited_api=limited_api,
|
|
69
|
+
)
|
|
70
|
+
],
|
|
71
|
+
cmdclass={
|
|
72
|
+
"build": Build,
|
|
73
|
+
"bdist_wheel": BdistWheel,
|
|
74
|
+
"egg_info": EggInfo,
|
|
75
|
+
},
|
|
76
|
+
zip_safe=False
|
|
77
|
+
)
|