'Prepare static and dynamic search structures.'

def _compile(self):

    self.static = {}
    self.dynamic = []
    def fpat_sub(m):
        return (m.group(0) if (len(m.group(1)) % 2) else (m.group(1) + '(?:'))
    for rule in self.rules:
        target = self.routes[rule]
        if (not self.syntax.search(rule)):
            self.static[rule.replace('\\:', ':')] = target
            continue
        gpat = self._compile_pattern(rule)
        fpat = re.sub('(\\\\*)(\\(\\?P<[^>]*>|\\((?!\\?))', fpat_sub, gpat.pattern)
        gpat = (gpat.match if gpat.groupindex else None)
        try:
            combined = ('%s|(%s)' % (self.dynamic[(-1)][0].pattern, fpat))
            self.dynamic[(-1)] = (re.compile(combined), self.dynamic[(-1)][1])
            self.dynamic[(-1)][1].append((gpat, target))
        except (AssertionError, IndexError) as e:
            self.dynamic.append((re.compile(('(^%s$)' % fpat)), [(gpat, target)]))
        except re.error as e:
            raise RouteSyntaxError(('Could    not    add    Route:    %s    (%s)' % (rule, e)))
