Chris Allegretta | 215eb36 | 2008-10-01 00:49:19 +0000 | [diff] [blame] | 1 | ## Here is an example for C/C++/Obj-C. |
Benno Schulenberg | fe9da94 | 2014-05-16 20:21:34 +0000 | [diff] [blame] | 2 | |
Chris Allegretta | 215eb36 | 2008-10-01 00:49:19 +0000 | [diff] [blame] | 3 | syntax "m" "\.m$" |
Mike Scalora | 6a2032f | 2016-05-25 22:13:50 +0200 | [diff] [blame] | 4 | comment "//" |
Chris Allegretta | 215eb36 | 2008-10-01 00:49:19 +0000 | [diff] [blame] | 5 | |
Benno Schulenberg | fe9da94 | 2014-05-16 20:21:34 +0000 | [diff] [blame] | 6 | # Stuffs, |
| 7 | color brightwhite "\<[A-Z_][0-9A-Z_]+\>" |
Chris Allegretta | 215eb36 | 2008-10-01 00:49:19 +0000 | [diff] [blame] | 8 | color green "\<(float|double|BOOL|bool|char|int|short|long|id|sizeof|enum|void|static|const|struct|union|typedef|extern|(un)?signed|inline)\>" |
| 9 | color green "\<[[:alpha:]_][[:alnum:]_]*_t\>" |
| 10 | color green "\<(class|namespace|template|public|protected|private|typename|this|friend|virtual|using|mutable|volatile|register|explicit)\>" |
| 11 | color brightgreen "\<(for|if|while|do|else|case|default|switch)\>" |
| 12 | color brightgreen "\<(try|throw|catch|operator|new|delete)\>" |
| 13 | color brightgreen "\<(goto|continue|break|return)\>" |
| 14 | color brightgreen "@\<(en(code|d)|i(mplementation|nterface)|selector)\>" |
Benno Schulenberg | c4b344f | 2014-02-23 16:07:44 +0000 | [diff] [blame] | 15 | |
Benno Schulenberg | fe9da94 | 2014-05-16 20:21:34 +0000 | [diff] [blame] | 16 | # GCC builtins. |
Chris Allegretta | 215eb36 | 2008-10-01 00:49:19 +0000 | [diff] [blame] | 17 | color cyan "__attribute__[[:space:]]*\(\([^)]*\)\)" "__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__" |
| 18 | |
Benno Schulenberg | fe9da94 | 2014-05-16 20:21:34 +0000 | [diff] [blame] | 19 | # Selector/method. |
Chris Allegretta | 215eb36 | 2008-10-01 00:49:19 +0000 | [diff] [blame] | 20 | color brightmagenta "(^|[[:space:]])\[.*[[:space:]].*\]" |
| 21 | color white ":[[:alnum:]]*" |
| 22 | color magenta "[[:alnum:]]*:" |
| 23 | color white "\[[^][:space:]]*\]" |
| 24 | |
Benno Schulenberg | fe9da94 | 2014-05-16 20:21:34 +0000 | [diff] [blame] | 25 | # Strings. |
Chris Allegretta | 215eb36 | 2008-10-01 00:49:19 +0000 | [diff] [blame] | 26 | color brightblack "'([^'\]|(\\["'abfnrtv\\]))'" "'\\(([0-3]?[0-7]{1,2}))'" "'\\x[0-9A-Fa-f]{1,2}'" |
| 27 | color brightblack "<[^= ]*>" ""(\\.|[^"])*"" |
| 28 | color brightblue "@"(\\.|[^"])*"" |
Benno Schulenberg | ae598e7 | 2015-12-29 16:48:25 +0000 | [diff] [blame] | 29 | # Multiline strings. This regex is VERY resource intensive, |
| 30 | # and sometimes colours things that shouldn't be coloured. |
| 31 | ###color brightyellow start=""(\\.|[^"])*\\[[:space:]]*$" end="^(\\.|[^"])*"" |
Chris Allegretta | 215eb36 | 2008-10-01 00:49:19 +0000 | [diff] [blame] | 32 | |
Benno Schulenberg | fe9da94 | 2014-05-16 20:21:34 +0000 | [diff] [blame] | 33 | # Preprocessor commands. |
Chris Allegretta | 215eb36 | 2008-10-01 00:49:19 +0000 | [diff] [blame] | 34 | color brightblue "^[[:space:]]*#[[:space:]]*(define|include|import|(un|ifn?)def|endif|el(if|se)|if|warning|error)" |
| 35 | |
Benno Schulenberg | fe9da94 | 2014-05-16 20:21:34 +0000 | [diff] [blame] | 36 | # Comments. |
Chris Allegretta | 215eb36 | 2008-10-01 00:49:19 +0000 | [diff] [blame] | 37 | color yellow "//.*" |
| 38 | color yellow start="/\*" end="\*/" |
| 39 | |
Benno Schulenberg | fe9da94 | 2014-05-16 20:21:34 +0000 | [diff] [blame] | 40 | # Trailing whitespace. |
| 41 | color ,green "[[:space:]]+$" |