swish/commit

New upstream copies.

authorJan Wielemaker
Fri Sep 16 14:29:12 2016 +0200
committerJan Wielemaker
Fri Sep 16 14:29:12 2016 +0200
commitc8bcbaa982b0c161769a4b4affaf84240a96142c
treeb04f378fe6d963a845bea24d5f33499cddc29c5e
parentc243945d2b771f48a1ddd8f3645a93ce9370cd0b
Diff style: patch stat
diff --git a/examples/render_graphviz.swinb b/examples/render_graphviz.swinb
index 084d315..49ca578 100644
--- a/examples/render_graphviz.swinb
+++ b/examples/render_graphviz.swinb
@@ -131,7 +131,7 @@ grammar below:
 	      | digraph(Options, Statements)
   Options    := ID | [ID] | [strict, ID]
   Statements := List of statements
-  Statement  := NodeStm | EdgeStm | AttrStm | Name = Value | SubGraph
+  Statement  := NodeStm | EdgeStm | AttrStm | Name = Value | SubGraph | Group
   NodeStm    := NodeID | node(NodeID, AttrList)
   NodeID     := ID | ID:Port | ID:Port:CompassPT
   CompassPT  := n | ne | e | se | s | sw | w | nw | c | _
@@ -145,7 +145,10 @@ grammar below:
   Attribute  := Name = Value
 	      | Name(Value)
   SubGraph   := subgraph(ID, Statements)
+  Group      := group(Statements)
   ```
+
+A term group(Statements) generates a {...} delimited group in the output.  A typical usage is group([rank=same, a, b, c]) to place the nodes a..c on the same rank.
 </div>
 
 <div class="nb-cell markdown">
diff --git a/lib/swish/render/graphviz.pl b/lib/swish/render/graphviz.pl
index 4dc30a3..0a5e50b 100644
--- a/lib/swish/render/graphviz.pl
+++ b/lib/swish/render/graphviz.pl
@@ -409,6 +409,11 @@ statement(subgraph(ID, Statements), O) -->
 	{ step_indent(O, O1) },
 	keyword(subgraph), ws, id(ID), ws, "{", nl,
 	statements(Statements, O1), indent(O), "}".
+statement(group(Statements), O) -->
+	{ step_indent(O, O1) },
+	"{", nl, statements(Statements, O1), indent(O), "}".
+statement(ID, O) -->
+	node(ID, O).
 
 step_indent(O, O2) :-
 	I is O.indent+2,