diff --git a/CHANGELOG.md b/CHANGELOG.md index 66bd364c9..3e11517d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ### Parsing -Added Bash and Ruby support. +Added Bash, Common Lisp and Ruby support. Updated the C, CSS and JSON parsers to the latest upstream versions. diff --git a/README.md b/README.md index 42ca19291..f60a1bed7 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,7 @@ Difftastic supports the following languages: * C++ * C# * Clojure +* Common Lisp * CSS * Elixir * Emacs Lisp diff --git a/build.rs b/build.rs index 92a8568e2..895e3529c 100644 --- a/build.rs +++ b/build.rs @@ -77,6 +77,11 @@ fn main() { src_dir: "vendor/tree-sitter-clojure-src".into(), extra_files: vec![], }, + TreeSitterParser { + name: "tree-sitter-commonlisp".into(), + src_dir: "vendor/tree-sitter-commonlisp-src".into(), + extra_files: vec![], + }, TreeSitterParser { name: "tree-sitter-css".into(), src_dir: "vendor/tree-sitter-css-src".into(), diff --git a/manual/src/introduction.md b/manual/src/introduction.md index 02af39580..a820aa677 100644 --- a/manual/src/introduction.md +++ b/manual/src/introduction.md @@ -8,6 +8,7 @@ tool that understands syntax. It supports the following languages: * C++ * C# * Clojure +* Common Lisp * CSS * Elixir * Emacs Lisp diff --git a/manual/src/upstream_parsers.md b/manual/src/upstream_parsers.md index 668d17566..3d8c82224 100644 --- a/manual/src/upstream_parsers.md +++ b/manual/src/upstream_parsers.md @@ -9,6 +9,7 @@ Difftastic uses the following tree-sitter parsers: | C++ | [tree-sitter/tree-sitter-cpp](https://github.com/tree-sitter/tree-sitter-cpp) | | C# | [tree-sitter/tree-sitter-c-sharp](https://github.com/tree-sitter/tree-sitter-c-sharp) | | Clojure | [sogaiu/tree-sitter-clojure](https://github.com/sogaiu/tree-sitter-clojure) | +| Common Lisp | [theHamsta/tree-sitter-commonlisp](https://github.com/theHamsta/tree-sitter-commonlisp) | | CSS | [tree-sitter/tree-sitter-css](https://github.com/tree-sitter/tree-sitter-css) | | Elixir | [ananthakumaran/tree-sitter-elixir](https://github.com/ananthakumaran/tree-sitter-elixir) | | Emacs Lisp | [wilfred/tree-sitter-elisp](https://github.com/Wilfred/tree-sitter-elisp) | diff --git a/src/tree_sitter_parser.rs b/src/tree_sitter_parser.rs index 6bdd9affa..4e4f800d8 100644 --- a/src/tree_sitter_parser.rs +++ b/src/tree_sitter_parser.rs @@ -47,6 +47,7 @@ extern "C" { fn tree_sitter_c_sharp() -> Language; fn tree_sitter_clojure() -> Language; fn tree_sitter_cpp() -> Language; + fn tree_sitter_commonlisp() -> Language; fn tree_sitter_css() -> Language; fn tree_sitter_elisp() -> Language; fn tree_sitter_elixir() -> Language; @@ -204,6 +205,13 @@ pub fn from_extension(extension: &OsStr) -> Option { delimiter_tokens: (vec![("{", "}"), ("[", "]")]), highlight_queries: include_str!("../vendor/highlights/json.scm"), }), + "lisp" | "lsp" | "asd" => Some(TreeSitterConfig { + name: "Common Lisp", + language: unsafe { tree_sitter_commonlisp() }, + atom_nodes: (vec!["str_lit"]).into_iter().collect(), + delimiter_tokens: (vec![("(", ")")]), + highlight_queries: "", + }), "ml" => Some(TreeSitterConfig { name: "OCaml", language: unsafe { tree_sitter_ocaml() }, diff --git a/vendor/tree-sitter-commonlisp-src b/vendor/tree-sitter-commonlisp-src new file mode 120000 index 000000000..2daf16a55 --- /dev/null +++ b/vendor/tree-sitter-commonlisp-src @@ -0,0 +1 @@ +tree-sitter-commonlisp/src \ No newline at end of file