Skip to content

Commit

Permalink
Use tree-sitter-bash from crates.io
Browse files Browse the repository at this point in the history
  • Loading branch information
Wilfred committed Dec 20, 2024
1 parent 7e8974e commit f9d663e
Show file tree
Hide file tree
Showing 51 changed files with 20 additions and 238,341 deletions.
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ with YAML.

Improved language detection when one argument is a named pipe.

Updated to the latest tree-sitter parser for C, C++, C#, Go, Haskell,
Java, JavaScript, Julia, Objective-C, OCaml, Python, Ruby, Scala and
TypeScript.
Updated to the latest tree-sitter parser for Bash, C, C++, C#, Go,
Haskell, Java, JavaScript, Julia, Objective-C, OCaml, Python, Ruby,
Scala and TypeScript.

### Syntax Highlighting

Expand Down
11 changes: 11 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ tree-sitter-typescript = "0.23.2"
tree-sitter-java = "0.23.4"
tree-sitter-julia = "0.23.1"
tree-sitter-go = "0.23.4"
tree-sitter-bash = "0.23.3"

[dev-dependencies]
# assert_cmd 2.0.10 requires predicates 3.
Expand Down
5 changes: 0 additions & 5 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,6 @@ fn main() {
src_dir: "vendored_parsers/tree-sitter-ada-src",
extra_files: vec![],
},
TreeSitterParser {
name: "tree-sitter-bash",
src_dir: "vendored_parsers/tree-sitter-bash-src",
extra_files: vec!["scanner.c"],
},
TreeSitterParser {
name: "tree-sitter-clojure",
src_dir: "vendored_parsers/tree-sitter-clojure-src",
Expand Down
12 changes: 5 additions & 7 deletions src/parse/tree_sitter_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ pub(crate) struct TreeSitterConfig {
extern "C" {
fn tree_sitter_ada() -> ts::Language;
fn tree_sitter_apex() -> ts::Language;
fn tree_sitter_bash() -> ts::Language;
fn tree_sitter_clojure() -> ts::Language;
fn tree_sitter_cmake() -> ts::Language;
fn tree_sitter_commonlisp() -> ts::Language;
Expand Down Expand Up @@ -163,18 +162,17 @@ pub(crate) fn from_language(language: guess::Language) -> TreeSitterConfig {
}
}
Bash => {
let language = unsafe { tree_sitter_bash() };
let language_fn = tree_sitter_bash::LANGUAGE;
let language = tree_sitter::Language::new(language_fn);

TreeSitterConfig {
language: language.clone(),
atom_nodes: vec!["string", "raw_string", "heredoc_body"]
.into_iter()
.collect(),
delimiter_tokens: vec![("(", ")"), ("{", "}"), ("[", "]")],
highlight_query: ts::Query::new(
&language,
include_str!("../../vendored_parsers/highlights/bash.scm"),
)
.unwrap(),
highlight_query: ts::Query::new(&language, tree_sitter_bash::HIGHLIGHT_QUERY)
.unwrap(),
sub_languages: vec![],
}
}
Expand Down
1 change: 0 additions & 1 deletion vendored_parsers/highlights/bash.scm

This file was deleted.

1 change: 0 additions & 1 deletion vendored_parsers/tree-sitter-bash-src

This file was deleted.

20 changes: 0 additions & 20 deletions vendored_parsers/tree-sitter-bash/.eslintrc.js

This file was deleted.

6 changes: 0 additions & 6 deletions vendored_parsers/tree-sitter-bash/.gitattributes

This file was deleted.

37 changes: 0 additions & 37 deletions vendored_parsers/tree-sitter-bash/.github/workflows/ci.yml

This file was deleted.

22 changes: 0 additions & 22 deletions vendored_parsers/tree-sitter-bash/.github/workflows/fuzz.yml

This file was deleted.

19 changes: 0 additions & 19 deletions vendored_parsers/tree-sitter-bash/.github/workflows/lint.yml

This file was deleted.

93 changes: 0 additions & 93 deletions vendored_parsers/tree-sitter-bash/.github/workflows/pack.yml

This file was deleted.

Loading

0 comments on commit f9d663e

Please sign in to comment.