Dart grammar for tree-sitter (covers Flutter)
Project description
tree-sitter-dart
A tree-sitter grammar for the Dart programming language — which also covers Flutter (Flutter widgets are ordinary Dart classes; there is no separate Flutter syntax).
This is a fork of UserNobody14/tree-sitter-dart
(MIT) packaged and published as a Python distribution with pre-compiled
wheels (Linux/macOS/Windows), since no tree-sitter-dart existed on PyPI
compatible with tree-sitter>=0.23.
Python usage
pip install tree-sitter-dart # ships pre-compiled wheels; no C compiler needed
import tree_sitter_dart
from tree_sitter import Language, Parser
parser = Parser(Language(tree_sitter_dart.language()))
tree = parser.parse(b"class MyWidget extends StatelessWidget { Widget build(c) {} }")
print(tree.root_node.type) # -> program
language() returns a tree_sitter.Language PyCapsule, the standard
py-tree-sitter interface. Wheels are abi3 (CPython 3.8+).
Grammar development (Node / tree-sitter CLI)
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.
Getting started
- Go to the project directory
- run
npm install(first time) - run
npm run build_init(first time)npm run build(subsequent times) - run
npm run test
To test a single highlight file
- run
tree-sitter highlight test/highlight/types.dart
To test a single test file
- run
tree-sitter test -f 'testcasefilter' - for example
tree-sitter test -f 'dart string literals'
To show the output of a parse for a sample file (for example while debugging highlight issues)
- run
tree-sitter parse path/to/file.dart
Credits
Grammar by UserNobody14 and contributors (MIT). This fork adds Python packaging, a modernized PyCapsule binding, and pre-compiled wheels.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tree_sitter_dart-0.1.0.tar.gz.
File metadata
- Download URL: tree_sitter_dart-0.1.0.tar.gz
- Upload date:
- Size: 312.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d1566e150f5ad8cd79ae225ff89db3eaf4a5e4cbbc667839578aee0512c3fdd
|
|
| MD5 |
43a642c4834946d3af4bba75bf3f1a12
|
|
| BLAKE2b-256 |
7957e6d2294ab6f5c8fe5dd031837361ac256fecb7a285f06f665cafd6bf0a31
|
Provenance
The following attestation bundles were made for tree_sitter_dart-0.1.0.tar.gz:
Publisher:
release.yml on efrenbl/tree-sitter-dart
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tree_sitter_dart-0.1.0.tar.gz -
Subject digest:
5d1566e150f5ad8cd79ae225ff89db3eaf4a5e4cbbc667839578aee0512c3fdd - Sigstore transparency entry: 1899049286
- Sigstore integration time:
-
Permalink:
efrenbl/tree-sitter-dart@12ba73fbfd0755652d97bd10e76a84c076112d14 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/efrenbl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@12ba73fbfd0755652d97bd10e76a84c076112d14 -
Trigger Event:
push
-
Statement type:
File details
Details for the file tree_sitter_dart-0.1.0-cp38-abi3-win_amd64.whl.
File metadata
- Download URL: tree_sitter_dart-0.1.0-cp38-abi3-win_amd64.whl
- Upload date:
- Size: 128.1 kB
- Tags: CPython 3.8+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee1d5f2109d2a206583227cfc4e2b0890f48700a0796207c2eecb5c3d7f23f63
|
|
| MD5 |
280ea962f51f8ccc58fd1a1f01e60d45
|
|
| BLAKE2b-256 |
f7a7e8af7fb56dfd0d39df6f96e180d47d822407a7c98edc485b0c18ddd7ee28
|
Provenance
The following attestation bundles were made for tree_sitter_dart-0.1.0-cp38-abi3-win_amd64.whl:
Publisher:
release.yml on efrenbl/tree-sitter-dart
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tree_sitter_dart-0.1.0-cp38-abi3-win_amd64.whl -
Subject digest:
ee1d5f2109d2a206583227cfc4e2b0890f48700a0796207c2eecb5c3d7f23f63 - Sigstore transparency entry: 1899049723
- Sigstore integration time:
-
Permalink:
efrenbl/tree-sitter-dart@12ba73fbfd0755652d97bd10e76a84c076112d14 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/efrenbl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@12ba73fbfd0755652d97bd10e76a84c076112d14 -
Trigger Event:
push
-
Statement type:
File details
Details for the file tree_sitter_dart-0.1.0-cp38-abi3-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: tree_sitter_dart-0.1.0-cp38-abi3-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 162.6 kB
- Tags: CPython 3.8+, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
05906d65a1c8688a0a0358c2e1b65ade0eec2ec7be7364c75de2f5c1e2844e0c
|
|
| MD5 |
7c7647f677697c91a16270f1d1862c94
|
|
| BLAKE2b-256 |
43e3ebee709bdd1e472bfbd1f824e5377993cfcfb7437c9e9fedeac243480ac1
|
Provenance
The following attestation bundles were made for tree_sitter_dart-0.1.0-cp38-abi3-musllinux_1_2_x86_64.whl:
Publisher:
release.yml on efrenbl/tree-sitter-dart
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tree_sitter_dart-0.1.0-cp38-abi3-musllinux_1_2_x86_64.whl -
Subject digest:
05906d65a1c8688a0a0358c2e1b65ade0eec2ec7be7364c75de2f5c1e2844e0c - Sigstore transparency entry: 1899049937
- Sigstore integration time:
-
Permalink:
efrenbl/tree-sitter-dart@12ba73fbfd0755652d97bd10e76a84c076112d14 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/efrenbl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@12ba73fbfd0755652d97bd10e76a84c076112d14 -
Trigger Event:
push
-
Statement type:
File details
Details for the file tree_sitter_dart-0.1.0-cp38-abi3-musllinux_1_2_aarch64.whl.
File metadata
- Download URL: tree_sitter_dart-0.1.0-cp38-abi3-musllinux_1_2_aarch64.whl
- Upload date:
- Size: 170.1 kB
- Tags: CPython 3.8+, musllinux: musl 1.2+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a3b4d52633b48dc4f996c3b07694e2502d8d860aece0750c138ba4651cf8392b
|
|
| MD5 |
20018ba37a169bee5dec91256d7c64f8
|
|
| BLAKE2b-256 |
c5f89e204131897888bdd7f5f6220c312dd757f7b3b92a81d52faa1e63a51610
|
Provenance
The following attestation bundles were made for tree_sitter_dart-0.1.0-cp38-abi3-musllinux_1_2_aarch64.whl:
Publisher:
release.yml on efrenbl/tree-sitter-dart
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tree_sitter_dart-0.1.0-cp38-abi3-musllinux_1_2_aarch64.whl -
Subject digest:
a3b4d52633b48dc4f996c3b07694e2502d8d860aece0750c138ba4651cf8392b - Sigstore transparency entry: 1899049617
- Sigstore integration time:
-
Permalink:
efrenbl/tree-sitter-dart@12ba73fbfd0755652d97bd10e76a84c076112d14 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/efrenbl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@12ba73fbfd0755652d97bd10e76a84c076112d14 -
Trigger Event:
push
-
Statement type:
File details
Details for the file tree_sitter_dart-0.1.0-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.
File metadata
- Download URL: tree_sitter_dart-0.1.0-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
- Upload date:
- Size: 170.9 kB
- Tags: CPython 3.8+, manylinux: glibc 2.17+ ARM64, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb9a28e9c6cccfe9ca0aa44a47a1f9fb39bc9dbe7bc347bea4efef68bfe2f78a
|
|
| MD5 |
6732e0005385c8d0961721aec34177ae
|
|
| BLAKE2b-256 |
ec81f570a883d874c59845814afe6994cc74c2dab0c71dcd8a48bf85c8fc4072
|
Provenance
The following attestation bundles were made for tree_sitter_dart-0.1.0-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl:
Publisher:
release.yml on efrenbl/tree-sitter-dart
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tree_sitter_dart-0.1.0-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl -
Subject digest:
bb9a28e9c6cccfe9ca0aa44a47a1f9fb39bc9dbe7bc347bea4efef68bfe2f78a - Sigstore transparency entry: 1899049380
- Sigstore integration time:
-
Permalink:
efrenbl/tree-sitter-dart@12ba73fbfd0755652d97bd10e76a84c076112d14 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/efrenbl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@12ba73fbfd0755652d97bd10e76a84c076112d14 -
Trigger Event:
push
-
Statement type:
File details
Details for the file tree_sitter_dart-0.1.0-cp38-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.
File metadata
- Download URL: tree_sitter_dart-0.1.0-cp38-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
- Upload date:
- Size: 163.7 kB
- Tags: CPython 3.8+, manylinux: glibc 2.28+ x86-64, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b680bcde02d1ba0b9791d092804733a517fb3bfe9b32e002a0622ce2286e6304
|
|
| MD5 |
fe9308fa0acb78de3359cc035e9a356f
|
|
| BLAKE2b-256 |
10c93dce1e4dc071e8ed536ab30694798fd5d4c7e3a1c875dff60517195bb5bd
|
Provenance
The following attestation bundles were made for tree_sitter_dart-0.1.0-cp38-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl:
Publisher:
release.yml on efrenbl/tree-sitter-dart
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tree_sitter_dart-0.1.0-cp38-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl -
Subject digest:
b680bcde02d1ba0b9791d092804733a517fb3bfe9b32e002a0622ce2286e6304 - Sigstore transparency entry: 1899049815
- Sigstore integration time:
-
Permalink:
efrenbl/tree-sitter-dart@12ba73fbfd0755652d97bd10e76a84c076112d14 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/efrenbl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@12ba73fbfd0755652d97bd10e76a84c076112d14 -
Trigger Event:
push
-
Statement type:
File details
Details for the file tree_sitter_dart-0.1.0-cp38-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: tree_sitter_dart-0.1.0-cp38-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 138.6 kB
- Tags: CPython 3.8+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
715948740c5a2398564b20e0303ce855024ebce1a6c8de79e8468f71c4fe9127
|
|
| MD5 |
0eac7b8ecaee397fae092b133941ff32
|
|
| BLAKE2b-256 |
478abe6748e2b1ab5ff8f4b14e0f815627162b1447cebaa7fc6397e612894c28
|
Provenance
The following attestation bundles were made for tree_sitter_dart-0.1.0-cp38-abi3-macosx_11_0_arm64.whl:
Publisher:
release.yml on efrenbl/tree-sitter-dart
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tree_sitter_dart-0.1.0-cp38-abi3-macosx_11_0_arm64.whl -
Subject digest:
715948740c5a2398564b20e0303ce855024ebce1a6c8de79e8468f71c4fe9127 - Sigstore transparency entry: 1899050032
- Sigstore integration time:
-
Permalink:
efrenbl/tree-sitter-dart@12ba73fbfd0755652d97bd10e76a84c076112d14 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/efrenbl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@12ba73fbfd0755652d97bd10e76a84c076112d14 -
Trigger Event:
push
-
Statement type:
File details
Details for the file tree_sitter_dart-0.1.0-cp38-abi3-macosx_10_13_x86_64.whl.
File metadata
- Download URL: tree_sitter_dart-0.1.0-cp38-abi3-macosx_10_13_x86_64.whl
- Upload date:
- Size: 130.2 kB
- Tags: CPython 3.8+, macOS 10.13+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8630403e224ecc585eed92ef608af6f3d65728511a0e4340686716273b94b56d
|
|
| MD5 |
31b6a9aeaac57f1331fc1bf0a6230774
|
|
| BLAKE2b-256 |
3d0d77f161a7a14b837e051c11ce6432830978491c0608bf1686a39706253fe0
|
Provenance
The following attestation bundles were made for tree_sitter_dart-0.1.0-cp38-abi3-macosx_10_13_x86_64.whl:
Publisher:
release.yml on efrenbl/tree-sitter-dart
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tree_sitter_dart-0.1.0-cp38-abi3-macosx_10_13_x86_64.whl -
Subject digest:
8630403e224ecc585eed92ef608af6f3d65728511a0e4340686716273b94b56d - Sigstore transparency entry: 1899049497
- Sigstore integration time:
-
Permalink:
efrenbl/tree-sitter-dart@12ba73fbfd0755652d97bd10e76a84c076112d14 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/efrenbl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@12ba73fbfd0755652d97bd10e76a84c076112d14 -
Trigger Event:
push
-
Statement type: