tree-sitter-mulle-objc 0.0.3__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 (25) hide show
  1. tree_sitter_mulle_objc-0.0.3/LICENSE +23 -0
  2. tree_sitter_mulle_objc-0.0.3/PKG-INFO +24 -0
  3. tree_sitter_mulle_objc-0.0.3/README.md +5 -0
  4. tree_sitter_mulle_objc-0.0.3/bindings/python/tree_sitter_mulle_objc.egg-info/PKG-INFO +24 -0
  5. tree_sitter_mulle_objc-0.0.3/bindings/python/tree_sitter_mulle_objc.egg-info/SOURCES.txt +15 -0
  6. tree_sitter_mulle_objc-0.0.3/bindings/python/tree_sitter_mulle_objc.egg-info/dependency_links.txt +1 -0
  7. tree_sitter_mulle_objc-0.0.3/bindings/python/tree_sitter_mulle_objc.egg-info/not-zip-safe +1 -0
  8. tree_sitter_mulle_objc-0.0.3/bindings/python/tree_sitter_mulle_objc.egg-info/requires.txt +3 -0
  9. tree_sitter_mulle_objc-0.0.3/bindings/python/tree_sitter_mulle_objc.egg-info/top_level.txt +2 -0
  10. tree_sitter_mulle_objc-0.0.3/bindings/python/tree_sitter_objc/__init__.py +37 -0
  11. tree_sitter_mulle_objc-0.0.3/bindings/python/tree_sitter_objc/__init__.pyi +7 -0
  12. tree_sitter_mulle_objc-0.0.3/bindings/python/tree_sitter_objc/binding.c +27 -0
  13. tree_sitter_mulle_objc-0.0.3/bindings/python/tree_sitter_objc/py.typed +0 -0
  14. tree_sitter_mulle_objc-0.0.3/pyproject.toml +29 -0
  15. tree_sitter_mulle_objc-0.0.3/queries/folds.scm +20 -0
  16. tree_sitter_mulle_objc-0.0.3/queries/highlights.scm +217 -0
  17. tree_sitter_mulle_objc-0.0.3/queries/indents.scm +1 -0
  18. tree_sitter_mulle_objc-0.0.3/queries/injections.scm +10 -0
  19. tree_sitter_mulle_objc-0.0.3/queries/locals.scm +1 -0
  20. tree_sitter_mulle_objc-0.0.3/setup.cfg +4 -0
  21. tree_sitter_mulle_objc-0.0.3/setup.py +73 -0
  22. tree_sitter_mulle_objc-0.0.3/src/parser.c +634271 -0
  23. tree_sitter_mulle_objc-0.0.3/src/tree_sitter/alloc.h +54 -0
  24. tree_sitter_mulle_objc-0.0.3/src/tree_sitter/array.h +291 -0
  25. tree_sitter_mulle_objc-0.0.3/src/tree_sitter/parser.h +266 -0
