def _parse_type(self, named: Union[(bool, str)], outer: str=None) -> ASTType:
    "\n        named=False|'maybe'|True: 'maybe' is e.g., for function objects which\n        doesn't need to name the arguments\n\n        outer == operatorCast: annoying case, we should not take the params\n        "
    if outer:
        if (outer not in ('type', 'member', 'function', 'operatorCast', 'templateParam')):
            raise Exception(('Internal error, unknown outer "%s".' % outer))
        if (outer != 'operatorCast'):
            assert named
    if (outer in ('type', 'function')):
        prevErrors = []
        startPos = self.pos
        try:
            declSpecs = self._parse_decl_specs(outer=outer, typed=False)
            decl = self._parse_declarator(named=True, paramMode=outer, typed=False)
            self.assert_end()
        except DefinitionError as exUntyped:
            if (outer == 'type'):
                desc = 'If just a name'
            elif (outer == 'function'):
                desc = 'If the function has no return type'
            else:
                assert False
            prevErrors.append((exUntyped, desc))
            self.pos = startPos
            try:
                declSpecs = self._parse_decl_specs(outer=outer)
                decl = self._parse_declarator(named=True, paramMode=outer)
            except DefinitionError as exTyped:
                self.pos = startPos
                if (outer == 'type'):
                    desc = 'If typedef-like declaration'
                elif (outer == 'function'):
                    desc = 'If the function has a return type'
                else:
                    assert False
                prevErrors.append((exTyped, desc))
                if True:
                    if (outer == 'type'):
                        header = 'Type must be either just a name or a '
                        header += 'typedef-like declaration.'
                    elif (outer == 'function'):
                        header = 'Error when parsing function declaration.'
                    else:
                        assert False
                    raise self._make_multi_error(prevErrors, header)
                else:
                    self.pos = startPos
                    typed = True
                    declSpecs = self._parse_decl_specs(outer=outer, typed=typed)
                    decl = self._parse_declarator(named=True, paramMode=outer, typed=typed)
    else:
        paramMode = 'type'
        if (outer == 'member'):
            named = True
        elif (outer == 'operatorCast'):
            paramMode = 'operatorCast'
            outer = None
        elif (outer == 'templateParam'):
            named = 'single'
        declSpecs = self._parse_decl_specs(outer=outer)
        decl = self._parse_declarator(named=named, paramMode=paramMode)
    return ASTType(declSpecs, decl)
named=False|'maybe'|True: 'maybe' is e.g., for function objects which
doesn't need to name the arguments

outer == operatorCast: annoying case, we should not take the params
def _parse_type(self, named: Union[(bool, str)], outer: str=None) -> ASTType:
    "\n        named=False|'maybe'|True: 'maybe' is e.g., for function objects which\n        doesn't need to name the arguments\n\n        outer == operatorCast: annoying case, we should not take the params\n        "
    if outer:
        if (outer not in ('type', 'member', 'function', 'operatorCast', 'templateParam')):
            raise Exception(('Internal error, unknown outer "%s".' % outer))
        if (outer != 'operatorCast'):
            assert named
    if (outer in ('type', 'function')):
        prevErrors = []
        startPos = self.pos
        try:
            declSpecs = self._parse_decl_specs(outer=outer, typed=False)
            decl = self._parse_declarator(named=True, paramMode=outer, typed=False)
            self.assert_end()
        except DefinitionError as exUntyped:
            if (outer == 'type'):
                desc = 'If just a name'
            elif (outer == 'function'):
                desc = 'If the function has no return type'
            else:
                assert False
            prevErrors.append((exUntyped, desc))
            self.pos = startPos
            try:
                declSpecs = self._parse_decl_specs(outer=outer)
                decl = self._parse_declarator(named=True, paramMode=outer)
            except DefinitionError as exTyped:
                self.pos = startPos
                if (outer == 'type'):
                    desc = 'If typedef-like declaration'
                elif (outer == 'function'):
                    desc = 'If the function has a return type'
                else:
                    assert False
                prevErrors.append((exTyped, desc))
                if True:
                    if (outer == 'type'):
                        header = 'Type must be either just a name or a '
                        header += 'typedef-like declaration.'
                    elif (outer == 'function'):
                        header = 'Error when parsing function declaration.'
                    else:
                        assert False
                    raise self._make_multi_error(prevErrors, header)
                else:
                    self.pos = startPos
                    typed = True
                    declSpecs = self._parse_decl_specs(outer=outer, typed=typed)
                    decl = self._parse_declarator(named=True, paramMode=outer, typed=typed)
    else:
        paramMode = 'type'
        if (outer == 'member'):
            named = True
        elif (outer == 'operatorCast'):
            paramMode = 'operatorCast'
            outer = None
        elif (outer == 'templateParam'):
            named = 'single'
        declSpecs = self._parse_decl_specs(outer=outer)
        decl = self._parse_declarator(named=named, paramMode=paramMode)
    return ASTType(declSpecs, decl)