Skip to content

Commit

Permalink
Use tree-sitter-yaml from crates.io
Browse files Browse the repository at this point in the history
  • Loading branch information
Wilfred committed Dec 21, 2024
1 parent dda6433 commit dfcb26c
Show file tree
Hide file tree
Showing 45 changed files with 19 additions and 60,908 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

### Parsing

Updated to the latest tree-sitter parser for Make.
Updated to the latest tree-sitter parser for Make and YAML.

## 0.62 (released 20th December 2024)

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 @@ -97,6 +97,7 @@ tree-sitter-toml-ng = "0.7.0"
tree-sitter-lua = "0.2.0"
tree-sitter-xml = "0.7.0"
tree-sitter-make = "1.1.1"
tree-sitter-yaml = "0.7.0"

[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 @@ -242,11 +242,6 @@ fn main() {
src_dir: "vendored_parsers/tree-sitter-vhdl-src",
extra_files: vec![],
},
TreeSitterParser {
name: "tree-sitter-yaml",
src_dir: "vendored_parsers/tree-sitter-yaml-src",
extra_files: vec!["scanner.cc"],
},
TreeSitterParser {
name: "tree-sitter-zig",
src_dir: "vendored_parsers/tree-sitter-zig-src",
Expand Down
2 changes: 1 addition & 1 deletion manual/src/languages_supported.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,5 @@ with `difft --list-languages`.
| SCSS | [serenadeai/tree-sitter-scss](https://github.com/serenadeai/tree-sitter-scss) |
| TOML | [tree-sitter-grammars/tree-sitter-toml](https://github.com/tree-sitter-grammars/tree-sitter-toml) |
| XML | [tree-sitter-grammars/tree-sitter-xml](https://github.com/tree-sitter-grammars/tree-sitter-xml) |
| YAML | [ikatyang/tree-sitter-yaml](https://github.com/ikatyang/tree-sitter-yaml) |
| YAML | [tree-sitter-grammars/tree-sitter-yaml](https://github.com/tree-sitter-grammars/tree-sitter-yaml) |

12 changes: 5 additions & 7 deletions src/parse/tree_sitter_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ extern "C" {
fn tree_sitter_sql() -> ts::Language;
fn tree_sitter_swift() -> ts::Language;
fn tree_sitter_vhdl() -> ts::Language;
fn tree_sitter_yaml() -> ts::Language;
fn tree_sitter_zig() -> ts::Language;
}

Expand Down Expand Up @@ -1093,7 +1092,9 @@ pub(crate) fn from_language(language: guess::Language) -> TreeSitterConfig {
}
}
Yaml => {
let language = unsafe { tree_sitter_yaml() };
let language_fn = tree_sitter_yaml::LANGUAGE;
let language = tree_sitter::Language::new(language_fn);

TreeSitterConfig {
language: language.clone(),
atom_nodes: vec![
Expand All @@ -1105,11 +1106,8 @@ pub(crate) fn from_language(language: guess::Language) -> TreeSitterConfig {
.into_iter()
.collect(),
delimiter_tokens: (vec![("{", "}"), ("(", ")"), ("[", "]")]),
highlight_query: ts::Query::new(
&language,
include_str!("../../vendored_parsers/highlights/yaml.scm"),
)
.unwrap(),
highlight_query: ts::Query::new(&language, tree_sitter_yaml::HIGHLIGHTS_QUERY)
.unwrap(),
sub_languages: vec![],
}
}
Expand Down
51 changes: 0 additions & 51 deletions vendored_parsers/highlights/yaml.scm

This file was deleted.

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

This file was deleted.

12 changes: 0 additions & 12 deletions vendored_parsers/tree-sitter-yaml/.editorconfig

This file was deleted.

7 changes: 0 additions & 7 deletions vendored_parsers/tree-sitter-yaml/.gitattributes

This file was deleted.

5 changes: 0 additions & 5 deletions vendored_parsers/tree-sitter-yaml/.gitignore

This file was deleted.

8 changes: 0 additions & 8 deletions vendored_parsers/tree-sitter-yaml/.gitmodules

This file was deleted.

Empty file.
13 changes: 0 additions & 13 deletions vendored_parsers/tree-sitter-yaml/.travis.yml

This file was deleted.

69 changes: 0 additions & 69 deletions vendored_parsers/tree-sitter-yaml/CHANGELOG.md

This file was deleted.

21 changes: 0 additions & 21 deletions vendored_parsers/tree-sitter-yaml/LICENSE

This file was deleted.

53 changes: 0 additions & 53 deletions vendored_parsers/tree-sitter-yaml/README.md

This file was deleted.

19 changes: 0 additions & 19 deletions vendored_parsers/tree-sitter-yaml/binding.gyp

This file was deleted.

28 changes: 0 additions & 28 deletions vendored_parsers/tree-sitter-yaml/bindings/node/binding.cc

This file was deleted.

Loading

0 comments on commit dfcb26c

Please sign in to comment.