Returns a list of highlighting rules for this highlighter.  This will
        join the list of keywords as a regular expression with the keyword
        format as well as any custom patterns that have been defined.
        
        :return     [(<str>, <QtGui.QTextCharFormat>), ..]

def patterns(self):
        """
        Returns a list of highlighting rules for this highlighter.  This will
        join the list of keywords as a regular expression with the keyword
        format as well as any custom patterns that have been defined.
        
        :return     [(<str>, <QtGui.QTextCharFormat>), ..]
        """
        patterns = []
        
        # add keyword patterns
        form = self.styleFormat(XCodeHighlighter.Style.Keyword)
        for kwd in self.keywords():
            patterns.append((r'\b{0}\b'.format(kwd), form))
        
        # add additional patterns
        for style, pattern in self._patterns:
            form = self.styleFormat(style)
            if not form:
                continue
            
            patterns.append((pattern, form))
        
        return patterns