From 515ec57b77ed4f814c54c86b887d8f60f75c29b9 Mon Sep 17 00:00:00 2001 From: yeti Date: Sun, 17 Jul 2022 20:18:30 +0100 Subject: [PATCH] improve fortran syntax highlighting (#2479) * support integer highlighting * add missing keywords and move some to where they fit better * add missing operators * fix previous commit * add and * add import --- runtime/syntax/fortran.yaml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/runtime/syntax/fortran.yaml b/runtime/syntax/fortran.yaml index b30e5443..9e3ed173 100644 --- a/runtime/syntax/fortran.yaml +++ b/runtime/syntax/fortran.yaml @@ -5,18 +5,18 @@ detect: rules: - type: "(?i)\\b(action|advance|all|allocatable|allocated|any|apostrophe)\\b" - - type: "(?i)\\b(append|asis|assign|assignment|associated|character|common)\\b" + - type: "(?i)\\b(append|asis|assign|assignment|associated|bind|character|common)\\b" - type: "(?i)\\b(complex|data|default|delim|dimension|double precision)\\b" - - type: "(?i)\\b(elemental|epsilon|external|file|fmt|form|format|huge)\\b" + - type: "(?i)\\b(elemental|enum|enumerator|epsilon|external|file|fmt|form|format|huge)\\b" - type: "(?i)\\b(implicit|include|index|inquire|integer|intent|interface)\\b" - type: "(?i)\\b(intrinsic|iostat|kind|logical|module|none|null|only)\\\\b" - type: "(?i)\\b(operator|optional|pack|parameter|pointer|position|private)\\b" - type: "(?i)\\b(program|public|real|recl|recursive|selected_int_kind)\\b" - - type: "(?i)\\b(selected_real_kind|subroutine|status)\\b" + - type: "(?i)\\b(selected_real_kind|subroutine|status|module|function|logical)\\b" - constant: "(?i)\\b(abs|achar|adjustl|adjustr|allocate|bit_size|call|char)\\b" - constant: "(?i)\\b(close|contains|count|cpu_time|cshift|date_and_time)\\b" - - constant: "(?i)\\b(deallocate|digits|dot_product|eor|eoshift|function|iachar)\\b" + - constant: "(?i)\\b(deallocate|digits|dot_product|eor|eoshift|iachar)\\b" - constant: "(?i)\\b(iand|ibclr|ibits|ibset|ichar|ieor|iolength|ior|ishft|ishftc)\\b" - constant: "(?i)\\b(lbound|len|len_trim|matmul|maxexponent|maxloc|maxval|merge)\\b" - constant: "(?i)\\b(minexponent|minloc|minval|mvbits|namelist|nearest|nullify)\\b" @@ -24,16 +24,18 @@ rules: - constant: "(?i)\\b(random_number|random_seed|range|read|readwrite|replace)\\b" - constant: "(?i)\\b(reshape|rewind|save|scan|sequence|shape|sign|size|spacing)\\b" - constant: "(?i)\\b(spread|sum|system_clock|target|transfer|transpose|trim)\\b" - - constant: "(?i)\\b(ubound|unpack|verify|write|tiny|type|use|yes)\\b" + - constant: "(?i)\\b(ubound|unpack|verify|write|tiny|type|use|yes|true|false|not)\\b" + + - constant.number: "\\b([0-9]+)\\b" - statement: "(?i)\\b(.and.|case|do|else|else?if|else?where|end|end?do|end?if)\\b" - statement: "(?i)\\b(end?select|.eqv.|forall|if|lge|lgt|lle|llt|.neqv.|.not.)\\b" - - statement: "(?i)\\b(.or.|repeat|select case|then|where|while)\\b" + - statement: "(?i)\\b(or|and|repeat|select|case|then|where|while|import)\\b" - special: "(?i)\\b(continue|cycle|exit|go?to|result|return)\\b" #Operator Color - - symbol.operator: "[.:;,+*|=!\\%]|/|-|&" + - symbol.operator: "[.:;,+*|=!\\%]|/|-|>|<|&" #Parenthetical Color - symbol.bracket: "[(){}]|\\[|\\]" @@ -60,4 +62,3 @@ rules: end: "$" rules: - todo: "(TODO|XXX|FIXME):?" - -- 2.44.0