tree-sitter-dm 0.25.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 (28) hide show
  1. tree_sitter_dm-0.25.0/LICENSE +21 -0
  2. tree_sitter_dm-0.25.0/PKG-INFO +32 -0
  3. tree_sitter_dm-0.25.0/README.md +13 -0
  4. tree_sitter_dm-0.25.0/bindings/python/tree_sitter_dm/__init__.py +42 -0
  5. tree_sitter_dm-0.25.0/bindings/python/tree_sitter_dm/__init__.pyi +10 -0
  6. tree_sitter_dm-0.25.0/bindings/python/tree_sitter_dm/binding.c +35 -0
  7. tree_sitter_dm-0.25.0/bindings/python/tree_sitter_dm/py.typed +0 -0
  8. tree_sitter_dm-0.25.0/bindings/python/tree_sitter_dm.egg-info/PKG-INFO +32 -0
  9. tree_sitter_dm-0.25.0/bindings/python/tree_sitter_dm.egg-info/SOURCES.txt +22 -0
  10. tree_sitter_dm-0.25.0/bindings/python/tree_sitter_dm.egg-info/dependency_links.txt +1 -0
  11. tree_sitter_dm-0.25.0/bindings/python/tree_sitter_dm.egg-info/not-zip-safe +1 -0
  12. tree_sitter_dm-0.25.0/bindings/python/tree_sitter_dm.egg-info/requires.txt +3 -0
  13. tree_sitter_dm-0.25.0/bindings/python/tree_sitter_dm.egg-info/top_level.txt +2 -0
  14. tree_sitter_dm-0.25.0/pyproject.toml +29 -0
  15. tree_sitter_dm-0.25.0/queries/highlights.scm +147 -0
  16. tree_sitter_dm-0.25.0/queries/neovim/highlights.scm +205 -0
  17. tree_sitter_dm-0.25.0/queries/neovim/injections.scm +12 -0
  18. tree_sitter_dm-0.25.0/queries/neovim/tags.scm +7 -0
  19. tree_sitter_dm-0.25.0/queries/tags.scm +7 -0
  20. tree_sitter_dm-0.25.0/queries/vscode/highlights.scm +205 -0
  21. tree_sitter_dm-0.25.0/queries/vscode/injections.scm +12 -0
  22. tree_sitter_dm-0.25.0/queries/vscode/tags.scm +7 -0
  23. tree_sitter_dm-0.25.0/setup.cfg +4 -0
  24. tree_sitter_dm-0.25.0/setup.py +77 -0
  25. tree_sitter_dm-0.25.0/src/parser.c +111221 -0
  26. tree_sitter_dm-0.25.0/src/tree_sitter/alloc.h +54 -0
  27. tree_sitter_dm-0.25.0/src/tree_sitter/array.h +330 -0
  28. tree_sitter_dm-0.25.0/src/tree_sitter/parser.h +286 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 FeudeyTF
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,32 @@
1
+ Metadata-Version: 2.4
2
+ Name: tree-sitter-dm
3
+ Version: 0.25.0
4
+ Summary: DreamMaker grammar
5
+ Author-email: FeudeyTF <yanmordanenko089@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/feudeytf/tree-sitter-dm
8
+ Keywords: incremental,parsing,tree-sitter,dm
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-dm
21
+
22
+ [![discord][discord]](https://discord.gg/Vh8TJp9)
23
+
24
+ DreamMaker grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter).
25
+
26
+ # References
27
+ - [DM Reference](https://www.byond.com/docs/ref/#/DM)
28
+
29
+ # Status
30
+ Project is currently WIP. The parser was tested on the source code of the Space Station 13 codebases.
31
+
32
+ [discord]: https://img.shields.io/discord/484170914754330625?logo=discord&label=discord
@@ -0,0 +1,13 @@
1
+ # tree-sitter-dm
2
+
3
+ [![discord][discord]](https://discord.gg/Vh8TJp9)
4
+
5
+ DreamMaker grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter).
6
+
7
+ # References
8
+ - [DM Reference](https://www.byond.com/docs/ref/#/DM)
9
+
10
+ # Status
11
+ Project is currently WIP. The parser was tested on the source code of the Space Station 13 codebases.
12
+
13
+ [discord]: https://img.shields.io/discord/484170914754330625?logo=discord&label=discord
@@ -0,0 +1,42 @@
1
+ """DreamMaker 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
+ 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_dm(void);
6
+
7
+ static PyObject* _binding_language(PyObject *Py_UNUSED(self), PyObject *Py_UNUSED(args)) {
8
+ return PyCapsule_New(tree_sitter_dm(), "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,32 @@
1
+ Metadata-Version: 2.4
2
+ Name: tree-sitter-dm
3
+ Version: 0.25.0
4
+ Summary: DreamMaker grammar
5
+ Author-email: FeudeyTF <yanmordanenko089@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/feudeytf/tree-sitter-dm
8
+ Keywords: incremental,parsing,tree-sitter,dm
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-dm
21
+
22
+ [![discord][discord]](https://discord.gg/Vh8TJp9)
23
+
24
+ DreamMaker grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter).
25
+
26
+ # References
27
+ - [DM Reference](https://www.byond.com/docs/ref/#/DM)
28
+
29
+ # Status
30
+ Project is currently WIP. The parser was tested on the source code of the Space Station 13 codebases.
31
+
32
+ [discord]: https://img.shields.io/discord/484170914754330625?logo=discord&label=discord
@@ -0,0 +1,22 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ setup.py
5
+ bindings/python/tree_sitter_dm/binding.c
6
+ bindings/python/tree_sitter_dm.egg-info/PKG-INFO
7
+ bindings/python/tree_sitter_dm.egg-info/SOURCES.txt
8
+ bindings/python/tree_sitter_dm.egg-info/dependency_links.txt
9
+ bindings/python/tree_sitter_dm.egg-info/not-zip-safe
10
+ bindings/python/tree_sitter_dm.egg-info/requires.txt
11
+ bindings/python/tree_sitter_dm.egg-info/top_level.txt
12
+ bindings/python/tree_sitter_dm/__init__.py
13
+ bindings/python/tree_sitter_dm/__init__.pyi
14
+ bindings/python/tree_sitter_dm/binding.c
15
+ bindings/python/tree_sitter_dm/py.typed
16
+ bindings/python/tree_sitter_dm.egg-info/PKG-INFO
17
+ bindings/python/tree_sitter_dm.egg-info/SOURCES.txt
18
+ bindings/python/tree_sitter_dm.egg-info/dependency_links.txt
19
+ bindings/python/tree_sitter_dm.egg-info/not-zip-safe
20
+ bindings/python/tree_sitter_dm.egg-info/requires.txt
21
+ bindings/python/tree_sitter_dm.egg-info/top_level.txt
22
+ src/parser.c
@@ -0,0 +1,3 @@
1
+
2
+ [core]
3
+ tree-sitter~=0.24
@@ -0,0 +1,2 @@
1
+ _binding
2
+ tree_sitter_dm
@@ -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-dm"
7
+ description = "DreamMaker grammar"
8
+ version = "0.25.0"
9
+ keywords = ["incremental", "parsing", "tree-sitter", "dm"]
10
+ classifiers = [
11
+ "Intended Audience :: Developers",
12
+ "Topic :: Software Development :: Compilers",
13
+ "Topic :: Text Processing :: Linguistic",
14
+ "Typing :: Typed",
15
+ ]
16
+ authors = [{ name = "FeudeyTF", email = "yanmordanenko089@gmail.com" }]
17
+ requires-python = ">=3.10"
18
+ license.text = "MIT"
19
+ readme = "README.md"
20
+
21
+ [project.urls]
22
+ Homepage = "https://github.com/feudeytf/tree-sitter-dm"
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,147 @@
1
+ (comment) @comment
2
+ (identifier) @variable
3
+ ((identifier) @constant
4
+ (#match? @constant "^[A-Z][A-Z\\d_]*$"))
5
+
6
+ (pair
7
+ key: (expression (literal (identifier) @member)))
8
+
9
+ "break" @keyword
10
+ "continue" @keyword
11
+ "else" @keyword
12
+ "for" @keyword
13
+ "if" @keyword
14
+ "goto" @keyword
15
+ "in" @keyword
16
+ "return" @keyword
17
+ "static" @keyword
18
+ "switch" @keyword
19
+ "while" @keyword
20
+ "do" @keyword
21
+ "set" @keyword
22
+
23
+ "#define" @keyword
24
+ "#undef" @keyword
25
+ "#elif" @keyword
26
+ "#else" @keyword
27
+ "#endif" @keyword
28
+ "#if" @keyword
29
+ "#ifdef" @keyword
30
+ "#ifndef" @keyword
31
+ "#include" @keyword
32
+ "#warn" @keyword
33
+ "#error" @keyword
34
+ "spawn" @keyword
35
+
36
+ "new" @keyword
37
+
38
+ (preproc_message) @string
39
+
40
+ (preproc_ifdef
41
+ name: (identifier) @keyword)
42
+
43
+ (preproc_def
44
+ name: (identifier) @keyword)
45
+
46
+ (preproc_undef
47
+ name: (identifier) @keyword)
48
+
49
+ (preproc_defproc
50
+ name: (identifier) @keyword)
51
+
52
+ (preproc_call_expression
53
+ directive: (identifier) @function.special)
54
+
55
+ (interpolation
56
+ "[" @punctuation.special
57
+ "]" @punctuation.special) @embedded
58
+
59
+ [
60
+ "="
61
+ "-"
62
+ "*"
63
+ "/"
64
+ "+"
65
+ "%"
66
+ "%%"
67
+ "|"
68
+ "&"
69
+ "^"
70
+ "<<"
71
+ ">>"
72
+ "<"
73
+ "<="
74
+ ">="
75
+ ">"
76
+ "=="
77
+ "<>"
78
+ "~="
79
+ "~!"
80
+ ":="
81
+ "!="
82
+ "!"
83
+ "&&"
84
+ "||"
85
+ "-="
86
+ "+="
87
+ "*="
88
+ "/="
89
+ "%="
90
+ "|="
91
+ "&="
92
+ "^="
93
+ ">>="
94
+ "<<="
95
+ "--"
96
+ "++"
97
+ "&&="
98
+ "||="
99
+ "%%="
100
+ ] @operator
101
+
102
+ "?." @delimiter
103
+ "." @delimiter
104
+
105
+ [
106
+ (string_start)
107
+ (string_content)
108
+ (string_end)
109
+ ] @string
110
+
111
+ (file_literal) @string
112
+ (null) @keyword
113
+ (number_literal) @number
114
+ (builtin_const) @keyword
115
+ (builtin_macro) @keyword
116
+
117
+
118
+ (primitive_type
119
+ (identifier) @type)
120
+
121
+ (primitive_type) @type
122
+ (var_keyword) @keyword
123
+ (proc_keyword) @keyword
124
+
125
+ (var_definition
126
+ name: (identifier) @variable)
127
+
128
+ (proc_definition
129
+ name: (identifier) @function)
130
+
131
+ (proc_override
132
+ name: (identifier) @function)
133
+
134
+ (proc_parameter
135
+ name: (identifier) @variable)
136
+
137
+ (call_expression
138
+ name: (identifier) @function)
139
+
140
+ (field_proc_expression
141
+ proc: (identifier) @function)
142
+
143
+ (field_expression
144
+ field: (identifier) @property)
145
+
146
+ +(type_proc_override
147
+ + name: (identifier) @function)
@@ -0,0 +1,205 @@
1
+ (comment) @comment @spell
2
+ (identifier) @variable
3
+ ((identifier) @constant
4
+ (#match? @constant "^[A-Z][A-Z\\d_]*$"))
5
+
6
+ (pair
7
+ key: (expression (literal (identifier) @member)))
8
+
9
+ [
10
+ "while"
11
+ "for"
12
+ "in"
13
+ "step"
14
+ "continue"
15
+ "break"
16
+ "goto"
17
+ "do"
18
+ ] @keyword.repeat
19
+
20
+ [
21
+ "if"
22
+ "else"
23
+ "switch"
24
+ "to"
25
+ "as"
26
+ ] @keyword.conditional
27
+
28
+ [
29
+ "try"
30
+ "catch"
31
+ ] @keyword.exception
32
+
33
+ [
34
+ "#if"
35
+ "#ifdef"
36
+ "#ifndef"
37
+ "#else"
38
+ "#elif"
39
+ "#endif"
40
+ "#error"
41
+ "#warn"
42
+ "#pragma"
43
+ ] @keyword.directive
44
+
45
+ [
46
+ "#define"
47
+ "#undef"
48
+ ] @keyword.directive.define
49
+
50
+ "#include" @keyword.import
51
+
52
+ "..." @punctuation.special
53
+
54
+ [
55
+ "("
56
+ ")"
57
+ "["
58
+ "]"
59
+ "{"
60
+ "}"
61
+ ] @punctuation.bracket
62
+
63
+ [
64
+ "="
65
+ "-"
66
+ "*"
67
+ "/"
68
+ "+"
69
+ "%"
70
+ "%%"
71
+ "|"
72
+ "&"
73
+ "^"
74
+ "<<"
75
+ ">>"
76
+ "<"
77
+ "<="
78
+ ">="
79
+ ">"
80
+ "=="
81
+ "<>"
82
+ "~="
83
+ "~!"
84
+ ":="
85
+ "!="
86
+ "!"
87
+ "&&"
88
+ "||"
89
+ "-="
90
+ "+="
91
+ "*="
92
+ "/="
93
+ "%="
94
+ "|="
95
+ "&="
96
+ "^="
97
+ ">>="
98
+ "<<="
99
+ "--"
100
+ "++"
101
+ "&&="
102
+ "||="
103
+ "%%="
104
+ ] @operator
105
+
106
+ [
107
+ "TRUE"
108
+ "FALSE"
109
+ ] @boolean
110
+
111
+ (conditional_expression
112
+ [
113
+ "?"
114
+ ":"
115
+ ] @keyword.conditional.ternary)
116
+
117
+ (type_operator) @punctuation.delimiter
118
+
119
+ "return" @keyword.return
120
+ [
121
+ "static"
122
+ "global"
123
+ "final"
124
+ "const"
125
+ "tmp"
126
+ ] @keyword
127
+
128
+ "new" @keyword
129
+
130
+ (preproc_message) @string
131
+
132
+ (preproc_ifdef
133
+ name: (identifier) @keyword)
134
+
135
+ (preproc_def
136
+ name: (identifier) @keyword)
137
+
138
+ (preproc_undef
139
+ name: (identifier) @keyword)
140
+
141
+ (preproc_defproc
142
+ name: (identifier) @keyword)
143
+
144
+ (preproc_call_expression
145
+ directive: (identifier) @keyword)
146
+
147
+ [
148
+ "?."
149
+ "."
150
+ ] @delimiter
151
+
152
+ (interpolation
153
+ "[" @punctuation.special
154
+ "]" @punctuation.special) @embedded
155
+ [
156
+ (string_literal)
157
+ (file_literal)
158
+ ] @string
159
+ (escape_sequence) @string.escape
160
+
161
+ (null) @keyword
162
+ (number_literal) @number
163
+ (builtin_const) @keyword
164
+ (builtin_macro) @keyword
165
+
166
+ (primitive_type
167
+ (identifier) @type)
168
+
169
+ (primitive_type) @type
170
+
171
+ (var_keyword) @keyword
172
+ (proc_keyword) @keyword
173
+ "set" @keyword
174
+
175
+ (var_definition
176
+ name: (identifier) @variable)
177
+
178
+ "spawn" @function
179
+
180
+ (proc_definition
181
+ name: (identifier) @function)
182
+
183
+ (type_proc_definition
184
+ name: (identifier) @function)
185
+
186
+ (type_proc_override
187
+ name: (identifier) @function)
188
+
189
+ (proc_override
190
+ name: (identifier) @function)
191
+
192
+ (proc_parameter
193
+ name: (identifier) @variable)
194
+
195
+ (call_expression
196
+ name: (identifier) @function.call)
197
+
198
+ (field_proc_expression
199
+ proc: (identifier) @function.call)
200
+
201
+ (field_expression
202
+ field: (identifier) @property)
203
+
204
+ (as_type) @keyword
205
+
@@ -0,0 +1,12 @@
1
+ ((line_comment) @injection.content
2
+ (#set! injection.language "comment"))
3
+
4
+ (call_expression
5
+ name: (identifier) @_regex
6
+ arguments: (argument_list
7
+ (expression
8
+ (literal
9
+ (string_literal
10
+ (string_content) @injection.content))))
11
+ (#eq? @_regex "regex")
12
+ (#set! injection.language "regex"))
@@ -0,0 +1,7 @@
1
+ (proc_definition
2
+ name: (identifier) @name) @definition.function
3
+
4
+ (call_expression
5
+ name: [
6
+ (identifier) @name
7
+ ]) @reference.call
@@ -0,0 +1,7 @@
1
+ (proc_definition
2
+ name: (identifier) @name) @definition.function
3
+
4
+ (call_expression
5
+ name: [
6
+ (identifier) @name
7
+ ]) @reference.call