#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

#16 in Text editors

Download history 71/week @ 2021-01-15 17/week @ 2021-01-22 5/week @ 2021-01-29 65/week @ 2021-02-05 20/week @ 2021-02-12 47/week @ 2021-02-19 67/week @ 2021-02-26 53/week @ 2021-03-05 16/week @ 2021-03-12 15/week @ 2021-03-19 276/week @ 2021-03-26 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

150 downloads per month
Used in 4 crates (2 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