diff --git a/RustEnhanced.sublime-syntax b/RustEnhanced.sublime-syntax index adc156c8..c00ed17f 100644 --- a/RustEnhanced.sublime-syntax +++ b/RustEnhanced.sublime-syntax @@ -28,7 +28,7 @@ contexts: - match: ';' scope: punctuation.terminator - - match: '''({{identifier}})\s*(:)' + - match: '(''{{identifier}})\s*(:)' captures: 1: entity.name.label.rust 2: punctuation.separator.rust @@ -138,9 +138,14 @@ contexts: - match: \b(crate|extern|use|where)\b scope: keyword.other.rust - - match: \b(break|else|for|if|loop|match|while|continue|yield)\b + - match: \b(else|for|if|loop|match|while|yield)\b scope: keyword.control.rust + - match: '\b(break|continue)(?:\s+(''{{identifier}}))?' + captures: + 1: keyword.control.rust + 2: entity.name.label.rust + - match: \breturn\b scope: keyword.control.rust diff --git a/syntax_test_rust.rs b/syntax_test_rust.rs index 19411025..d9d97264 100644 --- a/syntax_test_rust.rs +++ b/syntax_test_rust.rs @@ -500,6 +500,23 @@ let big_n = } } +'label1: for _ in 0..100 { + 'label2 : loop { +// ^^^^^^^ entity.name.label +// ^ punctuation.separator.rust + 'label3: while true { +// ^^^^^^^ entity.name.label +// ^ punctuation.separator + break 'label2; +// ^^^^^^^ entity.name.label +// ^ punctuation.terminator + } + continue 'label1; +// ^^^^^^^ entity.name.label +// ^ punctuation.terminator + } +} + while n < 50 { //^^^ keyword.control n = n * 2;