#incremental #parsing #javascript

tree-sitter-javascript

JavaScript grammar for the tree-sitter parsing library

2 unstable releases

0.19.0 Mar 3, 2021
0.16.0 Oct 27, 2020

#20 in Text editors

Download history 131/week @ 2021-04-02 241/week @ 2021-04-09 62/week @ 2021-04-16 25/week @ 2021-04-23 76/week @ 2021-04-30 133/week @ 2021-05-07 130/week @ 2021-05-14 197/week @ 2021-05-21 61/week @ 2021-05-28 22/week @ 2021-06-04 37/week @ 2021-06-11 49/week @ 2021-06-18 63/week @ 2021-06-25 36/week @ 2021-07-02 80/week @ 2021-07-09 55/week @ 2021-07-16

393 downloads per month
Used in 6 crates (4 directly)

MIT license

1.5MB
57K SLoC

C 55K SLoC // 0.0% comments JavaScript 1K SLoC // 0.0% comments Scheme 278 SLoC // 0.1% comments Rust 35 SLoC // 0.1% comments

tree-sitter-javascript

This crate provides a JavaScript grammar for the tree-sitter parsing library. To use this crate, add it to the [dependencies] section of your Cargo.toml file. (Note that you will probably also need to depend on the tree-sitter crate to use the parsed result in any useful way.)

[dependencies]
tree-sitter = "0.17"
tree-sitter-javascript = "0.16"

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

let code = r#"
    function double(x) {
        return x * 2;
    }
"#;
let mut parser = Parser::new();
parser.set_language(tree_sitter_javascript::language()).expect("Error loading JavaScript grammar");
let parsed = parser.parse(code, None);

If you have any questions, please reach out to us in the tree-sitter discussions page.

Dependencies

~1.4–2MB
~52K SLoC