blob: 01053bf91dc208a09e349cb9c1b48fa40f3e088f [file] [log] [blame]
David Lawrence Ramsey5e6434c2006-06-01 17:23:28 +00001## Here is an example for C/C++.
Benno Schulenberg275b6172014-05-15 12:52:30 +00002
Benno Schulenbergcf79e522014-02-22 16:57:23 +00003syntax "c" "\.(c(c|pp|xx|\+\+)?|C)$" "\.(h(h|pp|xx)?|H)$" "\.ii?$"
Benno Schulenberg275b6172014-05-15 12:52:30 +00004magic "(ASCII|UTF-8 Unicode) C(\+\+)? program text"
Mike Scalora6a2032f2016-05-25 22:13:50 +02005comment "//"
Benno Schulenberg275b6172014-05-15 12:52:30 +00006
Benno Schulenbergfe9da942014-05-16 20:21:34 +00007color brightred "\<[A-Z_][0-9A-Z_]+\>"
Chris Allegrettad1336f62013-06-14 02:48:59 +00008color green "\<(float|double|bool|char|int|short|long|sizeof|enum|void|auto|static|const|struct|union|typedef|extern|(un)?signed|inline)\>"
David Lawrence Ramsey012425c2006-09-16 02:40:31 +00009color green "\<((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\>"
Mike Frysinger3ca6c922017-02-20 13:07:25 -050010color green "\<(class|namespace|template|public|protected|private|typename|this|friend|virtual|override|using|mutable|volatile|register|explicit)\>"
David Lawrence Ramsey5e6434c2006-06-01 17:23:28 +000011color brightyellow "\<(for|if|while|do|else|case|default|switch)\>"
12color brightyellow "\<(try|throw|catch|operator|new|delete)\>"
13color magenta "\<(goto|continue|break|return)\>"
Chris Allegrettafe2042d2010-03-21 05:04:03 +000014color brightcyan "^[[:space:]]*#[[:space:]]*(define|include(_next)?|(un|ifn?)def|endif|el(if|se)|if|warning|error|pragma)"
David Lawrence Ramsey5e6434c2006-06-01 17:23:28 +000015color brightmagenta "'([^'\]|(\\["'abfnrtv\\]))'" "'\\(([0-3]?[0-7]{1,2}))'" "'\\x[0-9A-Fa-f]{1,2}'"
Benno Schulenbergc4b344f2014-02-23 16:07:44 +000016
Benno Schulenberg275b6172014-05-15 12:52:30 +000017# GCC builtins.
David Lawrence Ramsey5e6434c2006-06-01 17:23:28 +000018color cyan "__attribute__[[:space:]]*\(\([^)]*\)\)" "__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__"
Benno Schulenbergc4b344f2014-02-23 16:07:44 +000019
Benno Schulenberg275b6172014-05-15 12:52:30 +000020# Strings. In general you will want your strings and comments to come last,
21# because highlighting rules are applied in the order they are read in.
Benno Schulenberg836fa702016-02-07 13:14:23 +000022color brightyellow ""([^"]|\\")*"" "<[^[:blank:]=]*>"
Benno Schulenbergae598e72015-12-29 16:48:25 +000023# Multiline strings. This regex is VERY resource intensive,
24# and sometimes colours things that shouldn't be coloured.
25###color brightyellow start=""(\\.|[^"])*\\[[:space:]]*$" end="^(\\.|[^"])*""
David Lawrence Ramsey5e6434c2006-06-01 17:23:28 +000026
Benno Schulenberg275b6172014-05-15 12:52:30 +000027# Comments.
David Lawrence Ramsey5e6434c2006-06-01 17:23:28 +000028color brightblue "//.*"
David Lawrence Ramsey6da4e562006-08-02 19:30:24 +000029color brightblue start="/\*" end="\*/"
David Lawrence Ramseye081fb92007-04-11 22:18:16 +000030
Benno Schulenberg275b6172014-05-15 12:52:30 +000031# Reminders.
Benno Schulenberg836fa702016-02-07 13:14:23 +000032color ,yellow "\<(FIXME|TODO|XXX)\>"
Benno Schulenberg8347d022014-04-13 15:57:05 +000033
Benno Schulenberg275b6172014-05-15 12:52:30 +000034# Trailing whitespace.
David Lawrence Ramseye081fb92007-04-11 22:18:16 +000035color ,green "[[:space:]]+$"