anchor.diff:                         |> Option.fill scheme.KeywordTypes
           | None -> scheme.KeywordTypes
   
  +module Tokens =
  +    let (|InactiveCode|_|) = function
  +        | token when token.ColorClass = FSharpTokenColorKind.InactiveCode -> Some token
  +        | _ -> None
  +
  +    let (|InactiveCodeSection|_|) = function
  +       | InactiveCode x :: xs -> 
  +           let rec loop ts acc = 
  +               match ts with 
  +               | InactiveCode head :: rest ->
  +                   loop rest (head :: acc) 
  +               | _ -> List.rev acc, ts
  +           Some (loop xs [x])
  +       | _ -> None
  +
  +    let CollapseInactiveTokens tokens =
  +        let rec loop tokens =
  +            [   match tokens with
  +                | InactiveCodeSection (inactiveSegs, rest) ->
  +                    //collapse inactivesegs
  +                    let startSeg = inactiveSegs |> List.head
  +                    let endSeg = inactiveSegs |> List.last
  +                    let combinedToken =
  +                        {startSeg with RightColumn = endSeg.RightColumn
  +                                       FullMatchedLength = endSeg.RightColumn - startSeg.LeftColumn}
  +                    yield combinedToken
  +                    yield! loop rest
  +                | head::tail -> yield head
  +                                yield! loop tail
  +                | [] -> () ]
  +        loop tokens
  +
  +
   type FSharpSyntaxMode(editor, context) =
       inherit MonoDevelop.Ide.Editor.Highlighting.SemanticHighlighting(editor, context)
   
  
positive.code:             | _ -> None
          else None
  
  
      let isPreprocessor (s:string) =
          s.StartsWith "#if" || s.StartsWith "#else" || s.StartsWith "#endif" 
  
  //    let (|StartsWithAbstractBlockSpan|ContainsAbstractBlockSpan|Other|) (spans: CloneableStack<Span>) =
  //        if spans = null || spans.Count = 0 then Other else
  //        match spans.Peek () with
  //        | :? FSharpSyntaxModeInternals.AbstractBlockSpan as abs -> StartsWithAbstractBlockSpan abs
  //        | _ -> spans.Clone()
  //               |> Seq.tryFind (fun s -> s :? FSharpSyntaxModeInternals.AbstractBlockSpan)
  //               |> function
  //                  | Some bs -> ContainsAbstractBlockSpan (bs :?> FSharpSyntaxModeInternals.AbstractBlockSpan)
  //                  | None -> Other
  
  //    let (|ExcludedCode|StringCode|CommentCode|OtherCode|PreProcessor|) (document: TextDocument, line: DocumentLine, offset, length, style: Highlighting.ColorScheme) =
  //        let docText = document.GetTextAt(offset, length)
  //
  //        let isPreProcessor = docText.Trim() |> isPreprocessor
  //
  //        if line.StartSpan <> null && line.StartSpan.Count > 0 then
  //            match line.StartSpan with
  //            | StartsWithAbstractBlockSpan abs ->
  //                if isPreProcessor then
  //                    PreProcessor docText
  //                else
  //                    if abs.Disabled then
  //                        ExcludedCode style.ExcludedCode.Name
  //                    else
  //                        OtherCode (style.PlainText.Name, docText)
  //
  //            | ContainsAbstractBlockSpan bs-> 
  //                if bs.Disabled then
  //                    ExcludedCode style.ExcludedCode.Name
  //                else
  //                    OtherCode (style.PlainText.Name, docText)
  //
  //            | Other ->
  //                match line.StartSpan.Peek() with
  //                | span when span.Rule = "String" || span.Rule = "VerbatimString" || span.Rule = "TripleQuotedString" ->
  //                    StringCode span.Color
  //                | span when span.Rule = "Comment" || span.Rule = "MultiComment" ->
  //                    CommentCode span.Color
  //                | _span -> OtherCode (style.PlainText.Name, docText)
  //
  //        else
  //            if docText.StartsWith ("#") then
  //                PreProcessor docText
  //            else
  //                OtherCode (style.PlainText.Name, docText)
  
  module internal Rules =
      let baseMode =
          let assembly = Reflection.Assembly.GetExecutingAssembly ()
  
negative.code:     override x.GetColoredSegments (segment) =
          let line = editor.GetLineByOffset segment.Offset
          match segments with
          | xs when xs.Length >= line.LineNumber-1 -> segments.[line.LineNumber-1] |> List.toSeq
          | _ -> Seq.empty