1 | ## Cforall syntax colouring. |
---|
2 | ## WIP |
---|
3 | |
---|
4 | syntax "cfa" "\.(c|h)fa" |
---|
5 | |
---|
6 | # Macros |
---|
7 | color brightred "\<[A-Z_][0-9A-Z_]+\>" |
---|
8 | |
---|
9 | # Types |
---|
10 | color green "\<(forall|trait|(o|d|f|t)type|mutex|_Bool|volatile|virtual)\>" |
---|
11 | color green "\<(float|double|bool|char|int|short|long|enum|void|auto)\>" |
---|
12 | color green "\<((s?size)|one|zero|((u_?)?int(8|16|32|64|ptr)))_t\>" |
---|
13 | color green "\<(static|const|extern|(un)?signed|inline)\>" |
---|
14 | color green "\<(typeof|vtable|sizeof|alignof)\>" |
---|
15 | |
---|
16 | # Declarations |
---|
17 | color brightgreen "\<(struct|union|typedef|trait|coroutine|generator)\>" |
---|
18 | color brightgreen "\<(monitor|thread|with|exception)\>" |
---|
19 | |
---|
20 | # Control Flow Structures |
---|
21 | color brightyellow "\<(if|else|while|do|for|switch|choose|case|default)\>" |
---|
22 | color brightyellow "\<(disable|enable|waitfor|when|timeout|suspend)\>" |
---|
23 | color brightyellow "\<(try|catch(Resume)?|finally)\>" |
---|
24 | |
---|
25 | # Control Flow Statements |
---|
26 | color magenta "\<(goto|return|break|continue|fallthr(u|ough)|throw(Resume)?)\>" |
---|
27 | |
---|
28 | # Escaped Keywords, now Identifiers. |
---|
29 | color white "``\w+" |
---|
30 | |
---|
31 | # Operator Names |
---|
32 | color blue "\^?\?\{\}|\?\[\?\]|\?\(\)" "\?(\+\+|--)" "(\+\+?|--?|\*|~|!)\?" |
---|
33 | color blue "\?(=|\+|-|\*|/|%|\&|\||\^|<<?|>>?)=?\?" "\?!=\?" |
---|
34 | |
---|
35 | ## The <...> in attributes can be coloured as strings. (??) |
---|
36 | ## color red "\<<?[[:alpha:]][[:alnum:]_]*>?![[:lower:]]+\>" |
---|
37 | |
---|
38 | ## Update/Redistribute |
---|
39 | # GCC builtins |
---|
40 | color cyan "__attribute__[[:space:]]*\(\(([^)]|[^)]\))*\)\)" |
---|
41 | ##color cyan "__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__" |
---|
42 | |
---|
43 | # Preprocesser Directives |
---|
44 | color brightcyan "^[[:space:]]*#[[:space:]]*(include(_next)?|define|(ifn?|un)def|if|el(if|se)|endif|error|warning|pragma)" |
---|
45 | |
---|
46 | # Values |
---|
47 | # Booleans |
---|
48 | color blue "\<(true|false)\>" |
---|
49 | # Characters |
---|
50 | color brightmagenta "'([^'\]|(\\")|(\\['abfnrtv\\]))'" |
---|
51 | color brightmagenta "'\\(([0-3]?[0-7]{1,2}))'" "'\\x[0-9A-Fa-f]{1,2}'" |
---|
52 | # Strings and Angle Strings |
---|
53 | color yellow ""([^"]|\\")*"" "<[^[:blank:]=]*>" |
---|
54 | # Multiline Strings: This regex is VERY expencive and often too strong. |
---|
55 | ###color brightyellow start=""(\\.|[^"])*\\[[:space:]]*$" end="^(\\.|[^"])*"" |
---|
56 | |
---|
57 | # Comments |
---|
58 | color brightblue "//.*" |
---|
59 | color brightblue start="/\*" end="\*/" |
---|
60 | |
---|
61 | # Reminders |
---|
62 | color ,yellow "\<(FIXME|TODO|XXX)\>" |
---|
63 | |
---|
64 | # Trailing Whitespace |
---|
65 | color ,green "[[:space:]]+$" |
---|