[gtksourceview] css.lang: Improve highlighting of functions: nesting and dimensions



commit 7d020c4d88ff6731766f9c51e105f42d52aa4af0
Author: Tobias Schönberg <tobias47n9e gmail com>
Date:   Wed Jun 21 19:32:12 2017 +0200

    css.lang: Improve highlighting of functions: nesting and dimensions
    
    Currently nested functions are not highlighted. Functions like
    'translateX' are not hightlighted when the x is lower case.
    Dimensions are not highlighted at all within functions.
    This commit fixes these 3 issues. Function context is now
    defined after units and imports them. Nesting is allowed.
    Regex allows uppercase letters in function names.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=776830

 data/language-specs/css.lang |   28 +++++++++++++++++-----------
 1 files changed, 17 insertions(+), 11 deletions(-)
---
diff --git a/data/language-specs/css.lang b/data/language-specs/css.lang
index c6236c4..eff8b86 100644
--- a/data/language-specs/css.lang
+++ b/data/language-specs/css.lang
@@ -162,17 +162,6 @@
       <keyword>yellow</keyword>
     </context>
 
-    <context id="function">
-      <start>[a-zA-Z][a-z0-9-]+\(</start>
-      <end>\)</end>
-      <include>
-        <context sub-pattern="0" where="start" style-ref="function"/>
-        <context sub-pattern="0" where="end" style-ref="function"/>
-        <context ref="def:escape"/>
-        <context ref="def:line-continue"/>
-      </include>
-    </context>
-
     <context id="dimension" style-ref="dimension">
       
<match>[\+-]?([0-9]+|[0-9]*\.[0-9]+)(%|e(m|x)|(v(h|w|min|max))|ch|fr|rem|p(x|t|c)|in|ft|(m|c)m|k?Hz|deg|g?rad|m?s)</match>
     </context>
@@ -978,6 +967,23 @@
       <match>[*&gt;+]</match>
     </context>
 
+    <context id="function">
+      <start>[a-zA-Z][a-zA-Z0-9-]+\(</start>
+      <end>\)</end>
+      <include>
+        <context sub-pattern="0" where="start" style-ref="function"/>
+        <context sub-pattern="0" where="end" style-ref="function"/>
+        <context ref="def:escape"/>
+        <context ref="def:line-continue"/>
+        <context ref="hexadecimal-color"/>
+        <context ref="resolution"/>
+        <context ref="dimension"/>
+        <context ref="float-number"/>
+        <context ref="number"/>
+        <context ref="function"/>
+      </include>
+    </context>
+
     <context id="css" class="no-spell-check">
       <include>
         <context ref="def:string"/>


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