[gtksourceview/gtksourceview-4-8] c.lang: place type keywords in separate style



commit 6d08807ba9c0cd5e027fc4e696d3111f85e8ca0d
Author: Christian Hergert <chergert redhat com>
Date:   Fri Jan 14 12:08:04 2022 -0800

    c.lang: place type keywords in separate style
    
    This allows for styling the type keywords differently (but falling back to
    the same behavior as before by referencing c:keyword) so that we can make
    style schemes such as solarized more closely match their upstream counter-
    parts.
    
    For example, in Solarized (VIM at least), `if` and another keywords are
    green except for typedef/struct/enum/union which are yellow.

 data/language-specs/c.lang | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/data/language-specs/c.lang b/data/language-specs/c.lang
index 96489321..ff6df3ae 100644
--- a/data/language-specs/c.lang
+++ b/data/language-specs/c.lang
@@ -38,6 +38,7 @@
     <style id="included-file"     name="Included File"         map-to="def:string"/>
     <style id="char"              name="Character"             map-to="def:character"/>
     <style id="keyword"           name="Keyword"               map-to="def:keyword"/>
+    <style id="type-keyword"      name="Type Keyword"          map-to="c:keyword"/>
     <style id="operator"          name="Operator"              map-to="def:operator"/>
     <style id="type"              name="Data Type"             map-to="def:type"/>
     <style id="storage-class"     name="Storage Class"         map-to="def:type"/>
@@ -199,17 +200,20 @@
       <keyword>default</keyword>
       <keyword>do</keyword>
       <keyword>else</keyword>
-      <keyword>enum</keyword>
       <keyword>for</keyword>
       <keyword>fortran</keyword>
       <keyword>goto</keyword>
       <keyword>if</keyword>
       <keyword>return</keyword>
-      <keyword>struct</keyword>
       <keyword>switch</keyword>
+      <keyword>while</keyword>
+    </context>
+
+    <context id="type-keywords" style-ref="type-keyword">
+      <keyword>enum</keyword>
+      <keyword>struct</keyword>
       <keyword>typedef</keyword>
       <keyword>union</keyword>
-      <keyword>while</keyword>
     </context>
 
     <context id="operators" style-ref="operator">
@@ -329,6 +333,7 @@
         <context ref="invalid-octal"/>
         <context ref="decimal"/>
         <context ref="keywords"/>
+        <context ref="type-keywords"/>
         <context ref="operators"/>
         <context ref="types"/>
         <context ref="storage-class"/>


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