0
Under review

Fortran syntax highlighting of comments is bogus

Luc Bourhis 11 years ago in General updated by Alexander Blach (Developer) 11 years ago 4

In Fortran, any line starting with a star is a comment line. Textastic does not honour that as exemplified by the following example.

Image 66

Note how Fortran keywords are highlighted, clearly showing Textastic believes this is regular code instead of a comment block. It gets however worse the comment features one lone single quote:

Image 67

Textastic believes that the single quote starts a string and it highlights everything following it as a string. Not shown on this picture but the string highlighting only stops at the very end of the file about 300 lines further down!


As a result, Textatic Fortran syntax highlighting is unusable in practice.

I don't know much about Fortran, but every online source I see when I search for "fortran comments" says that only an exclamation mark "!" starts a comment line.


I could find a reference to the asterisk comments in the wikipedia article on Fortran: http://en.wikipedia.org/wiki/Fortran#Obsolescence_and_deletions - it's the last line in the table on obsolete features in Fortran 90. 


I assume that the since the syntax definition is called "Fortran - Modern" that it doesn't support legacy features like fixed from source code.

You actually provide "Fortran - Modern" and "Fortran - Punchcard". But neither of them knows that an asterisk in column 1 shall start a comment line. The definitive reference is Fortran 77 standard, section 3.2.1. The both of your Fortran syntax definition shall honour that since any F77 program shall be a valid F90 program, even though as you pointed out some features are obsolete, but that means "don't use them for new program", not "we don't support it anymore".


As a side note, the Fortran code I illustrated my bug report with is an excerpt of the LAPACK library, i.e. one of the most revered piece of FORTRAN in circulation!

I'm using the following TextMate bundle in Textastic: https://github.com/textmate/fortran.tmbundle

It doesn't seem to support these obsolete features and I don't plan to add it, sorry.

You can add custom syntax definitions to Textastic by using TextMate bundles. See
You could try to modify the Fortran bundle yourself. The syntax files are located here: https://github.com/textmate/fortran.tmbundle/tree/...

The Fortran (Modern) comment syntax is defined here: https://github.com/textmate/fortran.tmbundle/blob/...

It supports "!" and "!-". The difference is that comments with "!-" also appear in the symbol list.