Skip to content

Commit 4cdc234

Browse files
authored
Merge pull request #3321 from niksilver/elm-import-exposed
Elm: roles:imported -> roles:exposed for non-modules
2 parents 94e964e + 8959a9c commit 4cdc234

File tree

8 files changed

+59
-45
lines changed

8 files changed

+59
-45
lines changed

Tmain/list-roles.d/stdout-expected.txt

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,14 @@ DTD e/element attOwner on attributes owner
4040
DTD p/parameterEntity condition on conditions
4141
DTD p/parameterEntity elementName on element names
4242
DTD p/parameterEntity partOfAttDef on part of attribute definition
43-
Elm c/constructor imported on item imported
44-
Elm f/function imported on item imported
45-
Elm m/module imported on item imported
46-
Elm t/type imported on item imported
43+
Elm c/constructor exposed on item exposed from a module
44+
Elm c/constructor imported on module imported
45+
Elm f/function exposed on item exposed from a module
46+
Elm f/function imported on module imported
47+
Elm m/module exposed on item exposed from a module
48+
Elm m/module imported on module imported
49+
Elm t/type exposed on item exposed from a module
50+
Elm t/type imported on module imported
4751
Flex I/import import on imports
4852
GDScript c/class extended on used as a base class for extending
4953
GemSpec g/gem develDep on specifying development dependency
@@ -148,10 +152,14 @@ DTD e/element attOwner on attributes owner
148152
DTD p/parameterEntity condition on conditions
149153
DTD p/parameterEntity elementName on element names
150154
DTD p/parameterEntity partOfAttDef on part of attribute definition
151-
Elm c/constructor imported on item imported
152-
Elm f/function imported on item imported
153-
Elm m/module imported on item imported
154-
Elm t/type imported on item imported
155+
Elm c/constructor exposed on item exposed from a module
156+
Elm c/constructor imported on module imported
157+
Elm f/function exposed on item exposed from a module
158+
Elm f/function imported on module imported
159+
Elm m/module exposed on item exposed from a module
160+
Elm m/module imported on module imported
161+
Elm t/type exposed on item exposed from a module
162+
Elm t/type imported on module imported
155163
Flex I/import import on imports
156164
GDScript c/class extended on used as a base class for extending
157165
GemSpec g/gem develDep on specifying development dependency

Units/parser-elm.r/elm-imports.d/expected.tags

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
SomeMod input.elm /^module SomeMod exposing (..)$/;" m roles:def
22
PlainImport input.elm /^import PlainImport$/;" m roles:imported
33
MyMod input.elm /^import MyMod exposing$/;" m roles:imported
4-
map input.elm /^ ( map, foldl$/;" f module:MyMod roles:imported
5-
foldl input.elm /^ ( map, foldl$/;" f module:MyMod roles:imported
6-
Maybe input.elm /^ , Maybe, Possibly$/;" t module:MyMod roles:imported
7-
Possibly input.elm /^ , Maybe, Possibly$/;" t module:MyMod roles:imported
8-
Result input.elm /^ , Result(..)$/;" t module:MyMod roles:imported
9-
MyList input.elm /^ , MyList(Empty), Tree(Node, Value, Special) )$/;" t module:MyMod roles:imported
10-
Empty input.elm /^ , MyList(Empty), Tree(Node, Value, Special) )$/;" c type:MyMod.MyList roles:imported
11-
Tree input.elm /^ , MyList(Empty), Tree(Node, Value, Special) )$/;" t module:MyMod roles:imported
12-
Node input.elm /^ , MyList(Empty), Tree(Node, Value, Special) )$/;" c type:MyMod.Tree roles:imported
13-
Value input.elm /^ , MyList(Empty), Tree(Node, Value, Special) )$/;" c type:MyMod.Tree roles:imported
14-
Special input.elm /^ , MyList(Empty), Tree(Node, Value, Special) )$/;" c type:MyMod.Tree roles:imported
4+
map input.elm /^ ( map, foldl$/;" f module:MyMod roles:exposed
5+
foldl input.elm /^ ( map, foldl$/;" f module:MyMod roles:exposed
6+
Maybe input.elm /^ , Maybe, Possibly$/;" t module:MyMod roles:exposed
7+
Possibly input.elm /^ , Maybe, Possibly$/;" t module:MyMod roles:exposed
8+
Result input.elm /^ , Result(..)$/;" t module:MyMod roles:exposed
9+
MyList input.elm /^ , MyList(Empty), Tree(Node, Value, Special) )$/;" t module:MyMod roles:exposed
10+
Empty input.elm /^ , MyList(Empty), Tree(Node, Value, Special) )$/;" c type:MyMod.MyList roles:exposed
11+
Tree input.elm /^ , MyList(Empty), Tree(Node, Value, Special) )$/;" t module:MyMod roles:exposed
12+
Node input.elm /^ , MyList(Empty), Tree(Node, Value, Special) )$/;" c type:MyMod.Tree roles:exposed
13+
Value input.elm /^ , MyList(Empty), Tree(Node, Value, Special) )$/;" c type:MyMod.Tree roles:exposed
14+
Special input.elm /^ , MyList(Empty), Tree(Node, Value, Special) )$/;" c type:MyMod.Tree roles:exposed
1515
otherMod input.elm /^import otherMod exposing (Coin)$/;" m roles:imported
16-
Coin input.elm /^import otherMod exposing (Coin)$/;" t module:otherMod roles:imported
16+
Coin input.elm /^import otherMod exposing (Coin)$/;" t module:otherMod roles:exposed
1717
Dotted.name.Here input.elm /^import Dotted.name.Here exposing (Dot(Cons))$/;" m roles:imported
18-
Dot input.elm /^import Dotted.name.Here exposing (Dot(Cons))$/;" t module:Dotted.name.Here roles:imported
19-
Cons input.elm /^import Dotted.name.Here exposing (Dot(Cons))$/;" c type:Dotted.name.Here.Dot roles:imported
18+
Dot input.elm /^import Dotted.name.Here exposing (Dot(Cons))$/;" t module:Dotted.name.Here roles:exposed
19+
Cons input.elm /^import Dotted.name.Here exposing (Dot(Cons))$/;" c type:Dotted.name.Here.Dot roles:exposed
2020
func input.elm /^func x =$/;" f module:SomeMod roles:def
2121
String input-1.elm /^import String$/;" m roles:imported
2222
A input-1.elm /^type A = B$/;" t roles:def
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
A1Mod input.elm /^module A1Mod exposing (..)$/;" m roles:def
22
A1NameSpace input.elm /^import A1Import as A1NameSpace exposing (a1ImpFunc)$/;" n module:A1Mod roles:def moduleName:A1Import
33
A1Import input.elm /^import A1Import as A1NameSpace exposing (a1ImpFunc)$/;" m roles:imported
4-
a1ImpFunc input.elm /^import A1Import as A1NameSpace exposing (a1ImpFunc)$/;" f module:A1Import roles:imported
4+
a1ImpFunc input.elm /^import A1Import as A1NameSpace exposing (a1ImpFunc)$/;" f module:A1Import roles:exposed
55
func input.elm /^func a1 =$/;" f module:A1Mod roles:def

