diff options
author | Mike Krüger <mkrueger@xamarin.com> | 2011-11-07 15:04:52 +0400 |
---|---|---|
committer | Mike Krüger <mkrueger@xamarin.com> | 2011-11-07 15:05:30 +0400 |
commit | 50edb8a59d8f3f90c145fbceaef7f0c5ddba171f (patch) | |
tree | f51fbd83d0ea6b2fb8331760292ed0074f544fc1 /main/src/addins/CSharpBinding | |
parent | 0981ff7eded28f170187411c132e20feb2e28ee0 (diff) |
[CSharpBinding] Pre processor directives now need to start the line
for beeing highlighted. (otherwise they are not pre processor
directives in C#)
Diffstat (limited to 'main/src/addins/CSharpBinding')
-rw-r--r-- | main/src/addins/CSharpBinding/MonoDevelop.CSharp.Highlighting/CSharpSyntaxMode.cs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Highlighting/CSharpSyntaxMode.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Highlighting/CSharpSyntaxMode.cs index 4b478c0da5..4033fe0701 100644 --- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Highlighting/CSharpSyntaxMode.cs +++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Highlighting/CSharpSyntaxMode.cs @@ -494,7 +494,7 @@ namespace MonoDevelop.CSharp.Highlighting return; } int textOffset = i - StartOffset; - if (CurText.IsAt (textOffset, "#else")) { + if (CurText.IsAt (textOffset, "#else") && IsFirstNonWsChar (textOffset)) { if (!spanStack.Any (s => s is IfBlockSpan || s is ElseIfBlockSpan)) { base.ScanSpan (ref i); return; @@ -529,7 +529,7 @@ namespace MonoDevelop.CSharp.Highlighting FoundSpanBegin (preprocessorSpan, i, 0); return; } - if (CurText.IsAt (textOffset, "#if")) { + if (CurText.IsAt (textOffset, "#if") && IsFirstNonWsChar (textOffset)) { int length = CurText.Length - textOffset; string parameter = CurText.Substring (textOffset + 3, length - 3); var lexer = new ICSharpCode.OldNRefactory.Parser.CSharp.Lexer (new System.IO.StringReader (parameter)); @@ -564,7 +564,7 @@ namespace MonoDevelop.CSharp.Highlighting i += length - 1; return; } - if (CurText.IsAt (textOffset, "#elif") && spanStack.Any (span => span is IfBlockSpan)) { + if (CurText.IsAt (textOffset, "#elif") && spanStack.Any (span => span is IfBlockSpan) && IsFirstNonWsChar (textOffset)) { LineSegment line = doc.GetLineByOffset (i); int length = line.Offset + line.EditableLength - i; string parameter = doc.GetTextAt (i + 5, length - 5); @@ -603,7 +603,7 @@ namespace MonoDevelop.CSharp.Highlighting //i += length - 1; return; } - if (CurRule.Name == "<root>" && CurText[textOffset] == '#') { + if (CurRule.Name == "<root>" && CurText[textOffset] == '#' && IsFirstNonWsChar (textOffset)) { var preprocessorSpan = CreatePreprocessorSpan (); FoundSpanBegin (preprocessorSpan, i, 1); } |