1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
mod error;
mod input_edit;
mod language;
mod logger;
mod node;
mod parser;
mod point;
mod query;
mod range;
mod tree;
mod tree_cursor;

pub use error::*;
pub use input_edit::*;
pub use language::*;
pub use logger::*;
pub use node::*;
pub use parser::*;
pub use point::*;
pub use query::*;
pub use range::*;
pub use tree::*;
pub use tree_cursor::*;

use wasm_bindgen::prelude::*;

pub struct TreeSitter;

impl TreeSitter {
    #[cfg(not(target_arch = "wasm32"))]
    pub async fn init() -> Result<(), JsError> {
        Ok(())
    }

    #[cfg(target_arch = "wasm32")]
    pub async fn init() -> Result<(), JsError> {
        web_tree_sitter::TreeSitter::init().await
    }
}