| 1 |
<?xml version="1.0" encoding="UTF-8"?> |
| 2 |
<!DOCTYPE language> |
| 3 |
<language name="Fortran (Free Format)" version="5" kateversion="5.53" section="Sources" extensions="*.f90;*.F90;*.f95;*.F95;*.f03;*.F03;*.f08;*.F08;" mimetype="text/x-fortran-src" casesensitive="0" author="Franchin Matteo ([email protected]), Janus Weil" license="MIT" priority="10"> |
| 4 |
<!-- Original author: Franchin Matteo ([email protected]). |
| 5 |
Adaptation to free & fixed format: Janus Weil. |
| 6 |
--> |
| 7 |
<!-- NOTE: Keep in sync with the "Fortran (Fixed Format)" highlighter! (fortran-fixed.xml) --> |
| 8 |
<highlighting> |
| 9 |
|
| 10 |
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * --> |
| 11 |
<!-- * L I S T S * --> |
| 12 |
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * --> |
| 13 |
<list name="keywords"> |
| 14 |
<include>keywords##Fortran (Fixed Format)</include> |
| 15 |
<item>associate</item> |
| 16 |
<item>import</item> |
| 17 |
<item>impure</item> |
| 18 |
</list> |
| 19 |
<list name="io_functions"> |
| 20 |
<include>io_functions##Fortran (Fixed Format)</include> |
| 21 |
</list> |
| 22 |
<!-- Keywords inside read(...), write(...), backspace(...), |
| 23 |
rewind(...), endfile(...), close(...) --> |
| 24 |
<list name="io_keywords"> |
| 25 |
<include>io_keywords##Fortran (Fixed Format)</include> |
| 26 |
</list> |
| 27 |
<!-- Keywords inside open(...) --> |
| 28 |
<list name="open_keywords"> |
| 29 |
<include>open_keywords##Fortran (Fixed Format)</include> |
| 30 |
</list> |
| 31 |
<!-- Keywords inside inquire(...) --> |
| 32 |
<list name="inquire_keywords"> |
| 33 |
<include>inquire_keywords##Fortran (Fixed Format)</include> |
| 34 |
</list> |
| 35 |
<list name="types"> |
| 36 |
<include>types##Fortran (Fixed Format)</include> |
| 37 |
<item>abstract</item> |
| 38 |
<item>asynchronous</item> |
| 39 |
<item>bind</item> |
| 40 |
<item>contiguous</item> |
| 41 |
<item>deferred</item> |
| 42 |
<item>enum</item> |
| 43 |
<item>enumerator</item> |
| 44 |
<item>final</item> |
| 45 |
<item>generic</item> |
| 46 |
<item>nopass</item> |
| 47 |
<item>non_overridable</item> |
| 48 |
<item>protected</item> |
| 49 |
<item>value</item> |
| 50 |
<item>volatile</item> |
| 51 |
</list> |
| 52 |
|
| 53 |
<!-- There are 4 types of intrinsic procedures in Fortran 90: |
| 54 |
1) Elemental procedures (elemental_procs); |
| 55 |
2) Inquiry functions (inquiry_fn); |
| 56 |
3) Transformational functions (transform_fn); |
| 57 |
4) Non elemental subroutines (non_elem_subr); |
| 58 |
Often mathematical functions have one generic form and many specific names! |
| 59 |
If you use the generic form, the compiler will select the right function |
| 60 |
to use depending on the type of the arguments. |
| 61 |
But you can use also the specific names! |
| 62 |
--> |
| 63 |
|
| 64 |
<!-- E L E M E N T A L P R O C E D U R E S --> |
| 65 |
<list name="elemental_procs"> |
| 66 |
<include>elemental_procs##Fortran (Fixed Format)</include> |
| 67 |
<!-- Elemental mathematical functions --> |
| 68 |
<item>acosh</item> |
| 69 |
<item>asinh</item> |
| 70 |
<item>atanh</item> |
| 71 |
<item>bessel_j0</item> |
| 72 |
<item>bessel_j1</item> |
| 73 |
<item>bessel_jn</item> |
| 74 |
<item>bessel_y0</item> |
| 75 |
<item>bessel_y1</item> |
| 76 |
<item>bessel_yn</item> |
| 77 |
<item>erf</item> |
| 78 |
<item>erfc</item> |
| 79 |
<item>erfc_scaled</item> |
| 80 |
<item>gamma</item> |
| 81 |
<item>log_gamma</item> |
| 82 |
<item>hypot</item> |
| 83 |
</list> |
| 84 |
|
| 85 |
<!-- I N Q U I R Y F U N C T I O N S --> |
| 86 |
<list name="inquiry_fn"> |
| 87 |
<include>inquiry_fn##Fortran (Fixed Format)</include> |
| 88 |
<!-- Inquiry functions for any type --> |
| 89 |
<item>extends_type_of</item> |
| 90 |
<item>same_type_as</item> |
| 91 |
<item>storage_size</item> |
| 92 |
<!-- Coarray inquiry functions --> |
| 93 |
<item>lcobound</item> |
| 94 |
<item>ucobound</item> |
| 95 |
<item>image_index</item> |
| 96 |
</list> |
| 97 |
|
| 98 |
<!-- T R A N S F O R M A T I O N A L F U N C T I O N S --> |
| 99 |
<list name="transform_fn"> |
| 100 |
<include>transform_fn##Fortran (Fixed Format)</include> |
| 101 |
<!-- Transformational functions for kind values --> |
| 102 |
<item>selected_char_kind</item> |
| 103 |
<!-- Transformational functions that reduce arrays --> |
| 104 |
<item>parity</item> |
| 105 |
<item>iall</item> |
| 106 |
<item>iany</item> |
| 107 |
<item>iparity</item> |
| 108 |
<!-- Coarray transformational functions --> |
| 109 |
<item>num_images</item> |
| 110 |
<item>this_image</item> |
| 111 |
</list> |
| 112 |
|
| 113 |
<!-- N O N E L E M E N T A L S U B R O U T I N E S --> |
| 114 |
<list name="non_elem_subr"> |
| 115 |
<include>non_elem_subr##Fortran (Fixed Format)</include> |
| 116 |
<!-- Real time clock --> |
| 117 |
<item>cpu_time</item> |
| 118 |
<!-- System commands --> |
| 119 |
<item>execute_command_line</item> |
| 120 |
<item>get_environment_variable</item> |
| 121 |
</list> |
| 122 |
|
| 123 |
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * --> |
| 124 |
<!-- * C O N T E X T S * --> |
| 125 |
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * --> |
| 126 |
<contexts> |
| 127 |
<context attribute="Normal Text" lineEndContext="#stay" name="default" > |
| 128 |
<IncludeRules context="find_strings" /> |
| 129 |
<IncludeRules context="find_io_stmnts" /> |
| 130 |
<IncludeRules context="find_op_and_log##Fortran (Fixed Format)" /> |
| 131 |
<IncludeRules context="find_numbers##Fortran (Fixed Format)" /> |
| 132 |
<IncludeRules context="find_preprocessor##Fortran (Fixed Format)" /> |
| 133 |
<IncludeRules context="find_comments" /> |
| 134 |
<IncludeRules context="find_symbols##Fortran (Fixed Format)" /> |
| 135 |
<IncludeRules context="find_begin_stmnts" /> |
| 136 |
<IncludeRules context="find_mid_stmnts" /> |
| 137 |
<IncludeRules context="find_end_stmnts" /> |
| 138 |
<IncludeRules context="find_decls" /> |
| 139 |
<IncludeRules context="find_intrinsics" /> |
| 140 |
</context> |
| 141 |
<!--************************END OF THE MAIN CONTEXT*************************--> |
| 142 |
|
| 143 |
|
| 144 |
<!-- IMPORTANT: If you modify something, do it also in "fortran-fixed.xml"! --> |
| 145 |
|
| 146 |
<!-- This context highlights comments --> |
| 147 |
<context attribute="Normal Text" lineEndContext="#stay" name="find_comments"> |
| 148 |
<DetectChar attribute="Comment" context="comment" char="!"/> |
| 149 |
</context> |
| 150 |
<context attribute="Comment" lineEndContext="#pop" name="comment"> |
| 151 |
<IncludeRules context="##Comments"/> |
| 152 |
</context> |
| 153 |
|
| 154 |
<!-- This context highlights items inside the parentesis of a function --> |
| 155 |
<context attribute="Normal Text" lineEndContext="#stay" name="inside_func_paren"> |
| 156 |
<!-- inside_func_paren##Fortran (Fixed Format) --> |
| 157 |
<DetectChar attribute="Normal Text" context="inside_func_paren" char="("/> |
| 158 |
<DetectChar attribute="Normal Text" context="#pop" char=")"/> |
| 159 |
<IncludeRules context="find_strings" /> |
| 160 |
<IncludeRules context="find_intrinsics" /> |
| 161 |
<IncludeRules context="find_numbers##Fortran (Fixed Format)" /> |
| 162 |
</context> |
| 163 |
|
| 164 |
<!-- The following two contexts match input/output statements --> |
| 165 |
<context attribute="Normal Text" lineEndContext="#stay" name="find_io_stmnts"> |
| 166 |
<!-- find_io_stmnts##Fortran (Fixed Format) --> |
| 167 |
<RegExpr attribute="IO Function" context="find_io_paren" String="\b(?:flush|wait|read|write|backspace|rewind|end\s*file|close|open|inquire)\s*[(]" insensitive="true"/> |
| 168 |
<RegExpr attribute="IO Function" context="format_stmnt" String="\bformat\s*[(]" insensitive="true"/> |
| 169 |
<RegExpr attribute="IO Function" context="#stay" String="\bend\s*file\b" insensitive="true"/> |
| 170 |
<keyword attribute="IO Function" context="#stay" String="io_functions"/> |
| 171 |
</context> |
| 172 |
<!-- This context matches parenthesis for the read, write, ... statements --> |
| 173 |
<context attribute="Normal Text" lineEndContext="#stay" name="find_io_paren"> |
| 174 |
<!-- find_io_paren##Fortran (Fixed Format) --> |
| 175 |
<DetectChar attribute="IO Function" context="#stay" char="*"/> |
| 176 |
<DetectChar attribute="Normal Text" context="inside_func_paren" char="("/> |
| 177 |
<DetectChar attribute="IO Function" context="#pop" char=")"/> |
| 178 |
<keyword attribute="IO Function" context="#stay" String="io_keywords"/> |
| 179 |
<keyword attribute="IO Function" context="#stay" String="inquire_keywords"/> |
| 180 |
<keyword attribute="IO Function" context="#stay" String="open_keywords"/> |
| 181 |
<IncludeRules context="find_strings" /> |
| 182 |
<IncludeRules context="find_intrinsics" /> |
| 183 |
<IncludeRules context="find_numbers##Fortran (Fixed Format)" /> |
| 184 |
<IncludeRules context="find_symbols##Fortran (Fixed Format)" /> |
| 185 |
</context> |
| 186 |
<!-- This context highlights the text inside the parenthesis of fortran statement --> |
| 187 |
<context attribute="Normal Text" lineEndContext="#stay" name="format_stmnt"> |
| 188 |
<DetectChar attribute="IO Function" context="format_stmnt" char="("/> |
| 189 |
<DetectChar attribute="IO Function" context="#pop" char=")"/> |
| 190 |
<IncludeRules context="find_strings" /> |
| 191 |
<IncludeRules context="format_stmnt##Fortran (Fixed Format)" /> |
| 192 |
</context> |
| 193 |
|
| 194 |
<!-- FIXME: beginRegion/endRegion don't work well with IncludeRules. When this is corrected, use IncludeRules instead of replicating rules. --> |
| 195 |
<!-- The following context matches the begin of program units --> |
| 196 |
<context attribute="Normal Text" lineEndContext="#stay" name="find_begin_stmnts"> |
| 197 |
<WordDetect attribute="Keyword" context="#stay" String="submodule" insensitive="true" beginRegion="Routine"/> |
| 198 |
<RegExpr attribute="Keyword" context="#stay" String="\b(?:do\s*[,\s]\s*concurrent|select\s+type|block|critical)\b" insensitive="true" beginRegion="Block"/> |
| 199 |
<!-- Here IncludeRules: find_begin_stmnts##Fortran (Fixed Format) --> |
| 200 |
<RegExpr attribute="Keyword" context="#stay" String="\bmodule\s+procedure\b" insensitive="true"/> |
| 201 |
<RegExpr attribute="Keyword" context="#stay" String="\b(?:subroutine|function|block\s*data|program|module)\b" insensitive="true" beginRegion="Routine"/> |
| 202 |
<RegExpr attribute="Keyword" context="#stay" String="\b(?:then|do|select\s+case)\b" insensitive="true" beginRegion="Block"/> |
| 203 |
</context> |
| 204 |
<!-- The following context matches the end of program units --> |
| 205 |
<context attribute="Normal Text" lineEndContext="#stay" name="find_end_stmnts"> |
| 206 |
<RegExpr attribute="Keyword" context="#stay" String="\bend\s*(?:procedure|submodule)\b" insensitive="true" endRegion="Routine"/> |
| 207 |
<RegExpr attribute="Keyword" context="#stay" String="\bend\s*(?:block|critical)\b" insensitive="true" endRegion="Block"/> |
| 208 |
<RegExpr attribute="Keyword" context="#stay" String="\bend\s*(?:associate)\b" insensitive="true"/> |
| 209 |
<RegExpr attribute="Data Type" context="#stay" String="\bend\s*(?:type|enum)\b" insensitive="true"/> |
| 210 |
<!-- Here IncludeRules: find_end_stmnts##Fortran (Fixed Format) --> |
| 211 |
<RegExpr attribute="Keyword" context="#stay" String="\bend\s*(?:subroutine|function|block\s*data|program|module)\b" insensitive="true" endRegion="Routine"/> |
| 212 |
<RegExpr attribute="Keyword" context="#stay" String="\bend\s*(?:do|if)\b" insensitive="true" endRegion="Block"/> |
| 213 |
<RegExpr attribute="Keyword" context="#stay" String="\bend\s*(?:select|where|forall|interface)\b" insensitive="true"/> |
| 214 |
<RegExpr attribute="Keyword" context="#stay" String="\belse\s*if\b" insensitive="true" endRegion="Block"/> |
| 215 |
<WordDetect attribute="Keyword" context="#stay" String="end" insensitive="true" endRegion="Routine"/> |
| 216 |
</context> |
| 217 |
<!-- The following context matches the mid of program units --> |
| 218 |
<context attribute="Normal Text" lineEndContext="#stay" name="find_mid_stmnts"> |
| 219 |
<RegExpr attribute="Keyword" context="#stay" String="\b(?:type\s+is|class\s+(?:is|default))\b" insensitive="true" endRegion="Block" beginRegion="Block"/> |
| 220 |
<!-- Here IncludeRules: find_mid_stmnts##Fortran (Fixed Format) --> |
| 221 |
<WordDetect attribute="Keyword" context="#stay" String="else" insensitive="true" endRegion="Block" beginRegion="Block"/> |
| 222 |
<RegExpr attribute="Keyword" context="#stay" String="\bcase(?:\s+default)?\b" insensitive="true" endRegion="Block" beginRegion="Block"/> |
| 223 |
<WordDetect attribute="Keyword" context="#stay" String="contains" insensitive="true" endRegion="Routine" beginRegion="Routine"/> |
| 224 |
</context> |
| 225 |
|
| 226 |
<!-- The following two contexts match declarations --> |
| 227 |
<context attribute="Normal Text" lineEndContext="#stay" name="find_decls"> |
| 228 |
<RegExpr attribute="Data Type" context="find_paren" String="\b(?:class|extends|procedure|pass|codimension)\s*[(]" insensitive="true"/> |
| 229 |
<WordDetect attribute="Data Type" context="#stay" String="codimension" insensitive="true"/> |
| 230 |
<WordDetect attribute="Data Type" context="#stay" String="procedure" insensitive="true"/> |
| 231 |
<WordDetect attribute="Data Type" context="#stay" String="pass" insensitive="true"/> |
| 232 |
<!-- find_decls##Fortran (Fixed Format) --> |
| 233 |
<keyword attribute="Data Type" context="#stay" String="types"/> |
| 234 |
<!--<RegExpr attribute="Data Type" context="find_paren" String="real\s*[(]" firstNonSpace="true" insensitive="true"/>--> |
| 235 |
<RegExpr attribute="Data Type" context="find_paren" String="\b(?:type|integer|real|complex|character|logical|intent|dimension)\s*[(]" insensitive="true"/> |
| 236 |
<IncludeRules context="find_decls##Fortran (Fixed Format)"/> |
| 237 |
</context> |
| 238 |
<!-- This context matches parenthesis in data type declarations, such as in 'real(...)'--> |
| 239 |
<context attribute="Data Type" lineEndContext="#pop" name="find_paren"> |
| 240 |
<!-- find_paren##Fortran (Fixed Format) --> |
| 241 |
<AnyChar attribute="Data Type" context="find_paren" String="(["/> |
| 242 |
<AnyChar attribute="Data Type" context="#pop" String=")]"/> |
| 243 |
</context> |
| 244 |
|
| 245 |
<!-- The following context matches intrinsic procedures --> |
| 246 |
<context attribute="Normal Text" lineEndContext="#stay" name="find_intrinsics"> |
| 247 |
<!-- find_intrinsics##Fortran (Fixed Format) --> |
| 248 |
<keyword attribute="Keyword" context="#stay" String="keywords"/> |
| 249 |
<!-- INTRINSIC PROCEDURES --> |
| 250 |
<keyword attribute="Elemental Procedure" context="#stay" String="elemental_procs"/> |
| 251 |
<keyword attribute="Inquiry Function" context="#stay" String="inquiry_fn"/> |
| 252 |
<keyword attribute="Transformational Function" context="#stay" String="transform_fn"/> |
| 253 |
<keyword attribute="Non elemental subroutine" context="#stay" String="non_elem_subr"/> |
| 254 |
</context> |
| 255 |
|
| 256 |
<!-- The following four contexts implement the complex string multi-line declarations --> |
| 257 |
<!-- NOTE: Contexts replicated from "Fortran (Fixed Format)" --> |
| 258 |
<!-- Matches STRINGS (there are 2 types of strings: '...' and "...") --> |
| 259 |
<context attribute="String" lineEndContext="#stay" name="find_strings"> |
| 260 |
<DetectChar attribute="String" context="string_1" char="'"/> |
| 261 |
<DetectChar attribute="String" context="string_2" char="""/> |
| 262 |
</context> |
| 263 |
|
| 264 |
<context attribute="String" lineEndContext="#stay" name="string_1" fallthrough="true" fallthroughContext="#pop"> |
| 265 |
<RegExpr attribute="String" context="#pop" String="[^']*'"/> |
| 266 |
<RegExpr attribute="Keyword" context="end_of_string" String="&\s*$"/> |
| 267 |
<RegExpr attribute="String" context="end_of_string" String=".*(?=&\s*$)"/> |
| 268 |
</context> |
| 269 |
|
| 270 |
<context attribute="String" lineEndContext="#stay" name="string_2" fallthrough="true" fallthroughContext="#pop"> |
| 271 |
<RegExpr attribute="String" context="#pop" String="[^"]*""/> |
| 272 |
<RegExpr attribute="Keyword" context="end_of_string" String="&\s*$"/> |
| 273 |
<RegExpr attribute="String" context="end_of_string" String=".*(?=&\s*$)"/> |
| 274 |
</context> |
| 275 |
|
| 276 |
<context attribute="String" lineEndContext="#stay" name="end_of_string" fallthrough="true" fallthroughContext="#pop#pop"> |
| 277 |
<DetectSpaces /> |
| 278 |
<RegExpr attribute="Keyword" context="#stay" String="&\s*$"/> |
| 279 |
<DetectChar attribute="Keyword" context="#pop" char="&" firstNonSpace="true"/> |
| 280 |
<DetectChar attribute="Comment" context="comment" char="!" firstNonSpace="true"/> |
| 281 |
</context> |
| 282 |
</contexts> |
| 283 |
|
| 284 |
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * --> |
| 285 |
<!-- * S T Y L E I T E M D E F I N I T I O N S * --> |
| 286 |
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * --> |
| 287 |
<itemDatas> |
| 288 |
<itemData name="Normal Text" defStyleNum="dsNormal"/> |
| 289 |
<itemData name="Keyword" defStyleNum="dsKeyword"/> |
| 290 |
<itemData name="Data Type" defStyleNum="dsDataType"/> |
| 291 |
<itemData name="String" defStyleNum="dsString"/> |
| 292 |
<itemData name="Comment" defStyleNum="dsComment"/> |
| 293 |
<itemData name="IO Function" defStyleNum="dsFunction" bold="0" italic="0"/> |
| 294 |
<itemData name="Elemental Procedure" defStyleNum="dsBuiltIn" bold="1" italic="0"/> |
| 295 |
<itemData name="Inquiry Function" defStyleNum="dsFunction" bold="1" italic="1"/> |
| 296 |
<itemData name="Transformational Function" defStyleNum="dsFunction" bold="1" italic="0"/> |
| 297 |
<itemData name="Non elemental subroutine" defStyleNum="dsFunction" bold="1" italic="0"/> |
| 298 |
</itemDatas> |
| 299 |
</highlighting> |
| 300 |
<general> |
| 301 |
<comments> |
| 302 |
<comment name="singleLine" start="!"/> |
| 303 |
</comments> |
| 304 |
<keywords casesensitive="0"/> |
| 305 |
</general> |
| 306 |
</language> |
| 307 |
<!-- kate: replace-tabs on; tab-width 2; indent-width 2; --> |