tree-sitter-dart 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.
Files changed (29) hide show
  1. tree_sitter_dart-0.1.0/LICENSE +23 -0
  2. tree_sitter_dart-0.1.0/MANIFEST.in +8 -0
  3. tree_sitter_dart-0.1.0/PKG-INFO +77 -0
  4. tree_sitter_dart-0.1.0/README.md +54 -0
  5. tree_sitter_dart-0.1.0/bindings/c/tree-sitter-dart.h +16 -0
  6. tree_sitter_dart-0.1.0/bindings/python/tree_sitter_dart/__init__.py +5 -0
  7. tree_sitter_dart-0.1.0/bindings/python/tree_sitter_dart/__init__.pyi +1 -0
  8. tree_sitter_dart-0.1.0/bindings/python/tree_sitter_dart/binding.c +27 -0
  9. tree_sitter_dart-0.1.0/bindings/python/tree_sitter_dart/py.typed +0 -0
  10. tree_sitter_dart-0.1.0/bindings/python/tree_sitter_dart.egg-info/PKG-INFO +77 -0
  11. tree_sitter_dart-0.1.0/bindings/python/tree_sitter_dart.egg-info/SOURCES.txt +27 -0
  12. tree_sitter_dart-0.1.0/bindings/python/tree_sitter_dart.egg-info/dependency_links.txt +1 -0
  13. tree_sitter_dart-0.1.0/bindings/python/tree_sitter_dart.egg-info/not-zip-safe +1 -0
  14. tree_sitter_dart-0.1.0/bindings/python/tree_sitter_dart.egg-info/requires.txt +3 -0
  15. tree_sitter_dart-0.1.0/bindings/python/tree_sitter_dart.egg-info/top_level.txt +2 -0
  16. tree_sitter_dart-0.1.0/bindings/swift/TreeSitterDart/dart.h +16 -0
  17. tree_sitter_dart-0.1.0/grammar.js +3224 -0
  18. tree_sitter_dart-0.1.0/pyproject.toml +36 -0
  19. tree_sitter_dart-0.1.0/queries/highlights.scm +279 -0
  20. tree_sitter_dart-0.1.0/queries/tags.scm +92 -0
  21. tree_sitter_dart-0.1.0/queries/test.scm +1 -0
  22. tree_sitter_dart-0.1.0/setup.cfg +4 -0
  23. tree_sitter_dart-0.1.0/setup.py +60 -0
  24. tree_sitter_dart-0.1.0/src/parser.c +235987 -0
  25. tree_sitter_dart-0.1.0/src/scanner.c +130 -0
  26. tree_sitter_dart-0.1.0/src/tree_sitter/alloc.h +54 -0
  27. tree_sitter_dart-0.1.0/src/tree_sitter/array.h +291 -0
  28. tree_sitter_dart-0.1.0/src/tree_sitter/parser.h +286 -0
  29. tree_sitter_dart-0.1.0/tree-sitter.json +19 -0
