X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fsbp%2Fmeta%2FRepeat.java;h=b3f184199688a9e23e22bf9ffaa7ba3e0890981c;hb=fb8694140dd9736855795e64a9bd4c3d50f7f2ea;hp=680b63699f0677dd842d079af911c134e8bbd86c;hpb=4378d20232cd88fb2a57edc5a5114f952ab58a18;p=sbp.git diff --git a/src/edu/berkeley/sbp/meta/Repeat.java b/src/edu/berkeley/sbp/meta/Repeat.java index 680b636..b3f1841 100644 --- a/src/edu/berkeley/sbp/meta/Repeat.java +++ b/src/edu/berkeley/sbp/meta/Repeat.java @@ -1,3 +1,5 @@ +// Copyright 2006 all rights reserved; see LICENSE file for BSD-style license + package edu.berkeley.sbp.meta; import edu.berkeley.sbp.util.*; import edu.berkeley.sbp.*; @@ -18,21 +20,21 @@ public class Repeat extends Union { protected Repeat(final Element e, boolean zeroOkay, boolean manyOkay, final Element separator, boolean maximal, Object tag, Atom follow) { super(e+(!manyOkay ? "?" : (zeroOkay ? (maximal ? "**" : "*") : (maximal ? "++" : "+")))+(separator==null?"":("/"+separator)), true); if (zeroOkay && !manyOkay) { - add(Sequence.newEmptySequence().followedBy(follow)); - add(Sequence.newSingletonSequence(e).followedBy(follow)); + add(Sequence.create().followedBy(follow)); + add(Sequence.create(e).followedBy(follow)); return; } if (zeroOkay) { - add(Sequence.newRewritingSequence(tag, new Element[] { }, null).followedBy(follow)); + add(Sequence.create(tag, new Element[] { }, null, false).followedBy(follow)); //add(new Sequence.Constant.Empty()); // FUGLY - add(Sequence.newSingletonSequence(many1(e, separator, tag)).followedBy(follow)); + add(Sequence.create(many1(e, separator, tag)).followedBy(follow)); } else { - add(Sequence.newRewritingSequence(tag, new Element[] { e }, null).followedBy(follow)); + add(Sequence.create(tag, new Element[] { e }, null, false).followedBy(follow)); if (separator==null) - add(Sequence.newUnwrapSequence(new Element[] { e, Repeat.this }, tag, new boolean[] { false, false }).followedBy(follow)); + add(Sequence.create(tag, new Element[] { e, Repeat.this }, new boolean[] { false, false }, true).followedBy(follow)); else - add(Sequence.newUnwrapSequence(new Element[] { e, separator, Repeat.this }, tag, new boolean[] { false, true, false }).followedBy(follow)); + add(Sequence.create(tag, new Element[] { e, separator, Repeat.this }, new boolean[] { false, true, false }, true).followedBy(follow)); } }