Files
zyedidia.micro/syntax_files/rust.micro
2016-03-21 12:18:41 -04:00

37 lines
1.0 KiB
Plaintext

# Nano configuration for Rust
# Copyright 2015 The Rust Project Developers.
#
# NOTE: Rules are applied in order: later rules re-colorize matching text.
syntax "Rust" "\.rs"
# function definition
color magenta "fn [a-z0-9_]+"
# Reserved words
color yellow "\b(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)\b"
# macros
color red "[a-z_]+!"
# Constants
color magenta "[A-Z][A-Z_]+"
# Traits/Enums/Structs/Types/etc.
color magenta "[A-Z][a-z]+"
# Strings
color green "\".*\""
color green "(?s)\".*\\$.*?.*\""
# NOTE: This isn't accurate but matching "#{0,} for the end of the string is too liberal
color green "(?s)r#+\".*?\"#+"
# Comments
color blue "//.*"
color blue "(?s)/\*.*?\*/"
# Attributes
color magenta "(?s)#!\[.*?\]"
# Some common markers
color brightcyan "(XXX|TODO|FIXME|\?\?\?)"