xref: /Universal-ctags/optlib/elixir.ctags (revision bd186360d320c31e9777827dbdda155fdc5641bf)
1#
2# This is free and unencumbered software released into the public domain.
3#
4# Anyone is free to copy, modify, publish, use, compile, sell, or
5# distribute this software, either in source code form or as a compiled
6# binary, for any purpose, commercial or non-commercial, and by any
7# means.
8#
9# In jurisdictions that recognize copyright laws, the author or authors
10# of this software dedicate any and all copyright interest in the
11# software to the public domain. We make this dedication for the benefit
12# of the public at large and to the detriment of our heirs and
13# successors. We intend this dedication to be an overt act of
14# relinquishment in perpetuity of all present and future rights to this
15# software under copyright law.
16#
17# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23# OTHER DEALINGS IN THE SOFTWARE.
24#
25# For more information, please refer to <http://unlicense.org>
26#
27
28#
29# WHEN FIXING A BUG OF THIS PARSER, WORK WITH THE UPSTREAM PROJECT.
30#
31
32#
33# This file is imported from https://github.com/mmorearty/elixir-ctags
34# by Masatake YAMATO <yamato@redhat.com> with some modifications.
35# See https://github.com/mmorearty/elixir-ctags/issues/5 and
36# https://github.com/universal-ctags/ctags/issues/1758#issuecomment-391692762.
37# @dylan-chong and @FredrikAugust realized this u-ctags integration.
38#
39
40#
41# * Put the original LICENSE file as the header of the .ctags.
42# * Use --map= option instead of --langmap because optlib2c doesn't handle
43#   --langmap option.
44# * Define kinds explicitly with --kinddef-<LANG> option.
45# * Remove backslashes before double quotes chars in the regex pattern for
46#  "test".
47# * Use singular forms for kind names.
48#
49
50--langdef=Elixir
51
52--map-Elixir=+.ex
53--map-Elixir=+.exs
54
55--kinddef-Elixir=p,protocol,protocols (defprotocol...)
56--kinddef-Elixir=m,module,modules (defmodule ...)
57--kinddef-Elixir=f,function,functions (def ...)
58--kinddef-Elixir=c,callback,callbacks (defcallback ...)
59--kinddef-Elixir=d,delegate,delegates (defdelegate ...)
60--kinddef-Elixir=e,exception,exceptions (defexception ...)
61--kinddef-Elixir=g,guard,guards (defguard ...)
62--kinddef-Elixir=i,implementation,implementations (defimpl ...)
63--kinddef-Elixir=a,macro,macros (defmacro ...)
64--kinddef-Elixir=o,operator,operators (e.g. "defmacro a <<< b")
65--kinddef-Elixir=r,record,records (defrecord...)
66--kinddef-Elixir=t,test,tests (test ...)
67--kinddef-Elixir=y,type,types (@type ...)
68
69--regex-Elixir=/^[ \t]*defprotocol[ \t]+([A-Z][a-zA-Z0-9_]*\.)*([A-Z][a-zA-Z0-9_?!]*)/\2/p/{scope=set}
70--regex-Elixir=/^[ \t]*defmodule[ \t]+([A-Z][a-zA-Z0-9_]*\.)*([A-Z][a-zA-Z0-9_?!]*)/\2/m/{scope=set}
71--regex-Elixir=/^[ \t]*def((p?)|macro(p?))[ \t]+([a-zA-Z0-9_?!]+)[ \t]+([\|\^\/&<>~.=!*+-]{1,3}|and|or|in|(not( +in)?)|when)[ \t]+[a-zA-Z0-9_?!]/\5/o/{scope=ref}{exclusive}
72--regex-Elixir=/^[ \t]*def[ \t]+([a-z_][a-zA-Z0-9_?!]*)/\1/f/{scope=ref}{{. (public) access:}}
73--regex-Elixir=/^[ \t]*defp[ \t]+([a-z_][a-zA-Z0-9_?!]*)/\1/f/{scope=ref}{{. (private) access:}}
74--regex-Elixir=/^[ \t]*(@|def)callback[ \t]+([a-z_][a-zA-Z0-9_?!]*)/\2/c/{scope=ref}
75--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}{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}}
85--regex-Elixir=/^[ \t]*defguard[ \t]+(is_[a-zA-Z0-9_?!]+)/\1/g/{scope=ref}{{. (public) access:}}
86--regex-Elixir=/^[ \t]*defguardp[ \t]+(is_[a-zA-Z0-9_?!]+)/\1/g/{scope=ref}{{. (private) access:}}
87--regex-Elixir=/^[ \t]*defimpl[ \t]+([A-Z][a-zA-Z0-9_]*\.)*([A-Z][a-zA-Z0-9_?!]*)/\2/i/{scope=ref}
88--regex-Elixir=/^[ \t]*defmacro[ \t]+([a-z_][a-zA-Z0-9_?!]*)(.[^\|\^\/&<>~.=!*+-]+)/\1/a/{scope=ref}{{. (public) access:}}
89--regex-Elixir=/^[ \t]*defmacrop[ \t]+([a-z_][a-zA-Z0-9_?!]*)(.[^\|\^\/&<>~.=!*+-]+)/\1/a/{scope=ref}{{. (private) access:}}
90--regex-Elixir=/^[ \t]*Record\.defrecord[ \t(]+:([a-zA-Z0-9_]+)(\)?)/\1/r/{scope=ref}{{. (public) access:}}
91--regex-Elixir=/^[ \t]*Record\.defrecordp[ \t(]+:([a-zA-Z0-9_]+)(\)?)/\1/r/{scope=ref}{{. (private) access:}}
92--regex-Elixir=/^[ \t]*test[ \t(]+"([a-z_][a-zA-Z0-9_?! ]*)"*(\)?)[ \t]*do/\1/t/{scope=ref}
93--regex-Elixir=/^[ \t]*@(type|opaque)[ \t]+([a-z_][a-zA-Z0-9_?!]*)/\2/y/{scope=ref}{{. (public) access:}}
94--regex-Elixir=/^[ \t]*@typep[ \t]+([a-z_][a-zA-Z0-9_?!]*)/\1/y/{scope=ref}{{. (private) access:}}
95