X-Git-Url: http://git.megacz.com/?p=sbp.git;a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fsbp%2FSequence.java;h=b8e4263ff727c6f7214377b72a3a13243473dfa9;hp=a75bafa008243da5b7f83fd045e8362002e1af5d;hb=e5cfb136bf7fd1352eff1bd87a458aa4ff748537;hpb=6ae224025882c9929e2e4e9e8461decbf3b9cae4 diff --git a/src/edu/berkeley/sbp/Sequence.java b/src/edu/berkeley/sbp/Sequence.java index a75bafa..b8e4263 100644 --- a/src/edu/berkeley/sbp/Sequence.java +++ b/src/edu/berkeley/sbp/Sequence.java @@ -18,6 +18,7 @@ public abstract class Sequence extends Element implements Iterable { 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 { * 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 e whose corresponding boolean in drops is false will be included in the output tree + * @param drops only elements of e whose corresponding boolean in drops + * is false 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 { 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 { protected final Element[] elements; final HashSet needed = new HashSet(); - final HashSet hated = new HashSet(); - final HashSet needs = new HashSet(); - final HashSet hates = new HashSet(); + final HashSet hated = new HashSet(); + final HashSet needs = new HashSet(); + final HashSet hates = new HashSet(); public boolean lame = false; final Position firstp;