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