'Create and set as the current namespace.'

def setNamespace(self, namelist, usesBracketedStyle, doc=None):

    if self.currentNamespace:
        self.currentNamespace.lineend = (self.lineno - 1)
    if (not namelist):
        self.currentNamespace = None
    else:
        depth = self.depth
        if (not usesBracketedStyle):
            depth = None
        namespace_path = qualifyNamespacePath('\\'.join(namelist))
        namespace = self.fileinfo.namespaces.get(namespace_path)
        if (namespace is None):
            namespace = PHPNamespace(namespace_path, self.lineno, depth, doc=doc)
            self.fileinfo.namespaces[namespace_path] = namespace
        self.currentNamespace = namespace
        log.debug('NAMESPACE:    %r    on    line    %d    in    %s    at    depth    %r', namespace_path, self.lineno, self.filename, depth)
