checkpoint
[sbp.git] / src / edu / berkeley / sbp / Sequence.java
index 2ba9096..68e9357 100644 (file)
@@ -17,7 +17,7 @@ public abstract class Sequence extends Element implements Iterable<Element> {
         Sequence ret = _clone();
         for(Sequence s : needs) { ret.needs.add(s); s.needed.add(ret); }
         for(Sequence s : hates) { ret.hates.add(s); s.hated.add(ret); }
-        ret.noFollow = noFollow;
+        ret.follow = follow;
         return ret;
     }
 
@@ -44,8 +44,8 @@ public abstract class Sequence extends Element implements Iterable<Element> {
 
     ////////////////////////////////////////////////////////////////////////////////
 
-    public Element noFollow = null;
-    public final Topology noFollow() { return noFollow==null ? null : Atom.toAtom(noFollow); }
+    public Element follow = null;
+    public final Topology follow() { return follow==null ? null : Atom.toAtom(follow); }
 
     Topology toAtom() {
         if (elements.length!=1) throw new RuntimeException("cannot invoke toAtom() on a Sequence with " + elements.length + " elements: " + this);
@@ -162,6 +162,10 @@ public abstract class Sequence extends Element implements Iterable<Element> {
             sb.append(elements[i].toString());
             sb.append(' ');
         }
+        if (follow != null) {
+            sb.append("-> ");
+            sb.append(follow);
+        }
         return sb;
     }
 
@@ -238,11 +242,11 @@ public abstract class Sequence extends Element implements Iterable<Element> {
         }
         public StringBuffer toString(StringBuffer sb, boolean spacing) {
             int len = sb.length();
+            if (tag != null)
+                sb.append("\""+StringUtil.escapify(tag.toString(),"\"\r\n")+"\":: ");
             super.toString(sb, spacing);
             len = sb.length()-len;
             if (spacing) for(int i=0; i<50-len; i++) sb.append(' ');
-            sb.append(" => ");
-            sb.append(tag);
             return sb;
         }
     }