[gtksourceview: 4/13] css.lang: Allow comments before attribute name in attribute selectors



commit dcff4fc93af1957dd11a2f22c3721742327be790
Author: Jeffery To <jeffery to gmail com>
Date:   Sat Nov 30 22:50:29 2019 +0800

    css.lang: Allow comments before attribute name in attribute selectors

 data/language-specs/css.lang        | 11 ++++-------
 tests/syntax-highlighting/file.css  |  3 ++-
 tests/syntax-highlighting/file.less |  3 ++-
 tests/syntax-highlighting/file.scss |  3 ++-
 4 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/data/language-specs/css.lang b/data/language-specs/css.lang
index 3a709643..3aee114f 100644
--- a/data/language-specs/css.lang
+++ b/data/language-specs/css.lang
@@ -2280,22 +2280,19 @@
       <match>\*</match>
     </context>
 
-    <context id="attribute-selector-attribute-name">
-      <match>(?&lt;=\[)\s*(\%{identifier})</match>
-      <include>
-        <context sub-pattern="1" style-ref="attribute-selector-name"/>
-      </include>
+    <context id="attribute-selector-attribute-name" once-only="true" style-ref="attribute-selector-name">
+      <match>\%{identifier}</match>
     </context>
 
-    <context id="attribute-selector-operator" style-ref="attribute-selector-operator">
+    <context id="attribute-selector-operator" once-only="true" style-ref="attribute-selector-operator">
       <match>[~|^$*]?=</match>
     </context>
 
     <context id="attribute-selector-content">
       <include>
-        <context ref="string-value"/>
         <context ref="attribute-selector-attribute-name"/>
         <context ref="attribute-selector-operator"/>
+        <context ref="string-value"/>
       </include>
     </context>
 
diff --git a/tests/syntax-highlighting/file.css b/tests/syntax-highlighting/file.css
index a31674fa..21964d48 100644
--- a/tests/syntax-highlighting/file.css
+++ b/tests/syntax-highlighting/file.css
@@ -42,7 +42,8 @@ Body {
 .someclass,    /* class */
 div,           /* type */
 *,             /* universal */
-[lang|="zh"] { /* attribute */
+[lang|="zh"], /* attribute */
+[ /* comment */ lang /* comment */ |= /* comment */ "zh" /* comment */ ] {
     color: black;
 }
 
diff --git a/tests/syntax-highlighting/file.less b/tests/syntax-highlighting/file.less
index 0640f6b3..889931d7 100644
--- a/tests/syntax-highlighting/file.less
+++ b/tests/syntax-highlighting/file.less
@@ -464,7 +464,8 @@ Body {
 .someclass,    /* class */
 div,           /* type */
 *,             /* universal */
-[lang|="zh"] { /* attribute */
+[lang|="zh"], /* attribute */
+[ /* comment */ lang /* comment */ |= /* comment */ "zh" /* comment */ ] {
     color: black;
 }
 
diff --git a/tests/syntax-highlighting/file.scss b/tests/syntax-highlighting/file.scss
index 3242e224..12d70a57 100644
--- a/tests/syntax-highlighting/file.scss
+++ b/tests/syntax-highlighting/file.scss
@@ -489,7 +489,8 @@ Body {
 .someclass,    /* class */
 div,           /* type */
 *,             /* universal */
-[lang|="zh"] { /* attribute */
+[lang|="zh"], /* attribute */
+[ /* comment */ lang /* comment */ |= /* comment */ "zh" /* comment */ ] {
     color: black;
 }
 


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