Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions Tmain/list-roles.d/stdout-expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,14 @@ DTD e/element attOwner on attributes owner
DTD p/parameterEntity condition on conditions
DTD p/parameterEntity elementName on element names
DTD p/parameterEntity partOfAttDef on part of attribute definition
Elm c/constructor imported on item imported
Elm f/function imported on item imported
Elm m/module imported on item imported
Elm t/type imported on item imported
Elm c/constructor exposed on item exposed from a module
Elm c/constructor imported on module imported
Elm f/function exposed on item exposed from a module
Elm f/function imported on module imported
Elm m/module exposed on item exposed from a module
Elm m/module imported on module imported
Elm t/type exposed on item exposed from a module
Elm t/type imported on module imported
Flex I/import import on imports
GDScript c/class extended on used as a base class for extending
GemSpec g/gem develDep on specifying development dependency
Expand Down Expand Up @@ -148,10 +152,14 @@ DTD e/element attOwner on attributes owner
DTD p/parameterEntity condition on conditions
DTD p/parameterEntity elementName on element names
DTD p/parameterEntity partOfAttDef on part of attribute definition
Elm c/constructor imported on item imported
Elm f/function imported on item imported
Elm m/module imported on item imported
Elm t/type imported on item imported
Elm c/constructor exposed on item exposed from a module
Elm c/constructor imported on module imported
Elm f/function exposed on item exposed from a module
Elm f/function imported on module imported
Elm m/module exposed on item exposed from a module
Elm m/module imported on module imported
Elm t/type exposed on item exposed from a module
Elm t/type imported on module imported
Flex I/import import on imports
GDScript c/class extended on used as a base class for extending
GemSpec g/gem develDep on specifying development dependency
Expand Down
28 changes: 14 additions & 14 deletions Units/parser-elm.r/elm-imports.d/expected.tags
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
SomeMod input.elm /^module SomeMod exposing (..)$/;" m roles:def
PlainImport input.elm /^import PlainImport$/;" m roles:imported
MyMod input.elm /^import MyMod exposing$/;" m roles:imported
map input.elm /^ ( map, foldl$/;" f module:MyMod roles:imported
foldl input.elm /^ ( map, foldl$/;" f module:MyMod roles:imported
Maybe input.elm /^ , Maybe, Possibly$/;" t module:MyMod roles:imported
Possibly input.elm /^ , Maybe, Possibly$/;" t module:MyMod roles:imported
Result input.elm /^ , Result(..)$/;" t module:MyMod roles:imported
MyList input.elm /^ , MyList(Empty), Tree(Node, Value, Special) )$/;" t module:MyMod roles:imported
Empty input.elm /^ , MyList(Empty), Tree(Node, Value, Special) )$/;" c type:MyMod.MyList roles:imported
Tree input.elm /^ , MyList(Empty), Tree(Node, Value, Special) )$/;" t module:MyMod roles:imported
Node input.elm /^ , MyList(Empty), Tree(Node, Value, Special) )$/;" c type:MyMod.Tree roles:imported
Value input.elm /^ , MyList(Empty), Tree(Node, Value, Special) )$/;" c type:MyMod.Tree roles:imported
Special input.elm /^ , MyList(Empty), Tree(Node, Value, Special) )$/;" c type:MyMod.Tree roles:imported
map input.elm /^ ( map, foldl$/;" f module:MyMod roles:exposed
foldl input.elm /^ ( map, foldl$/;" f module:MyMod roles:exposed
Maybe input.elm /^ , Maybe, Possibly$/;" t module:MyMod roles:exposed
Possibly input.elm /^ , Maybe, Possibly$/;" t module:MyMod roles:exposed
Result input.elm /^ , Result(..)$/;" t module:MyMod roles:exposed
MyList input.elm /^ , MyList(Empty), Tree(Node, Value, Special) )$/;" t module:MyMod roles:exposed
Empty input.elm /^ , MyList(Empty), Tree(Node, Value, Special) )$/;" c type:MyMod.MyList roles:exposed
Tree input.elm /^ , MyList(Empty), Tree(Node, Value, Special) )$/;" t module:MyMod roles:exposed
Node input.elm /^ , MyList(Empty), Tree(Node, Value, Special) )$/;" c type:MyMod.Tree roles:exposed
Value input.elm /^ , MyList(Empty), Tree(Node, Value, Special) )$/;" c type:MyMod.Tree roles:exposed
Special input.elm /^ , MyList(Empty), Tree(Node, Value, Special) )$/;" c type:MyMod.Tree roles:exposed
otherMod input.elm /^import otherMod exposing (Coin)$/;" m roles:imported
Coin input.elm /^import otherMod exposing (Coin)$/;" t module:otherMod roles:imported
Coin input.elm /^import otherMod exposing (Coin)$/;" t module:otherMod roles:exposed
Dotted.name.Here input.elm /^import Dotted.name.Here exposing (Dot(Cons))$/;" m roles:imported
Dot input.elm /^import Dotted.name.Here exposing (Dot(Cons))$/;" t module:Dotted.name.Here roles:imported
Cons input.elm /^import Dotted.name.Here exposing (Dot(Cons))$/;" c type:Dotted.name.Here.Dot roles:imported
Dot input.elm /^import Dotted.name.Here exposing (Dot(Cons))$/;" t module:Dotted.name.Here roles:exposed
Cons input.elm /^import Dotted.name.Here exposing (Dot(Cons))$/;" c type:Dotted.name.Here.Dot roles:exposed
func input.elm /^func x =$/;" f module:SomeMod roles:def
String input-1.elm /^import String$/;" m roles:imported
A input-1.elm /^type A = B$/;" t roles:def
Expand Down
2 changes: 1 addition & 1 deletion Units/parser-elm.r/elm-namespaces.d/expected.tags
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
A1Mod input.elm /^module A1Mod exposing (..)$/;" m roles:def
A1NameSpace input.elm /^import A1Import as A1NameSpace exposing (a1ImpFunc)$/;" n module:A1Mod roles:def moduleName:A1Import
A1Import input.elm /^import A1Import as A1NameSpace exposing (a1ImpFunc)$/;" m roles:imported
a1ImpFunc input.elm /^import A1Import as A1NameSpace exposing (a1ImpFunc)$/;" f module:A1Import roles:imported
a1ImpFunc input.elm /^import A1Import as A1NameSpace exposing (a1ImpFunc)$/;" f module:A1Import roles:exposed
func input.elm /^func a1 =$/;" f module:A1Mod roles:def
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Main input.elm /^port module Main exposing (..)$/;" m roles:def
List input.elm /^import List$/;" m roles:imported
Maybe input.elm /^import Maybe exposing (withDefault)$/;" m roles:imported
withDefault input.elm /^import Maybe exposing (withDefault)$/;" f module:Maybe roles:imported
withDefault input.elm /^import Maybe exposing (withDefault)$/;" f module:Maybe roles:exposed
Je input.elm /^import Json.Encode as Je$/;" n module:Main roles:def moduleName:Json.Encode
Json.Encode input.elm /^import Json.Encode as Je$/;" m roles:imported
Thing input.elm /^type Thing$/;" t module:Main roles:def
Expand Down
18 changes: 10 additions & 8 deletions docs/man/ctags-lang-elm.7.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ EXAMPLES
Imports
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

