[mono/monodevelop] 9dfdc8b0: Fixed 'Bug 15233 - Syntax highlighting incorrect in F#'.

Mike Krüger ([email protected]) <[email protected]>
Newsgroups gmane.comp.gnome.mono.patches
Message-ID <00000141bbab39f4-88f33b25-64f2-4752-8ef7-00df7d1bc4e7-000000@email.amazonses.com>
   Branch: refs/heads/master
     Home: https://github.com/mono/monodevelop
  Compare: https://github.com/mono/monodevelop/compare/4e63a77545ae...9dfdc8b08e4e

   Commit: 9dfdc8b08e4eef2b62c47644149d31731ce4f795
   Author: Mike Krüger <[email protected]> (mkrueger)
     Date: 2013-10-15 10:29:22 GMT
      URL: https://github.com/mono/monodevelop/commit/9dfdc8b08e4eef2b62c47644149d31731ce4f795

Fixed 'Bug 15233 - Syntax highlighting incorrect in F#'.

Changed paths:
  M main/src/core/Mono.Texteditor/Mono.TextEditor.Highlighting/SyntaxMode.cs
  M main/src/core/Mono.Texteditor/SyntaxModes/FSharpSyntaxMode.xml

Modified: main/src/core/Mono.Texteditor/Mono.TextEditor.Highlighting/SyntaxMode.cs
===================================================================
@@ -205,7 +205,6 @@ public class SpanParser
 			protected Stack<Rule> ruleStack;
 			protected readonly TextDocument doc;
 
-			internal Func<bool> IsAtWordStart = () => true;
 			int maxEnd;
 
 			public Rule CurRule {
@@ -367,8 +366,11 @@ protected virtual bool ScanSpan (ref int i)
 					bool mismatch = false;
 					if ((span.BeginFlags & SpanBeginFlags.FirstNonWs) == SpanBeginFlags.FirstNonWs)
 						mismatch = CurText.Take (i).Any (ch => !char.IsWhiteSpace (ch));
-					if ((span.BeginFlags & SpanBeginFlags.NewWord) == SpanBeginFlags.NewWord)
-						mismatch = !IsAtWordStart ();
+					if ((span.BeginFlags & SpanBeginFlags.NewWord) == SpanBeginFlags.NewWord) {
+						if (i - 1 > 0 && i - 1 < CurText.Length) {
+							mismatch = !char.IsWhiteSpace (CurText[i - 1]);
+						}
+					}
 					if (mismatch)
 						continue;
 					FoundSpanBegin (span, i, match.Length);
@@ -463,7 +465,6 @@ public ChunkParser (SyntaxMode mode, SpanParser spanParser, ColorScheme style, D
 				spanParser.FoundSpanEnd = FoundSpanEnd;
 				spanParser.FoundSpanExit = FoundSpanExit;
 				spanParser.ParseChar += ParseChar;
-				spanParser.IsAtWordStart = () => wordbuilder.Length == 0;
 				if (line == null)
 					throw new ArgumentNullException ("line");
 			}

Modified: main/src/core/Mono.Texteditor/SyntaxModes/FSharpSyntaxMode.xml
===================================================================
@@ -63,21 +63,16 @@
 		<End>"""</End>
 	</Span>
 	
-	<Span color="String" rule="String" stopateol="true">
+	<Span color="String" rule="String" stopateol="true" escape='\"'>
 		<Begin>"</Begin>
 		<End>"</End>
 	</Span>
 	
 	<Span rule="Let" stopateol = "false">
-		<Begin color="Keyword(Iteration)" flags="NewWord">let</Begin>
+		<Begin color="Keyword(Iteration)" flags="NewWord">let </Begin>
 		<End>=</End>
 	</Span>
 
-	<Span color = "String" rule="String" stopateol = "true">
-		<Begin>&apos;</Begin>
-		<End>&apos;</End>
-	</Span>
-  
 <!-- 
 	<Span color="String" rule="String" stopateol="true" escape='\'>
 		<Begin>[]</Begin>
@@ -95,6 +90,10 @@
        <Group color="String"/>
 	</Match>
 
+	<Match color="String">'(\w|\\['ntbrafv])'</Match>
+       
+
+
 	<Match color="Number">CSharpNumber</Match>
 
 	<!-- It is really impossible to do some intelligent grouping here, because
_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.