tentative checkpoint ROLL THIS BACK BUT INCLUDES CRUCIAL FIX
[sbp.git] / src / edu / berkeley / sbp / Sequence.java
index a75bafa..b8e4263 100644 (file)
@@ -18,6 +18,7 @@ public abstract class Sequence extends Element implements Iterable<Element> {
         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.follow = follow;
+        ret.lame = lame;
         return ret;
     }
 
@@ -38,7 +39,8 @@ public abstract class Sequence extends Element implements Iterable<Element> {
      *  after matching the sequence, create the specified output tree
      *  @param tag   the tag for the output tree
      *  @param e     the elements to match
-     *  @param drops only elements of <tt>e</tt> whose corresponding <tt>boolean</tt> in <tt>drops</tt> is <i>false</i> will be included in the output tree
+     *  @param drops only elements of <tt>e</tt> whose corresponding <tt>boolean</tt> in <tt>drops</tt>
+     *               is <i>false</i> will be included in the output tree
      **/
     public static Sequence rewritingSequence(Object tag, Element[] e, Object[] labs, boolean[] drops) {
         return new RewritingSequence(tag, e, labs, drops); }
@@ -49,7 +51,8 @@ public abstract class Sequence extends Element implements Iterable<Element> {
     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);
+        if (elements.length!=1)
+            throw new RuntimeException("cannot invoke toAtom() on a Sequence with " + elements.length + " elements: " + this);
         return Atom.toAtom(elements[0]);
     }
 
@@ -59,9 +62,9 @@ public abstract class Sequence extends Element implements Iterable<Element> {
     protected final Element[] elements;
 
     final HashSet<Sequence> needed = new HashSet<Sequence>();
-    final HashSet<Sequence> hated = new HashSet<Sequence>();
-    final HashSet<Sequence> needs = new HashSet<Sequence>();
-    final HashSet<Sequence> hates = new HashSet<Sequence>();
+    final HashSet<Sequence> hated  = new HashSet<Sequence>();
+    final HashSet<Sequence> needs  = new HashSet<Sequence>();
+    final HashSet<Sequence> hates  = new HashSet<Sequence>();
     public boolean           lame  = false;
 
     final Position          firstp;