GNOME Bugzilla – Bug 143970
Syntax highlighting for Fortran
Last modified: 2004-12-22 21:47:04 UTC
Please find attached a .lang file for Fortran 95. It's not comprehensive or complicated, but it's better than nothing.
Created attachment 28481 [details] Fortan 95 syntax file
Sorry for the late reply. May you please attach a couple of Fortran 95 files, so that I can test your .lang file? Note that I don't know Fortran. Thanks. Paolo
Created attachment 29684 [details] Some Fortran.
Created attachment 29685 [details] Some more fortran
Comment on attachment 28481 [details] Fortan 95 syntax file Testing the .lang file with the samples you sent me I have seen some problems: - enddo is not higlighted - Shouldn't PARAMETER, INTENT, DIMENSION, etc. be highlighted too? - "sin" is not hightlighted - I don't like "String_doublequotes" an d "String_singlequotes" names. Do not use "_" in names. - The following warning is displayed in the console: "(gedit:20602): Gtk-WARNING **: Failed to set label from markup due to error parsing markup: Error on line 2: Character '=' is not valid inside an entity name". Could you please try to fix these problems? Normally I try to use the same colors as Vim and use the Vim syntax files as a starting point.
The warning "(gedit:20602): Gtk-WARNING **: Failed to set label from markup due to error parsing markup: Error on line 2: Character '=' is not valid inside an entity name" is not due to your .lang file. Sorry.
Created attachment 29840 [details] Second try at fortran 95 syntax highlighting file This version includes the intrinsic functions (such as sin) listed in the vim syntax file, as well as some other additions. It remains non-comprehensive, but should be substantially less likely to raise eyebrows than the previous version. One known limitation is that it fails to distinguish between the use of a type name in a declaration, and its use in the function. I don't understand the vim syntax file well enough to see how to do that.
Thanks, I just committed the file. Please feel free to close the bug if you feel the limitation is not very important. I don't know Fortran so I can't tell. We can always reopen later, or open new bugs.
Created attachment 31833 [details] [review] A couple of additions -Add support for ancient-style line comments (a line beginning with C) -Add "data","block data","common" keywords
I have just committed a modified version of the last John' patch. Closing. Jonh: feel free to open a new bug if you feel that the limitation of the current fortran.lang file are important.