2008-10-01 04:49:19 +04:00
|
|
|
## Here is an example for C/C++/Obj-C.
|
2014-05-17 00:21:34 +04:00
|
|
|
|
2018-02-07 13:25:46 +03:00
|
|
|
syntax m "\.m$"
|
2017-11-19 13:10:53 +03:00
|
|
|
magic "Objective-C source"
|
2016-05-25 23:13:50 +03:00
|
|
|
comment "//"
|
2008-10-01 04:49:19 +04:00
|
|
|
|
2014-05-17 00:21:34 +04:00
|
|
|
# Stuffs,
|
|
|
|
color brightwhite "\<[A-Z_][0-9A-Z_]+\>"
|
2008-10-01 04:49:19 +04:00
|
|
|
color green "\<(float|double|BOOL|bool|char|int|short|long|id|sizeof|enum|void|static|const|struct|union|typedef|extern|(un)?signed|inline)\>"
|
|
|
|
color green "\<[[:alpha:]_][[:alnum:]_]*_t\>"
|
|
|
|
color green "\<(class|namespace|template|public|protected|private|typename|this|friend|virtual|using|mutable|volatile|register|explicit)\>"
|
|
|
|
color brightgreen "\<(for|if|while|do|else|case|default|switch)\>"
|
|
|
|
color brightgreen "\<(try|throw|catch|operator|new|delete)\>"
|
|
|
|
color brightgreen "\<(goto|continue|break|return)\>"
|
2017-12-30 19:32:15 +03:00
|
|
|
color brightgreen "@(encode|end|implementation|interface)|selector)\>"
|
2014-02-23 20:07:44 +04:00
|
|
|
|
2014-05-17 00:21:34 +04:00
|
|
|
# GCC builtins.
|
2008-10-01 04:49:19 +04:00
|
|
|
color cyan "__attribute__[[:space:]]*\(\([^)]*\)\)" "__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__"
|
|
|
|
|
2014-05-17 00:21:34 +04:00
|
|
|
# Selector/method.
|
2008-10-01 04:49:19 +04:00
|
|
|
color brightmagenta "(^|[[:space:]])\[.*[[:space:]].*\]"
|
|
|
|
color white ":[[:alnum:]]*"
|
|
|
|
color magenta "[[:alnum:]]*:"
|
|
|
|
color white "\[[^][:space:]]*\]"
|
|
|
|
|
2014-05-17 00:21:34 +04:00
|
|
|
# Strings.
|
2008-10-01 04:49:19 +04:00
|
|
|
color brightblack "'([^'\]|(\\["'abfnrtv\\]))'" "'\\(([0-3]?[0-7]{1,2}))'" "'\\x[0-9A-Fa-f]{1,2}'"
|
|
|
|
color brightblack "<[^= ]*>" ""(\\.|[^"])*""
|
|
|
|
color brightblue "@"(\\.|[^"])*""
|
2015-12-29 19:48:25 +03:00
|
|
|
# Multiline strings. This regex is VERY resource intensive,
|
|
|
|
# and sometimes colours things that shouldn't be coloured.
|
|
|
|
###color brightyellow start=""(\\.|[^"])*\\[[:space:]]*$" end="^(\\.|[^"])*""
|
2008-10-01 04:49:19 +04:00
|
|
|
|
2014-05-17 00:21:34 +04:00
|
|
|
# Preprocessor commands.
|
2008-10-01 04:49:19 +04:00
|
|
|
color brightblue "^[[:space:]]*#[[:space:]]*(define|include|import|(un|ifn?)def|endif|el(if|se)|if|warning|error)"
|
|
|
|
|
2014-05-17 00:21:34 +04:00
|
|
|
# Comments.
|
2008-10-01 04:49:19 +04:00
|
|
|
color yellow "//.*"
|
|
|
|
color yellow start="/\*" end="\*/"
|
|
|
|
|
2018-11-03 22:41:42 +03:00
|
|
|
# Trailing whitespace.
|
2014-05-17 00:21:34 +04:00
|
|
|
color ,green "[[:space:]]+$"
|