-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
43 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,18 @@ | ||
[package] | ||
name = "tree-sitter-bash" | ||
description = "Bash grammar for tree-sitter" | ||
version = "0.19.0" | ||
version = "0.20.0" | ||
authors = ["Max Brunsfeld <[email protected]"] | ||
license = "MIT" | ||
readme = "bindings/rust/README.md" | ||
keywords = ["incremental", "parsing", "bash"] | ||
categories = ["parsing", "text-editors"] | ||
repository = "https://github.com/tree-sitter/tree-sitter-bash" | ||
edition = "2021" | ||
license = "MIT" | ||
authors = [ | ||
"Max Brunsfeld <[email protected]", | ||
] | ||
autoexamples = false | ||
|
||
build = "bindings/rust/build.rs" | ||
include = [ | ||
"bindings/rust/*", | ||
"grammar.js", | ||
"queries/*", | ||
"src/*", | ||
] | ||
include = ["bindings/rust/*", "grammar.js", "queries/*", "src/*"] | ||
|
||
[lib] | ||
path = "bindings/rust/lib.rs" | ||
|
@@ -26,4 +21,4 @@ path = "bindings/rust/lib.rs" | |
tree-sitter = "~0.20.10" | ||
|
||
[build-dependencies] | ||
cc = "^1.0" | ||
cc = "~1.0.82" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# tree-sitter-bash | ||
|
||
This crate provides a Bash 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-bash = "0.20.0" | ||
``` | ||
|
||
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#" | ||
echo "Hello, world!" | ||
echo "Goodbye, world!" | ||
"#; | ||
let mut parser = Parser::new(); | ||
parser.set_language(tree_sitter_bash::language()).expect("Error loading Bash 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-bash/*/tree_sitter_bash/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters