temp
[sbp.git] / src / edu / berkeley / sbp / misc / MetaGrammar.java
index e4592a8..aedc920 100644 (file)
@@ -115,9 +115,9 @@ public class MetaGrammar extends StringWalker {
         else if ("++".equals(head)) return Repeat.maximal1((Element)walk(tree.child(0)));
         else if ("?".equals(head))  return Repeat.maybe((Element)walk(tree.child(0)));
         else if ("&".equals(head))
-            return ((PreSequence)walk(tree,0)).and(new PreSequence((Element[])Reflection.lub((Object[])walk(tree, 1)), null).buildSequence(null, true, false));
+            return ((Sequence)walk(tree,0)).and(new PreSequence((Element[])Reflection.lub((Object[])walk(tree, 1)), null).buildSequence(null, true, false));
         else if ("&~".equals(head))
-            return ((PreSequence)walk(tree,0)).not(new PreSequence((Element[])Reflection.lub((Object[])walk(tree, 1)), null).buildSequence(null, true, false));
+            return ((Sequence)walk(tree,0)).not(new PreSequence((Element[])Reflection.lub((Object[])walk(tree, 1)), null).buildSequence(null, true, false));
         else if ("epsilon".equals(head)) return Union.epsilon;
         else if ("()".equals(head)) return Union.epsilon;
         else if (")".equals(head)) return SELF;
@@ -129,7 +129,7 @@ public class MetaGrammar extends StringWalker {
         else if ("-".equals(head)) return new Range(walk(tree, 0).toString().charAt(0), walk(tree,1).toString().charAt(0));
         else if ("range".equals(head)) return new Range(walk(tree, 0).toString().charAt(0), walk(tree,0).toString().charAt(0));
         else if ("gram".equals(head)) return walk(tree, 0);
-        else if ("=>".equals(head)) { PreSequence p = (PreSequence)walk(tree, 0); p.tag = string(tree.child(1)); return p; }
+        else if ("=>".equals(head)) { PreSequence p = (PreSequence)walk(tree, 0); p.tag = string(tree.child(1)); return p.buildSequence(); }
         else if ("[]".equals(head)) { PreSequence p = (PreSequence)walk(tree, 0); p.unwrap = true; return p; }
         else if ("psy".equals(head)) return (PreSequence)walk(tree, 0);
         else if ("psyl".equals(head)) throw new Error("not supported");
@@ -142,7 +142,7 @@ public class MetaGrammar extends StringWalker {
         else if ("ps".equals(head)) return new PreSequence((Element[])walk(tree, 0));
         else if ("qprod".equals(head)) {
             String s = string(tree.child(0));
-            return new PreSequence(new Element[] { string(s) }, s, new boolean[] { true });
+            return new PreSequence(new Element[] { string(s) }, s, new boolean[] { true }).buildSequence();
         } else if ("ps2".equals(head)) {
             Object[] o1 = (Object[])walk(tree, 0);
             String s = string(tree.child(1));