difftastic/vendored_parsers/tree-sitter-json/bindings/rust
Wilfred Hughes ab1966b7d2 Merge commit '3fef30de8aee74600f25ec2e319b62a1a870d51e'
Update JSON parser. This allows multiple items, so JSONL is no longer
a parse error.

Fixes #528
2023-10-07 10:47:05 +07:00
..
README.md Merge commit '3fef30de8aee74600f25ec2e319b62a1a870d51e' 2023-10-07 10:47:05 +07:00
build.rs Rename vendor/ directory 2023-01-10 08:35:01 +07:00
lib.rs Rename vendor/ directory 2023-01-10 08:35:01 +07:00

README.md

tree-sitter-json

This crate provides a JSON 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.20.10"
tree-sitter-json = "0.20.1"

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#"
{
  "name": "tree-sitter-json",
  "description": "JSON parsing for tree-sitter",
}
"#;
let mut parser = Parser::new();
parser.set_language(tree_sitter_json::language()).expect("Error loading JSON grammar");
let parsed = parser.parse(code, None);

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