:py:mod:`raesl.compile.typechecking.utils` ========================================== .. py:module:: raesl.compile.typechecking.utils .. autoapi-nested-parse:: Support functions. Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: raesl.compile.typechecking.utils.split_arguments raesl.compile.typechecking.utils.construct_var_param_map raesl.compile.typechecking.utils.construct_vargroup_map raesl.compile.typechecking.utils.construct_comp_instances_map raesl.compile.typechecking.utils.construct_verb_prepos_combis raesl.compile.typechecking.utils.construct_relinst_goal_transform_design_behavior_map raesl.compile.typechecking.utils.resolve_var_param_node raesl.compile.typechecking.utils.resolve_var_param_group_node .. py:function:: split_arguments(params_length: int, multiple_index: Optional[int], arguments: List[raesl.compile.scanner.Token]) -> List[List[raesl.compile.scanner.Token]] Given a list arguments, split them into 'params_length' pieces, where each piece has length 1, except piece 'multiple_index' if not None, which takes all the slack. :param params_length: Number of pieces in the result. :param multiple_index: Index in 'arguments' where the multi-piece starts, only if multiple_index is not None. :param arguments: Actual arguments to split in pieces. .. py:function:: construct_var_param_map(comp_def: raesl.compile.ast.components.ComponentDefinition) -> Dict[str, raesl.compile.ast.components.VarParam] Construct a dict of variable / parameter names to their definitions. :param comp_def: Definition to search for available variables and parameters. :returns: Dictionary of names to their definitions. .. py:function:: construct_vargroup_map(comp_def: raesl.compile.ast.components.ComponentDefinition) -> Dict[str, raesl.compile.ast.components.VariableGroup] Construct a dict of variable groups names to their definitions. :param comp_def: Definition to search for available variables and parameters. :returns: Dictionary of group names to their definitions. .. py:function:: construct_comp_instances_map(comp_def: raesl.compile.ast.components.ComponentDefinition) -> Dict[str, raesl.compile.ast.components.ComponentInstance] Construct a dict of child component instance names of the given component definition. :param comp_def: Definition to search for available component instances. :return: Dictionary of component instance names to their instances. .. py:function:: construct_verb_prepos_combis(spec: raesl.compile.ast.specification.Specification) -> Set[Tuple[str, str]] Construct a set with all defined verb/prepos combinations. .. py:function:: construct_relinst_goal_transform_design_behavior_map(comp_def: raesl.compile.ast.components.ComponentDefinition) -> Dict[str, Union[raesl.compile.ast.components.RelationInstance, raesl.compile.ast.components.Goal, raesl.compile.ast.components.Transformation, raesl.compile.ast.components.Design, raesl.compile.ast.components.BehaviorFunction]] Construct a dict to quickly find goals, transformations, designs, and behaviors by their label name. :param comp_def: Definition to search. :returns: Dictionary of labels to their goals, transformations, designs, and behaviors. .. py:function:: resolve_var_param_node(name_tok: raesl.compile.scanner.Token, avail_vps: Dict[str, raesl.compile.ast.components.VarParam], reported_names: Set[str], diag_store: raesl.compile.diagnostics.DiagnosticStore) -> Optional[raesl.compile.ast.nodes.VarNode] Resolve the (possibly sub)node of a variable or parameter indicated by 'name'. If it fails, report an error if necessary. :param name_tok: Name of the node to obtain, may contain a dotted name. :param avail_vps: Variables and parameters available in the context. :param reported_names: Non-existing names and prefixes that are reported already. :param diag_store: Storage for found diagnostics. :returns: The node represented by the name, or None if it could not be found. In the latter case, an problem exists indicating failure to find the node. .. py:function:: resolve_var_param_group_node(name_tok: raesl.compile.scanner.Token, avail_vps: Optional[Dict[str, raesl.compile.ast.components.VarParam]], avail_vgroups: Optional[Dict[str, raesl.compile.ast.components.VariableGroup]], reported_names: Set[str], diag_store: raesl.compile.diagnostics.DiagnosticStore) -> Optional[raesl.compile.ast.nodes.Node] Resolve the provided (possibly dotted) name to a node from a variable, parameter or variable group. :param name_tok: Name of the node to obtain, may contain a dotted name. :param avail_vps: Available variables and parameters, may be None. :param avail_vgroups: Available variable groups, may be None. :param reported_names: Non-existing variables, parameters, and groups that are reported already. :param diag_store: Destination for found diagnostics. :returns: The node represented by the name. It can be a Node if the name points at a variable groups. It is always a VarNode if the nam points at a variable or parameter.