[TxMt] Fortran bundle type definition

Jörg Stiller joerg.stiller at tu-dresden.de
Tue Mar 5 15:39:00 UTC 2013


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






-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20130305/123d77a7/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: screenshot1.png
Type: image/png
Size: 36196 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20130305/123d77a7/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: screenshot2.png
Type: image/png
Size: 36063 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20130305/123d77a7/attachment-0003.png>


More information about the textmate mailing list