Hi there, 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.
Thanks.
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.)
Thanks Steve, it helped.
On Thu, 31 Mar 2011 09:32:53 -0400, Steve King wrote:
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.)
Hello.
The following document with a xml-stylesheet is not formatted in TextMate's web preview. It works in Safari, but only if the file extension is xhtml. My guess is that the the document sent to preview is served as html and not xhtml. Is there a way to make TextMate's web preview to understand that this is xhtml? -------------------------------------------- <?xml-stylesheet href="format.css" type="text/css"?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Title</title> </head>
<body> <h1>Hello</h1> <p>This page is not formatted according to format.css in TextMates web preview. It works well in Safari and Firefox</p> </body> </html> -------------------------------------------- Björn Jadelius Boll smedja Karlavagnsgatan 5 417 56 Göteborg
070-2504749 bjorn@bollsmedja.se
Hello!
Apologies for dragging up an old message. For my Uni Thesis work, I am going to translate some Fortran code to C++ or Python. My knowledge of Fortran, Regex and tmbundles is essentially zero beyond recent Kindle book reads. Because I did not think to search for a fortran bundle, I wrote my own primitive one which used the following for comments which seems to better colourise fortran code even if it is not 100% as per specs:
{ name = 'comment.line.character.fortran'; match = '^([\S]{1,}[\s]{1,})*'; }, { name = 'comment.line.character.fortran'; match = '!([\S\s]{1,})'; },
Testing in Textmate / Sublime, you can see my results in the left hand side of the image in this URL:
http://skitch.com/mlivingstone/f5h1w/tmscore.f
The right hand side is the existing Textmate fortran bundle colourising (shown in a Sublime window).
Could someone with SVN access please fix the spelling of "intrinsic" which the bundle author keeps using other dyslexic spelling? ;-)
This was my first attempt which worked quite well seeing I didn't know anything about what I was doing before commencing!
{ scopeName = 'source.fortran'; comment = '
This has only been tested against two classic column delimited Fortran 77 code files, and I have never written a Fortran program before, so buyer beware ;-) That said, it colourises code by other experienced Fortran code as I would expect. --- livingstonemark@gmail.com '; fileTypes = ( 'f', 'for', 'f77' ); foldingStartMarker = '/**|{\s*$'; foldingStopMarker = '**/|^\s*}'; patterns = ( { name = 'comment.line.character.fortran'; match = '^([\S]{1,}[\s]{1,})*'; }, { name = 'comment.line.character.fortran'; match = '!([\S\s]{1,})'; }, { name = 'constant.language.fortran'; match = '(?i)([.](true|false)[.])'; }, { name = 'entity.name.function.fortran'; match = '(?i)\b(getarg|iargc|read|print|format|close|open|write)\b'; }, { name = 'entity.name.tag.fortran'; match = '(?i)\b(unit=|file=|status=|end=|err=|fmt=|access=|form=|recl=)\b'; }, { name = 'keyword.control.fortran'; match = '(?i)\b(if|then|while|for|return|continue|stop|call|elseif|else if|else|[e][n][d][i][f]|do|enddo|goto|continue)\b'; }, { name = 'keyword.operator.fortran'; match = '(?i)([.](gt|ge|eq|lt|le|or|ne|and|eqv|neqv|not)[.])'; }, { name = 'keyword.other.fortran'; match = '(?i)\b(abs|acos|aint|anint|asin|atan|cos|cosh|dabs|datan2|dcos|dim|dsin|exp|int|log|log10|max|min|mod|nint|real|sign|sin|sinh|sqrt|tan|tanh|dsqrt)\b'; }, { name = 'storage.type.fortran'; match = '(?i)\b(program|parameter|subroutine|function|end|dimension|data|save|integer|external|intrinsic|implicit|implicit none|logical|character|real|double|float|precision|complex|equivalence|common|block data)\b'; }, { name = 'string.quoted.single.fortran'; begin = "'"; end = "'"; patterns = ( { name = 'constant.character.escape.fortran'; match = '\.'; }, ); }, ); }
The first language I was formally taught was Cobol in the early 80s so this all takes me back! :-D
Cheers,
MarkL
On 1/04/11 12:32 AM, Steve King wrote:
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.)
On Sep 26, 2011, at 1:17 AM, Mark Livingstone wrote:
Apologies for dragging up an old message. For my Uni Thesis work, I am going to translate some Fortran code to C++ or Python. My knowledge of Fortran, Regex and tmbundles is essentially zero beyond recent Kindle book reads. Because I did not think to search for a fortran bundle, I wrote my own primitive one which used the following for comments which seems to better colourise fortran code even if it is not 100% as per specs:
Just committed a fix for this, in the process the bundle was removed from SVN in favor of Github: