#parser #incremental #turbowave

tree-sitter-turbowave

turbowave grammar for the tree-sitter parsing library

1 stable release

1.7.1 Sep 7, 2022

#433 in Text editors

MIT license

275KB
10K SLoC

C 10K SLoC JavaScript 91 SLoC Rust 31 SLoC // 0.5% comments Scheme 17 SLoC

Parser for turboWAVE

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.

Dependencies

~2.7–4MB
~71K SLoC