   supportCount: true
 
   # Return 'open' or 'close'
-  getPairState: ({matchText, range, match}) ->
-    switch match.length
-      when 2
-        @pairStateInBufferRange(range, matchText)
-      when 3
-        switch
-          when match[1] then 'open'
-          when match[2] then 'close'
-
-  pairStateInBufferRange: (range, char) ->
-    text = getLineTextToBufferPosition(@editor, range.end)
-    escapedChar = _.escapeRegExp(char)
-    bs = backSlashPattern
-    patterns = [
-      "#{bs}#{bs}#{escapedChar}"
-      "[^#{bs}]?#{escapedChar}"
-    ]
-    pattern = new RegExp(patterns.join('|'))
-    ['close', 'open'][(countChar(text, pattern) % 2)]
+  getPairState: ({match}) ->
+    switch
+      when match[1] then 'open'
+      when match[2] then 'close'
 
   getFilters: (from) ->
     filters = []


  findOpen: (from) ->
    stack = []
    found = null

    filters = @getFilters(from)

    findPair @editor, from, @pair, 'backward', (event) =>
      {range, stop} = event
      return if filters.some((filter) -> filter(event))

      if @getPairState(event) is 'close'
        stack.push({range})
      else
        stack.pop()
        found = range if stack.length is 0
      stop() if found?
    found

  findClose: (from) ->
    stack = []
    found = null

    filters = @getFilters(from)

    findPair @editor, from, @pair, 'forward', (event) =>
      {range, stop} = event
      return if filters.some((filter) -> filter(event))

      if @getPairState(event) is 'open'
        stack.push({range})
      else
        entry = stack.pop()
        if stack.length is 0
          if (openStart = entry?.range.start)
            if @allowForwarding
              return if openStart.row isnt from.row
            else
              return if openStart.isGreaterThan(from)
          found = range
      stop() if found?
    found

  getPairInfo: (from) ->
    pairInfo = null

  @extend(false)
  allowForwarding: true
  allowNextLine: false

  getPairState: ({matchText, range, match}) ->
    @pairStateInBufferRange(range, matchText)

  pairStateInBufferRange: (range, char) ->
    text = getLineTextToBufferPosition(@editor, range.end)
    escapedChar = _.escapeRegExp(char)
    bs = backSlashPattern
    patterns = [
      "#{bs}#{bs}#{escapedChar}"
      "[^#{bs}]?#{escapedChar}"
    ]
    pattern = new RegExp(patterns.join('|'))
    ['close', 'open'][(countChar(text, pattern) % 2)]

class DoubleQuote extends Quote
  @extend(false)
