temp
authoradam <adam@megacz.com>
Sun, 15 Jan 2006 21:52:58 +0000 (16:52 -0500)
committeradam <adam@megacz.com>
Sun, 15 Jan 2006 21:52:58 +0000 (16:52 -0500)
darcs-hash:20060115215258-5007d-503cc518550a6af223f22f3458d2ee7993d54aeb.gz

src/edu/berkeley/sbp/misc/MetaGrammar.java
tests/meta.g

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));
index 0f69022..5815214 100644 (file)
@@ -17,9 +17,9 @@ ps         ::= e*/ws                              => "ps"
 psy        ::= ps
              | ps wp ^"/" ws e
 psx        ::= psy                   => "psy"
-             | e "<-" psy        /ws => "psyl"
+//             | e "<-" psy        /ws => "psyl"
              |        psy "->" e /ws => "psyr"
-             | e "<-" psy "->" e /ws => "psylr"
+//             | e "<-" psy "->" e /ws => "psylr"
 Sequence   ::= Quoted => "qprod"
              > psx
              | psx  "=>" ^"[]"         /ws