gtksourceview r2003 - in trunk: . gtksourceview/language-specs



Author: muntyan
Date: Mon Aug  4 23:23:26 2008
New Revision: 2003
URL: http://svn.gnome.org/viewvc/gtksourceview?rev=2003&view=rev

Log:
2008-08-04  Yevgen Muntyan  <muntyan tamu edu>

	* gtksourceview/language-specs/csharp.lang: added {...} format regex
	to strings (see bug #507125 for reference), replaced single-quoted
	string with a character context like in c.lang.



Modified:
   trunk/ChangeLog
   trunk/gtksourceview/language-specs/csharp.lang

Modified: trunk/gtksourceview/language-specs/csharp.lang
==============================================================================
--- trunk/gtksourceview/language-specs/csharp.lang	(original)
+++ trunk/gtksourceview/language-specs/csharp.lang	Mon Aug  4 23:23:26 2008
@@ -37,6 +37,9 @@
     <style id="error" _name="Error" map-to="def:error"/>
     <style id="type" _name="Data Type" map-to="def:type"/>
     <style id="string" _name="String" map-to="def:string"/>
+    <style id="char" _name="Character" map-to="def:character"/>
+    <style id="escaped-character" _name="Escaped Character" map-to="def:special-char"/>
+    <style id="format" _name="String Format" map-to="def:character"/>
     <style id="keyword" _name="Keyword" map-to="def:keyword"/>
     <style id="preprocessor" _name="Preprocessor" map-to="def:preprocessor"/>
     <style id="null-value" _name="Null Value" map-to="def:special-constant"/>
@@ -98,12 +101,8 @@
     </context>
 
     <context id="multiline-string" style-ref="string">
-      <start>@"([^"]|"")*</start>
+      <start>@"</start>
       <end>"</end>
-      <include>
-        <context ref="def:escape"/>
-        <context ref="def:line-continue"/>
-      </include>
     </context>
 
     <context id="keywords" style-ref="keyword">
@@ -230,14 +229,42 @@
       </match>
     </context>
 
+    <!-- FIXME Taken from C, is it right? -->
+    <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="string" style-ref="string" end-at-line-end="true">
+      <start>"</start>
+      <end>"</end>
+      <include>
+	<context id="csharp-format" style-ref="format">
+          <match>{[0-9][0-9:\#\%,./cdefgnrxtsuDTFGMY]*}</match>
+        </context>
+        <context id="escaped-character" style-ref="escaped-character">
+          <match>\%{escaped-character}</match>
+        </context>
+        <context ref="def:line-continue"/>
+      </include>
+    </context>
+
+    <context id="char" style-ref="char">
+      <!-- FIXME I don't know C# syntax -->
+      <match>'(\%{escaped-character}|.)'</match>
+    </context>
+
     <context id="c-sharp">
       <include>
-        <context ref="def:string"/>
-        <context ref="def:single-quoted-string"/>
+        <context ref="multiline-string"/>
+        <context ref="string"/>
+        <context ref="char"/>
         <context ref="line-comment"/>
         <context ref="multiline-comment"/>
         <context ref="close-comment-outside-comment"/>
-        <context ref="multiline-string"/>
         <context ref="if-false-comment"/>
         <context ref="preprocessor"/>
         <context ref="keywords"/>



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