2020-04-20 17:15:43 +00:00
|
|
|
## Syntax highlighting for C/C++/Obj-C files.
|
2014-05-16 20:21:34 +00:00
|
|
|
|
2018-02-07 10:25:46 +00:00
|
|
|
syntax m "\.m$"
|
2017-11-19 10:10:53 +00:00
|
|
|
magic "Objective-C source"
|
2016-05-25 20:13:50 +00:00
|
|
|
comment "//"
|
2008-10-01 00:49:19 +00:00
|
|
|
|
2014-05-16 20:21:34 +00:00
|
|
|
# Stuffs,
|
|
|
|
color brightwhite "\<[A-Z_][0-9A-Z_]+\>"
|
2008-10-01 00:49:19 +00: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 16:32:15 +00:00
|
|
|
color brightgreen "@(encode|end|implementation|interface)|selector)\>"
|
2014-02-23 16:07:44 +00:00
|
|
|
|
2014-05-16 20:21:34 +00:00
|
|
|
# GCC builtins.
|
2021-04-27 09:18:41 +00:00
|
|
|
color cyan "__attribute__[[:blank:]]*\(\([^)]*\)\)" "__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__"
|
2008-10-01 00:49:19 +00:00
|
|
|
|
2014-05-16 20:21:34 +00:00
|
|
|
# Selector/method.
|
2021-04-27 09:18:41 +00:00
|
|
|
color brightmagenta "(^|[[:blank:]])\[.*[[:blank:]].*\]"
|
2008-10-01 00:49:19 +00:00
|
|
|
color white ":[[:alnum:]]*"
|
|
|
|
color magenta "[[:alnum:]]*:"
|
2021-04-27 09:18:41 +00:00
|
|
|
color white "\[[^][:blank:]]*\]"
|
2008-10-01 00:49:19 +00:00
|
|
|
|
2014-05-16 20:21:34 +00:00
|
|
|
# Strings.
|
2008-10-01 00:49:19 +00:00
|
|
|
color brightblack "'([^'\]|(\\["'abfnrtv\\]))'" "'\\(([0-3]?[0-7]{1,2}))'" "'\\x[0-9A-Fa-f]{1,2}'"
|
|
|
|
color brightblack "<[^= ]*>" ""(\\.|[^"])*""
|
|
|
|
color brightblue "@"(\\.|[^"])*""
|
|
|
|
|
2014-05-16 20:21:34 +00:00
|
|
|
# Preprocessor commands.
|
2021-04-27 09:18:41 +00:00
|
|
|
color brightblue "^[[:blank:]]*#[[:blank:]]*(define|include|import|(un|ifn?)def|endif|el(if|se)|if|warning|error)"
|
2008-10-01 00:49:19 +00:00
|
|
|
|
2014-05-16 20:21:34 +00:00
|
|
|
# Comments.
|
2008-10-01 00:49:19 +00:00
|
|
|
color yellow "//.*"
|
|
|
|
color yellow start="/\*" end="\*/"
|
|
|
|
|
2018-11-03 19:41:42 +00:00
|
|
|
# Trailing whitespace.
|
2014-05-16 20:21:34 +00:00
|
|
|
color ,green "[[:space:]]+$"
|