[gtksourceview/wip/latex] latex.lang: more specific commands contexts



commit cb933889f6b999be23f11ab84c420cfb72083f49
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Thu Nov 28 16:23:15 2013 +0100

    latex.lang: more specific commands contexts
    
    Apply the 'name' style to some specific commands.
    Rename the 'command' context to 'generic-command'.

 data/language-specs/latex.lang |   52 +++++++++++++++++++++++++++------------
 1 files changed, 36 insertions(+), 16 deletions(-)
---
diff --git a/data/language-specs/latex.lang b/data/language-specs/latex.lang
index ae9d733..68d7a64 100644
--- a/data/language-specs/latex.lang
+++ b/data/language-specs/latex.lang
@@ -259,18 +259,6 @@
       <keyword>zeta</keyword>
     </context>
 
-    <context id="command" style-ref="command" class="no-spell-check">
-      <match>\\[a-zA-Z]+\*?</match>
-    </context>
-
-    <context id="usepackage">
-      <match>(\\usepackage)(\[.*\])?\{([0-9a-zA-Z,\s]+)\}</match>
-        <include>
-          <context sub-pattern="1" style-ref="include"/>
-          <context sub-pattern="3" style-ref="name"/>
-        </include>
-    </context>
-
     <context id="include" style-ref="include" class="no-spell-check">
       <prefix>\\</prefix>
 
@@ -280,6 +268,38 @@
       <keyword>usepackage</keyword>
     </context>
 
+    <context id="generic-command" style-ref="command" class="no-spell-check">
+      <match>\\[a-zA-Z]+\*?</match>
+    </context>
+
+    <context id="specific-commands">
+      <include>
+        <context id="documentclass" class="no-spell-check">
+          <match>(\\documentclass)(\[.*\])?\{([a-zA-Z]+)\}</match>
+          <include>
+            <context sub-pattern="1" style-ref="common-commands"/>
+            <context sub-pattern="3" style-ref="name"/>
+          </include>
+        </context>
+
+        <context id="usepackage" class="no-spell-check">
+          <match>(\\usepackage)(\[.*\])?\{([0-9a-zA-Z,\s]+)\}</match>
+          <include>
+            <context sub-pattern="1" style-ref="include"/>
+            <context sub-pattern="3" style-ref="name"/>
+          </include>
+        </context>
+
+        <context id="begin-end-command" class="no-spell-check">
+          <match>(\\(begin|end))\{([a-zA-Z0-9]+\*?)\}</match>
+          <include>
+            <context sub-pattern="1" style-ref="common-commands"/>
+            <context sub-pattern="3" style-ref="name"/>
+          </include>
+        </context>
+      </include>
+    </context>
+
     <!-- special characters -->
 
     <define-regex id="accents" extended="true">
@@ -330,7 +350,7 @@
       <include>
         <context ref="common-commands"/>
         <context ref="special-char"/>
-        <context ref="command"/>
+        <context ref="generic-command"/>
       </include>
     </context>
 
@@ -338,7 +358,7 @@
       <include>
         <context ref="common-commands"/>
         <context ref="special-char"/>
-        <context ref="command"/>
+        <context ref="generic-command"/>
       </include>
     </context>
 
@@ -396,11 +416,11 @@
         <context ref="comment"/>
         <context ref="verbatim"/>
         <context ref="math"/>
-        <context ref="usepackage"/>
+        <context ref="specific-commands"/>
         <context ref="include"/>
         <context ref="common-commands"/>
         <context ref="special-char"/>
-        <context ref="command"/>
+        <context ref="generic-command"/>
       </include>
     </context>
   </definitions>


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