tree-sitter-asl 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.
@@ -0,0 +1,17 @@
1
+ MIT License
2
+ Copyright (c) 2026 Connor Sample
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+ The above copyright notice and this permission notice shall be included in all
10
+ copies or substantial portions of the Software.
11
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17
+ SOFTWARE.
@@ -0,0 +1,31 @@
1
+ Metadata-Version: 2.4
2
+ Name: tree-sitter-asl
3
+ Version: 0.1.0
4
+ Summary: ACPI Source Language
5
+ Author-email: Connor Sample <tabulatejarl8@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Funding, https://ko-fi.com/tabulate
8
+ Project-URL: Homepage, https://github.com/tabulatejarl8/tree-sitter-asl
9
+ Keywords: asl,incremental,parsing,tree-sitter
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Topic :: Software Development :: Compilers
12
+ Classifier: Topic :: Text Processing :: Linguistic
13
+ Classifier: Typing :: Typed
14
+ Requires-Python: >=3.10
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Provides-Extra: core
18
+ Requires-Dist: tree-sitter~=0.24; extra == "core"
19
+ Dynamic: license-file
20
+
21
+ # tree-sitter-asl
22
+
23
+ [![crates][crates]](https://crates.io/crates/tree-sitter-asl)
24
+ [![npm][npm]](https://www.npmjs.com/package/tree-sitter-asl)
25
+ [![pypi][pypi]](https://pypi.org/project/tree-sitter-asl)
26
+
27
+ ASL ([ACPI Source Language](https://uefi.org/htmlspecs/ACPI_Spec_6_4_html/19_ASL_Reference/ACPI_Source_Language_Reference.html)) grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter).
28
+
29
+ [npm]: https://img.shields.io/npm/v/tree-sitter-asl?logo=npm
30
+ [crates]: https://img.shields.io/crates/v/tree-sitter-asl?logo=rust
31
+ [pypi]: https://img.shields.io/pypi/v/tree-sitter-asl?logo=pypi&logoColor=ffd242
@@ -0,0 +1,11 @@
1
+ # tree-sitter-asl
2
+
3
+ [![crates][crates]](https://crates.io/crates/tree-sitter-asl)
4
+ [![npm][npm]](https://www.npmjs.com/package/tree-sitter-asl)
5
+ [![pypi][pypi]](https://pypi.org/project/tree-sitter-asl)
6
+
7
+ ASL ([ACPI Source Language](https://uefi.org/htmlspecs/ACPI_Spec_6_4_html/19_ASL_Reference/ACPI_Source_Language_Reference.html)) grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter).
8
+
9
+ [npm]: https://img.shields.io/npm/v/tree-sitter-asl?logo=npm
10
+ [crates]: https://img.shields.io/crates/v/tree-sitter-asl?logo=rust
11
+ [pypi]: https://img.shields.io/pypi/v/tree-sitter-asl?logo=pypi&logoColor=ffd242
@@ -0,0 +1,43 @@
1
+ """ACPI Source Language"""
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_asl(void);
6
+
7
+ static PyObject* _binding_language(PyObject *Py_UNUSED(self), PyObject *Py_UNUSED(args)) {
8
+ return PyCapsule_New(tree_sitter_asl(), "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,31 @@
1
+ Metadata-Version: 2.4
2
+ Name: tree-sitter-asl
3
+ Version: 0.1.0
4
+ Summary: ACPI Source Language
5
+ Author-email: Connor Sample <tabulatejarl8@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Funding, https://ko-fi.com/tabulate
8
+ Project-URL: Homepage, https://github.com/tabulatejarl8/tree-sitter-asl
9
+ Keywords: asl,incremental,parsing,tree-sitter
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Topic :: Software Development :: Compilers
12
+ Classifier: Topic :: Text Processing :: Linguistic
13
+ Classifier: Typing :: Typed
14
+ Requires-Python: >=3.10
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Provides-Extra: core
18
+ Requires-Dist: tree-sitter~=0.24; extra == "core"
19
+ Dynamic: license-file
20
+
21
+ # tree-sitter-asl
22
+
23
+ [![crates][crates]](https://crates.io/crates/tree-sitter-asl)
24
+ [![npm][npm]](https://www.npmjs.com/package/tree-sitter-asl)
25
+ [![pypi][pypi]](https://pypi.org/project/tree-sitter-asl)
26
+
27
+ ASL ([ACPI Source Language](https://uefi.org/htmlspecs/ACPI_Spec_6_4_html/19_ASL_Reference/ACPI_Source_Language_Reference.html)) grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter).
28
+
29
+ [npm]: https://img.shields.io/npm/v/tree-sitter-asl?logo=npm
30
+ [crates]: https://img.shields.io/crates/v/tree-sitter-asl?logo=rust
31
+ [pypi]: https://img.shields.io/pypi/v/tree-sitter-asl?logo=pypi&logoColor=ffd242
@@ -0,0 +1,15 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ setup.py
5
+ bindings/python/tree_sitter_asl/__init__.py
6
+ bindings/python/tree_sitter_asl/__init__.pyi
7
+ bindings/python/tree_sitter_asl/binding.c
8
+ bindings/python/tree_sitter_asl/py.typed
9
+ bindings/python/tree_sitter_asl.egg-info/PKG-INFO
10
+ bindings/python/tree_sitter_asl.egg-info/SOURCES.txt
11
+ bindings/python/tree_sitter_asl.egg-info/dependency_links.txt
12
+ bindings/python/tree_sitter_asl.egg-info/not-zip-safe
13
+ bindings/python/tree_sitter_asl.egg-info/requires.txt
14
+ bindings/python/tree_sitter_asl.egg-info/top_level.txt
15
+ src/parser.c
@@ -0,0 +1,3 @@
1
+
2
+ [core]
3
+ tree-sitter~=0.24
@@ -0,0 +1,2 @@
1
+ _binding
2
+ tree_sitter_asl
@@ -0,0 +1,30 @@
1
+ [project]
2
+ name = "tree-sitter-asl"
3
+ version = "0.1.0"
4
+ description = "ACPI Source Language"
5
+ readme = "README.md"
6
+ requires-python = ">=3.10"
7
+ license = "MIT"
8
+ authors = [{ name = "Connor Sample", email = "tabulatejarl8@gmail.com" }]
9
+ keywords = ["asl", "incremental", "parsing", "tree-sitter"]
10
+ classifiers = [
11
+ "Intended Audience :: Developers",
12
+ "Topic :: Software Development :: Compilers",
13
+ "Topic :: Text Processing :: Linguistic",
14
+ "Typing :: Typed",
15
+ ]
16
+
17
+ [project.urls]
18
+ Funding = "https://ko-fi.com/tabulate"
19
+ Homepage = "https://github.com/tabulatejarl8/tree-sitter-asl"
20
+
21
+ [project.optional-dependencies]
22
+ core = ["tree-sitter~=0.24"]
23
+
24
+ [build-system]
25
+ requires = ["setuptools>=62.4.0", "wheel"]
26
+ build-backend = "setuptools.build_meta"
27
+
28
+ [tool.cibuildwheel]
29
+ build = "cp310-*"
30
+ build-frontend = "build"
@@ -0,0 +1,272 @@
1
+ ; https://zed.dev/docs/extensions/languages#syntax-highlighting
2
+ ; https://neovim.io/doc/user/treesitter/
3
+
4
+ (comment) @comment
5
+ (string) @string
6
+ [ (decimal_const) (octal_const) (hex_const) ] @number
7
+
8
+ (name_seg) @variable
9
+
10
+ (arg_term) @variable.parameter
11
+ [ (local_term) (debug) ] @variable.special @variable.builtin
12
+
13
+ ; methods
14
+
15
+ (method_term method_name: (name_string (name_path (name_seg) @function)))
16
+ (function_term function_name: (name_string (name_path (name_seg) @function)))
17
+
18
+ ; types
19
+ (device_term device_name: (name_string (name_path (name_seg) @type)))
20
+ (scope_term location: (name_string (name_path (name_seg) @type)))
21
+ (processor_term processor_name: (name_string (name_path (name_seg) @type)))
22
+ (thermal_zone_term thermal_zone_name: (name_string (name_path (name_seg) @type)))
23
+ (power_res_term resource_name: (name_string (name_path (name_seg) @type)))
24
+
25
+ ; constants
26
+ (op_region_term region_name: (name_string (name_path (name_seg) @constant)))
27
+ (mutex_term mutex_name: (name_string (name_path (name_seg) @constant)))
28
+ (event_term event_name: (name_string (name_path (name_seg) @constant)))
29
+ (name_term object_name: (name_string (name_path (name_seg) @constant)))
30
+ (alias_term alias_object: (name_string (name_path (name_seg) @constant)))
31
+
32
+ ; field terms
33
+ (field_unit_entry (name_seg) @property @variable.member)
34
+ (create_bit_field_term bit_field_name: (name_string (name_path (name_seg) @property @variable.member)))
35
+ (create_byte_field_term byte_field_name: (name_string (name_path (name_seg) @property @variable.member)))
36
+ (create_word_field_term word_field_name: (name_string (name_path (name_seg) @property @variable.member)))
37
+ (create_dword_field_term dword_field_name: (name_string (name_path (name_seg) @property @variable.member)))
38
+ (create_qword_field_term qword_field_name: (name_string (name_path (name_seg) @property @variable.member)))
39
+ (create_field_term field_name: (name_string (name_path (name_seg) @property @variable.member)))
40
+ (pld_keyword) @property @variable.member
41
+
42
+ ; resource descriptor names
43
+ (_ descriptor_name: (name_string (name_path (name_seg) @label)))
44
+
45
+ ; method call
46
+ (method_invocation_term (name_string (name_path (name_seg) @function)))
47
+
48
+ ; keywords
49
+ [
50
+ ; declarations
51
+ (definition_block)
52
+ (device)
53
+ (method)
54
+ (function)
55
+ (scope)
56
+ (name)
57
+ (alias)
58
+ (processor)
59
+ (power_resource)
60
+ (thermal_zone)
61
+ (mutex)
62
+ (event)
63
+ (field)
64
+ (bank_field)
65
+ (index_field)
66
+ (operation_region)
67
+ (data_table_region)
68
+ (offset)
69
+ (access_as)
70
+ (connection)
71
+ (create_bit_field)
72
+ (create_byte_field)
73
+ (create_word_field)
74
+ (create_dword_field)
75
+ (create_qword_field)
76
+ (create_field)
77
+
78
+ ; control flow
79
+ (if)
80
+ (else)
81
+ (else_if)
82
+ (switch)
83
+ (case)
84
+ (default)
85
+ (while)
86
+ (for)
87
+ (break)
88
+ (break_point)
89
+ (continue)
90
+ (return)
91
+ (fatal)
92
+ (no_op)
93
+ (sleep)
94
+ (stall)
95
+ (notify)
96
+ (acquire)
97
+ (release)
98
+ (reset)
99
+ (signal)
100
+ (wait)
101
+ (load)
102
+ (load_table)
103
+ (unload)
104
+ ] @keyword
105
+
106
+ ; compiler directives
107
+ [
108
+ (include)
109
+ (external)
110
+ ] @preproc @keyword.directive
111
+
112
+ ; operator functions
113
+ [
114
+ (add)
115
+ (and)
116
+ (decrement)
117
+ (divide)
118
+ (find_set_left_bit)
119
+ (find_set_right_bit)
120
+ (increment)
121
+ (mod)
122
+ (multiply)
123
+ (n_and)
124
+ (n_or)
125
+ (not)
126
+ (or)
127
+ (shift_left)
128
+ (shift_right)
129
+ (subtract)
130
+ (xor)
131
+ (l_and)
132
+ (l_equal)
133
+ (l_greater)
134
+ (l_greater_equal)
135
+ (l_less)
136
+ (l_less_equal)
137
+ (l_not)
138
+ (l_not_equal)
139
+ (l_or)
140
+ (cond_ref_of)
141
+ (deref_of)
142
+ (ref_of)
143
+ (concatenate)
144
+ (concatenate_res_template)
145
+ (copy_object)
146
+ (eisa_id)
147
+ (fprintf)
148
+ (printf)
149
+ (from_bcd)
150
+ (to_bcd)
151
+ (index)
152
+ (match)
153
+ (mid)
154
+ (object_type)
155
+ (size_of)
156
+ (store)
157
+ (timer)
158
+ (to_buffer)
159
+ (to_decimal_string)
160
+ (to_hex_string)
161
+ (to_integer)
162
+ (to_pld)
163
+ (to_string)
164
+ (to_uuid)
165
+ (unicode)
166
+ ] @function.builtin
167
+
168
+ ; data constructors
169
+ [
170
+ (buffer)
171
+ (package)
172
+ (raw_data_buffer)
173
+ (resource_template)
174
+ (dma)
175
+ (dword_io)
176
+ (dword_memory)
177
+ (dword_space)
178
+ (end_dependent_fn)
179
+ (extended_io)
180
+ (extended_memory)
181
+ (extended_space)
182
+ (fixed_dma)
183
+ (fixed_io)
184
+ (gpio_int)
185
+ (gpio_io)
186
+ (i2c_serial_bus_v2)
187
+ (interrupt)
188
+ (io)
189
+ (irq)
190
+ (irq_no_flags)
191
+ (memory24)
192
+ (memory32)
193
+ (memory32_fixed)
194
+ (pin_config)
195
+ (pin_function)
196
+ (pin_group)
197
+ (pin_group_config)
198
+ (pin_group_function)
199
+ (qword_io)
200
+ (qword_memory)
201
+ (qword_space)
202
+ (register)
203
+ (spi_serial_bus_v2)
204
+ (start_dependent_fn)
205
+ (start_dependent_fn_no_pri)
206
+ (uart_serial_bus_v2)
207
+ (vendor_long)
208
+ (vendor_short)
209
+ (word_bus_number)
210
+ (word_io)
211
+ (word_space)
212
+ ] @constructor
213
+
214
+ ; builtin type
215
+ (object_type_keyword) @type.builtin
216
+
217
+ ; builtin constants
218
+ [
219
+ (zero)
220
+ (one)
221
+ (ones)
222
+ (revision)
223
+ (access_attrib_keyword)
224
+ (access_type_keyword)
225
+ (address_keyword)
226
+ (addressing_mode_keyword)
227
+ (bus_master_keyword)
228
+ (clock_phase_keyword)
229
+ (clock_polarity_keyword)
230
+ (data_bits_keyword)
231
+ (decode_keyword)
232
+ (device_polarity_keyword)
233
+ (dma_type_keyword)
234
+ (endianess_keyword)
235
+ (extended_access_attrib_keyword)
236
+ (flow_control_keyword)
237
+ (interrupt_type_keyword)
238
+ (interrupt_level_keyword)
239
+ (io_decode_keyword)
240
+ (io_restriction_keyword)
241
+ (lock_rule_keyword)
242
+ (match_op_keyword)
243
+ (max_keyword)
244
+ (mem_type_keyword)
245
+ (min_keyword)
246
+ (parity_type_keyword)
247
+ (pin_config_keyword)
248
+ (range_type_keyword)
249
+ (read_write_keyword)
250
+ (region_space_keyword)
251
+ (resource_type_keyword)
252
+ (serialize_rule_keyword)
253
+ (share_type_keyword)
254
+ (slave_mode_keyword)
255
+ (stop_bits_keyword)
256
+ (transfer_width_keyword)
257
+ (translation_keyword)
258
+ (type_keyword)
259
+ (update_rule_keyword)
260
+ (wire_mode_keyword)
261
+ (xfer_type_keyword)
262
+ ] @constant.builtin
263
+
264
+ [
265
+ "+" "/" "%" "*" "-" "<<" ">>" "&" "|"
266
+ "^" "~" "++" "--" "==" "!=" "<" ">" "<="
267
+ ">=" "&&" "||" "!" "=" "+=" "/=" "%="
268
+ "*=" "-=" "<<=" ">>=" "&=" "|=" "^="
269
+ ] @operator
270
+ [ "(" ")" "{" "}" "[" "]" ] @punctuation.bracket
271
+ [ "," "." ";" ] @punctuation.delimiter
272
+ [ "\\" "^" ] @punctuation.special
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,77 @@
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_asl", "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
+
46
+
47
+ setup(
48
+ packages=find_packages("bindings/python"),
49
+ package_dir={"": "bindings/python"},
50
+ package_data={
51
+ "tree_sitter_asl": ["*.pyi", "py.typed"],
52
+ "tree_sitter_asl.queries": ["*.scm"],
53
+ },
54
+ ext_package="tree_sitter_asl",
55
+ ext_modules=[
56
+ Extension(
57
+ name="_binding",
58
+ sources=[
59
+ "bindings/python/tree_sitter_asl/binding.c",
60
+ "src/parser.c",
61
+ ],
62
+ define_macros=[
63
+ ("PY_SSIZE_T_CLEAN", None),
64
+ ("TREE_SITTER_HIDE_SYMBOLS", None),
65
+ ],
66
+ include_dirs=["src"],
67
+ py_limited_api=not get_config_var("Py_GIL_DISABLED"),
68
+ )
69
+ ],
70
+ cmdclass={
71
+ "build": Build,
72
+ "build_ext": BuildExt,
73
+ "bdist_wheel": BdistWheel,
74
+ "egg_info": EggInfo,
75
+ },
76
+ zip_safe=False
77
+ )