Kate currently seems to have only one syntax-highlighting mode for Fortran. However, in the Fortran language there are two different source formats: * fixed format (from the old Fortran77 standard, extension .f) * free format (introduced with Fortran90, extension .f90) The keywords etc are the same, but one thing that differs is commenting: In fixed format every line with a 'c' in the first column is a comment, while in free format comments start with an '!' (in any column). Both of these mechanisms seem to be supported in Kate 16.04.3 on Ubuntu 16.10 (with Fortran highlighting file v2). The problem is that lines starting with 'c' are also displayed like a comment in f90 files (where only '!' indicates a comment). Simple example ('test.f90'): ! this is a test program that does absolutely nothing program test contains subroutine s end subroutine end program The first line is greyed out, which is correct, but also the third line ('contains') is greyed out, which is wrong. It is displayed normally if a space is inserted before 'contains.'
Implemented here: https://github.com/KDE/syntax-highlighting/pull/3
Submitted for review here: https://git.reviewboard.kde.org/r/129569/
Hi Janus, could you have a look at the review request again? I've added some comments and thoughts there. Thanks!
Git commit c579929d8667114ca1d440563d409f7c92cf00e6 by Christoph Cullmann, on behalf of Nibaldo González. Committed on 03/07/2019 at 18:19. Pushed by cullmann into branch 'master'. Fortran: implement free & fixed formats Summary: Task T9775 * Implement patch provided at: https://github.com/janusw/syntax-highlighting/commits/Fortran_2003_2008 * The `fortran-fixed.xml` file corresponds to the original file (`fortran.xml`), which is renamed. The `fortran-free.xml` file uses `IncludeRules` and include-keywords to avoid replicated code. * Some unnecessary `RegExpr` rules are replaced for optimization. TODO: ask for MIT license. Reviewers: #framework_syntax_highlighting, dhaumann, cullmann Reviewed By: #framework_syntax_highlighting, cullmann Subscribers: nononux, kwrite-devel, kde-frameworks-devel Tags: #kate, #frameworks Differential Revision: https://phabricator.kde.org/D21713 A +28 -0 autotests/folding/highlight.f.fold M +9 -13 autotests/folding/highlight.f90.fold A +35 -0 autotests/html/highlight.f.html M +24 -28 autotests/html/highlight.f90.html A +28 -0 autotests/input/highlight.f M +8 -12 autotests/input/highlight.f90 A +28 -0 autotests/reference/highlight.f.ref M +23 -27 autotests/reference/highlight.f90.ref R +36 -38 data/syntax/fortran-fixed.xml [from: data/syntax/fortran.xml - 087% similarity] A +311 -0 data/syntax/fortran-free.xml https://commits.kde.org/syntax-highlighting/c579929d8667114ca1d440563d409f7c92cf00e6