[gtksourceview] c.lang: place type keywords in separate style



commit f3d0c62df1dced3b8bbf75c1be602937fa9bd35d
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 7a368c2f..48c7f9c4 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">
@@ -320,6 +324,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]