Commit 376e7309 authored by Junio C Hamano's avatar Junio C Hamano

Merge branch 'ln/userdiff-elixir'

The patterns to detect function boundary for Elixir language has
been added.

* ln/userdiff-elixir:
  userdiff: add Elixir to supported userdiff languages
parents 9a5d34c6 a807200f
......@@ -812,6 +812,8 @@ patterns are available:
- `dts` suitable for devicetree (DTS) files.
- `elixir` suitable for source code in the Elixir language.
- `fortran` suitable for source code in the Fortran language.
- `fountain` suitable for Fountain documents.
......
......@@ -32,6 +32,7 @@ diffpatterns="
csharp
css
dts
elixir
fortran
fountain
golang
......
defmodule RIGHT do
end
#
#
# ChangeMe; do not pick up 'end' line
defmodule Test do
test "RIGHT" do
assert true == true
assert ChangeMe
end
end
def function(RIGHT, arg) do
# comment
# comment
ChangeMe
end
defmacro foo(RIGHT) do
# Code
# Code
ChangeMe
end
defmodule RIGHT do
@moduledoc """
Foo bar
"""
def ChangeMe(a) where is_map(a) do
a
end
end
defmodule Foo do
def fun(RIGHT) do
# Code
# Code
# Code
ChangeMe
end
end
defmodule MyApp.RIGHT do
@moduledoc """
Foo bar
"""
def ChangeMe(a) where is_map(a) do
a
end
end
defp function(RIGHT, arg) do
# comment
# comment
ChangeMe
end
defprotocol RIGHT do
@doc """
Calculates the size (and not the length!) of a data structure
"""
def size(data, ChangeMe)
end
defimpl RIGHT do
# Docs
# Docs
def foo(ChangeMe), do: :ok
end
......@@ -32,6 +32,18 @@ PATTERNS("dts",
/* Property names and math operators */
"[a-zA-Z0-9,._+?#-]+"
"|[-+*/%&^|!~]|>>|<<|&&|\\|\\|"),
PATTERNS("elixir",
"^[ \t]*((def(macro|module|impl|protocol|p)?|test)[ \t].*)$",
/* Atoms, names, and module attributes */
"|[@:]?[a-zA-Z0-9@_?!]+"
/* Numbers with specific base */
"|[-+]?0[xob][0-9a-fA-F]+"
/* Numbers */
"|[-+]?[0-9][0-9_.]*([eE][-+]?[0-9_]+)?"
/* Operators and atoms that represent them */
"|:?(\\+\\+|--|\\.\\.|~~~|<>|\\^\\^\\^|<?\\|>|<<<?|>?>>|<<?~|~>?>|<~>|<=|>=|===?|!==?|=~|&&&?|\\|\\|\\|?|=>|<-|\\\\\\\\|->)"
/* Not real operators, but should be grouped */
"|:?%[A-Za-z0-9_.]\\{\\}?"),
IPATTERN("fortran",
"!^([C*]|[ \t]*!)\n"
"!^[ \t]*MODULE[ \t]+PROCEDURE[ \t]\n"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment