:py:mod:`raesl.compile.ast.types` ================================= .. py:module:: raesl.compile.ast.types .. autoapi-nested-parse:: AST storage of types. Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: raesl.compile.ast.types.BaseType raesl.compile.ast.types.ElementaryType raesl.compile.ast.types.TypeDef raesl.compile.ast.types.CompoundField raesl.compile.ast.types.Compound .. py:class:: BaseType Base class of a type. .. py:method:: get_units() -> Optional[Set[str]] :abstractmethod: Retrieve the units that may be used with values of the type. :returns: Set of unit names, set(['-']) if it has no units specified, or None if the type doesn't support units. .. py:class:: ElementaryType(parent: Optional[ElementaryType], units: List[raesl.compile.scanner.Token], intervals: Optional[List[Tuple[Optional[raesl.compile.ast.exprs.Value], Optional[raesl.compile.ast.exprs.Value]]]]) Bases: :py:obj:`BaseType` A type of a singular value in ESL. The allowed values in a parent type always have priority over the allowed values in a child type. :param parent: Parent elementary type if specified. :param units: Allowed units of the type, should not have square brackets around the text. :param intervals: Disjunction of allowed ranges of the type, pairs of (lowerbound, upperbound) where one of the bounds may be None. Constants and enumerations are expressed as intervals with the same lower and upper bound. .. py:method:: get_units() Retrieve the units that may be used with values of the type. :returns: Set of unit names, set(['-']) if it has no units specified, or None if the type doesn't support units. .. py:class:: TypeDef(name: raesl.compile.scanner.Token, the_type: BaseType) A named type. :param name: Name of the type definition. :param the_type: Type associated with the name. .. py:class:: CompoundField(name: raesl.compile.scanner.Token, the_type: BaseType) A named field in a Compound. :param name: Name of the compound field. :param the_type: Type of the compound field. .. py:class:: Compound(fields: List[CompoundField]) Bases: :py:obj:`BaseType` A collection of named typed values. Note that a Compound cannot have parents, units, or intervals. :param fields: Fields of the compound. .. py:method:: get_units() Retrieve the units that may be used with values of the type. :returns: Set of unit names, set(['-']) if it has no units specified, or None if the type doesn't support units.