Units/parser-elm.r/elm-optlist-compatibility.d/expected.tags

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Main input.elm /^port module Main exposing (..)$/;" m roles:def
22
List input.elm /^import List$/;" m roles:imported
33
Maybe input.elm /^import Maybe exposing (withDefault)$/;" m roles:imported
4-
withDefault input.elm /^import Maybe exposing (withDefault)$/;" f module:Maybe roles:imported
4+
withDefault input.elm /^import Maybe exposing (withDefault)$/;" f module:Maybe roles:exposed
55
Je input.elm /^import Json.Encode as Je$/;" n module:Main roles:def moduleName:Json.Encode
66
Json.Encode input.elm /^import Json.Encode as Je$/;" m roles:imported
77
Thing input.elm /^type Thing$/;" t module:Main roles:def

docs/man/ctags-lang-elm.7.rst

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@ EXAMPLES
3030
Imports
3131
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3232

33-
Imported items are tagged, but their role is "imported", not "def".
33+
Imported modules are tagged, and their role is "imported", not "def".
34+
Types, functions, etc which are exposed via imported module have their
35+
role as "exposed".
3436

35-
Imported items are marked as being in the scope of their own module,
37+
Exposed items are marked as being in the scope of their own module,
3638
not the module that's doing the importing.
3739