@@ -0,0 +1,23 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2026 Nat! - Mulle kybernetiK
4
+ Copyright (c) 2023 Amaan Qureshi <amaanq12@gmail.com>
5
+
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
@@ -0,0 +1,24 @@
1
+ Metadata-Version: 2.4
2
+ Name: tree-sitter-mulle-objc
3
+ Version: 0.0.3
4
+ Summary: mulle-objc Objective-C grammar for tree-sitter
5
+ Author-email: Nat! <nat-tree-sitter@mulle-kybernetik.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/mulle-cc/tree-sitter-mulle-objc
8
+ Keywords: incremental,parsing,tree-sitter,objc,mulle-objc
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.9
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ Provides-Extra: core
17
+ Requires-Dist: tree-sitter~=0.22; extra == "core"
18
+ Dynamic: license-file
19
+
20
+ # tree-sitter-mulle-objc
21
+
22
+ [mulle-objc Objective C](https://www.mulle-kybernetik.com/de-re-mulle-objc/)
23
+ grammar for [tree-sitter](https://tree-sitter.github.io)
24
+
@@ -0,0 +1,5 @@
1
+ # tree-sitter-mulle-objc
2
+
3
+ [mulle-objc Objective C](https://www.mulle-kybernetik.com/de-re-mulle-objc/)
4
+ grammar for [tree-sitter](https://tree-sitter.github.io)
5
+
@@ -0,0 +1,24 @@
1
+ Metadata-Version: 2.4
2
+ Name: tree-sitter-mulle-objc
3
+ Version: 0.0.3
4
+ Summary: mulle-objc Objective-C grammar for tree-sitter
5
+ Author-email: Nat! <nat-tree-sitter@mulle-kybernetik.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/mulle-cc/tree-sitter-mulle-objc
8
+ Keywords: incremental,parsing,tree-sitter,objc,mulle-objc
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.9
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ Provides-Extra: core
17
+ Requires-Dist: tree-sitter~=0.22; extra == "core"
18
+ Dynamic: license-file
19
+
20
+ # tree-sitter-mulle-objc
21
+
22
+ [mulle-objc Objective C](https://www.mulle-kybernetik.com/de-re-mulle-objc/)
23
+ grammar for [tree-sitter](https://tree-sitter.github.io)
24
+
@@ -0,0 +1,15 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ setup.py
5
+ bindings/python/tree_sitter_mulle_objc.egg-info/PKG-INFO
6
+ bindings/python/tree_sitter_mulle_objc.egg-info/SOURCES.txt
7
+ bindings/python/tree_sitter_mulle_objc.egg-info/dependency_links.txt
8
+ bindings/python/tree_sitter_mulle_objc.egg-info/not-zip-safe
9
+ bindings/python/tree_sitter_mulle_objc.egg-info/requires.txt
10
+ bindings/python/tree_sitter_mulle_objc.egg-info/top_level.txt
11
+ bindings/python/tree_sitter_objc/__init__.py
12
+ bindings/python/tree_sitter_objc/__init__.pyi
13
+ bindings/python/tree_sitter_objc/binding.c
14
+ bindings/python/tree_sitter_objc/py.typed
15
+ src/parser.c
@@ -0,0 +1,37 @@
1
+ """mulle-objc Objective-C grammar for tree-sitter"""
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
+ if name == "HIGHLIGHTS_QUERY":
16
+ return _get_query("HIGHLIGHTS_QUERY", "highlights.scm")
17
+ if name == "INJECTIONS_QUERY":
18
+ return _get_query("INJECTIONS_QUERY", "injections.scm")
19
+ if name == "LOCALS_QUERY":
20
+ return _get_query("LOCALS_QUERY", "locals.scm")
21
+
22
+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
23
+
24
+
25
+ __all__ = [
26
+ "language",
27
+ "HIGHLIGHTS_QUERY",
28
+ "INJECTIONS_QUERY",
29
+ "LOCALS_QUERY",
30
+ ]
31
+
32
+
33
+ def __dir__():
34
+ return sorted(__all__ + [
35
+ "__all__", "__builtins__", "__cached__", "__doc__", "__file__",
36
+ "__loader__", "__name__", "__package__", "__path__", "__spec__",
37
+ ])
@@ -0,0 +1,7 @@
1
+ from typing import Final
2
+
3
+ HIGHLIGHTS_QUERY: Final[str]
4
+ INJECTIONS_QUERY: Final[str]
5
+ LOCALS_QUERY: Final[str]
6
+
7
+ def language() -> object: ...
@@ -0,0 +1,27 @@
1
+ #include <Python.h>
2
+
3
+ typedef struct TSLanguage TSLanguage;
4
+
5
+ TSLanguage *tree_sitter_objc(void);
6
+
7
+ static PyObject* _binding_language(PyObject *Py_UNUSED(self), PyObject *Py_UNUSED(args)) {
8
+ return PyCapsule_New(tree_sitter_objc(), "tree_sitter.Language", NULL);
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,29 @@
1
+ [build-system]
2
+ requires = ["setuptools>=42", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "tree-sitter-mulle-objc"
7
+ description = "mulle-objc Objective-C grammar for tree-sitter"
8
+ version = "0.0.3"
9
+ keywords = ["incremental", "parsing", "tree-sitter", "objc", "mulle-objc"]
10
+ classifiers = [
11
+ "Intended Audience :: Developers",
12
+ "Topic :: Software Development :: Compilers",
13
+ "Topic :: Text Processing :: Linguistic",
14
+ "Typing :: Typed",
15
+ ]
16
+ authors = [{ name = "Nat!", email = "nat-tree-sitter@mulle-kybernetik.com" }]
17
+ requires-python = ">=3.9"
18
+ license.text = "MIT"
19
+ readme = "README.md"
20
+
21
+ [project.urls]
22
+ Homepage = "https://github.com/mulle-cc/tree-sitter-mulle-objc"
23
+
24
+ [project.optional-dependencies]
25
+ core = ["tree-sitter~=0.22"]
26
+
27
+ [tool.cibuildwheel]
28
+ build = "cp39-*"
29
+ build-frontend = "build"
@@ -0,0 +1,20 @@
1
+ ; inherits: c
2
+
3
+ [
4
+ (class_declaration)
5
+ (class_interface)
6
+ (class_implementation)
7
+ (protocol_declaration)
8
+ (property_declaration)
9
+ (method_declaration)
10
+ (struct_declaration)
11
+ (struct_declarator)
12
+ (try_statement)
13
+ (catch_clause)
14
+ (finally_clause)
15
+ (throw_statement)
16
+ ; MULLE_DISABLED: blocks (block_literal)
17
+ (ms_asm_block)
18
+ (dictionary_literal)
19
+ (array_literal)
20
+ ] @fold
@@ -0,0 +1,217 @@
1
+ ; inherits: c
2
+
3
+ ; Preprocs
4
+
5
+ (preproc_undef
6
+ name: (_) @constant) @preproc
7
+
8
+ ; Includes
9
+
10
+ (module_import "@import" @include path: (identifier) @namespace)
11
+
12
+ ((preproc_include
13
+ _ @include path: (_))
14
+ (#any-of? @include "#include" "#import"))
15
+
16
+ ; Type Qualifiers
17
+
18
+ [
19
+ "@optional"
20
+ "@required"
21
+ ; MULLE_DISABLED: generics "__covariant"
22
+ ; MULLE_DISABLED: generics "__contravariant"
23
+ (visibility_specification)
24
+ ] @type.qualifier
25
+
26
+ ; Storageclasses
27
+
28
+ [
29
+ "@autoreleasepool"
30
+ "@synthesize"
31
+ "@dynamic"
32
+ "volatile"
33
+ (protocol_qualifier)
34
+ ] @storageclass
35
+
36
+ ; Keywords
37
+
38
+ [
39
+ "@protocol"
40
+ "@interface"
41
+ "@implementation"
42
+ "@compatibility_alias"
43
+ "@property"
44
+ "@selector"
45
+ "@defs"
46
+ "availability"
47
+ "@end"
48
+ ] @keyword
49
+
50
+ (class_declaration "@" @keyword "class" @keyword) ; I hate Obj-C for allowing "@ class" :)
51
+
52
+ (method_definition ["+" "-"] @keyword.function)
53
+ (method_declaration ["+" "-"] @keyword.function)
54
+
55
+ [
56
+ "__typeof__"
57
+ "__typeof"
58
+ "typeof"
59
+ "in"
60
+ ] @keyword.operator
61
+
62
+ [
63
+ "@synchronized"
64
+ "oneway"
65
+ ] @keyword.coroutine
66
+
67
+ ; Exceptions
68
+
69
+ [
70
+ "@try"
71
+ "__try"
72
+ "@catch"
73
+ "__catch"
74
+ "@finally"
75
+ "__finally"
76
+ "@throw"
77
+ ] @exception
78
+
79
+ ; Variables
80
+
81
+ ((identifier) @variable.builtin
82
+ (#any-of? @variable.builtin "self" "super"))
83
+
84
+ ; Functions & Methods
85
+
86
+ [
87
+ "objc_bridge_related"
88
+ "@available"
89
+ "__builtin_available"
90
+ "va_arg"
91
+ "asm"
92
+ ] @function.builtin
93
+
94
+ (method_definition (identifier) @method)
95
+
96
+ (method_declaration (identifier) @method)
97
+
98
+ (method_identifier (identifier)? @method ":" @method (identifier)? @method)
99
+
100
+ (message_expression method: (identifier) @method.call)
101
+
102
+ ; Constructors
103
+
104
+ ((message_expression method: (identifier) @constructor)
105
+ (#eq? @constructor "init"))
106
+
107
+ ; Attributes
108
+
109
+ (availability_attribute_specifier
110
+ [
111
+ "CF_FORMAT_FUNCTION" "NS_AVAILABLE" "__IOS_AVAILABLE" "NS_AVAILABLE_IOS"
112
+ "API_AVAILABLE" "API_UNAVAILABLE" "API_DEPRECATED" "NS_ENUM_AVAILABLE_IOS"
113
+ "NS_DEPRECATED_IOS" "NS_ENUM_DEPRECATED_IOS" "NS_FORMAT_FUNCTION" "DEPRECATED_MSG_ATTRIBUTE"
114
+ "__deprecated_msg" "__deprecated_enum_msg" "NS_SWIFT_NAME" "NS_SWIFT_UNAVAILABLE"
115
+ "NS_EXTENSION_UNAVAILABLE_IOS" "NS_CLASS_AVAILABLE_IOS" "NS_CLASS_DEPRECATED_IOS" "__OSX_AVAILABLE_STARTING"
116
+ "NS_ROOT_CLASS" "NS_UNAVAILABLE" "NS_REQUIRES_NIL_TERMINATION" "CF_RETURNS_RETAINED"
117
+ "CF_RETURNS_NOT_RETAINED" "DEPRECATED_ATTRIBUTE" "UI_APPEARANCE_SELECTOR" "UNAVAILABLE_ATTRIBUTE"
118
+ ]) @attribute
119
+
120
+ ; Macros
121
+
122
+ (type_qualifier
123
+ [
124
+ "_Complex"
125
+ "_Nonnull"
126
+ "_Nullable"
127
+ "_Nullable_result"
128
+ "_Null_unspecified"
129
+ "__autoreleasing"
130
+ "__block"
131
+ "__bridge"
132
+ "__bridge_retained"
133
+ "__bridge_transfer"
134
+ "__complex"
135
+ "__kindof"
136
+ "__nonnull"
137
+ "__nullable"
138
+ "__ptrauth_objc_class_ro"
139
+ "__ptrauth_objc_isa_pointer"
140
+ "__ptrauth_objc_super_pointer"
141
+ "__strong"
142
+ "__thread"
143
+ "__unsafe_unretained"
144
+ "__unused"
145
+ "__weak"
146
+ ]) @function.macro.builtin
147
+
148
+ [ "__real" "__imag" ] @function.macro.builtin
149
+
150
+ ((call_expression function: (identifier) @function.macro)
151
+ (#eq? @function.macro "testassert"))
152
+
153
+ ; Types
154
+
155
+ (class_declaration (identifier) @type)
156
+
157
+ (class_interface "@interface" . (identifier) @type superclass: _? @type category: _? @namespace)
158
+
159
+ (class_implementation "@implementation" . (identifier) @type superclass: _? @type category: _? @namespace)
160
+
161
+ (protocol_forward_declaration (identifier) @type) ; @interface :(
162
+
163
+ (protocol_reference_list (identifier) @type) ; ^
164
+
165
+ [
166
+ "BOOL"
167
+ "IMP"
168
+ "SEL"
169
+ "Class"
170
+ "id"
171
+ ] @type.builtin
172
+
173
+ ; Constants
174
+
175
+ (property_attribute (identifier) @constant "="?)
176
+
177
+ [ "__asm" "__asm__" ] @constant.macro
178
+
179
+ ; Properties
180
+
181
+ (property_implementation "@synthesize" (identifier) @property)
182
+
183
+ ((identifier) @property
184
+ (#has-ancestor? @property struct_declaration))
185
+
186
+ ; Parameters
187
+
188
+ (method_parameter ":" @method (identifier) @parameter)
189
+
190
+ (method_parameter declarator: (identifier) @parameter)
191
+
192
+ ; MULLE_DISABLED: blocks
193
+ ; (parameter_declaration
194
+ ; declarator: (function_declarator
195
+ ; declarator: (parenthesized_declarator
196
+ ; (block_pointer_declarator
197
+ ; declarator: (identifier) @parameter))))
198
+
199
+ "..." @parameter.builtin
200
+
201
+ ; Operators
202
+
203
+ [
204
+ "^"
205
+ ] @operator
206
+
207
+ ; Literals
208
+
209
+ (platform) @string.special
210
+
211
+ (version_number) @text.uri @number
212
+
213
+ ; Punctuation
214
+
215
+ "@" @punctuation.special
216
+
217
+ [ "<" ">" ] @punctuation.bracket
@@ -0,0 +1 @@
1
+ ; inherits: c
@@ -0,0 +1,10 @@
1
+ ; inherits: c
2
+
3
+ ; TODO(amaanq): uncomment/add when I add asm support
4
+ ; (ms_asm_block "{" _ @asm "}")
5
+ ;
6
+ ; ((asm_specifier (string_literal) @asm)
7
+ ; (#offset! @asm 0 1 0 -1))
8
+ ;
9
+ ; ((asm_statement (string_literal) @asm)
10
+ ; (#offset! @asm 0 1 0 -1))
@@ -0,0 +1 @@
1
+ ; inherits: c
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,73 @@
1
+ from os import path
2
+ from platform import system
3
+
4
+ from setuptools import Extension, find_packages, setup
5
+ from setuptools.command.build import build
6
+ from setuptools.command.egg_info import egg_info
7
+ from wheel.bdist_wheel import bdist_wheel
8
+
9
+ sources = [
10
+ "bindings/python/tree_sitter_objc/binding.c",
11
+ "src/parser.c",
12
+ ]
13
+ if path.exists("src/scanner.c"):
14
+ sources.append("src/scanner.c")
15
+
16
+ if system() != "Windows":
17
+ cflags = ["-std=c11", "-fvisibility=hidden"]
18
+ else:
19
+ cflags = ["/std:c11", "/utf-8"]
20
+
21
+
22
+ class Build(build):
23
+ def run(self):
24
+ if path.isdir("queries"):
25
+ dest = path.join(self.build_lib, "tree_sitter_objc", "queries")
26
+ self.copy_tree("queries", dest)
27
+ super().run()
28
+
29
+
30
+ class BdistWheel(bdist_wheel):
31
+ def get_tag(self):
32
+ python, abi, platform = super().get_tag()
33
+ if python.startswith("cp"):
34
+ python, abi = "cp39", "abi3"
35
+ return python, abi, platform
36
+
37
+
38
+ class EggInfo(egg_info):
39
+ def find_sources(self):
40
+ super().find_sources()
41
+ self.filelist.recursive_include("queries", "*.scm")
42
+ self.filelist.include("src/tree_sitter/*.h")
43
+
44
+
45
+ setup(
46
+ packages=find_packages("bindings/python"),
47
+ package_dir={"": "bindings/python"},
48
+ package_data={
49
+ "tree_sitter_objc": ["*.pyi", "py.typed"],
50
+ "tree_sitter_objc.queries": ["*.scm"],
51
+ },
52
+ ext_package="tree_sitter_objc",
53
+ ext_modules=[
54
+ Extension(
55
+ name="_binding",
56
+ sources=sources,
57
+ extra_compile_args=cflags,
58
+ define_macros=[
59
+ ("Py_LIMITED_API", "0x03090000"),
60
+ ("PY_SSIZE_T_CLEAN", None),
61
+ ("TREE_SITTER_HIDE_SYMBOLS", None),
62
+ ],
63
+ include_dirs=["src"],
64
+ py_limited_api=True,
65
+ )
66
+ ],
67
+ cmdclass={
68
+ "build": Build,
69
+ "bdist_wheel": BdistWheel,
70
+ "egg_info": EggInfo,
71
+ },
72
+ zip_safe=False
73
+ )