#Native PlantUML states

    This dedicated reader preserves typed state statements and lossless source nodes. It has no renderer, host or UI dependency. Behavior text and history remain descriptive data.

    }
    ///|
    test {
    let scan = @envelope.scan(
    "@startuml\nstate Ready\nReady --> Done : finish\n@enduml\n",
    )
    let read = @state.read(scan)
    let document = read.document.unwrap()
    let model = @state.to_state(document).state.unwrap()
    assert_eq(model.transitions[0].source, "Ready")
    assert_eq(model.transitions[0].target, "Done")
    }

    Conversion

    pub struct Conversion {
    state :
    StateDiagram
    ?
    diagnostics : ReadOnlyArray[
    Diagnostic
    ]
    }

    Document

    pub struct Document {
    name : String?
    complete : Bool
    statements : ReadOnlyArray[
    Statement
    ]
    items : ReadOnlyArray[Statement]
    } derive(Eq,
    Debug
    )

    Document::equal

    fn Document::equal(Document, Document) -> Bool

    Document::logical_equal

    fn Document::logical_equal(self : Document, other : Document) -> Bool

    Document::new

    fn Document::new(items : ArrayView[Statement], name? : String, complete? : Bool, statements? : ArrayView[
    Statement
    ]) -> Document

    Document::not_equal

    fn Document::not_equal(x : Document, y : Document) -> Bool

    Document::to_repr

    Document::without_spans

    fn Document::without_spans(self : Document) -> Document

    Kind

    pub(all) enum Kind {
    Declaration(String, String, String, Bool)
    Close
    Separator(Bool)
    Description(String, String)
    Transition(String, String, String, String)
    Note(String, String?, String, String?)
    Direction(
    Direction
    )
    Presentation(String)
    } derive(Eq,
    Debug
    )

    Editable native statements. Open/close/separator values retain lexical order.

    Kind::equal

    fn Kind::equal(Kind, Kind) -> Bool

    Kind::not_equal

    fn Kind::not_equal(x : Kind, y : Kind) -> Bool

    Kind::to_repr

    ReadResult

    pub struct ReadResult {
    nodes : ReadOnlyArray[
    Node
    ]
    document : Document?
    diagnostics : ReadOnlyArray[
    Diagnostic
    ]
    }

    Statement

    pub struct Statement {
    kind : Kind
    explicit_label : Bool
    span :
    Span
    ?
    } derive(Eq,
    Debug
    )

    Statement::equal

    fn Statement::equal(Statement, Statement) -> Bool

    Statement::new

    fn Statement::new(kind : Kind, span? :
    Span
    , explicit_label? : Bool) -> Statement

    Statement::not_equal

    fn Statement::not_equal(x : Statement, y : Statement) -> Bool

    diagnostic_codes

    let diagnostic_codes : ReadOnlyArray[String]

    fn print_body(document : Document, limits? :
    Limits
    ) -> Result[String, ReadOnlyArray[
    Diagnostic
    ]]

    Canonical source is derived from edited values and checked for representability.

    read

    Read a scanned native state block. Recovery preserves subsequent statements.

    to_state

    fn to_state(document : Document, id? : String, limits? :
    Limits
    ) -> Conversion

    Build explicit state topology; descriptions and history never execute.