1 release (0 unstable)
3.0.0-alpha.1 | Dec 31, 2024 |
---|
#155 in Text editors
132 downloads per month
6.5MB
188K
SLoC
Tree-sitter-usfm3
Tree-sitter implementation of the USFM language.
Installation
To use this Rust implementation of the Tree-sitter grammar for USFM, you need to have Rust installed on your system. If Rust is not installed, install Rust first.
Add as a Dependency
Include the crate in your Cargo.toml
file:
[dependencies]
tree-sitter = "0.24"
tree-sitter-usfm3 = "3.0.0-alpha.1"
Usage
Below is an example of using the tree-sitter-usfm3
library in a Rust project:
use tree_sitter::{Parser, Language};
extern "C" { fn tree_sitter_usfm3() -> Language; }
fn main() {
let mut parser = tree_sitter::Parser::new();
let code = r#"\\id GEN\n\\c 1\n\\p\n\\v 1 In the beginning..
"#;
parser.set_language(&tree_sitter_usfm3::language()).expect("Error loading Usfm3 grammar");
let tree = parser.parse(code, None).unwrap();
println!("{}", tree.root_node().to_sexp());
}
License
This project is licensed under the MIT License. See the LICENSE file for details.
Dependencies
~2.8–4MB
~79K SLoC