1CTAGS-LANG-ELM(7)               Universal Ctags              CTAGS-LANG-ELM(7)
2
3
4

NAME

6       ctags-lang-elm  -  Random notes about tagging Elm source code with Uni‐
7       versal Ctags
8

SYNOPSIS

10       ctags ... --languages=+Elm ...
11       ctags ... --language-force=Elm ...
12       ctags ... --map-Elm=+.elm ...
13
14

DESCRIPTION

16       The Elm parser is a PEG parser using PackCC, which is part of the ctags
17       infrastructure.  It  should correctly process all top level statements,
18       however there is a limitation with functions embedded in let/in blocks.
19       They  will  mostly  be fine, but sometimes a function in a let/in block
20       will be omitted.
21

EXAMPLES

23   Imports
24       Imported modules are tagged, and their role is "imported",  not  "def".
25       Types,  functions, etc which are exposed via imported module have their
26       role as "exposed".
27
28       Exposed items are marked as being in the scope of their own module, not
29       the module that's doing the importing.
30
31       "input.elm"
32
33          module SomeMod exposing (..)
34
35          import MyMod exposing
36            ( map
37            , Maybe
38            , Result(..)
39            , MyList(Empty)
40            )
41
42       "output.tags"   with   "--options=NONE   -o   -  --sort=no  --extras=+r
43       --fields=+r input.elm"
44
45          SomeMod input.elm       /^module SomeMod exposing (..)$/;"      m       roles:def
46          MyMod   input.elm       /^import MyMod exposing$/;"     m       roles:imported
47          map     input.elm       /^  ( map$/;"   f       module:MyMod    roles:exposed
48          Maybe   input.elm       /^  , Maybe$/;" t       module:MyMod    roles:exposed
49          Result  input.elm       /^  , Result(..)$/;"    t       module:MyMod    roles:exposed
50          MyList  input.elm       /^  , MyList(Empty)$/;" t       module:MyMod    roles:exposed
51          Empty   input.elm       /^  , MyList(Empty)$/;" c       type:MyMod.MyList       roles:exposed
52
53   Namespaces
54       Namespaces are tagged and their role is "def".
55
56       "input.elm"
57
58          module AMod exposing (..)
59
60          import MyImport as NSpace exposing (impFunc)
61
62       "output.tags"  with  "--options=NONE   -o   -   --sort=no   --extras=+r
63       --fields=+r input.elm"
64
65          AMod    input.elm       /^module AMod exposing (..)$/;" m       roles:def
66          NSpace  input.elm       /^import MyImport as NSpace exposing (impFunc)$/;"      n       module:AMod     roles:def       moduleName:MyImport
67          MyImport        input.elm       /^import MyImport as NSpace exposing (impFunc)$/;"      m       roles:imported
68          impFunc input.elm       /^import MyImport as NSpace exposing (impFunc)$/;"      f       module:MyImport roles:exposed
69
70   Type names
71       Constructors top level functions will have type names.
72
73       "input.elm"
74
75          funcA : Int -> Int
76          funcA a = a + 1
77
78          type B
79              = B1Cons
80                { x : Float
81                , y : Float
82                }
83              | B2Cons String Integer
84              | B3Cons
85
86       "output.tags"   with   "--options=NONE   -o   -  --sort=no  --extras=+r
87       --fields=+r input.elm"
88
89          funcA   input.elm       /^funcA a = a + 1$/;"   f       typeref:typename:Int -> Int     roles:def
90          B       input.elm       /^type B$/;"    t       roles:def
91          B1Cons  input.elm       /^    = B1Cons$/;"      c       type:B  typeref:typename:{ x : Float , y : Float } -> B roles:def
92          B2Cons  input.elm       /^    | B2Cons String Integer$/;"       c       type:B  typeref:typename:String -> Integer -> B roles:def
93          B3Cons  input.elm       /^    | B3Cons$/;"      c       type:B  typeref:typename:B      roles:def
94
95   Function parameter lists
96       Function parameter lists can be extracted into the tags file  signature
97       field.  They  are  not really function signatures, but it's the closest
98       concept available in ctags.  Use "--fields=+S".
99
100          funcA a1 a2 =
101              a1 + a2
102
103       "output.tags" with "--sort=no --extras=+r --fields=+rS"
104
105          funcA       input.elm       /^funcA a1 a2 =$/;"     f       signature:a1 a2 roles:def
106

KNOWN LIMITATIONS

108       The ctags signature field is used for function  parameter  lists,  even
109       though it's not an idea field. See above.
110
111       Elm  requires all statements at the same logical level to have the same
112       indentation. If there is additional indentation that line  is  part  of
113       the previous one. Therefore without over-complicating the PEG parser we
114       have the following limitations...
115
116       Sometimes functions in let/in blocks will be omitted.
117
118       Functions in let/in blocks will be marked as  being  in  the  scope  of
119       their  outer function, regardless of how deeply nested the let/in block
120       is.
121
122       Functions in let/in blocks won't have type names.
123

SEE ALSO

125       ctags(1), ctags-client-tools(7)
126
127
128
129
1306.0.0                                                        CTAGS-LANG-ELM(7)
Impressum