Statifier.Validator.HistoryStateValidator (statifier v1.9.0)

View Source

Validates history state constraints in SCXML documents.

Ensures history states follow SCXML specification requirements:

  • History states must have a parent state (not at root level)
  • History states cannot have child states
  • Only one history state per type (shallow/deep) per parent
  • History type must be valid (shallow or deep)
  • Default transition targets must exist
  • Warns if history state is unreachable

Summary

Functions

Validate that history states have no child states. History states are pseudo-states and cannot contain child states.

Validate that history states are not at root level. History states must be children of compound or parallel states.

Validate all history state constraints in the document.

Validate that default transition targets in history states exist.

Validate that history type is valid (shallow or deep). This should already be enforced by parsing, but we validate as a safety check.

Validate that history states have unique IDs within their parent state. While general ID uniqueness is checked elsewhere, this ensures no ID conflicts within the same parent state.

Validate that there is only one history state per type per parent. A parent can have at most one shallow and one deep history state.

Warn if history states are unreachable (no transitions target them).

Functions

validate_history_no_children(result, history_states)

Validate that history states have no child states. History states are pseudo-states and cannot contain child states.

validate_history_not_at_root(result, document, history_states)

Validate that history states are not at root level. History states must be children of compound or parallel states.

validate_history_states(result, document)

Validate all history state constraints in the document.

validate_history_transition_targets(result, history_states, document)

Validate that default transition targets in history states exist.

validate_history_type(result, history_states)

Validate that history type is valid (shallow or deep). This should already be enforced by parsing, but we validate as a safety check.

validate_history_unique_in_parent(result, all_states, history_states)

Validate that history states have unique IDs within their parent state. While general ID uniqueness is checked elsewhere, this ensures no ID conflicts within the same parent state.

validate_one_history_per_type_per_parent(result, all_states, history_states)

@spec validate_one_history_per_type_per_parent(
  Statifier.Validator.validation_result(),
  [Statifier.State.t()],
  [Statifier.State.t()]
) :: Statifier.Validator.validation_result()

Validate that there is only one history state per type per parent. A parent can have at most one shallow and one deep history state.

warn_unreachable_history_states(result, history_states, all_states)

Warn if history states are unreachable (no transitions target them).