:py:mod:`raesl.compile.machine_files.type_defs` =============================================== .. py:module:: raesl.compile.machine_files.type_defs .. autoapi-nested-parse:: Line matcher state machines for type definitions. Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: raesl.compile.machine_files.type_defs.get_unit_specification_part raesl.compile.machine_files.type_defs._convert_unit_spec raesl.compile.machine_files.type_defs.get_enumeration_specification_part raesl.compile.machine_files.type_defs.get_short_enumeration_specification_part raesl.compile.machine_files.type_defs._convert_enum_spec raesl.compile.machine_files.type_defs.get_interval_specification_part raesl.compile.machine_files.type_defs._convert_interval_spec raesl.compile.machine_files.type_defs.get_constant_specification_part raesl.compile.machine_files.type_defs._convert_constant_spec raesl.compile.machine_files.type_defs._process_define_type raesl.compile.machine_files.type_defs._process_new_type_def raesl.compile.machine_files.type_defs._process_derived_type_def raesl.compile.machine_files.type_defs._process_bundle_type raesl.compile.machine_files.type_defs._process_bundle_field Attributes ~~~~~~~~~~ .. autoapisummary:: raesl.compile.machine_files.type_defs._DEFINE_TYPE_SPEC raesl.compile.machine_files.type_defs._NEW_TYPE_SPEC raesl.compile.machine_files.type_defs._TYPE_IS_A_TYPE_SPEC raesl.compile.machine_files.type_defs._BUNDLE_TYPE_SPEC raesl.compile.machine_files.type_defs._BUNDLE_FIELD_SPEC raesl.compile.machine_files.type_defs.MACHINES .. py:function:: get_unit_specification_part(start_loc: str, end_1locs: List[str], prefix: str = '') -> str State machine part implementing the 'unit-specification' rule. unit-specification ::= "with" ( "unit" | "units" ) UNIT-NAME { "," UNIT-NAME } .. py:function:: _convert_unit_spec(tags: Dict[str, List[raesl.compile.scanner.Token]]) -> Optional[List[raesl.compile.scanner.Token]] Convert a unit specification to a list of unit names, if it exists. .. py:function:: get_enumeration_specification_part(start_loc: str, end_2locs: List[str], prefix: str = '') -> str State machine part implementing the 'enumeration-specification' rule. enumeration-specification ::= "is" "an" "enumeration" "of" VALUE [ UNIT ] { "," VALUE [ UNIT ]} .. py:function:: get_short_enumeration_specification_part(start_loc: str, end_2locs: List[str], prefix: str = '') -> str State machine part implementing the short 'enumeration-specification' rule. short-enumeration-specification ::= "enumeration" "of" VALUE [ UNIT ] { "," VALUE [ UNIT ]} .. py:function:: _convert_enum_spec(tags: Dict[str, List[raesl.compile.scanner.Token]]) -> Optional[List[raesl.compile.ast.exprs.Value]] Convert an enumeration specification to a number of values if it exists in the given tags. :param tags: Tags from the matched line. :returns: Values of the enumeration. .. py:function:: get_interval_specification_part(start_loc: str, end_4locs: List[str], prefix: str = '') -> str State machine part implementing the 'interval-specification' rule. interval-specification ::= "of" interval { "or" interval } .. py:function:: _convert_interval_spec(tags: Dict[str, List[raesl.compile.scanner.Token]]) -> Optional[List[Tuple[Optional[raesl.compile.ast.exprs.Value], Optional[raesl.compile.ast.exprs.Value]]]] Convert an interval specification of a line to a (disjunctive) sequence of expressions, if such a specification exists in the given tags. .. py:function:: get_constant_specification_part(start_loc: str, end_2locs: List[str], prefix: str = '') -> str State machine part implementing the 'constant-specification' rule. constant-specification ::= "equal" "to" VALUE [ UNIT ] .. py:function:: _convert_constant_spec(tags: Dict[str, List[raesl.compile.scanner.Token]]) -> Optional[raesl.compile.ast.exprs.Value] Convert a constant specification of a line to a Value if it exits. .. py:data:: _DEFINE_TYPE_SPEC :value: Multiline-String .. raw:: html
Show Value .. code-block:: python """ define_type: start initial; start -> s1 [DEFINE_KW] tag=define; s1 -> s2 [TYPE_KW]; end accept=define_type; s2 -> end [NL_TK]; s2 -> end [EOF_TK]; """ .. raw:: html
.. py:function:: _process_define_type(tags: raesl.compile.machine_files.typing.TokensDict, _accept: str, builder: raesl.compile.typechecking.ast_builder.AstBuilder) -> None .. py:data:: _NEW_TYPE_SPEC .. py:function:: _process_new_type_def(tags: raesl.compile.machine_files.typing.TokensDict, _accept: str, builder: raesl.compile.typechecking.ast_builder.AstBuilder) -> None .. py:data:: _TYPE_IS_A_TYPE_SPEC .. py:function:: _process_derived_type_def(tags: raesl.compile.machine_files.typing.TokensDict, _accept: str, builder: raesl.compile.typechecking.ast_builder.AstBuilder) -> None .. py:data:: _BUNDLE_TYPE_SPEC :value: Multiline-String .. raw:: html
Show Value .. code-block:: python """ bundle_type: start initial; start -> s1 [NAME] tag=bundle_name; s1 -> s2 [IS_KW]; s2 -> s3 [A_KW]; s3 -> s4 [BUNDLE_KW]; s4 -> s5 [OF_KW]; end accept=bundle_type; s5 -> end [NL_TK]; s5 -> end [EOF_TK]; """ .. raw:: html
.. py:function:: _process_bundle_type(tags: raesl.compile.machine_files.typing.TokensDict, _accept: str, builder: raesl.compile.typechecking.ast_builder.AstBuilder) -> None .. py:data:: _BUNDLE_FIELD_SPEC :value: Multiline-String .. raw:: html
Show Value .. code-block:: python """ bundle_field: start initial; end accept=bundle_field; start -> s1 [STAR_TK]; s1 -> s2 [NAME] tag=field_name; s2 -> s3 [IS_KW]; s3 -> s4 [A_KW]; s4 -> s5 [NAME] tag=field_type; s5 -> end [NL_TK]; s5 -> end [EOF_TK]; """ .. raw:: html
.. py:function:: _process_bundle_field(tags: raesl.compile.machine_files.typing.TokensDict, _accept: str, builder: raesl.compile.typechecking.ast_builder.AstBuilder) -> None .. py:data:: MACHINES :type: raesl.compile.machine_files.typing.MachineTripletList :value: [('DEFINE_TYPE_MACHINE',), ('NEW_TYPE_MACHINE',), ('TYPE_IS_A_TYPE_MACHINE',),...