3 # Sort the statements of a dot file produced by `rst2gv` so the sequence of
23 out
(sort(@gather), @sfx);
27 while(defined($_ = <>)) {
29 if($in = /\{\s*$/ .. /\}\s*$/) {
35 { die("Embedded graphs are not supported: $_"); }
37 { die("Continuation lines are not supported: $_"); }
38 elsif(/\/\
*/ || /\
/\// || /#/)
39 { die("Comments are not supported: $_"); }
40 elsif(/;\s*$/) { # A statement
41 if(/^\s*(graph|node|edge)/) # An attribute statement
43 # Note: The order of nodes output by `pygraphviz` is random. This changes
44 # the semantic of the graph but unfortunately can not be controlled.
49 { die("Unsupported line ending: $_"); }