Skip to content

Commit 2ef7201

Browse files
committed
Update macro and function regex
Macros do not necessarily have to be followed by an `(` parenthesis, but they *do* necessarily have to *not* be followed by any of the characters inside the backticks: `|^/&<>~.=!*+-`. Because if they do, then they're no longer normal macros, but _operators_. From https://hexdocs.pm/elixir/operators.html > To define an operator, you can use the usual def* constructs (def, > defp, defmacro, and so on) but with a syntax similar to how the > operator is used So, what applied to `defmacro` applies equally to `def`, that's why we added the bracket expression to the function regex.
1 parent b6260af commit 2ef7201

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

.ctags

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
--langdef=Elixir
22
--langmap=Elixir:.ex.exs
3-
--regex-Elixir=/^[ \t]*def(p?)[ \t]+([a-z_][a-zA-Z0-9_?!]*)/\2/f,function,functions (def ...)/
3+
--regex-Elixir=/^[ \t]*def(p?)[ \t]+([a-z_][a-zA-Z0-9_?!]*)(.[^\|\^\/&<>~.=!*+-]+)/\2/f,function,functions (def ...)/
44
--regex-Elixir=/^[ \t]*(@|def)callback[ \t]+([a-z_][a-zA-Z0-9_?!]*)/\2/c,callback,callbacks (@callback ...)/
55
--regex-Elixir=/^[ \t]*defdelegate[ \t]+([a-z_][a-zA-Z0-9_?!]*)/\1/d,delegate,delegates (defdelegate ...)/
66
--regex-Elixir=/^[ \t]*defexception[ \t]+([A-Z][a-zA-Z0-9_]*\.)*([A-Z][a-zA-Z0-9_?!]*)/\2/e,exception,exceptions (defexception ...)/
77
--regex-Elixir=/^[ \t]*defguard(p?)[ \t]+(is_[a-zA-Z0-9_?!]+)/\2/g,guard,guards (defguard ...)/
88
--regex-Elixir=/^[ \t]*defimpl[ \t]+([A-Z][a-zA-Z0-9_]*\.)*([A-Z][a-zA-Z0-9_?!]*)/\2/i,implementation,implementations (defimpl ...)/
9-
--regex-Elixir=/^[ \t]*defmacro(p?)[ \t]+([a-z_][a-zA-Z0-9_?!]*)\(/\2/a,macro,macros (defmacro ...)/
9+
--regex-Elixir=/^[ \t]*defmacro(p?)[ \t]+([a-z_][a-zA-Z0-9_?!]*)(.[^\|\^\/&<>~.=!*+-]+)/\2/a,macro,macros (defmacro ...)/
1010
--regex-Elixir=/^[ \t]*defmacro(p?)[ \t]+([a-zA-Z0-9_?!]+)?[ \t]+([^ \tA-Za-z0-9_]+)[ \t]*[a-zA-Z0-9_!?!]/\3/o,operator,operators (e.g. "defmacro a <<< b")/
1111
--regex-Elixir=/^[ \t]*defmodule[ \t]+([A-Z][a-zA-Z0-9_]*\.)*([A-Z][a-zA-Z0-9_?!]*)/\2/m,module,modules (defmodule ...)/
1212
--regex-Elixir=/^[ \t]*defprotocol[ \t]+([A-Z][a-zA-Z0-9_]*\.)*([A-Z][a-zA-Z0-9_?!]*)/\2/p,protocol,protocols (defprotocol...)/

0 commit comments

Comments
 (0)