[TxMt] Fortran asterisk comments

Stefan Duret sduret at gmail.com
Sun Jan 13 18:40:19 UTC 2008


Thanks for the reply, but I've already figured this one out.  The  
problem was that the asterisk was being recognized as the  
multiplication operator before being recognized as the beginning of a  
comment line.  The simple solution was therefore to move all parts of  
the language grammar describing comments above those parts describing  
mathematical operators.

Also, there is no need to escape the asterisk (or any other special  
character) when it is placed between square brackets.  Fortran 77 does  
not allow for whitespace before the asterisk either so there is no  
need for a \s*.


On 13-Jan-08, at 8:11 AM, Dougal wrote:

> Not sure about the rest of it (I'm pretty unfamiliar with language
> grammars), but you'll definitely want to try escaping the asterisk;
> you'd probably be good with "^\*" instead of "^[*]". (You might also
> want a \s* -- any amount of whitespace -- between the ^, which means
> start-of-line, and the \*, to allow for whitespace before the
> asterisk, if Fortran allows it; I don't know, never used it.)
>
> On Jan 11, 2008 2:34 PM, Stefan Duret <sduret at gmail.com> wrote:
>> Hi,
>>
>> In the Fortran bundle, there doesn't appear to be any support for
>> comment lines beginning with an asterisk, only for comments beginning
>> with C or c. I have tried to add this in to the language but I am
>> quite unfamiliar with how to do this properly and am I not very
>> familiar with regular expressions.  I tried adding the following in
>> the bundle editor (using comment.line.c.fortran as an example) but it
>> still does not recognize lines beginning in * as comments. Any help
>> would be appreciated.
>>
>>                {       name = 'comment.line.asterisk.fortran';
>>                        begin = '^[*]';
>>                        end = '$\n?';
>>                        beginCaptures = { 0 = { name =
>> 'punctuation.definition.comment.fortran'; }; };
>>                        patterns = ( { match = '\\\s*\n'; } );
>>                },
>>
>> Thanks,
>>
>> Stefan
>>
>> ______________________________________________________________________
>> For new threads USE THIS: textmate at lists.macromates.com
>> (threading gets destroyed and the universe will collapse if you  
>> don't)
>> http://lists.macromates.com/mailman/listinfo/textmate
>>
>
> ______________________________________________________________________
> For new threads USE THIS: textmate at lists.macromates.com
> (threading gets destroyed and the universe will collapse if you don't)
> http://lists.macromates.com/mailman/listinfo/textmate




More information about the textmate mailing list