#parser #slang #incremental

tree-sitter-slang

slang grammar for the tree-sitter parsing library

4 releases

0.2.2 Apr 2, 2024
0.2.1 Apr 2, 2024
0.2.0 Apr 1, 2024
0.1.0 Feb 21, 2024

#448 in Text editors

Download history 158/week @ 2024-02-21 15/week @ 2024-02-28 8/week @ 2024-03-06 6/week @ 2024-03-13 209/week @ 2024-03-27 154/week @ 2024-04-03 2/week @ 2024-04-10

365 downloads per month

MIT license

32MB
1M SLoC

C 1M SLoC // 0.0% comments JavaScript 107 SLoC // 0.1% comments Rust 34 SLoC // 0.1% comments

tree-sitter-slang

This is a extension of tree-sitter-cpp and tree-sitter-hlsl to support the syntax of slang.

Work in progress...

Limitations/TODOs:

  • ambiguity between HLSL semantics and Slang type hints

lib.rs:

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

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

let code = "";
let mut parser = tree_sitter::Parser::new();
parser.set_language(tree_sitter_slang::language()).expect("Error loading slang grammar");
let tree = parser.parse(code, None).unwrap();

Dependencies

~2.7–4MB
~71K SLoC