[gtksourceview] Add scaping highlighting for example \n in string.



commit af5644fed38424cf3c2012513d76336fff22534b
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Thu Dec 3 23:46:15 2009 +0100

    Add scaping highlighting for example \n in string.

 gtksourceview/language-specs/prolog.lang |   35 +++++++++++++++++++++++------
 1 files changed, 27 insertions(+), 8 deletions(-)
---
diff --git a/gtksourceview/language-specs/prolog.lang b/gtksourceview/language-specs/prolog.lang
index 47ac6b4..d562bad 100644
--- a/gtksourceview/language-specs/prolog.lang
+++ b/gtksourceview/language-specs/prolog.lang
@@ -27,19 +27,28 @@
   </metadata>
 
   <styles>
-    <style id="comment"      _name="Comment"      map-to="def:comment"/>
-    <style id="variable"     _name="Variable"     map-to="def:type"/>
-    <style id="keyword"      _name="Keyword"      map-to="def:keyword"/>
-    <style id="string"       _name="String"       map-to="def:string"/>
-    <style id="number"       _name="Number"       map-to="def:decimal"/>
-    <style id="operator"     _name="Operator"     map-to="def:operator"/>
-    <style id="error"        _name="Error"        map-to="def:error"/>
+    <style id="comment"           _name="Comment"           map-to="def:comment"/>
+    <style id="variable"          _name="Variable"          map-to="def:type"/>
+    <style id="keyword"           _name="Keyword"           map-to="def:keyword"/>
+    <style id="string"            _name="String"            map-to="def:string"/>
+    <style id="number"            _name="Number"            map-to="def:decimal"/>
+    <style id="operator"          _name="Operator"          map-to="def:operator"/>
+    <style id="error"             _name="Error"             map-to="def:error"/>
+    <style id="escaped-character" _name="Escaped Character" map-to="def:special-char"/>
   </styles>
 
   <definitions>
     
     <define-regex id="symbolchar">[-!+\\|=:&amp;&gt;&lt;]</define-regex>
-    
+
+    <define-regex id="escaped-character" extended="true">
+            \\(                   # leading backslash
+            [\\\"\'nrbtfav\?] |   # escaped character
+            [0-7]{1,3} |          # one, two, or three octal digits
+            x[0-9A-Fa-f]+         # 'x' followed by hex digits
+            )
+    </define-regex>
+
     <context id="line-comment" style-ref="comment" end-at-line-end="true">
       <start>%</start>
       <include>
@@ -84,14 +93,24 @@
       <match>([!;]|:\-)</match>
     </context>
 
+    <context id="escaped-character" style-ref="escaped-character">
+          <match>\%{escaped-character}</match>
+    </context>
+
     <context id="string" style-ref="string" end-at-line-end="true">
       <start>"</start>
       <end>"</end>
+      <include>
+        <context ref="escaped-character"/>
+      </include>
     </context>
 
     <context id="string2" style-ref="string" end-at-line-end="true">
       <start>'</start>
       <end>'</end>
+      <include>
+        <context ref="escaped-character"/>
+      </include>
     </context>
 
     <context id="number" style-ref="number">



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