         closeRange: closeRange
       }
 
+class BracketFinder extends PairFinder
+  setPatternForPair: (pair) ->
+    [open, close] = pair
+    @pattern = ///(#{_.escapeRegExp(open)})|(#{_.escapeRegExp(close)})///g
+
+  getPairState: (editor, {match}) ->
+    switch
+      when match[1] then 'open'
+      when match[2] then 'close'
+
+class QuoteFinder extends PairFinder
+  setPatternForPair: (pair) ->
+    @pattern = ///(#{_.escapeRegExp(pair[0])})///g
+
+  getPairState: (editor, {matchText, range}) ->
+    matchText = _.escapeRegExp(matchText)
+    backslash = _.escapeRegExp('\\')
+    patterns = [
+      "#{backslash}#{backslash}#{matchText}"
+      "[^#{backslash}]?#{matchText}"
+    ]
+    pattern = new RegExp(patterns.join('|'))
+    lineText = getLineTextToBufferPosition(editor, range.end)
+    charCount = countChar(lineText, pattern)
+    if charCount % 2 is 0
+      'close'
+    else
+      'open'
+
 class TagFinder extends PairFinder
   pattern: /<(\/?)([^\s>]+)[^>]*>/g
+
+  getPairState: (event) ->
+    backslash = event.match[1]
+    {
+      state: if (backslash is '') then 'open' else 'close'
+      name: event.match[2]
+      range: event.range
+    }
 
   findPairRange: (which, direction, from, fn) ->
     switch direction

      if @filters.some((filter) -> filter(event))
        return

      tagState = getTagState(event)
      if tagState.state is oppositeState
        stack.push(tagState)
      else

  isEscapedCharAtPoint
} = require './utils'

class PairFinder
  filters: []

  constructor: (options) ->
    {@editor, @pair, @filters, @allowNextLine} = options

  getPattern: ->
    @pattern

  findPairRange: (which, direction, from, fn) ->
    switch direction
