D21713: Fortran: implement free & fixed formats
Arnaud Ruiz
noreply at phabricator.kde.org
Tue Jul 2 21:18:45 BST 2019
nononux added a comment.
Hi, thanks for the patch. I suggest additionnal changes to improve the syntax highlighting for Fortran fixed format.
I write fixed format fortran at least once a week using Kate. I can confirm these modifications will be usefull at least for me ;)
I tested the proposed changes on this file www.unige.ch/~hairer/prog/nonstiff/dop853.f (+ add some characters to test the comments highlighting after the 72th column).
Unfortunately I don't see how to write the changes without regular expressions, but I've only low knowledge on syntax highlighting files.
INLINE COMMENTS
> fortran-fixed.xml:375
> <IncludeRules context="find_preprocessor" />
> <IncludeRules context="find_comments" />
> <IncludeRules context="find_symbols" />
I propose to add this (why below)
<IncludeRules context="find_continue" />
> fortran-fixed.xml:408
> <context attribute="Normal Text" lineEndContext="#stay" name="find_comments">
> <AnyChar attribute="Comment" context="comment" String="cC*" column="0"/>
> </context>
I propose to add theses lines:
<DetectChar attribute="Comment" context="comment" char="!"/>
<RegExpr attribute="Comment" context="comment" String=".*" column="72" />
1st line : The "!" can be used even in fixed format. It can be used at any place in the line to comment the end of the line
2nd line : The characters after the 72th column are ignored by the compiler. So it's easier for the user if they are marked as a comment.
ref : my everyday use of Fortran + https://docs.oracle.com/cd/E19957-01/805-4939/6j4m0vn6l/index.html
> fortran-fixed.xml:424
> </context>
>
> <!-- This context highlights items inside the parentesis of a function -->
I propose to add this (with the line above) :
<!-- This context highlights the continuation character -->
<context attribute="Normal Text" lineEndContext="#stay" name="find_continue">
<RegExpr attribute="Continuation character" context="#stay" String="^ [^0-9\s]"/>
</context>
If the 5 firsts characters are blank and the 6th is not blank and not a number, this indicate a continuation character (usually "&" or "*").
It will be easier for the user to place the continuation character at the right column if it is coloured.
> fortran-fixed.xml:569
> <itemData name="IO Function" defStyleNum="dsFunction" bold="0" italic="0"/>
> <itemData name="Elemental Procedure" defStyleNum="dsBuiltIn" bold="1" italic="0"/>
> <itemData name="Inquiry Function" defStyleNum="dsFunction" bold="1" italic="1"/>
To complete the above modification:
<itemData name="Continuation character" defStyleNum="dsBuiltIn" bold="1" italic="0"/>
REPOSITORY
R216 Syntax Highlighting
REVISION DETAIL
https://phabricator.kde.org/D21713
To: nibags, #framework_syntax_highlighting, dhaumann, cullmann
Cc: nononux, kwrite-devel, kde-frameworks-devel, LeGast00n, domson, michaelh, ngraham, bruns, demsking, cullmann, sars, dhaumann
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kwrite-devel/attachments/20190702/3b9241f7/attachment.html>
More information about the KWrite-Devel
mailing list