states2dot

This script handles state diagrams.

Table of Contents

Elements

The following elements are supported.

Note

Notes can appear in state diagrams as well as in class diagrams. See classes2dot documentation.

State

{label @id
--
internal transition @id
…

--
    compartment name
internal transition @id
    continuation line
…}

A state may have zero or more compartments (in addition to the name compartment, which is always present). Compartments are separated by -- on a separate line. Each compartment may have a compartment name, specified by an indented line immediately following the separator. The remaining lines of a compartment specify the state’s internal transitions.

An internal transition may be specified on one or more lines. Only the first line is considered when looking for the @id and name. If an @id is not specifed explicitly, the name is extracted by taking the first word, delimited by whitespace or any of : ( ) « » < > { } [ ] /.

Indented lines are considered to be continuation lines. The indentation is preserved. Note that Graphviz will preserve spaces but skip tabs.

Initial pseudostate

(#) label @id

The label may be empty. If no explicit ID is specified, a sequential ID will be autoassigned.

Final state

((#)) label @id

The label may be empty. If no explicit ID is specified, a sequential ID will be autoassigned.

Transition

state [guard] ---> [label] state

The guard condition and label are optional. The arrow must contain two or more of hyphen characters; there is no upper limit.

Synchronization bar

--|== @id {
branches
}

The fork icon --|== can alternatively be written as a join ==|--; this does not affect semantics which is determined solely by the number of incoming and outgoing branches.

If no explicit ID is specified, a sequential ID will be autoassigned.

Within the braces, each line specifies a branch of the transition. An incoming branch is specified like this:

state ---> |

An outgoing branch:

| ---> state

Arrows must contain two or more hyphen characters.

Dynamic Choice Point

() label @id

The label may be empty. If no explicit ID is specified, a sequential ID will be autoassigned.

Synch State

(label @id)

The label may be empty. If no explicit ID is specified, a sequential ID will be autoassigned.

Decision

<> label @id

The label may be empty. If no explicit ID is specified, a sequential ID will be autoassigned.

Unsupported notation