def get_table_regions(self, table):
        '''Return the range of lines for a robot table
        
        'table' must be one of "Test Cases", "Keywords", "Variables" or "Settings"

        Some rough timings show this only takes 1ms or so with a test
        file with 2k lines. Nice.
        '''
        
        if table.lower() not in ("settings","test cases", "keywords", "variables"):
            raise Exception("invalid table '%s': " % table +
                            "must be one of 'settings', " + 
                            "'test cases', 'keywords' or 'variables'")
        any_heading_pattern=r'^ *\*+[\* ]*(Test Cases?|(User )?Keywords?|Settings?|Variables?)[\* ]*$'
        # N.B. this pattern assumes 'table' is plural (note how
        # a '?' is appended immediately after the table name)
        heading_pattern = table.lower() % r'^ *\*+ *%s?[ \*]*$'
        result = []
        end = "1.0"
        while True:
            start = self.dte.search(heading_pattern, end, stopindex="end", regexp=True, nocase=True)
            if (start == ""): break
            end = self.dte.search(any_heading_pattern, "%s lineend+1c" % start, 
                                  stopindex="end", regexp=True, nocase=True)
            if end == "": end=self.dte.index("end")
            result.append((start, end))
        return result
dataset/ETHPy150Open boakley/robotframework-workbench/rwb/editor/editor_page.py/EditorPage.get_table_regions/swapped operands of `%`