Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tree_sitter_dart-0.1.0.tar.gz (312.8 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

tree_sitter_dart-0.1.0-cp38-abi3-win_amd64.whl (128.1 kB view details)

Uploaded CPython 3.8+Windows x86-64

tree_sitter_dart-0.1.0-cp38-abi3-musllinux_1_2_x86_64.whl (162.6 kB view details)

Uploaded CPython 3.8+musllinux: musl 1.2+ x86-64

tree_sitter_dart-0.1.0-cp38-abi3-musllinux_1_2_aarch64.whl (170.1 kB view details)

Uploaded CPython 3.8+musllinux: musl 1.2+ ARM64

tree_sitter_dart-0.1.0-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (170.9 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

tree_sitter_dart-0.1.0-cp38-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (163.7 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.28+ x86-64manylinux: glibc 2.5+ x86-64

tree_sitter_dart-0.1.0-cp38-abi3-macosx_11_0_arm64.whl (138.6 kB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

tree_sitter_dart-0.1.0-cp38-abi3-macosx_10_13_x86_64.whl (130.2 kB view details)

Uploaded CPython 3.8+macOS 10.13+ x86-64

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

Hashes for tree_sitter_dart-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5d1566e150f5ad8cd79ae225ff89db3eaf4a5e4cbbc667839578aee0512c3fdd
MD5 43a642c4834946d3af4bba75bf3f1a12
BLAKE2b-256 7957e6d2294ab6f5c8fe5dd031837361ac256fecb7a285f06f665cafd6bf0a31

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_sitter_dart-0.1.0.tar.gz:

Publisher: release.yml on efrenbl/tree-sitter-dart

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tree_sitter_dart-0.1.0-cp38-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for tree_sitter_dart-0.1.0-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 ee1d5f2109d2a206583227cfc4e2b0890f48700a0796207c2eecb5c3d7f23f63
MD5 280ea962f51f8ccc58fd1a1f01e60d45
BLAKE2b-256 f7a7e8af7fb56dfd0d39df6f96e180d47d822407a7c98edc485b0c18ddd7ee28

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tree_sitter_dart-0.1.0-cp38-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for tree_sitter_dart-0.1.0-cp38-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 05906d65a1c8688a0a0358c2e1b65ade0eec2ec7be7364c75de2f5c1e2844e0c
MD5 7c7647f677697c91a16270f1d1862c94
BLAKE2b-256 43e3ebee709bdd1e472bfbd1f824e5377993cfcfb7437c9e9fedeac243480ac1

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tree_sitter_dart-0.1.0-cp38-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for tree_sitter_dart-0.1.0-cp38-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 a3b4d52633b48dc4f996c3b07694e2502d8d860aece0750c138ba4651cf8392b
MD5 20018ba37a169bee5dec91256d7c64f8
BLAKE2b-256 c5f89e204131897888bdd7f5f6220c312dd757f7b3b92a81d52faa1e63a51610

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

File hashes

Hashes for tree_sitter_dart-0.1.0-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 bb9a28e9c6cccfe9ca0aa44a47a1f9fb39bc9dbe7bc347bea4efef68bfe2f78a
MD5 6732e0005385c8d0961721aec34177ae
BLAKE2b-256 ec81f570a883d874c59845814afe6994cc74c2dab0c71dcd8a48bf85c8fc4072

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

File hashes

Hashes for tree_sitter_dart-0.1.0-cp38-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 b680bcde02d1ba0b9791d092804733a517fb3bfe9b32e002a0622ce2286e6304
MD5 fe9308fa0acb78de3359cc035e9a356f
BLAKE2b-256 10c93dce1e4dc071e8ed536ab30694798fd5d4c7e3a1c875dff60517195bb5bd

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tree_sitter_dart-0.1.0-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for tree_sitter_dart-0.1.0-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 715948740c5a2398564b20e0303ce855024ebce1a6c8de79e8468f71c4fe9127
MD5 0eac7b8ecaee397fae092b133941ff32
BLAKE2b-256 478abe6748e2b1ab5ff8f4b14e0f815627162b1447cebaa7fc6397e612894c28

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tree_sitter_dart-0.1.0-cp38-abi3-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for tree_sitter_dart-0.1.0-cp38-abi3-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 8630403e224ecc585eed92ef608af6f3d65728511a0e4340686716273b94b56d
MD5 31b6a9aeaac57f1331fc1bf0a6230774
BLAKE2b-256 3d0d77f161a7a14b837e051c11ce6432830978491c0608bf1686a39706253fe0

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page