]> git.lizzy.rs Git - micro.git/blob - runtime/syntax/fortran.yaml
improve fortran syntax highlighting (#2479)
[micro.git] / runtime / syntax / fortran.yaml
1 filetype: fortran
2
3 detect:
4     filename: "\\.([Ff]|[Ff]90|[Ff]95|[Ff][Oo][Rr])$"
5
6 rules:
7     - type:  "(?i)\\b(action|advance|all|allocatable|allocated|any|apostrophe)\\b"
8     - type:  "(?i)\\b(append|asis|assign|assignment|associated|bind|character|common)\\b"
9     - type:  "(?i)\\b(complex|data|default|delim|dimension|double precision)\\b"
10     - type:  "(?i)\\b(elemental|enum|enumerator|epsilon|external|file|fmt|form|format|huge)\\b"
11     - type:  "(?i)\\b(implicit|include|index|inquire|integer|intent|interface)\\b"
12     - type:  "(?i)\\b(intrinsic|iostat|kind|logical|module|none|null|only)\\\\b"
13     - type:  "(?i)\\b(operator|optional|pack|parameter|pointer|position|private)\\b"
14     - type:  "(?i)\\b(program|public|real|recl|recursive|selected_int_kind)\\b"
15     - type:  "(?i)\\b(selected_real_kind|subroutine|status|module|function|logical)\\b"
16
17     - constant:  "(?i)\\b(abs|achar|adjustl|adjustr|allocate|bit_size|call|char)\\b" 
18     - constant:  "(?i)\\b(close|contains|count|cpu_time|cshift|date_and_time)\\b" 
19     - constant:  "(?i)\\b(deallocate|digits|dot_product|eor|eoshift|iachar)\\b" 
20     - constant:  "(?i)\\b(iand|ibclr|ibits|ibset|ichar|ieor|iolength|ior|ishft|ishftc)\\b" 
21     - constant:  "(?i)\\b(lbound|len|len_trim|matmul|maxexponent|maxloc|maxval|merge)\\b" 
22     - constant:  "(?i)\\b(minexponent|minloc|minval|mvbits|namelist|nearest|nullify)\\b" 
23     - constant:  "(?i)\\b(open|pad|present|print|product|pure|quote|radix)\\b" 
24     - constant:  "(?i)\\b(random_number|random_seed|range|read|readwrite|replace)\\b" 
25     - constant:  "(?i)\\b(reshape|rewind|save|scan|sequence|shape|sign|size|spacing)\\b" 
26     - constant:  "(?i)\\b(spread|sum|system_clock|target|transfer|transpose|trim)\\b" 
27     - constant:  "(?i)\\b(ubound|unpack|verify|write|tiny|type|use|yes|true|false|not)\\b"
28
29     - constant.number: "\\b([0-9]+)\\b"
30
31     - statement: "(?i)\\b(.and.|case|do|else|else?if|else?where|end|end?do|end?if)\\b"
32     - statement: "(?i)\\b(end?select|.eqv.|forall|if|lge|lgt|lle|llt|.neqv.|.not.)\\b"
33     - statement: "(?i)\\b(or|and|repeat|select|case|then|where|while|import)\\b"
34
35     - special: "(?i)\\b(continue|cycle|exit|go?to|result|return)\\b"
36
37       #Operator Color
38     - symbol.operator: "[.:;,+*|=!\\%]|/|-|>|<|&"
39
40       #Parenthetical Color
41     - symbol.bracket: "[(){}]|\\[|\\]"
42
43       # Add preprocessor commands.
44     - preproc: "^[[:space:]]*#[[:space:]]*(define|include|(un|ifn?)def|endif|el(if|se)|if|warning|error)"
45
46     - constant.string:
47         start: "\""
48         end: "\""
49         skip: "\\\\."
50         rules:
51             - constant.specialChar: "\\\\."
52
53     - constant.string:
54         start: "'"
55         end: "'"
56         skip: "\\\\."
57         rules:
58             - constant.specialChar: "\\\\."
59
60     - comment:
61         start: "!"
62         end: "$"
63         rules:
64             - todo: "(TODO|XXX|FIXME):?"