[gtksourceview] css.lang: Add highlighting for @supports



commit 042e489e4975cb77a4b1b7a5880ddb8407eb1f8c
Author: Jeffery To <jeffery to gmail com>
Date:   Fri May 11 02:18:48 2018 +0800

    css.lang: Add highlighting for @supports
    
    This adds an at-supports-call context to highlight the @supports
    at-rule.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=796130

 data/language-specs/css.lang       |   35 +++++++++++++++++++++++++++++++++++
 tests/syntax-highlighting/file.css |   15 +++++++++++++++
 2 files changed, 50 insertions(+), 0 deletions(-)
---
diff --git a/data/language-specs/css.lang b/data/language-specs/css.lang
index 5d65f97..9e91988 100644
--- a/data/language-specs/css.lang
+++ b/data/language-specs/css.lang
@@ -1385,6 +1385,7 @@
       <keyword>ornaments</keyword>
       <keyword>styleset</keyword>
       <keyword>stylistic</keyword>
+      <keyword>supports</keyword>
       <keyword>swash</keyword>
     </context>
 
@@ -1443,6 +1444,39 @@
       </include>
     </context>
 
+    <context id="at-supports-test">
+      <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="at-supports-test"/>
+        <context ref="at-supports-operators"/>
+        <context ref="all-basic-data-types"/>
+        <context ref="all-functions"/>
+        <context ref="all-style-properties"/>
+        <context ref="comma"/>
+        <context ref="colon"/>
+      </include>
+    </context>
+
+    <context id="at-supports-operators" style-ref="at-rules">
+      <keyword>and</keyword>
+      <keyword>not</keyword>
+      <keyword>or</keyword>
+    </context>
+
+    <context id="at-supports-call">
+      <start>(?&lt;=@supports)</start>
+      <include>
+        <context ref="comment"/>
+        <context ref="at-supports-test"/>
+        <context ref="at-supports-operators"/>
+        <context ref="at-rule-general-block"/>
+      </include>
+    </context>
+
     <context id="all-at-rules">
       <include>
         <context ref="vendor-specific-at-rules"/>
@@ -1450,6 +1484,7 @@
         <context ref="at-rules"/>
         <context ref="at-keyframes-call"/>
         <context ref="at-media-call"/>
+        <context ref="at-supports-call"/>
       </include>
     </context>
 
diff --git a/tests/syntax-highlighting/file.css b/tests/syntax-highlighting/file.css
index d3a1773..18c00c6 100644
--- a/tests/syntax-highlighting/file.css
+++ b/tests/syntax-highlighting/file.css
@@ -100,3 +100,18 @@ div#\E9 dition .\0000E9dition .motion_\e9motion, /* Unicode character escape */
 @media (min-resolution: +2.54dpcm) {}
 
 @media (min-aspect-ratio: 16/9) {}
+
+@supports (animation-name: test) {
+    @keyframes 'my-complicated-animation' {
+        0%      {}
+        33.333% {}
+        66.667% {}
+        100%    {}
+    }
+}
+
+@supports not ((text-align-last: justify) or (-moz-text-align-last: justify)) {
+    body {
+        text-align: justify;
+    }
+}


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