Hi all,

when using TextMate2 with (modern) Fortran I found that the implementation of derived types does not support the access attributes. For example,

type node
   integer ::  i
end type node

looks nice, while inserting the "public" or "private" attributes as in

type, public ::  node
   integer ::  i
end type node

does not produce a consistent coloring (see also the attached screenshot1.png).

In an first attempt to resolve the problem, I changed the the corresponding entry in the Fortran-Modern Grammar from

{ name = 'meta.type-definition.fortran.modern';
comment = 'Type definition';
begin = '(?x: # extended mode
^\s*    # begining of line and some space
(?i:(type))  # 1: word type
\s+ # some space
([a-zA-Z_][a-zA-Z0-9_]*) # 2: type name
)';
end = '(?x:
((?i:end)) # 1: the word end
\s*     # possibly some space
(?i:(type))? # 2: possibly the word type
(\s+[A-Za-z_][A-Za-z0-9_]*)? # 3: possibly the name
)';
beginCaptures = {
1 = { name = 'storage.type.fortran.modern'; };
2 = { name = 'entity.name.type.fortran.modern'; };
};
endCaptures = {
1 = { name = 'keyword.other.fortran'; };
2 = { name = 'storage.type.fortran.modern'; };
3 = { name = 'entity.name.type.end.fortran.modern'; };
};

to

{ name = 'meta.type-definition.fortran.modern';
comment = 'Type definition';
begin = '(?x: # extended mode
^\s*    # begining of line and some space
(?i:(type))  # 1: word type
          (,\*(?i:(public|private)?)) # 2: optional access attribute
\s+ # some space
([a-zA-Z_][a-zA-Z0-9_]*) # 3: type name
)';
end = '(?x:
((?i:end)) # 1: the word end
\s*     # possibly some space
(?i:(type))? # 2: possibly the word type
(\s+[A-Za-z_][A-Za-z0-9_]*)? # 3: possibly the name
)';
beginCaptures = {
1 = { name = 'storage.type.fortran.modern'; };
2 = { name = 'storage.modifier.fortran.modern'; };
        3 = { name = 'entity.name.type.fortran.modern'; };
};
endCaptures = {
1 = { name = 'keyword.other.fortran'; };
2 = { name = 'storage.type.fortran.modern'; };
3 = { name = 'entity.name.type.end.fortran.modern'; };
};


which made things even worse (screenshot2.png). I tried several other versions, with no essential improvement.

Can anybody give me a hint how to resolve the problem?


Regards,
Joerg