@@ -0,0 +1,23 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020-2023 UserNobody14 and others (original grammar)
4
+ Copyright (c) 2026 Efren Bautista (Python packaging and distribution)
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining
7
+ a copy of this software and associated documentation files (the
8
+ "Software"), to deal in the Software without restriction, including
9
+ without limitation the rights to use, copy, modify, merge, publish,
10
+ distribute, sublicense, and/or sell copies of the Software, and to
11
+ permit persons to whom the Software is furnished to do so, subject to
12
+ the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be
15
+ included in all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,8 @@
1
+ # Ensure the source distribution contains everything needed to compile the
2
+ # extension from sdist (e.g. on platforms without a pre-built wheel). setuptools
3
+ # auto-includes the ext_modules .c sources but NOT the headers in include_dirs,
4
+ # so without this an `pip install` from sdist fails on a missing tree_sitter/*.h.
5
+ recursive-include src *.c *.h
6
+ recursive-include bindings *.c *.h
7
+ recursive-include queries *.scm
8
+ include grammar.js tree-sitter.json LICENSE README.md
@@ -0,0 +1,77 @@
1
+ Metadata-Version: 2.4
2
+ Name: tree-sitter-dart
3
+ Version: 0.1.0
4
+ Summary: Dart grammar for tree-sitter (covers Flutter)
5
+ Author: Efren Bautista
6
+ Maintainer: Efren Bautista
7
+ License: MIT
8
+ Project-URL: Homepage, https://github.com/efrenbl/tree-sitter-dart
9
+ Project-URL: Repository, https://github.com/efrenbl/tree-sitter-dart
10
+ Project-URL: Issues, https://github.com/efrenbl/tree-sitter-dart/issues
11
+ Keywords: incremental,parsing,tree-sitter,dart,flutter
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Topic :: Software Development :: Compilers
15
+ Classifier: Topic :: Text Processing :: Linguistic
16
+ Classifier: Typing :: Typed
17
+ Requires-Python: >=3.8
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Provides-Extra: core
21
+ Requires-Dist: tree-sitter>=0.23; extra == "core"
22
+ Dynamic: license-file
23
+
24
+ # tree-sitter-dart
25
+
26
+ A [tree-sitter](https://tree-sitter.github.io/) grammar for the Dart programming
27
+ language — which also covers **Flutter** (Flutter widgets are ordinary Dart
28
+ classes; there is no separate Flutter syntax).
29
+
30
+ This is a fork of [UserNobody14/tree-sitter-dart](https://github.com/UserNobody14/tree-sitter-dart)
31
+ (MIT) packaged and published as a **Python distribution with pre-compiled
32
+ wheels** (Linux/macOS/Windows), since no `tree-sitter-dart` existed on PyPI
33
+ compatible with `tree-sitter>=0.23`.
34
+
35
+ ## Python usage
36
+
37
+ ```bash
38
+ pip install tree-sitter-dart # ships pre-compiled wheels; no C compiler needed
39
+ ```
40
+
41
+ ```python
42
+ import tree_sitter_dart
43
+ from tree_sitter import Language, Parser
44
+
45
+ parser = Parser(Language(tree_sitter_dart.language()))
46
+ tree = parser.parse(b"class MyWidget extends StatelessWidget { Widget build(c) {} }")
47
+ print(tree.root_node.type) # -> program
48
+ ```
49
+
50
+ `language()` returns a `tree_sitter.Language` PyCapsule, the standard
51
+ py-tree-sitter interface. Wheels are abi3 (CPython 3.8+).
52
+
53
+ ## Grammar development (Node / tree-sitter CLI)
54
+
55
+ This is a tree-sitter grammar written for the dart programming language. We attempt to adhere as closely as possible to the dart language spec. Initially it was started with a copy of the tree-sitter Java grammar which is why there may be a few relics included in here. For the sake of simplifying the syntax tree, many items were made inlined with tree-sitter's "underscore" method of writing rules.
56
+
57
+ ### Getting started
58
+ - Go to the project directory
59
+ - run `npm install` (first time)
60
+ - run `npm run build_init` (first time) `npm run build` (subsequent times)
61
+ - run `npm run test`
62
+
63
+ ### To test a single highlight file
64
+ - run `tree-sitter highlight test/highlight/types.dart`
65
+
66
+ ### To test a single test file
67
+ - run `tree-sitter test -f 'testcasefilter'`
68
+ - for example `tree-sitter test -f 'dart string literals'`
69
+
70
+ ### To show the output of a parse for a sample file (for example while debugging highlight issues)
71
+ - run `tree-sitter parse path/to/file.dart`
72
+
73
+ ## Credits
74
+
75
+ Grammar by [UserNobody14](https://github.com/UserNobody14/tree-sitter-dart) and
76
+ contributors (MIT). This fork adds Python packaging, a modernized PyCapsule
77
+ binding, and pre-compiled wheels.
@@ -0,0 +1,54 @@
1
+ # tree-sitter-dart
2
+
3
+ A [tree-sitter](https://tree-sitter.github.io/) grammar for the Dart programming
4
+ language — which also covers **Flutter** (Flutter widgets are ordinary Dart
5
+ classes; there is no separate Flutter syntax).
6
+
7
+ This is a fork of [UserNobody14/tree-sitter-dart](https://github.com/UserNobody14/tree-sitter-dart)
8
+ (MIT) packaged and published as a **Python distribution with pre-compiled
9
+ wheels** (Linux/macOS/Windows), since no `tree-sitter-dart` existed on PyPI
10
+ compatible with `tree-sitter>=0.23`.
11
+
12
+ ## Python usage
13
+
14
+ ```bash
15
+ pip install tree-sitter-dart # ships pre-compiled wheels; no C compiler needed
16
+ ```
17
+
18
+ ```python
19
+ import tree_sitter_dart
20
+ from tree_sitter import Language, Parser
21
+
22
+ parser = Parser(Language(tree_sitter_dart.language()))
23
+ tree = parser.parse(b"class MyWidget extends StatelessWidget { Widget build(c) {} }")
24
+ print(tree.root_node.type) # -> program
25
+ ```
26
+
27
+ `language()` returns a `tree_sitter.Language` PyCapsule, the standard
28
+ py-tree-sitter interface. Wheels are abi3 (CPython 3.8+).
29
+
30
+ ## Grammar development (Node / tree-sitter CLI)
31
+
32
+ This is a tree-sitter grammar written for the dart programming language. We attempt to adhere as closely as possible to the dart language spec. Initially it was started with a copy of the tree-sitter Java grammar which is why there may be a few relics included in here. For the sake of simplifying the syntax tree, many items were made inlined with tree-sitter's "underscore" method of writing rules.
33
+
34
+ ### Getting started
35
+ - Go to the project directory
36
+ - run `npm install` (first time)
37
+ - run `npm run build_init` (first time) `npm run build` (subsequent times)
38
+ - run `npm run test`
39
+
40
+ ### To test a single highlight file
41
+ - run `tree-sitter highlight test/highlight/types.dart`
42
+
43
+ ### To test a single test file
44
+ - run `tree-sitter test -f 'testcasefilter'`
45
+ - for example `tree-sitter test -f 'dart string literals'`
46
+
47
+ ### To show the output of a parse for a sample file (for example while debugging highlight issues)
48
+ - run `tree-sitter parse path/to/file.dart`
49
+
50
+ ## Credits
51
+
52
+ Grammar by [UserNobody14](https://github.com/UserNobody14/tree-sitter-dart) and
53
+ contributors (MIT). This fork adds Python packaging, a modernized PyCapsule
54
+ binding, and pre-compiled wheels.
@@ -0,0 +1,16 @@
1
+ #ifndef TREE_SITTER_DART_H_
2
+ #define TREE_SITTER_DART_H_
3
+
4
+ typedef struct TSLanguage TSLanguage;
5
+
6
+ #ifdef __cplusplus
7
+ extern "C" {
8
+ #endif
9
+
10
+ const TSLanguage *tree_sitter_dart(void);
11
+
12
+ #ifdef __cplusplus
13
+ }
14
+ #endif
15
+
16
+ #endif // TREE_SITTER_DART_H_
@@ -0,0 +1,5 @@
1
+ "Dart grammar for tree-sitter"
2
+
3
+ from ._binding import language
4
+
5
+ __all__ = ["language"]
@@ -0,0 +1 @@
1
+ def language() -> object: ...
@@ -0,0 +1,27 @@
1
+ #include <Python.h>
2
+
3
+ typedef struct TSLanguage TSLanguage;
4
+
5
+ TSLanguage *tree_sitter_dart(void);
6
+
7
+ static PyObject* _binding_language(PyObject *self, PyObject *args) {
8
+ return PyCapsule_New(tree_sitter_dart(), "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,77 @@
1
+ Metadata-Version: 2.4
2
+ Name: tree-sitter-dart
3
+ Version: 0.1.0
4
+ Summary: Dart grammar for tree-sitter (covers Flutter)
5
+ Author: Efren Bautista
6
+ Maintainer: Efren Bautista
7
+ License: MIT
8
+ Project-URL: Homepage, https://github.com/efrenbl/tree-sitter-dart
9
+ Project-URL: Repository, https://github.com/efrenbl/tree-sitter-dart
10
+ Project-URL: Issues, https://github.com/efrenbl/tree-sitter-dart/issues
11
+ Keywords: incremental,parsing,tree-sitter,dart,flutter
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Topic :: Software Development :: Compilers
15
+ Classifier: Topic :: Text Processing :: Linguistic
16
+ Classifier: Typing :: Typed
17
+ Requires-Python: >=3.8
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Provides-Extra: core
21
+ Requires-Dist: tree-sitter>=0.23; extra == "core"
22
+ Dynamic: license-file
23
+
24
+ # tree-sitter-dart
25
+
26
+ A [tree-sitter](https://tree-sitter.github.io/) grammar for the Dart programming
27
+ language — which also covers **Flutter** (Flutter widgets are ordinary Dart
28
+ classes; there is no separate Flutter syntax).
29
+
30
+ This is a fork of [UserNobody14/tree-sitter-dart](https://github.com/UserNobody14/tree-sitter-dart)
31
+ (MIT) packaged and published as a **Python distribution with pre-compiled
32
+ wheels** (Linux/macOS/Windows), since no `tree-sitter-dart` existed on PyPI
33
+ compatible with `tree-sitter>=0.23`.
34
+
35
+ ## Python usage
36
+
37
+ ```bash
38
+ pip install tree-sitter-dart # ships pre-compiled wheels; no C compiler needed
39
+ ```
40
+
41
+ ```python
42
+ import tree_sitter_dart
43
+ from tree_sitter import Language, Parser
44
+
45
+ parser = Parser(Language(tree_sitter_dart.language()))
46
+ tree = parser.parse(b"class MyWidget extends StatelessWidget { Widget build(c) {} }")
47
+ print(tree.root_node.type) # -> program
48
+ ```
49
+
50
+ `language()` returns a `tree_sitter.Language` PyCapsule, the standard
51
+ py-tree-sitter interface. Wheels are abi3 (CPython 3.8+).
52
+
53
+ ## Grammar development (Node / tree-sitter CLI)
54
+
55
+ This is a tree-sitter grammar written for the dart programming language. We attempt to adhere as closely as possible to the dart language spec. Initially it was started with a copy of the tree-sitter Java grammar which is why there may be a few relics included in here. For the sake of simplifying the syntax tree, many items were made inlined with tree-sitter's "underscore" method of writing rules.
56
+
57
+ ### Getting started
58
+ - Go to the project directory
59
+ - run `npm install` (first time)
60
+ - run `npm run build_init` (first time) `npm run build` (subsequent times)
61
+ - run `npm run test`
62
+
63
+ ### To test a single highlight file
64
+ - run `tree-sitter highlight test/highlight/types.dart`
65
+
66
+ ### To test a single test file
67
+ - run `tree-sitter test -f 'testcasefilter'`
68
+ - for example `tree-sitter test -f 'dart string literals'`
69
+
70
+ ### To show the output of a parse for a sample file (for example while debugging highlight issues)
71
+ - run `tree-sitter parse path/to/file.dart`
72
+
73
+ ## Credits
74
+
75
+ Grammar by [UserNobody14](https://github.com/UserNobody14/tree-sitter-dart) and
76
+ contributors (MIT). This fork adds Python packaging, a modernized PyCapsule
77
+ binding, and pre-compiled wheels.
@@ -0,0 +1,27 @@
1
+ LICENSE
2
+ MANIFEST.in
3
+ README.md
4
+ grammar.js
5
+ pyproject.toml
6
+ setup.py
7
+ tree-sitter.json
8
+ bindings/c/tree-sitter-dart.h
9
+ bindings/python/tree_sitter_dart/__init__.py
10
+ bindings/python/tree_sitter_dart/__init__.pyi
11
+ bindings/python/tree_sitter_dart/binding.c
12
+ bindings/python/tree_sitter_dart/py.typed
13
+ bindings/python/tree_sitter_dart.egg-info/PKG-INFO
14
+ bindings/python/tree_sitter_dart.egg-info/SOURCES.txt
15
+ bindings/python/tree_sitter_dart.egg-info/dependency_links.txt
16
+ bindings/python/tree_sitter_dart.egg-info/not-zip-safe
17
+ bindings/python/tree_sitter_dart.egg-info/requires.txt
18
+ bindings/python/tree_sitter_dart.egg-info/top_level.txt
19
+ bindings/swift/TreeSitterDart/dart.h
20
+ queries/highlights.scm
21
+ queries/tags.scm
22
+ queries/test.scm
23
+ src/parser.c
24
+ src/scanner.c
25
+ src/tree_sitter/alloc.h
26
+ src/tree_sitter/array.h
27
+ src/tree_sitter/parser.h
@@ -0,0 +1,3 @@
1
+
2
+ [core]
3
+ tree-sitter>=0.23
@@ -0,0 +1,2 @@
1
+ _binding
2
+ tree_sitter_dart
@@ -0,0 +1,16 @@
1
+ #ifndef TREE_SITTER_DART_H_
2
+ #define TREE_SITTER_DART_H_
3
+
4
+ typedef struct TSLanguage TSLanguage;
5
+
6
+ #ifdef __cplusplus
7
+ extern "C" {
8
+ #endif
9
+
10
+ const TSLanguage *tree_sitter_dart(void);
11
+
12
+ #ifdef __cplusplus
13
+ }
14
+ #endif
15
+
16
+ #endif // TREE_SITTER_DART_H_