'Performs matched selection, selects text between matching quotes or
parentheses.
:param ignored_symbols; matching symbols to ignore.'

def match_select(self, ignored_symbols=None):

    def filter_matching(ignored_symbols, matching):
        '\n                                                Removes    any    ignored    symbol    from    the    match    dict.\n                                                '
        if (ignored_symbols is not None):
            for symbol in matching.keys():
                if (symbol in ignored_symbols):
                    matching.pop(symbol)
        return matching
    def find_opening_symbol(cursor, matching):
        '\n                                                Find    the    position    ot    the    opening    symbol\n                                                :param    cursor:    Current    text    cursor\n                                                :param    matching:    symbol    matches    map\n                                                '
        start_pos = None
        opening_char = None
        closed = {k: 0 for k in matching.values() if (k not in ['"', "'"])}
        stop = False
        while ((not stop) and (not cursor.atStart())):
            cursor.clearSelection()
            cursor.movePosition(cursor.Left, cursor.KeepAnchor)
            char = cursor.selectedText()
            if (char in closed.keys()):
                closed[char] += 1
            elif (char in matching.keys()):
                opposite = matching[char]
                if ((opposite in closed.keys()) and closed[opposite]):
                    closed[opposite] -= 1
                    continue
                else:
                    start_pos = (cursor.position() + 1)
                    stop = True
                    opening_char = char
        return (opening_char, start_pos)
    def find_closing_symbol(cursor, matching, opening_char, original_pos):
        '\n                                                Finds    the    position    of    the    closing    symbol.\n\n                                                :param    cursor:    current    text    cursor\n                                                :param    matching:    symbold    matching    dict\n                                                :param    opening_char:    the    opening    character\n                                                :param    original_pos:    position    of    the    opening    character.\n                                                '
        end_pos = None
        cursor.setPosition(original_pos)
        rev_matching = {v: k for (k, v) in matching.items()}
        opened = {k: 0 for k in rev_matching.values() if (k not in ['"', "'"])}
        stop = False
        while ((not stop) and (not cursor.atEnd())):
            cursor.clearSelection()
            cursor.movePosition(cursor.Right, cursor.KeepAnchor)
            char = cursor.selectedText()
            if (char in opened.keys()):
                opened[char] += 1
            elif (char in rev_matching.keys()):
                opposite = rev_matching[char]
                if ((opposite in opened.keys()) and opened[opposite]):
                    opened[opposite] -= 1
                    continue
                elif (matching[opening_char] == char):
                    end_pos = (cursor.position() - 1)
                    stop = True
        return end_pos
    matching = {'(': ')', '{': '}', '[': ']', '"': '"', "'": "'"}
    filter_matching(ignored_symbols, matching)
    cursor = self._editor.textCursor()
    original_pos = cursor.position()
    end_pos = None
    (opening_char, start_pos) = find_opening_symbol(cursor, matching)
    if opening_char:
        end_pos = find_closing_symbol(cursor, matching, opening_char, original_pos)
    if (start_pos and end_pos):
        cursor.setPosition(start_pos)
        cursor.movePosition(cursor.Right, cursor.KeepAnchor, (end_pos - start_pos))
        self._editor.setTextCursor(cursor)
        return True
    else:
        return False