3840
"input.elm"
@@ -55,11 +57,11 @@ with "--options=NONE -o - --sort=no --extras=+r --fields=+r input.elm"
5557
5658
SomeMod input.elm /^module SomeMod exposing (..)$/;" m roles:def
5759
MyMod input.elm /^import MyMod exposing$/;" m roles:imported
58-
map input.elm /^ ( map$/;" f module:MyMod roles:imported
59-
Maybe input.elm /^ , Maybe$/;" t module:MyMod roles:imported
60-
Result input.elm /^ , Result(..)$/;" t module:MyMod roles:imported
61-
MyList input.elm /^ , MyList(Empty)$/;" t module:MyMod roles:imported
62-
Empty input.elm /^ , MyList(Empty)$/;" c type:MyMod.MyList roles:imported
60+
map input.elm /^ ( map$/;" f module:MyMod roles:exposed
61+
Maybe input.elm /^ , Maybe$/;" t module:MyMod roles:exposed
62+
Result input.elm /^ , Result(..)$/;" t module:MyMod roles:exposed
63+
MyList input.elm /^ , MyList(Empty)$/;" t module:MyMod roles:exposed
64+
Empty input.elm /^ , MyList(Empty)$/;" c type:MyMod.MyList roles:exposed
6365
6466
Namespaces
6567
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -82,7 +84,7 @@ with "--options=NONE -o - --sort=no --extras=+r --fields=+r input.elm"
8284
AMod input.elm /^module AMod exposing (..)$/;" m roles:def
8385
NSpace input.elm /^import MyImport as NSpace exposing (impFunc)$/;" n module:AMod roles:def moduleName:MyImport
8486
MyImport input.elm /^import MyImport as NSpace exposing (impFunc)$/;" m roles:imported
85-
impFunc input.elm /^import MyImport as NSpace exposing (impFunc)$/;" f module:MyImport roles:imported
87+
impFunc input.elm /^import MyImport as NSpace exposing (impFunc)$/;" f module:MyImport roles:exposed
8688
8789
Type names
8890
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

man/ctags-lang-elm.7.rst.in

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@ EXAMPLES
3030
Imports
3131
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3232

33-
Imported items are tagged, but their role is "imported", not "def".
33+
Imported modules are tagged, and their role is "imported", not "def".
34+
Types, functions, etc which are exposed via imported module have their
35+
role as "exposed".
3436

35-
Imported items are marked as being in the scope of their own module,
37+
Exposed items are marked as being in the scope of their own module,
3638
not the module that's doing the importing.
3739

3840
"input.elm"
@@ -55,11 +57,11 @@ with "--options=NONE -o - --sort=no --extras=+r --fields=+r input.elm"
5557

5658
SomeMod input.elm /^module SomeMod exposing (..)$/;" m roles:def
5759
MyMod input.elm /^import MyMod exposing$/;" m roles:imported
58-
map input.elm /^ ( map$/;" f module:MyMod roles:imported
59-
Maybe input.elm /^ , Maybe$/;" t module:MyMod roles:imported
60-
Result input.elm /^ , Result(..)$/;" t module:MyMod roles:imported
61-
MyList input.elm /^ , MyList(Empty)$/;" t module:MyMod roles:imported
62-
Empty input.elm /^ , MyList(Empty)$/;" c type:MyMod.MyList roles:imported
60+
map input.elm /^ ( map$/;" f module:MyMod roles:exposed
61+
Maybe input.elm /^ , Maybe$/;" t module:MyMod roles:exposed
62+
Result input.elm /^ , Result(..)$/;" t module:MyMod roles:exposed
63+
MyList input.elm /^ , MyList(Empty)$/;" t module:MyMod roles:exposed
64+
Empty input.elm /^ , MyList(Empty)$/;" c type:MyMod.MyList roles:exposed
6365

6466
Namespaces
6567
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -82,7 +84,7 @@ with "--options=NONE -o - --sort=no --extras=+r --fields=+r input.elm"
8284
AMod input.elm /^module AMod exposing (..)$/;" m roles:def
8385
NSpace input.elm /^import MyImport as NSpace exposing (impFunc)$/;" n module:AMod roles:def moduleName:MyImport
8486
MyImport input.elm /^import MyImport as NSpace exposing (impFunc)$/;" m roles:imported
85-
impFunc input.elm /^import MyImport as NSpace exposing (impFunc)$/;" f module:MyImport roles:imported
87+
impFunc input.elm /^import MyImport as NSpace exposing (impFunc)$/;" f module:MyImport roles:exposed
8688

8789
Type names
8890
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

peg/elm.peg

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ importedItem <-
294294
/ importedItemIgnored
295295

296296
importedFunction <- <lowerStartIdentifier> {
297-
makeElmTag(auxil, $1, $1s, K_FUNCTION, ELM_ROLE_IMPORTED);
297+
makeElmTag(auxil, $1, $1s, K_FUNCTION, ELM_ROLE_EXPOSED);
298298
}
299299

300300
# When importing a type and constructors we want the constructors
@@ -304,7 +304,7 @@ importedFunction <- <lowerStartIdentifier> {
304304

305305
importedType <-
306306
<upperStartIdentifier> {
307-
makeElmTagSettingScope(auxil, $1, $1s, K_TYPE, ELM_ROLE_IMPORTED);
307+
makeElmTagSettingScope(auxil, $1, $1s, K_TYPE, ELM_ROLE_EXPOSED);
308308
} (_0_ '(' _0_ importedTypeConstructorList _0_ ')')? {
309309
// We're done with the type and its constructors, so we can pop it
310310
POP_SCOPE(auxil);
@@ -317,7 +317,7 @@ importedTypeConstructorList <-
317317

318318
importedTypeConstructor <-
319319
<upperStartIdentifier> {
320-
makeElmTag(auxil, $1, $1s, K_CONSTRUCTOR, ELM_ROLE_IMPORTED);
320+
makeElmTag(auxil, $1, $1s, K_CONSTRUCTOR, ELM_ROLE_EXPOSED);
321321
}
322322

323323
# Function with a type annotation.

peg/elm_pre.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,13 @@ typedef enum {
5353
/* We only define roles which aren't def(ined)
5454
*/
5555
typedef enum {
56-
ELM_ROLE_IMPORTED
56+
ELM_ROLE_IMPORTED,
57+
ELM_ROLE_EXPOSED,
5758
} elmRoles;
5859

5960
static roleDefinition ElmRoles [] = {
60-
{ true, "imported", "item imported" },
61+
{ true, "imported", "module imported" },
62+
{ true, "exposed", "item exposed from a module" },
6163
};
6264

6365
typedef enum {

0 commit comments

Comments
 (0)