3 unstable releases

0.10.2 Apr 15, 2022
0.10.1 Apr 15, 2022
0.8.1 Mar 23, 2021

#178 in Text editors

MIT license

6.5K SLoC

C 6K SLoC JavaScript 230 SLoC // 0.0% comments Scheme 95 SLoC // 0.1% comments Rust 27 SLoC // 0.2% comments


This crate provides a Svelte grammar for the tree-sitter parsing library. To use this crate, add it to the [dependencies] section of your Cargo.toml file. (Note that you will probably also need to depend on the tree-sitter crate to use the parsed result in any useful way.)

tree-sitter = "0.17"
tree-sitter-svelte = "0.1.0"

Typically, you will use the language function to add this grammar to a tree-sitter Parser, and then use the parser to parse some code:

let code = r#"
        let x = 1
let mut parser = Parser::new();
parser.set_language(tree_sitter_svelte::language()).expect("Error loading Svelte grammar");
let parsed = parser.parse(code, None);

If you have any questions, please reach out to us in the tree-sitter discussions page.


~53K SLoC