Skip to content

Commit

Permalink
Use tree-sitter-xml from crates.io
Browse files Browse the repository at this point in the history
  • Loading branch information
Wilfred committed Dec 20, 2024
1 parent cef0b56 commit b3606fc
Show file tree
Hide file tree
Showing 50 changed files with 19 additions and 23,125 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Improved language detection when one argument is a named pipe.

Updated to the latest tree-sitter parser for Bash, C, C++, C#, CSS,
Go, Haskell, HTML, Java, JavaScript, JSON, Julia, Lua, Objective-C,
OCaml, PHP, Python, Ruby, Scala, TOML and TypeScript.
OCaml, PHP, Python, Ruby, Scala, TOML, TypeScript and XML.

### 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 @@ -99,6 +99,7 @@ tree-sitter-html = "0.23.2"
tree-sitter-css = "0.23.1"
tree-sitter-toml-ng = "0.7.0"
tree-sitter-lua = "0.2.0"
tree-sitter-xml = "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 @@ -247,11 +247,6 @@ fn main() {
src_dir: "vendored_parsers/tree-sitter-vhdl-src",
extra_files: vec![],
},
TreeSitterParser {
name: "tree-sitter-xml",
src_dir: "vendored_parsers/tree-sitter-xml-src/tree-sitter-xml/src",
extra_files: vec!["scanner.c"],
},
TreeSitterParser {
name: "tree-sitter-yaml",
src_dir: "vendored_parsers/tree-sitter-yaml-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 @@ -70,6 +70,6 @@ with `difft --list-languages`.
| Newick | [delehef/tree-sitter-newick](https://github.com/delehef/tree-sitter-newick) |
| 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 | [ObserverOfTime/tree-sitter-xml](https://github.com/ObserverOfTime/tree-sitter-xml) |
| 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) |

12 changes: 5 additions & 7 deletions src/parse/tree_sitter_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ extern "C" {
fn tree_sitter_sql() -> ts::Language;
fn tree_sitter_swift() -> ts::Language;
fn tree_sitter_vhdl() -> ts::Language;
fn tree_sitter_xml() -> ts::Language;
fn tree_sitter_yaml() -> ts::Language;
fn tree_sitter_zig() -> ts::Language;
}
Expand Down Expand Up @@ -1080,19 +1079,18 @@ pub(crate) fn from_language(language: guess::Language) -> TreeSitterConfig {
}
}
Xml => {
let language = unsafe { tree_sitter_xml() };
let language_fn = tree_sitter_xml::LANGUAGE_XML;
let language = tree_sitter::Language::new(language_fn);

TreeSitterConfig {
language: language.clone(),
// XMLDecl is the <?xml ...?> header, but the parser
// just treats it as a sequence of tokens rather than
// e.g. string subexpressions, so flatten.
atom_nodes: vec!["AttValue", "XMLDecl"].into_iter().collect(),
delimiter_tokens: (vec![("<", ">")]),
highlight_query: ts::Query::new(
&language,
include_str!("../../vendored_parsers/highlights/xml.scm"),
)
.unwrap(),
highlight_query: ts::Query::new(&language, tree_sitter_xml::XML_HIGHLIGHT_QUERY)
.unwrap(),
sub_languages: vec![],
}
}
Expand Down
1 change: 0 additions & 1 deletion vendored_parsers/highlights/xml.scm

This file was deleted.

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

This file was deleted.

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

This file was deleted.

16 changes: 0 additions & 16 deletions vendored_parsers/tree-sitter-xml/.editorconfig

This file was deleted.

5 changes: 0 additions & 5 deletions vendored_parsers/tree-sitter-xml/.gitattributes

This file was deleted.

2 changes: 0 additions & 2 deletions vendored_parsers/tree-sitter-xml/.github/FUNDING.yml

This file was deleted.

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

This file was deleted.

8 changes: 0 additions & 8 deletions vendored_parsers/tree-sitter-xml/.gitignore

This file was deleted.

30 changes: 0 additions & 30 deletions vendored_parsers/tree-sitter-xml/Cargo.toml

This file was deleted.

19 changes: 0 additions & 19 deletions vendored_parsers/tree-sitter-xml/LICENSE

This file was deleted.

5 changes: 0 additions & 5 deletions vendored_parsers/tree-sitter-xml/README.md

This file was deleted.

22 changes: 0 additions & 22 deletions vendored_parsers/tree-sitter-xml/binding.gyp

This file was deleted.

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

This file was deleted.

1 change: 0 additions & 1 deletion vendored_parsers/tree-sitter-xml/bindings/node/dtd.js

This file was deleted.

20 changes: 0 additions & 20 deletions vendored_parsers/tree-sitter-xml/bindings/node/index.js

This file was deleted.

1 change: 0 additions & 1 deletion vendored_parsers/tree-sitter-xml/bindings/node/xml.js

This file was deleted.

26 changes: 0 additions & 26 deletions vendored_parsers/tree-sitter-xml/bindings/rust/build.rs

This file was deleted.

67 changes: 0 additions & 67 deletions vendored_parsers/tree-sitter-xml/bindings/rust/lib.rs

This file was deleted.

Loading

0 comments on commit b3606fc

Please sign in to comment.