diff --git a/Rust/Rust.sublime-syntax b/Rust/Rust.sublime-syntax index 5548a29056..31f9d373a6 100644 --- a/Rust/Rust.sublime-syntax +++ b/Rust/Rust.sublime-syntax @@ -498,14 +498,17 @@ contexts: - include: type-any-identifier - match: '''{{identifier}}(?!\'')\b' scope: storage.modifier.lifetime.rust - - match: '\b([[:upper:]]|_*[[:upper:]][[:alnum:]_]*[[:lower:]][[:alnum:]_]*)\b::' + - match: '\b([[:upper:]]|_*[[:upper:]][[:alnum:]_]*[[:lower:]][[:alnum:]_]*)\b(::)' scope: meta.path.rust storage.type.rust captures: 1: storage.type.rust - - match: '{{identifier}}::' - scope: meta.path.rust - - match: '::(?={{identifier}})' + 2: punctuation.accessor.rust + - match: '{{identifier}}(::)' scope: meta.path.rust + captures: + 1: punctuation.accessor.rust + - match: '(::)(?={{identifier}})' + scope: meta.path.rust punctuation.accessor.rust - match: '(?=<)' push: generic-angles - match: '\(' @@ -1060,12 +1063,15 @@ contexts: - meta_scope: meta.path.rust - include: no-path-identifiers - match: '::' + scope: punctuation.accessor.rust set: no-type-names - - match: '{{identifier}}::' + - match: '{{identifier}}(::)' scope: meta.path.rust + captures: + 1: punctuation.accessor.rust push: no-type-names - - match: '::(?={{identifier}})' - scope: meta.path.rust + - match: '(::)(?={{identifier}})' + scope: meta.path.rust punctuation.accessor.rust push: no-type-names - include: no-path-identifiers diff --git a/Rust/syntax_test_rust.rs b/Rust/syntax_test_rust.rs index 0461f21274..ee4e36f839 100644 --- a/Rust/syntax_test_rust.rs +++ b/Rust/syntax_test_rust.rs @@ -151,18 +151,23 @@ pub use self::trafile::*; // <- storage.modifier // ^ keyword.other // ^^^^^^^^^^^^^^^ meta.path +// ^^ punctuation.accessor use std::fmt; // <- keyword.other // ^^^^^ meta.path +// ^^ punctuation.accessor // ^^^ - meta.path use foo::i32; // ^^^^^ meta.path +// ^^ punctuation.accessor // ^^^ - meta.path storage.type use foo::Bar; // ^^^^^ meta.path +// ^^ punctuation.accessor use foo::{Baz, QUX, quux}; // ^^^^^ meta.path +// ^^ punctuation.accessor // ^^^^^^^^^^^^^^^^ meta.block // ^^^ constant.other @@ -221,6 +226,7 @@ impl fmt::Display for PrintableStruct { // <- storage.type.impl //^^ storage.type.impl // ^^^^^ meta.path +// ^^ punctuation.accessor // ^^^ keyword.other // ^^^^^^^^^^^^^^^ entity.name.impl // ^ meta.block punctuation.section.block.begin @@ -241,6 +247,7 @@ impl fmt::Display for PrintableStruct { // ^ punctuation.section.parameters.end // ^^ punctuation.separator // ^^^^^ meta.path +// ^^ punctuation.accessor // ^ meta.block punctuation.section.block.begin write!(f, "{}", self.0) // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function @@ -626,6 +633,7 @@ fn factory() -> Box i32> { // ^^ storage.type // ^^ punctuation.separator Box::new(|x| x + 1) +// ^^ punctuation.accessor } let inferred_closure = |i, j: u32| i + 1; @@ -829,7 +837,7 @@ macro_rules! forward_ref_binop [ // ^ meta.macro meta.group meta.block meta.impl meta.block punctuation.section.block.begin type Output = <$t as $imp<$u>>::Output; // ^^^^^^^^^^^^^^^^ meta.generic -// ^^ meta.path +// ^^ meta.path punctuation.accessor #[inline] // ^^^^^^^^^ meta.annotation @@ -845,7 +853,7 @@ macro_rules! forward_ref_binop [ // ^^ variable.other // ^^ punctuation.separator // ^^^^^^^^^^^^^^^^ meta.generic -// ^^ meta.path +// ^^ meta.path punctuation.accessor // ^ meta.macro meta.group meta.block meta.impl meta.block meta.block punctuation.section.block.begin #![cfg(all(unix, target_pointer_width = "32"))] // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.annotation