diff --git a/rflx/abstract_expression.py b/rflx/abstract_expression.py new file mode 100644 index 000000000..97518c7d3 --- /dev/null +++ b/rflx/abstract_expression.py @@ -0,0 +1,386 @@ +# pylint: disable=too-many-ancestors + +from __future__ import annotations + +from abc import abstractmethod + +from rflx import typing_ as rty +from rflx.common import Base +from rflx.contract import DBC + + +class AbstractExpr(DBC, Base): + @abstractmethod + def __init__(self, type_: rty.Type = rty.Undefined()): + self.type_ = type_ + + @classmethod + @abstractmethod + def create_not(cls, expr: AbstractExpr) -> AbstractNot: + raise NotImplementedError + + +class AbstractNot(AbstractExpr): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractBinExpr(AbstractExpr): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractAssExpr(AbstractExpr): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractBoolAssExpr(AbstractAssExpr): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractAnd(AbstractBoolAssExpr): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractAndThen(AbstractAnd): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractOr(AbstractBoolAssExpr): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractOrElse(AbstractOr): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractNumber(AbstractExpr): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractMathAssExpr(AbstractAssExpr): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractAdd(AbstractMathAssExpr): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractMul(AbstractMathAssExpr): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractMathBinExpr(AbstractBinExpr): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractSub(AbstractMathBinExpr): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractDiv(AbstractMathBinExpr): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractPow(AbstractMathBinExpr): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractMod(AbstractMathBinExpr): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractRem(AbstractMathBinExpr): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractName(AbstractExpr): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractLiteral(AbstractName): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractVariable(AbstractName): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractAttribute(AbstractName): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractSize(AbstractAttribute): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractLength(AbstractAttribute): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractFirst(AbstractAttribute): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractLast(AbstractAttribute): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractValidChecksum(AbstractAttribute): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractValid(AbstractAttribute): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractPreset(AbstractAttribute): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractHasData(AbstractAttribute): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractHead(AbstractAttribute): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractOpaque(AbstractAttribute): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractConstrained(AbstractAttribute): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractVal(AbstractAttribute): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractIndexed(AbstractName): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractSelected(AbstractName): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractCall(AbstractName): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractSlice(AbstractName): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractAggregate(AbstractExpr): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractString(AbstractAggregate): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractNamedAggregate(AbstractExpr): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractRelation(AbstractBinExpr): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractLess(AbstractRelation): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractLessEqual(AbstractRelation): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractEqual(AbstractRelation): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractGreaterEqual(AbstractRelation): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractGreater(AbstractRelation): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractNotEqual(AbstractRelation): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractIn(AbstractRelation): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractNotIn(AbstractRelation): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractIfExpr(AbstractExpr): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractQuantifiedExpr(AbstractExpr): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractForAllOf(AbstractQuantifiedExpr): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractForAllIn(AbstractQuantifiedExpr): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractForSomeIn(AbstractQuantifiedExpr): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractValueRange(AbstractExpr): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractConversion(AbstractExpr): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractQualifiedExpr(AbstractExpr): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractComprehension(AbstractExpr): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractMessageAggregate(AbstractExpr): + @abstractmethod + def __init__(self) -> None: + pass + + +class AbstractDeltaMessageAggregate(AbstractExpr): + @abstractmethod + def __init__(self) -> None: + pass