X-Git-Url: http://git.megacz.com/?p=sbp.git;a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fsbp%2Fmeta%2FRepeat.java;h=800639b14f3a2afb7ea33b804be596561a7d2df1;hp=bbf800a31bcefae778b6c4c31df91c4201efe136;hb=HEAD;hpb=dc46168f73937268a2a08577e4271d133a91bbef diff --git a/src/edu/berkeley/sbp/meta/Repeat.java b/src/edu/berkeley/sbp/meta/Repeat.java index bbf800a..800639b 100644 --- a/src/edu/berkeley/sbp/meta/Repeat.java +++ b/src/edu/berkeley/sbp/meta/Repeat.java @@ -12,7 +12,7 @@ import java.lang.ref.*; * Currently this class exports only static methods to create repetitions; * there are no public instance methods or constructors */ -public class Repeat extends Union { +class Repeat extends Union { public Repeat(final Element e, boolean zeroOkay, boolean manyOkay, Object tag) { this(e, zeroOkay, manyOkay, null, false, tag); } @@ -41,9 +41,12 @@ public class Repeat extends Union { add(Sequence.create(tag, new Element[] { }, null).followedBy(follow)); if (!(zeroOkay && manyOkay)) add(Sequence.create(tag, new Element[] { e }, null).followedBy(follow)); - if (zeroOkay && manyOkay) + + // FEATURE: stringify ~[]* as ... + if (zeroOkay && manyOkay && separator!=null) { add(Sequence.create(many1(e, separator, tag)).followedBy(follow)); - if (!zeroOkay && manyOkay) { + + } else if (manyOkay) { if (separator==null) add(Sequence.create(tag, new Element[] { Repeat.this, e },