[PATCH v2] feat: add Elixir to supported userdiff languages
---
Remove file that landed accidentally in the commit
t/t4018-diff-funcname.sh | 1 +
t/t4018/elixir-function | 5 +++++
t/t4018/elixir-module | 9 +++++++++
userdiff.c | 7 +++++++
4 files changed, 22 insertions(+)
create mode 100644 t/t4018/elixir-function
create mode 100644 t/t4018/elixir-module
diff --git a/t/t4018-diff-funcname.sh b/t/t4018-diff-funcname.sh
index 6f5ef0035e..194310377e 100755
--- a/t/t4018-diff-funcname.sh
+++ b/t/t4018-diff-funcname.sh
@@ -31,6 +31,7 @@ diffpatterns="
cpp
csharp
css
+ elixir
dts
fortran
fountain
diff --git a/t/t4018/elixir-function b/t/t4018/elixir-function
new file mode 100644
index 0000000000..d452f495a7
--- /dev/null
+++ b/t/t4018/elixir-function
@@ -0,0 +1,5 @@
+def function(RIGHT, arg) do
+ # comment
+ # comment
+ ChangeMe
+end
diff --git a/t/t4018/elixir-module b/t/t4018/elixir-module
new file mode 100644
index 0000000000..91a4e7aa20
--- /dev/null
+++ b/t/t4018/elixir-module
@@ -0,0 +1,9 @@
+defmodule RIGHT do
+ @moduledoc """
+ Foo bar
+ """
+
+ def ChangeMe(a) where is_map(a) do
+ a
+ end
+end
diff --git a/userdiff.c b/userdiff.c
index e187d356f6..31fff34e1e 100644
--- a/userdiff.c
+++ b/userdiff.c
@@ -32,6 +32,13 @@ PATTERNS("dts",
/* Property names and math operators */
"[a-zA-Z0-9,._+?#-]+"
"|[-+*/%&^|!~]|>>|<<|&&|\\|\\|"),
+PATTERNS("elixir",
+ "^[ \t]*((def(macro|module|impl|guard|protocol)?p?|test)[ \t].*)$",
+ "[a-zA-Z0-9_.]+"
+ "|:[a-zA-Z0-9@_]+"
+ "|:'a-zA-Z0-9@_]+'"
+ "|:\"[a-zA-Z0-9@_]+\""
+ "|@[a-zA-Z0-9_]+"),
IPATTERN("fortran",
"!^([C*]|[ \t]*!)\n"
"!^[ \t]*MODULE[ \t]+PROCEDURE[ \t]\n"
--
2.23.0