 tagPattern = /(<(\/?))([^\s>]+)[^>]*>/g
 class Tag extends Pair
   @extend(false)
+
+  _newStyle: false # REMOVE after rewrite DONE
+
   allowNextLine: true
   allowForwarding: true
   adjustInnerRange: false

    pattern = new RegExp(patterns.join('|'))
    ['close', 'open'][(countChar(text, pattern) % 2)]

  # Take start point of matched range.
  isEscapedCharAtPoint: (point) ->
    found = false

    bs = backSlashPattern
    pattern = new RegExp("[^#{bs}]#{bs}")
    scanRange = [[point.row, 0], point]
    @editor.backwardsScanInBufferRange pattern, scanRange, ({matchText, range, stop}) ->
      if range.end.isEqual(point)
        stop()
        found = true
    found

  findPair: (which, options, fn) ->
    {from, pattern, scanFunc, scanRange} = options
    @editor[scanFunc] pattern, scanRange, (event) =>
      {matchText, range, stop} = event
      unless @allowNextLine or (from.row is range.start.row)
        return stop()
      return if @isEscapedCharAtPoint(range.start)
      fn(event)

  findOpen: (from, pattern) ->
    options =
      scanFunc: 'backwardsScanInBufferRange'
      scanRange: new Range([0, 0], from)
      from: from
      pattern: pattern

    stack = []
    found = null
    @findPair 'open', options, (event) =>
      {range, stop} = event
      if @getPairState(event) is 'close'
        stack.push({range})
      else

      if entry.tagState is tagState
        return entry
    null

  # Take start point of matched range.
  isEscapedCharAtPoint: (point) ->
    found = false

    bs = backSlashPattern
    pattern = new RegExp("[^#{bs}]#{bs}")
    scanRange = [[point.row, 0], point]
    @editor.backwardsScanInBufferRange pattern, scanRange, ({matchText, range, stop}) ->
      if range.end.isEqual(point)
        stop()
        found = true
    found

  findPair: (which, options, fn) ->
    {from, pattern, scanFunc, scanRange} = options
    @editor[scanFunc] pattern, scanRange, (event) =>
      {matchText, range, stop} = event
      unless @allowNextLine or (from.row is range.start.row)
        return stop()
      return if @isEscapedCharAtPoint(range.start)
      fn(event)

  findOpen: (from,  pattern) ->
    scanFunc = 'backwardsScanInBufferRange'
