[gtksourceview/gnome-3-24] rust.lang: fix invalid-char context matching rust's lifetime syntax



commit d0a5b63d60ef37f45265a674bd718e15b6edf06f
Author: Chris van Zomeren <vanzomerenc gmail com>
Date:   Sat Feb 25 20:12:43 2017 -0500

    rust.lang: fix invalid-char context matching rust's lifetime syntax
    
    Lifetimes in rust use a single quote as part of their syntax.
    When 2 or more lifetimes appear on a line, part of the line is
    (incorrectly) highlighted by the invalid-char context.
    
    Example:
    
        struct SomeObject<'a, T: 'a> {}
    
    Before this patch, everything between the quotes on this line is
    highlighted as invalid-char.
    
    This patch prevents the invalid-char context in rust.lang from
    matching single quotes which are part of the lifetime syntax,
    by abandoning a match for invalid-char if the closing quote is
    immediately followed by an identifier.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=779236

 data/language-specs/rust.lang |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/data/language-specs/rust.lang b/data/language-specs/rust.lang
index 61d9997..c3ca232 100644
--- a/data/language-specs/rust.lang
+++ b/data/language-specs/rust.lang
@@ -273,7 +273,7 @@ except according to those terms.
     </context>
 
     <context id="invalid-char" style-ref="error">
-      <match extended="true">'([^\\']|\\\%{common-escape}|\\\%{unicode-escape}){2,}'</match>
+      <match extended="true">'([^\\']|\\\%{common-escape}|\\\%{unicode-escape}){2,}'(?!\%{ident})</match>
     </context>
 
     <context id="byte" style-ref="char">


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]