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