mirror of https://github.com/Wilfred/difftastic/
0.20.1
parent
ea01558a00
commit
2036eff6d3
@ -1,27 +1,24 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "tree-sitter-json"
|
name = "tree-sitter-json"
|
||||||
description = "json grammar for the tree-sitter parsing library"
|
description = "JSON grammar for tree-sitter"
|
||||||
version = "0.20.0"
|
version = "0.20.1"
|
||||||
|
authors = ["Max Brunsfeld <maxbrunsfeld@gmail.com>"]
|
||||||
|
license = "MIT"
|
||||||
|
readme = "bindings/rust/README.md"
|
||||||
keywords = ["incremental", "parsing", "json"]
|
keywords = ["incremental", "parsing", "json"]
|
||||||
categories = ["parsing", "text-editors"]
|
categories = ["parsing", "text-editors"]
|
||||||
repository = "https://github.com/tree-sitter/tree-sitter-json"
|
repository = "https://github.com/tree-sitter/tree-sitter-json"
|
||||||
edition = "2018"
|
edition = "2021"
|
||||||
license = "MIT"
|
autoexamples = false
|
||||||
authors = ["Max Brunsfeld <maxbrunsfeld@gmail.com>"]
|
|
||||||
|
|
||||||
build = "bindings/rust/build.rs"
|
build = "bindings/rust/build.rs"
|
||||||
include = [
|
include = ["bindings/rust/*", "grammar.js", "queries/*", "src/*"]
|
||||||
"bindings/rust/*",
|
|
||||||
"grammar.js",
|
|
||||||
"queries/*",
|
|
||||||
"src/*",
|
|
||||||
]
|
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "bindings/rust/lib.rs"
|
path = "bindings/rust/lib.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
tree-sitter = "0.20"
|
tree-sitter = "~0.20.10"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
cc = "1.0"
|
cc = "~1.0.83"
|
||||||
|
|||||||
@ -0,0 +1,37 @@
|
|||||||
|
# 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`][tree-sitter crate] crate to use the parsed result in any useful
|
||||||
|
way.)
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[dependencies]
|
||||||
|
tree-sitter = "0.20.10"
|
||||||
|
tree-sitter-json = "0.20.1"
|
||||||
|
```
|
||||||
|
|
||||||
|
Typically, you will use the [language][language func] function to add this
|
||||||
|
grammar to a tree-sitter [Parser][], and then use the parser to parse some code:
|
||||||
|
|
||||||
|
```rust
|
||||||
|
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.
|
||||||
|
|
||||||
|
[language func]: https://docs.rs/tree-sitter-json/*/tree_sitter_json/fn.language.html
|
||||||
|
[Parser]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Parser.html
|
||||||
|
[tree-sitter]: https://tree-sitter.github.io/
|
||||||
|
[tree-sitter crate]: https://crates.io/crates/tree-sitter
|
||||||
|
[tree-sitter discussions]: https://github.com/tree-sitter/tree-sitter/discussions
|
||||||
Loading…
Reference in New Issue