2016-06-23 22:42:12 +03:00
## Syntax highlighting for Rust.
2020-04-20 20:15:43 +03:00
2016-06-23 22:42:12 +03:00
## Copyright 2015 Luke Francl.
2021-06-27 12:08:42 +03:00
## Licensed under GPL version 3 or newer.
2016-06-23 22:42:12 +03:00
2018-05-18 21:40:08 +03:00
syntax rust "\.(rlib|rs)$"
2016-06-23 22:42:12 +03:00
comment "//"
# Function definitions
color magenta "fn [a-z_0-9]+"
# Reserved words
2019-09-29 16:11:15 +03:00
color yellow "\<(abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|false|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|true|try|type|typeof|unsafe|unsized|use|virtual|where|while|yield)\>"
2016-06-23 22:42:12 +03:00
# Macros
color red "[a-z_]+!"
# Constants
color magenta "[A-Z][A-Z_0-9]+"
# Traits/Enums/Structs/Types/...
2016-07-21 11:21:19 +03:00
color magenta "[A-Z][A-Za-z0-9]+"
2016-06-23 22:42:12 +03:00
# Strings
2021-10-21 12:27:29 +03:00
color green ""([^"]|\\")*""
2021-10-27 12:06:40 +03:00
color green start=""([^"]|\\")*\\$" end="(^|.*[^\])""
## Inaccurate, but it's not possible to balance the number of hashes.
2020-07-27 11:47:27 +03:00
color green start="r#+"" end=""#+"
2016-06-23 22:42:12 +03:00
# Comments
color blue "//.*"
color blue start="/\*" end="\*/"
# Attributes
color magenta start="#!\[" end="\]"
# Some common markers
2020-04-21 13:47:08 +03:00
color brightcyan "XXX|TODO|FIXME|\?\?\?"