def parse_expression(self) -> Union[(ASTExpression, ASTType)]:
    pos = self.pos
    try:
        expr = self._parse_expression()
        self.skip_ws()
        self.assert_end()
        return expr
    except DefinitionError as exExpr:
        self.pos = pos
        try:
            typ = self._parse_type(False)
            self.skip_ws()
            self.assert_end()
            return typ
        except DefinitionError as exType:
            header = 'Error when parsing (type) expression.'
            errs = []
            errs.append((exExpr, 'If expression'))
            errs.append((exType, 'If type'))
            raise self._make_multi_error(errs, header)
def parse_expression(self) -> Union[(ASTExpression, ASTType)]:
    pos = self.pos
    try:
        expr = self._parse_expression()
        self.skip_ws()
        self.assert_end()
        return expr
    except DefinitionError as exExpr:
        self.pos = pos
        try:
            typ = self._parse_type(False)
            self.skip_ws()
            self.assert_end()
            return typ
        except DefinitionError as exType:
            header = 'Error when parsing (type) expression.'
            errs = []
            errs.append((exExpr, 'If expression'))
            errs.append((exType, 'If type'))
            raise self._make_multi_error(errs, header)