#incremental-parser #dart #parser

tree-sitter-dart

dart grammar for the tree-sitter parsing library

4 releases

0.0.4 May 7, 2024
0.0.3 Jan 23, 2023
0.0.2 Jan 19, 2023
0.0.1 Jan 19, 2023

#95 in Text editors

Download history 140/week @ 2024-12-14 32/week @ 2024-12-21 69/week @ 2024-12-28 162/week @ 2025-01-04 153/week @ 2025-01-11 192/week @ 2025-01-18 1092/week @ 2025-01-25 2051/week @ 2025-02-01 2884/week @ 2025-02-08 2494/week @ 2025-02-15 3104/week @ 2025-02-22 2397/week @ 2025-03-01 2188/week @ 2025-03-08 1072/week @ 2025-03-15 543/week @ 2025-03-22 806/week @ 2025-03-29

5,075 downloads per month
Used in 9 crates (3 directly)

MIT license

5MB
154K SLoC

C 151K SLoC JavaScript 2K SLoC // 0.2% comments Scheme 153 SLoC // 0.2% comments Rust 34 SLoC // 0.4% comments

tree-sitter-dart

This is a tree-sitter grammar written for the dart programming language. I attempted to adhere as closely as possible to the dart language spec. Initially I 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

Dependencies

~2.8–4.5MB
~81K SLoC