Skip to content

Commit

Permalink
Use tree-sitter-python from crates.io
Browse files Browse the repository at this point in the history
  • Loading branch information
Wilfred committed Dec 20, 2024
1 parent a91e8dc commit 6ea71e6
Show file tree
Hide file tree
Showing 76 changed files with 17 additions and 159,895 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ with YAML.
Improved language detection when one argument is a named pipe.

Updated to the latest tree-sitter parser for C#, Haskell, Objective-C,
OCaml, Ruby and Scala.
OCaml, Python, Ruby and Scala.

### 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 @@ -84,6 +84,7 @@ tree-sitter-scala = "0.23.3"
tree-sitter-objc = "3.0.2"
tree-sitter-ocaml = "0.23.2"
tree-sitter-c-sharp = "0.23.1"
tree-sitter-python = "0.23.5"

[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 @@ -249,11 +249,6 @@ fn main() {
src_dir: "vendored_parsers/tree-sitter-php-src",
extra_files: vec!["scanner.cc"],
},
TreeSitterParser {
name: "tree-sitter-python",
src_dir: "vendored_parsers/tree-sitter-python-src",
extra_files: vec!["scanner.c"],
},
TreeSitterParser {
name: "tree-sitter-qmljs",
src_dir: "vendored_parsers/tree-sitter-qmljs-src",
Expand Down
11 changes: 4 additions & 7 deletions src/parse/tree_sitter_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ extern "C" {
fn tree_sitter_pascal() -> ts::Language;
fn tree_sitter_php() -> ts::Language;
fn tree_sitter_perl() -> ts::Language;
fn tree_sitter_python() -> ts::Language;
fn tree_sitter_qmljs() -> ts::Language;
fn tree_sitter_r() -> ts::Language;
fn tree_sitter_racket() -> ts::Language;
Expand Down Expand Up @@ -869,16 +868,14 @@ pub(crate) fn from_language(language: guess::Language) -> TreeSitterConfig {
}
}
Python => {
let language = unsafe { tree_sitter_python() };
let language_fn = tree_sitter_python::LANGUAGE;
let language = tree_sitter::Language::new(language_fn);
TreeSitterConfig {
language: language.clone(),
atom_nodes: vec!["string"].into_iter().collect(),
delimiter_tokens: vec![("(", ")"), ("[", "]"), ("{", "}")],
highlight_query: ts::Query::new(
&language,
include_str!("../../vendored_parsers/highlights/python.scm"),
)
.unwrap(),
highlight_query: ts::Query::new(&language, tree_sitter_python::HIGHLIGHTS_QUERY)
.unwrap(),
sub_languages: vec![],
}
}
Expand Down
1 change: 0 additions & 1 deletion vendored_parsers/highlights/python.scm

This file was deleted.

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

This file was deleted.

38 changes: 0 additions & 38 deletions vendored_parsers/tree-sitter-python/.editorconfig

This file was deleted.

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

This file was deleted.

15 changes: 0 additions & 15 deletions vendored_parsers/tree-sitter-python/.gitattributes

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

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

This file was deleted.

23 changes: 0 additions & 23 deletions vendored_parsers/tree-sitter-python/.github/workflows/publish.yml

This file was deleted.

36 changes: 0 additions & 36 deletions vendored_parsers/tree-sitter-python/.gitignore

This file was deleted.

Loading

0 comments on commit 6ea71e6

Please sign in to comment.