checkpoint
[sbp.git] / src / edu / berkeley / sbp / Forest.java
index 12c8cf1..9dabf60 100644 (file)
@@ -7,7 +7,10 @@ import java.util.*;
 import java.lang.reflect.*;
 
 /** an efficient representation of a collection of trees (Tomita's shared packed parse forest) */
-public abstract class Forest<T> /*extends PrintableTree<Forest.MyBody<T>>*/ implements Visitable<Forest.Body<T>>, IntegerMappable, GraphViz.ToGraphViz {
+public abstract class Forest<T> /*extends PrintableTree<Forest.MyBody<T>>*/
+    implements Visitable<Forest.Body<T>>,
+               IntegerMappable,
+               GraphViz.ToGraphViz {
 
     private static int master_idx = 0;
     private final int idx = master_idx++;
@@ -68,7 +71,7 @@ public abstract class Forest<T> /*extends PrintableTree<Forest.MyBody<T>>*/ impl
         public GraphViz.Node toGraphViz(GraphViz gv) {
             if (gv.hasNode(this)) return gv.createNode(this);
             GraphViz.Node n = gv.createNode(this);
-            n.label = headToString()==null?"":headToString();
+            n.label = StringUtil.escapify(headToString()==null?"":headToString(), "\r\n");
             n.directed = true;
             n.comment = reduction==null?null:reduction+"";
             edges(n);