anchor.diff:                          false
                       elif currentText.Substring(textOffset).StartsWith("#endif") then
                           let span = EndIfBlockSpan()
  -                        if this.CurSpan <> null && typeof<AbstractBlockSpan>.IsAssignableFrom(this.CurSpan.GetType()) then
  +                        if this.CurSpan <> null && this.CurSpan :? AbstractBlockSpan then
                               this.FoundSpanEnd.Invoke(this.CurSpan, i, 0)
                           this.FoundSpanBegin.Invoke(span, i, 6)
                           this.FoundSpanEnd.Invoke(span, i + 6, 0)
  +                        i <- i + 6
                           true
                       elif (this.CurSpan = null || (this.CurSpan <> null && this.CurSpan.Color <> "Excluded Code")) then
                           let spanLength = 
                               match currentText.Substring(textOffset).IndexOf(Environment.NewLine) with
                               | -1 -> currentText.Substring(textOffset).Length
                               | value -> value
  -                        this.FoundSpanBegin.Invoke(PreprocessorSpan(), i + textOffset, spanLength)
  -                        i <- i + spanLength
  -                        base.ScanSpan(&i)
  +                        let span = PreprocessorSpan()
  +                        this.FoundSpanBegin.Invoke(span, i, len)
  +                        this.FoundSpanEnd.Invoke(span, i + endIdx, 0)
  +                        i <- i + endIdx
  +                        true
                       else
                           false
                   elif (this.CurSpan <> null && this.CurSpan.Color <> "Excluded Code") then
  
positive.code:                 this.setColor()
  
      type EndIfBlockSpan() =
          inherit Span(Color = "Preprocessor", Rule = "PreProcessorComment")
  
      type IfBlockSpan() =
          inherit AbstractBlockSpan()
  
      type ElseBlockSpan() =
          inherit AbstractBlockSpan(Begin = Regex("#else"))
  
      type SpanParserState =  
          | General
          | TripleString
          | String
          | Comment
  
      let (|FoundTripleStringBegin|_|) (subText: string, (curSpan: Span), state: SpanParserState, i:int, len:int) =
          if subText.StartsWith(tripleString) && (state <> TripleString || curSpan = null || curSpan.Rule <> "String") then
              let newState = TripleString
              let spanBegin = StringSpan(), i, len
              let newi = i+3
              FoundTripleStringBegin(newState, spanBegin, newi) |> Some
          else None
  
      let (|FoundTripleStringEnd|_|) (subText: string, (curSpan: Span), state: SpanParserState, i:int, len:int) =
          if subText.StartsWith(tripleString) && (state = TripleString || curSpan.Rule = "String") then
              let newState = General
              let spanEnd = curSpan, i, len
              let newi = i+3
              FoundTripleStringEnd(newState, spanEnd, newi) |> Some
          else None
              
      let (|FoundVerbatimStringBegin|_|) (subText: string, _curSpan, state: SpanParserState, i:int, len:int) =
          if (subText.StartsWith(verbatimString) && state = General) then
              let newState = String
              let spanBegin = StringSpan(), i, len
              let newi = i+2
              FoundVerbatimStringBegin(newState, spanBegin, newi) |> Some
          else
              None     
              
      let (|FoundNormalStringBegin|_|) (subText: string, _curSpan, state: SpanParserState, i:int, len:int) =
          if (subText.StartsWith(normalString) && state = General) then
              let newState = String
              let spanBegin = StringSpan(), i, len
              let newi = i
              FoundNormalStringBegin(newState, spanBegin, newi) |> Some
          else
              None 
  
      let (|FoundEscapeString|_|) (subText: string, _curSpan, state: SpanParserState, _i:int, _len:int) =
          if (subText.StartsWith(escapeString) && (state = String || state=TripleString)) then
              FoundEscapeString |> Some
          else
              None
              
      let (|FoundNormalStringEnd|_|) (subText: string, curSpan, state: SpanParserState, i:int, len:int) =
          if (subText.StartsWith(normalString) && state = String) then
              let newState = General
              let spanEnd = curSpan, i, len
              let newi = i
              FoundNormalStringEnd(newState, spanEnd, newi) |> Some
          else
              None
  
      let containsFunctionDef (subText : string) =
          let endOfBlockDef = subText.IndexOf( '*')
          subText.IndexOf ( ')', endOfBlockDef) <> -1
  
      let (|FoundBlockCommentBegin|_|) (subText: string, _curSpan, state: SpanParserState, i:int, len:int) =
          if (subText.StartsWith(openBlockComment) && state = General && not (containsFunctionDef subText)) then
              let newState = Comment
              let spanBegin = CommentSpan(), i, len
              let newi = i+2
              FoundBlockCommentBegin(newState, spanBegin, newi) |> Some
          else
              None 
              
      let (|FoundBlockCommentEnd|_|) (subText: string, curSpan, state: SpanParserState, i:int, len:int) =
          if (subText.StartsWith(closeBlockComment) && state = Comment) then
              let newState = General
              let spanEnd = curSpan, i, len
              let newi = i+2
              FoundBlockCommentEnd(newState, spanEnd, newi) |> Some
          else
              None
      
  
      type FSharpSpanParser(mode:SyntaxMode, spanStack, defines: string list) =
          inherit SyntaxMode.SpanParser(mode, spanStack)
  
          member val private State = General with get, set
          member private this.ScanPreProcessorElse(i: byref<int>) =
              if not (spanStack |> contains (fun span -> span.GetType() = typeof<IfBlockSpan>)) then
                  i <- i + "#else".Length
  
              while spanStack.Count > 0 do
                  spanStack.Pop() |> ignore
              let elseBlockSpan = ElseBlockSpan()
              if this.CurSpan <> null && typeof<AbstractBlockSpan>.IsAssignableFrom(this.CurSpan.GetType()) then
                  elseBlockSpan.Disabled <- not (this.CurSpan :?> AbstractBlockSpan).Disabled
                  this.FoundSpanEnd.Invoke(this.CurSpan, i, 0)
              this.FoundSpanBegin.Invoke(elseBlockSpan, i , "#else".Length)
  
negative.code:                 let endIdx = this.CurText.Length
                  let len = endIdx - textOffset
                  let subText = currentText.Substring(textOffset)
                  if (textOffset < this.CurText.Length && 
                      this.CurText.[textOffset] = '#' && this.IsFirstNonWsChar(textOffset)) then
  
                      if currentText.Substring(textOffset).StartsWith("#else") then
  