git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH v2] feat: add Elixir to supported userdiff languages
@ 2019-11-06 17:48 Łukasz Niemier
  2019-11-06 20:39 ` Johannes Sixt
  0 siblings, 1 reply; 3+ messages in thread
From: Łukasz Niemier @ 2019-11-06 17:48 UTC (permalink / raw)
  To: git; +Cc: Łukasz Niemier

---
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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-11-06 22:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-06 17:48 [PATCH v2] feat: add Elixir to supported userdiff languages Łukasz Niemier
2019-11-06 20:39 ` Johannes Sixt
2019-11-06 22:07   ` Łukasz Niemier

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).