raesl.compile.machine_files.behavior#

Line matchers for the behavior section.

Module Contents#

Functions#

_process_behavior_header(→ None)

_process_new_behavior_function(→ None)

_process_new_case(→ None)

_process_normal_when_start(→ None)

_process_otherwise_when_start(→ None)

_decode_when_comparisons(...)

Decode the expression expressed in the tags from _BEHAVIOR_WHEN_CONDITION_SPEC.

_process_when_condition(→ None)

_process_then_start(→ None)

_decode_result(→ raesl.compile.ast.exprs.Comparison)

Decode a result line from collected tags by matching _BEHAVIOR_THEN_RESULT_SPEC.

_process_then_result(→ None)

Attributes#

_BEHAVIOR_HEADER_SPEC

_BEHAVIOR_NAME_SPEC

_BEHAVIOR_CASE_SPEC

_BEHAVIOR_WHEN_SPEC

_BEHAVIOR_WHEN_OTHERWISE_SPEC

_BEHAVIOR_WHEN_CONDITION_SPEC

_BEHAVIOR_THEN_SPEC

_BEHAVIOR_THEN_RESULT_SPEC

MACHINES

raesl.compile.machine_files.behavior._BEHAVIOR_HEADER_SPEC = Multiline-String#
Show Value
"""
behavior_header:
    start initial;

    start -> s1 [BEHAVIOR_REQUIREMENT_KW] tag=kind;
    start -> s1 [BEHAVIOR_CONSTRAINT_KW] tag=kind;

    end accept=behavior_header;
    s1 -> end [NL_TK];
"""
raesl.compile.machine_files.behavior._process_behavior_header(tags: raesl.compile.machine_files.typing.TokensDict, _accept: str, builder: raesl.compile.typechecking.ast_builder.AstBuilder) None#
raesl.compile.machine_files.behavior._BEHAVIOR_NAME_SPEC = Multiline-String#
Show Value
"""
behavior_name:
    start initial;

    start -> s1 [NAME] tag=label;
    s1 -> s2 [COLON_TK];

    end accept=behavior_name;
    s2 -> end [NL_TK];
"""
raesl.compile.machine_files.behavior._process_new_behavior_function(tags: raesl.compile.machine_files.typing.TokensDict, _accept: str, builder: raesl.compile.typechecking.ast_builder.AstBuilder) None#
raesl.compile.machine_files.behavior._BEHAVIOR_CASE_SPEC = Multiline-String#
Show Value
"""
behavior_case:
    start initial;

    start -> s1 [CASE_KW];
    s1 -> s2 [NAME] tag=case_name;
    s2 -> s3 [COLON_TK];

    end accept=behavior_case;
    s3 -> end [NL_TK];
"""
raesl.compile.machine_files.behavior._process_new_case(tags: raesl.compile.machine_files.typing.TokensDict, _accept: str, builder: raesl.compile.typechecking.ast_builder.AstBuilder) None#
raesl.compile.machine_files.behavior._BEHAVIOR_WHEN_SPEC = Multiline-String#
Show Value
"""
behavior_when:
    start initial;

    start -> s1 [WHEN_KW] tag=when;

    end accept=behavior_when;
    s1 -> end [NL_TK];
"""
raesl.compile.machine_files.behavior._process_normal_when_start(tags: raesl.compile.machine_files.typing.TokensDict, _accept: str, builder: raesl.compile.typechecking.ast_builder.AstBuilder) None#
raesl.compile.machine_files.behavior._BEHAVIOR_WHEN_OTHERWISE_SPEC = Multiline-String#
Show Value
"""
behavior_otherwise:
    start initial;

    start -> s1 [WHEN_KW] tag=when;
    s1 -> s2 [NO_KW];
    s2 -> s3 [OTHER_KW];
    s3 -> s4 [CASE_KW];
    s4 -> s5 [APPLIES_KW];

    end accept=behavior_when;
    s5 -> end [NL_TK];
"""
raesl.compile.machine_files.behavior._process_otherwise_when_start(tags: raesl.compile.machine_files.typing.TokensDict, _accept: str, builder: raesl.compile.typechecking.ast_builder.AstBuilder) None#
raesl.compile.machine_files.behavior._BEHAVIOR_WHEN_CONDITION_SPEC#
raesl.compile.machine_files.behavior._decode_when_comparisons(tags: Dict[str, List[raesl.compile.scanner.Token]]) raesl.compile.ast.exprs.Disjunction | raesl.compile.ast.exprs.RelationComparison#

Decode the expression expressed in the tags from _BEHAVIOR_WHEN_CONDITION_SPEC.

Much inspired by ‘machine_files.decode_disjunctive_comparisons’, but this is less generic due to lack of ‘aux’ and objectives.

Parameters:

tags – Key pieces of text found in the input.

Returns:

The equivalent expression.

raesl.compile.machine_files.behavior._process_when_condition(tags: raesl.compile.machine_files.typing.TokensDict, _accept: str, builder: raesl.compile.typechecking.ast_builder.AstBuilder) None#
raesl.compile.machine_files.behavior._BEHAVIOR_THEN_SPEC = Multiline-String#
Show Value
"""
behavior_then:
    start initial;

    start -> s1 [THEN_KW] tag=then;

    end accept=behavior_then;
    s1 -> end [NL_TK];
"""
raesl.compile.machine_files.behavior._process_then_start(tags: raesl.compile.machine_files.typing.TokensDict, _accept: str, builder: raesl.compile.typechecking.ast_builder.AstBuilder) None#
raesl.compile.machine_files.behavior._BEHAVIOR_THEN_RESULT_SPEC#
raesl.compile.machine_files.behavior._decode_result(tags: Dict[str, List[raesl.compile.scanner.Token]]) raesl.compile.ast.exprs.Comparison#

Decode a result line from collected tags by matching _BEHAVIOR_THEN_RESULT_SPEC.

Much inspired by ‘machine_files.decode_disjunctive_comparisons’, but this is simpler as there is no ‘or’, splitting is thus not needed.

Parameters:

tags – Key pieces of text found in the input.

Returns:

The expression equivalent to the matched text.

raesl.compile.machine_files.behavior._process_then_result(tags: raesl.compile.machine_files.typing.TokensDict, _accept: str, builder: raesl.compile.typechecking.ast_builder.AstBuilder) None#
raesl.compile.machine_files.behavior.MACHINES: raesl.compile.machine_files.typing.MachineTripletList = [('BEHAVIOR_HEADER_MACHINE',), ('BEHAVIOR_NAME_MACHINE',), ('BEHAVIOR_CASE_MACHINE',),...#