Skip to content

Commit bd18636

Browse files
committed
Elixir: when tagging an exception, use the name of the module where it is defined
Signed-off-by: Masatake YAMATO <[email protected]>
1 parent 0da4257 commit bd18636

File tree

7 files changed

+27
-11
lines changed

7 files changed

+27
-11
lines changed

Units/parser-elixir.r/elixir-exceptions.b/README.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

Units/parser-elixir.r/elixir-exceptions.b/expected.tags

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
--sort=no
2+
--fields=+Ka
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ModuleError input.ex /^defmodule ModuleError do$/;" module
2+
ModuleError input.ex /^ defexception [:message]$/;" exception module:ModuleError
3+
exception input.ex /^ def exception(value) do$/;" function module:ModuleError access:public
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
defmodule ErrorModule do
1+
defmodule ModuleError do
22
defexception [:message]
33

44
@impl true
55
def exception(value) do
66
msg = "did not get what was expected, got: #{inspect(value)}"
7-
%ErrorModule{message: msg}
7+
%ModuleError{message: msg}
88
end
99
end

optlib/elixir.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,17 @@ extern parserDefinition* ElixirParser (void)
8585
{"^[ \t]*defdelegate[ \t]+([a-z_][a-zA-Z0-9_?!]*)", "\\1",
8686
"d", "{scope=ref}", NULL, false},
8787
{"^[ \t]*defexception[ \t]+([A-Z][a-zA-Z0-9_]*\\.)*([A-Z][a-zA-Z0-9_?!]*)", "\\2",
88-
"e", "{scope=ref}", NULL, false},
88+
"e", "{scope=ref}{exclusive}", NULL, false},
89+
{"^[ \t]*defexception[ \t]+", "",
90+
"", "{exclusive}"
91+
"{{\n"
92+
" _scopetop {\n"
93+
" dup :kind /module eq {\n"
94+
" dup\n"
95+
" :name /exception _tag _commit exch scope:\n"
96+
" } if\n"
97+
" } if\n"
98+
"}}", NULL, false},
8999
{"^[ \t]*defguard[ \t]+(is_[a-zA-Z0-9_?!]+)", "\\1",
90100
"g", "{scope=ref}{{. (public) access:}}", NULL, false},
91101
{"^[ \t]*defguardp[ \t]+(is_[a-zA-Z0-9_?!]+)", "\\1",

optlib/elixir.ctags

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,15 @@
7373
--regex-Elixir=/^[ \t]*defp[ \t]+([a-z_][a-zA-Z0-9_?!]*)/\1/f/{scope=ref}{{. (private) access:}}
7474
--regex-Elixir=/^[ \t]*(@|def)callback[ \t]+([a-z_][a-zA-Z0-9_?!]*)/\2/c/{scope=ref}
7575
--regex-Elixir=/^[ \t]*defdelegate[ \t]+([a-z_][a-zA-Z0-9_?!]*)/\1/d/{scope=ref}
76-
--regex-Elixir=/^[ \t]*defexception[ \t]+([A-Z][a-zA-Z0-9_]*\.)*([A-Z][a-zA-Z0-9_?!]*)/\2/e/{scope=ref}
76+
--regex-Elixir=/^[ \t]*defexception[ \t]+([A-Z][a-zA-Z0-9_]*\.)*([A-Z][a-zA-Z0-9_?!]*)/\2/e/{scope=ref}{exclusive}
77+
--regex-Elixir=/^[ \t]*defexception[ \t]+//{exclusive}{{
78+
_scopetop {
79+
dup :kind /module eq {
80+
dup
81+
:name /exception _tag _commit exch scope:
82+
} if
83+
} if
84+
}}
7785
--regex-Elixir=/^[ \t]*defguard[ \t]+(is_[a-zA-Z0-9_?!]+)/\1/g/{scope=ref}{{. (public) access:}}
7886
--regex-Elixir=/^[ \t]*defguardp[ \t]+(is_[a-zA-Z0-9_?!]+)/\1/g/{scope=ref}{{. (private) access:}}
7987
--regex-Elixir=/^[ \t]*defimpl[ \t]+([A-Z][a-zA-Z0-9_]*\.)*([A-Z][a-zA-Z0-9_?!]*)/\2/i/{scope=ref}

0 commit comments

Comments
 (0)