1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-11-14 02:44:35 +03:00

fix rust pub highlight

This commit is contained in:
Skyler Hawthorne 2021-05-01 00:35:56 -04:00
parent e04cc1b4c8
commit a25ef2bd6d
5 changed files with 30 additions and 1 deletions

View File

@ -82,8 +82,9 @@ add-highlighter shared/rust/code/question_mark regex \? 0:meta
add-highlighter shared/rust/code/function_call regex _?[a-zA-Z]\w*\s*(?=\() 0:function
add-highlighter shared/rust/code/generic_function_call regex _?[a-zA-Z]\w*\s*(?=::<) 0:function
add-highlighter shared/rust/code/function_declaration regex (?:fn\h+)(_?\w+)(?:<[^>]+?>)?\( 1:function
add-highlighter shared/rust/code/keywords regex \b(?:let|as|fn|return|match|if|else|loop|for|in|while|break|continue|box|where|impl|dyn|unsafe|async|await|mod|crate|use|extern|trait|struct|enum|union|type|default)\b 0:keyword
add-highlighter shared/rust/code/keywords regex \b(?:as|break|continue|crate|else|enum|extern|false|fn|for|if|impl|in|let|loop|match|mod|pub|return|self|Self|struct|super|trait|true|type|unsafe|use|where|while|async|await|dyn|abstract|become|box|do|try)\b 0:keyword
add-highlighter shared/rust/code/storage regex \b(move|mut|ref|static|const)\b 0:type
add-highlighter shared/rust/code/pub_with_scope regex \b(pub)\h*(\()\h*(crate|super|self|in\h+[\w:]+)\h*(\)) 1:keyword 2:meta 4:meta
# after let can be an arbitrary pattern match
add-highlighter shared/rust/code/macro regex \b\w+! 0:meta
# the number literals syntax is defined here:

View File

@ -0,0 +1 @@

View File

@ -0,0 +1,17 @@
// bare
pub
// with scope
pub(crate)
pub (crate)
pub(super)
pub(self)
pub(in ::foo)
pub(in foo)
pub(in foo::bar)
pub(in foo::bar::baz)
// not valid pub expression, parens not colored
pub(crat)
pub(in)
spub(crate)

View File

@ -0,0 +1,3 @@
source "%val{runtime}/colors/default.kak"
source "%val{runtime}/rc/filetype/rust.kak"
set buffer filetype rust

File diff suppressed because one or more lines are too long