qmuntal / stateless

Go library for creating finite state machines

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Export to DOT graph doesn't produce correct string representation of the state machine

zaporozhets opened this issue · comments

Unfortunately, ToGraph doesn't generate correct output for phoneCall state machine from statemachine_test.go example.

Online visualizer(http://www.webgraphviz.com/) reports the following error

Warning: :7: string ran past end of line Error: :8: syntax error near line 8 context: exit >>> / <<< func2"; Warning: :8: string ran past end of line Warning: OnHold -> OnHold: head is inside tail cluster cluster_Connected Warning: OnHold -> OnHold: tail is inside head cluster cluster_Connected

image

digraph {
	compound=true;
	node [shape=Mrecord];
	rankdir="LR";

	subgraph cluster_Connected {
		label="Connected\n----------\nentry / startCallTimer
exit / func2";
		OnHold [label="OnHold"];
	}
	OffHook [label="OffHook"];
	Ringing [label="Ringing"];
	OnHold -> OffHook [label="LeftMessage", ltail="cluster_Connected"];
	Connected -> Connected [label="MuteMicrophone"];
	OnHold -> OnHold [label="PlacedOnHold", ltail="cluster_Connected"];
	Connected -> Connected [label="SetVolume"];
	Connected -> Connected [label="UnmuteMicrophone"];
	OffHook -> Ringing [label="CallDialed / func1"];
	OnHold -> PhoneDestroyed [label="PhoneHurledAgainstWall"];
	OnHold -> OnHold [label="TakenOffHold", lhead="cluster_Connected"];
	Ringing -> OnHold [label="CallConnected", lhead="cluster_Connected"];
	init [label="", shape=point];
	init -> OffHook
}

Can you, please, take a look?

Cheers,
Taras.

Thanks for reporting this issue. I've fixed it in #57.

That's awesome. Thanks