import java.lang.ref.*;
/** currently this class exports only static methods to create repetitions; there are no public instance methods or constructors */
-class Repeat extends Union {
+/* FIXME make private again */ public class Repeat extends Union {
- Repeat(final Element e, boolean zeroOkay, boolean manyOkay, final Element separator, boolean maximal) {
+ public Repeat(final Element e, boolean zeroOkay, boolean manyOkay, final Element separator, boolean maximal) {
this(e, zeroOkay, manyOkay, separator, maximal, null); }
Repeat(final Element e, boolean zeroOkay, boolean manyOkay, final Element separator, boolean maximal, Object tag) {
super(e+(!manyOkay ? "?" : (zeroOkay ? (maximal ? "**" : "*") : (maximal ? "++" : "+")))+(separator==null?"":("/"+separator)), true);
else
add(new Sequence.Unwrap(new Element[] { e, separator, Repeat.this }, tag, new boolean[] { false, true, false }));
}
- if (maximal) for(Sequence s : this) s.noFollow = separator==null ? e : separator;
+ // FIXME: hack!
+ if (maximal)
+ for(Sequence s : this)
+ s.follow = new edu.berkeley.sbp.misc.MetaGrammar.Invert(new edu.berkeley.sbp.misc.MetaGrammar.Infer(separator==null ? e : separator));
}
}