def handle_namespace_pattern(self, line: str, position: int, tokens: ParseResults) -> ParseResults:
        """Handle statements like ``DEFINE NAMESPACE X AS PATTERN "Y"``.

        :raises: RedefinedNamespaceError
        """
        namespace = tokens['name']
        self.raise_for_redefined_namespace(line, position, namespace)
        self.namespace_to_pattern[namespace] = re.compile(tokens['value'])
        return tokens
def handle_namespace_pattern ( self , line : str , position : int , tokens : ParseResults ) -> ParseResults : namespace = tokens [ 'name' ] self . raise_for_redefined_namespace ( line , position , namespace ) self . namespace_to_pattern [ namespace ] = re . compile ( tokens [ 'value' ] ) return tokens
Handle statements like ``DEFINE NAMESPACE X AS PATTERN "Y"``.

        :raises: RedefinedNamespaceError