def _parse_cast_expression(self) -> ASTExpression:
    pos = self.pos
    self.skip_ws()
    if self.skip_string('('):
        try:
            typ = self._parse_type(False)
            if (not self.skip_string(')')):
                self.fail("Expected ')' in cast expression.")
            expr = self._parse_cast_expression()
            return ASTCastExpr(typ, expr)
        except DefinitionError as exCast:
            self.pos = pos
            try:
                return self._parse_unary_expression()
            except DefinitionError as exUnary:
                errs = []
                errs.append((exCast, 'If type cast expression'))
                errs.append((exUnary, 'If unary expression'))
                raise self._make_multi_error(errs, 'Error in cast expression.')
    else:
        return self._parse_unary_expression()
def _parse_cast_expression(self) -> ASTExpression:
    pos = self.pos
    self.skip_ws()
    if self.skip_string('('):
        try:
            typ = self._parse_type(False)
            if (not self.skip_string(')')):
                self.fail("Expected ')' in cast expression.")
            expr = self._parse_cast_expression()
            return ASTCastExpr(typ, expr)
        except DefinitionError as exCast:
            self.pos = pos
            try:
                return self._parse_unary_expression()
            except DefinitionError as exUnary:
                errs = []
                errs.append((exCast, 'If type cast expression'))
                errs.append((exUnary, 'If unary expression'))
                raise self._make_multi_error(errs, 'Error in cast expression.')
    else:
        return self._parse_unary_expression()