blob: 0381de6d73b198980af3807526b04fcabe896f7b [file] [log] [blame]
Luke Franclba9214c2016-06-23 21:42:12 +02001## Syntax highlighting for Rust.
2## Copyright 2015 Luke Francl.
3## Licensed under GPL version 3.
4
5## NOTE: Rules are applied in order: later rules re-colorize matching text.
6
7syntax "rust" "\.rs"
8comment "//"
9
10# Function definitions
11color magenta "fn [a-z_0-9]+"
12
13# Reserved words
14color yellow "\<(abstract|alignof|as|become|box|break|const|continue|crate|do|else|enum|extern|false|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|offsetof|override|priv|pub|pure|ref|return|sizeof|static|self|struct|super|true|trait|type|typeof|unsafe|unsized|use|virtual|where|while|yield)\>"
15
16# Macros
17color red "[a-z_]+!"
18
19# Constants
20color magenta "[A-Z][A-Z_0-9]+"
21
22# Traits/Enums/Structs/Types/...
Dirkjan Ochtman1349c1d2016-07-21 10:21:19 +020023color magenta "[A-Z][A-Za-z0-9]+"
Luke Franclba9214c2016-06-23 21:42:12 +020024
25# Strings
26color green "\".*\""
27color green start="\".*\\$" end=".*\""
28## NOTE: This isn't accurate, but matching "#{0,} for the end of the string is too liberal.
29color green start="r#+\"" end="\"#+"
30
31# Comments
32color blue "//.*"
33color blue start="/\*" end="\*/"
34
35# Attributes
36color magenta start="#!\[" end="\]"
37
38# Some common markers
39color brightcyan "(XXX|TODO|FIXME|\?\?\?)"