Imported items are marked as being in the scope of their own module,
Exposed items are marked as being in the scope of their own module,
not the module that's doing the importing.

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

SomeMod input.elm /^module SomeMod exposing (..)$/;" m roles:def
MyMod input.elm /^import MyMod exposing$/;" m roles:imported
map input.elm /^ ( map$/;" f module:MyMod roles:imported
Maybe input.elm /^ , Maybe$/;" t module:MyMod roles:imported
Result input.elm /^ , Result(..)$/;" t module:MyMod roles:imported
MyList input.elm /^ , MyList(Empty)$/;" t module:MyMod roles:imported
Empty input.elm /^ , MyList(Empty)$/;" c type:MyMod.MyList roles:imported
map input.elm /^ ( map$/;" f module:MyMod roles:exposed
Maybe input.elm /^ , Maybe$/;" t module:MyMod roles:exposed
Result input.elm /^ , Result(..)$/;" t module:MyMod roles:exposed
MyList input.elm /^ , MyList(Empty)$/;" t module:MyMod roles:exposed
Empty input.elm /^ , MyList(Empty)$/;" c type:MyMod.MyList roles:exposed

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

Type names
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
18 changes: 10 additions & 8 deletions man/ctags-lang-elm.7.rst.in
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ EXAMPLES
Imports
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

Imported items are marked as being in the scope of their own module,
Exposed items are marked as being in the scope of their own module,
not the module that's doing the importing.

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

SomeMod input.elm /^module SomeMod exposing (..)$/;" m roles:def
MyMod input.elm /^import MyMod exposing$/;" m roles:imported
map input.elm /^ ( map$/;" f module:MyMod roles:imported
Maybe input.elm /^ , Maybe$/;" t module:MyMod roles:imported
Result input.elm /^ , Result(..)$/;" t module:MyMod roles:imported
MyList input.elm /^ , MyList(Empty)$/;" t module:MyMod roles:imported
Empty input.elm /^ , MyList(Empty)$/;" c type:MyMod.MyList roles:imported
map input.elm /^ ( map$/;" f module:MyMod roles:exposed
Maybe input.elm /^ , Maybe$/;" t module:MyMod roles:exposed
Result input.elm /^ , Result(..)$/;" t module:MyMod roles:exposed
MyList input.elm /^ , MyList(Empty)$/;" t module:MyMod roles:exposed
Empty input.elm /^ , MyList(Empty)$/;" c type:MyMod.MyList roles:exposed

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

Type names
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
6 changes: 3 additions & 3 deletions peg/elm.peg
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ importedItem <-
/ importedItemIgnored

importedFunction <- <lowerStartIdentifier> {
makeElmTag(auxil, $1, $1s, K_FUNCTION, ELM_ROLE_IMPORTED);
makeElmTag(auxil, $1, $1s, K_FUNCTION, ELM_ROLE_EXPOSED);
}

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

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

importedTypeConstructor <-
<upperStartIdentifier> {
makeElmTag(auxil, $1, $1s, K_CONSTRUCTOR, ELM_ROLE_IMPORTED);
makeElmTag(auxil, $1, $1s, K_CONSTRUCTOR, ELM_ROLE_EXPOSED);
}

# Function with a type annotation.
Expand Down
6 changes: 4 additions & 2 deletions peg/elm_pre.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,13 @@ typedef enum {
/* We only define roles which aren't def(ined)
*/
typedef enum {
ELM_ROLE_IMPORTED
ELM_ROLE_IMPORTED,
ELM_ROLE_EXPOSED,
} elmRoles;

static roleDefinition ElmRoles [] = {
{ true, "imported", "item imported" },
{ true, "imported", "module imported" },
{ true, "exposed", "item exposed from a module" },
};

typedef enum {
Expand Down