Crates.io | tree-sitter-turbowave |
lib.rs | tree-sitter-turbowave |
version | 1.7.1 |
source | src |
created_at | 2022-09-07 16:35:40.459911 |
updated_at | 2022-09-07 16:35:40.459911 |
description | turbowave grammar for the tree-sitter parsing library |
homepage | |
repository | https://github.com/dfgordon/tree-sitter-turbowave |
max_upload_size | |
id | 660495 |
size | 322,121 |
This is the rust binding for tree-sitter-turbowave. To use the parser, include the following in your package's Cargo.toml
:
[dependencies]
tree-sitter = "~0.20.6"
tree-sitter-turbowave = "~1.7.1"
Here is a trivial main.rs
example:
use tree_sitter;
use tree_sitter_turbowave;
fn main() {
let code = "timestep = 1\n";
let mut parser = tree_sitter::Parser::new();
parser.set_language(tree_sitter_turbowave::language())
.expect("Error loading grammar");
let tree = parser.parse(code,None).unwrap();
println!("{}",tree.root_node().to_sexp());
}
This should print the syntax tree
(input_file (assignment (obj_key (identifier)) (decimal)))
For more on parsing with rust, see the general guidance here.