7 releases (4 stable)

1.3.0 Dec 5, 2024
1.2.0 May 25, 2024
1.1.0 Aug 14, 2023
1.0.0 Jun 20, 2023
0.0.3 Feb 27, 2023

#18 in #starlark

Download history 115/week @ 2026-02-20 449/week @ 2026-02-27 1105/week @ 2026-03-06 993/week @ 2026-03-13 720/week @ 2026-03-20 827/week @ 2026-03-27 1161/week @ 2026-04-03 1613/week @ 2026-04-10 1221/week @ 2026-04-17 2330/week @ 2026-04-24 2014/week @ 2026-05-01 2426/week @ 2026-05-08 2423/week @ 2026-05-15 2446/week @ 2026-05-22 5041/week @ 2026-05-29 4813/week @ 2026-06-05

15,248 downloads per month
Used in 8 crates (5 directly)

MIT license

2.5MB
98K SLoC

C 97K SLoC // 0.0% comments Scheme 335 SLoC // 0.1% comments Rust 33 SLoC

This crate provides Starlark language support for the tree-sitter parsing library.

Typically, you will use the [LANGUAGE][] constant to add this language to a tree-sitter Parser, and then use the parser to parse some code:

let code = r#"
load("//tools/build_defs/starlark:starlark.bzl", "starlark_library")
starlark_library(
    name = "example",
    srcs = ["example.star"],
)
"#;
let mut parser = tree_sitter::Parser::new();
let language = tree_sitter_starlark::LANGUAGE;
parser
    .set_language(&language.into())
    .expect("Error loading Starlark parser");
let tree = parser.parse(code, None).unwrap();
assert!(!tree.root_node().has_error());

tree-sitter-starlark

Build Status Discord

Starlark grammar for tree-sitter

Adapted from the official spec and the Google spec

Dependencies

~245KB