checkpoint
[sbp.git] / src / edu / berkeley / sbp / meta / MetaGrammarBindings.java
index 0bad0b2..7a18bab 100644 (file)
@@ -81,10 +81,10 @@ public class MetaGrammarBindings extends AnnotationGrammarBindings {
                     group[j].build(cx, u2, cnt);
                 }
                 if (sequences.length==1) break;
-                Sequence seq = Sequence.newSingletonSequence(u2);
+                Sequence seq = Sequence.create(u2);
                 for(Sequence s : bad2) seq = seq.not(s);
                 u.add(seq);
-                bad2.add(Sequence.newSingletonSequence(u2));
+                bad2.add(Sequence.create(u2));
             }
         }
     }
@@ -128,11 +128,11 @@ public class MetaGrammarBindings extends AnnotationGrammarBindings {
             HashSet<Sequence> bad2 = new HashSet<Sequence>();
 
             Union urep = new Union(null, false);
-            urep.add(Sequence.newEmptySequence());
+            urep.add(Sequence.create());
             if (sep != null)
-                urep.add(Sequence.newSingletonSequence(new Element[] { cx.get(sep), u }, 1));
+                urep.add(Sequence.create(new Element[] { cx.get(sep), u }, 1));
             else
-                urep.add(Sequence.newSingletonSequence(new Element[] { u }, 0));
+                urep.add(Sequence.create(new Element[] { u }, 0));
 
             for(int i=0; i<sequences.length; i++) {
                 Seq[] group = sequences[i];
@@ -141,16 +141,17 @@ public class MetaGrammarBindings extends AnnotationGrammarBindings {
                 for(int j=0; j<group.length; j++) {
                     Union u3 = new Union(null, false);
                     group[j].build(cx, u3, this);
-                    Sequence s = Sequence.newUnwrapSequence(new Element[] { u3, urep },
-                                                            cx.rm.repeatTag(),
-                                                            new boolean[] { false, false });
+                    Sequence s = Sequence.create(cx.rm.repeatTag(),
+                                                 new Element[] { u3, urep },
+                                                 new boolean[] { false, false },
+                                                 true);
                     u2.add(s);
                 }
                 if (sequences.length==1) break;
-                Sequence seq = Sequence.newSingletonSequence(u2);
+                Sequence seq = Sequence.create(u2);
                 for(Sequence s : bad2) seq = seq.not(s);
                 u.add(seq);
-                bad2.add(Sequence.newSingletonSequence(u2));
+                bad2.add(Sequence.create(u2));
             }
         }
     }
@@ -245,9 +246,9 @@ public class MetaGrammarBindings extends AnnotationGrammarBindings {
                 for(int i=0; i<els.length; i++)
                     if (!drops[i])
                         if (idx==-1) idx = i;
-                        else throw new Error("multiple non-dropped elements in sequence: " + Sequence.newDropSequence(els));
-                if (idx != -1) ret = Sequence.newSingletonSequence(els, idx);
-                else           ret = Sequence.newDropSequence(els);
+                        else throw new Error("multiple non-dropped elements in sequence: " + Sequence.newConstantSequence(els, null));
+                if (idx != -1) ret = Sequence.create(els, idx);
+                else           ret = Sequence.newConstantSequence(els, null);
             }
             if (this.follow != null)
                 ret = ret.followedBy(this.follow.toAtom(cx));
@@ -268,7 +269,7 @@ public class MetaGrammarBindings extends AnnotationGrammarBindings {
     public static @bind.as("()")  ElementNode   epsilon()                         { return new Constant(epsilon); }
 
     private static Union epsilon = new Union("()");
-    static { epsilon.add(Sequence.newEmptySequence()); }
+    static { epsilon.add(Sequence.create()); }
 
     public static class NonTerminalReferenceNode extends ElementNode {
         public String nonTerminal;
@@ -325,7 +326,7 @@ public class MetaGrammarBindings extends AnnotationGrammarBindings {
             Union u = new Union(null, false);
             Sequence s = body.build(cx, u, null);
             Union u2 = new Union(null, false);
-            u2.add(Sequence.newSingletonSequence(new Element[] {
+            u2.add(Sequence.create(new Element[] {
                 CharAtom.leftBrace,
                 cx.get("ws"),
                 u,