[TxMt] Re: Unnecessary commenting line in modern fortran mode
Steve King
sking at arbor.net
Thu Mar 31 13:32:53 UTC 2011
On 2011-03-30 18:52, Kaster Might wrote:
> If some variable starts with "C", the whole line which contains that
> variable and where it at the very first place highlighted as comment.
> I suppose it comes from old F77 style, where C denotes comment, but
> it's not necessary now. Is there any way to fix it? My current
> way-around is to put single space before that variable, but in this
> case overall code doesn't look as nice as before.
The 'Fortran - Modern' bundle inherits this behavior from 'Fortran -
Punchcard'. Modern makes an attempt to flag lines beginning with 'C' as
invalid, but only if the 'C' is followed by whitespace. Punchcard treats
any line beginning with 'C' as a comment.
I think the easiest way to work around this is to edit the Punchcard
language definition to change the 'begin' expression for
'comment.line.c.fortran' from '^[Cc]' to '^[Cc]\s+', which requires
comments to start with 'C' followed by whitespace.. This may not
strictly adhere to the language spec, but it probably matches common
practice. And if you're not using the older F77 style it won't matter
anyway.
{ name = 'comment.line.c.fortran';
begin = '^[Cc]\s+';
end = '$\n?';
beginCaptures = { 0 = { name =
'punctuation.definition.comment.fortran'; }; };
patterns = ( { match = '\\\s*\n'; } );
},
(Wow, FORTRAN... That takes me back to 1984 and the start of college.
That was the first year the freshman FORTRAN class was taught using an
interactive terminal instead of on punch cards. Of course, it was on
VM/CMS which implemented a virtual card punch/reader system, but at
least we had the glorified virtual card punch that was XEDIT.)
--
Steve King
Sr. Software Engineer
Arbor Networks
+1 734 821 1461
www.arbornetworks.com <http://www.arbornetworks.com/>
More information about the textmate
mailing list