[TxMt] Re: Colorize the name of the loops in Fortran

Allan Odgaard throw-away-1 at macromates.com
Sat Sep 16 18:21:34 UTC 2006


On 16/9/2006, at 14:59, guerom00 wrote:

> [...] what I did :
> {	match = '(^[\t ]*)([A-Za-z_]+)(\s*:\b)';
> 	captures = { 2 = { name = 'name.loop'; }; };
> },
> {	match = '(^[\t ]*(?i:enddo|endif|end\sdo|end\sif)\s*\b)([A-Za-z_] 
> +)(\b.*$)';
> 	captures = { 2 = { name = 'name.loop'; }; };
> },
> Here is a screenshot of what happens :
> http://img96.imageshack.us/img96/5107/image1wn1.jpg
> You see that's pretty much OK except for the
> “enddo”, “endif” words which lose their color as they are
> not anymore in the 'keyword.other.Executable.fortran'
> scope...
> Can anything be done about that ?

Yes, the captures key is used to assign properties (names) to each of  
the captures, so in the second rule, let it be:

     captures = {
         2 = { name = 'keyword.other.Executable.fortran'; };
         3 = { name = 'name.loop'; };
     };

I noticed that you had capture #2 be the name of the loop, but I  
count that as being capture #3, and #2 being the keyword.

Btw: I would probably use a name of entity.name.type.loop.fortran for  
the loop label.




More information about the textmate mailing list