+ public void build(MetaGrammar.Context cx, Union u) {
+ if (!rep) { super.build(cx, u); return; }
+ HashSet<Sequence> bad2 = new HashSet<Sequence>();
+
+ Union urep = new Union();
+ urep.add(Sequence.empty);
+ urep.add(Sequence.singleton(new Element[] { cx.get(sep), u }, 1));
+
+ for(int i=0; i<sequences.length; i++) {
+ Seq[] group = sequences[i];
+ Union u2 = new Union();
+ if (sequences.length==1) u2 = u;
+ for(int j=0; j<group.length; j++) {
+ Union u3 = new Union();
+ group[j].build(cx, u3, false);
+ Sequence s = Sequence.unwrap(new Element[] { u3, urep },
+ cx.rm.repeatTag(),
+ new boolean[] { false, false });
+ u2.add(s);
+ }
+ if (sequences.length==1) break;
+ Sequence seq = Sequence.singleton(u2);
+ for(Sequence s : bad2) {
+ s.lame = true;
+ seq = seq.not(s);
+ }
+ u.add(seq);
+ bad2.add(Sequence.singleton(u2));
+ }
+ }