[gtksourceview] css.lang: Limit attribute operator highlighting



commit 5e57f0e3db38a90767b4ebc7359564e8d8ea13d1
Author: Jeffery To <jeffery to gmail com>
Date:   Thu May 10 20:28:31 2018 +0800

    css.lang: Limit attribute operator highlighting
    
    This adds an attribute selector container context, replacing the
    delimiters context, to limit highlighting of attribute selector
    operators (and strings) to inside the attribute selector.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=796130

 data/language-specs/css.lang |   25 ++++++++++++++++++++-----
 1 files changed, 20 insertions(+), 5 deletions(-)
---
diff --git a/data/language-specs/css.lang b/data/language-specs/css.lang
index af75c1b..5d65f97 100644
--- a/data/language-specs/css.lang
+++ b/data/language-specs/css.lang
@@ -1468,14 +1468,30 @@
       <match>\%{identifier-regex}</match>
     </context>
 
-    <context id="attribute-selector-delimiters" style-ref="others-2">
-      <match>(\[|\])</match>
+    <context id="attribute-selector-attribute-name">
+      <match>(?&lt;=\[)\s*(\%{identifier-regex})</match>
+      <include>
+        <context sub-pattern="1" style-ref="selector-tagname"/>
+      </include>
     </context>
 
-    <context id="attribute-selector-operators" style-ref="function">
+    <context id="attribute-selector-operators" style-ref="others-3">
       <match>[~|^$*]?=</match>
     </context>
 
+    <context id="attribute-selector">
+      <start>\[</start>
+      <end>\]</end>
+      <include>
+        <context sub-pattern="0" where="start" style-ref="others-3"/>
+        <context sub-pattern="0" where="end" style-ref="others-3"/>
+        <context ref="comment"/>
+        <context ref="string"/>
+        <context ref="attribute-selector-attribute-name"/>
+        <context ref="attribute-selector-operators"/>
+      </include>
+    </context>
+
     <context id="selector-grammar" style-ref="others-3">
       <match>[*&gt;+~]</match>
     </context>
@@ -1552,8 +1568,7 @@
         <context ref="selector-id"/>
         <context ref="selector-class"/>
         <context ref="selector-tagname"/>
-        <context ref="attribute-selector-delimiters"/>
-        <context ref="attribute-selector-operators"/>
+        <context ref="attribute-selector"/>
         <context ref="selector-vendor-specific-pseudo-elements-classes"/>
         <context ref="selector-pseudo-elements-one-colon"/>
         <context ref="selector-pseudo-elements"/>


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