]>
luflow.net public git repositories - flow-web.git/blob - static/highlight/languages/fortran.js
1 /*! `fortran` grammar compiled for Highlight.js 11.11.1 */
3 var hljsGrammar
= (function () {
8 Author: Anthony Scemama <scemama@irsamc.ups-tlse.fr>
9 Website: https://en.wikipedia.org/wiki/Fortran
13 /** @type LanguageFn */
14 function fortran(hljs
) {
15 const regex
= hljs
.regex
;
22 const COMMENT
= { variants: [
23 hljs
.COMMENT('!', '$', { relevance: 0 }),
24 // allow FORTRAN 77 style comments
25 hljs
.COMMENT('^C[ ]', '$', { relevance: 0 }),
26 hljs
.COMMENT('^C$', '$', { relevance: 0 })
29 // regex in both fortran and irpf90 should match
30 const OPTIONAL_NUMBER_SUFFIX
= /(_[a-z_\d]+)?/;
31 const OPTIONAL_NUMBER_EXP
= /([de][+-]?\d+)?/;
35 { begin: regex
.concat(/\b\d+/, /\.(\d*)/, OPTIONAL_NUMBER_EXP
, OPTIONAL_NUMBER_SUFFIX
) },
36 { begin: regex
.concat(/\b\d+/, OPTIONAL_NUMBER_EXP
, OPTIONAL_NUMBER_SUFFIX
) },
37 { begin: regex
.concat(/\.\d+/, OPTIONAL_NUMBER_EXP
, OPTIONAL_NUMBER_SUFFIX
) }
42 const FUNCTION_DEF
= {
43 className: 'function',
44 beginKeywords: 'subroutine function program',
47 hljs
.UNDERSCORE_TITLE_MODE
,
56 hljs
.APOS_STRING_MODE
,
57 hljs
.QUOTE_STRING_MODE
190 "c_long_double_complex",
207 "character_storage_size",
213 "numeric_storage_size",
217 "ieee_support_underflow_control",
218 "ieee_get_underflow_mode",
219 "ieee_set_underflow_mode",
459 "selected_real_kind",
480 "command_argument_count",
482 "get_command_argument",
483 "get_environment_variable",
486 "ieee_support_underflow_control",
487 "ieee_get_underflow_mode",
488 "ieee_set_underflow_mode",
492 "selected_char_kind",
513 "execute_command_line",
552 case_insensitive: true,
558 $pattern: /\b[a-z][a-z0-9_]+\b|\.[a-z][a-z0-9_]+\./,
567 // allow `C = value` for assignments so they aren't misdetected
568 // as Fortran 77 style comments
570 begin: /^C\s*=(?!=)/,
583 hljs
.registerLanguage('fortran', hljsGrammar
);