checkpoint
authoradam <adam@megacz.com>
Wed, 14 Dec 2005 06:55:27 +0000 (01:55 -0500)
committeradam <adam@megacz.com>
Wed, 14 Dec 2005 06:55:27 +0000 (01:55 -0500)
darcs-hash:20051214065527-5007d-c2fed7b44d9799e5de6597da8e650560976bf0de.gz

src/edu/berkeley/sbp/misc/MetaGrammar.java

index 9381aa0..f210673 100644 (file)
@@ -27,7 +27,7 @@ public class MetaGrammar extends ReflectiveWalker {
 
     // MetaGrammar //////////////////////////////////////////////////////////////////////////////
 
 
     // MetaGrammar //////////////////////////////////////////////////////////////////////////////
 
-    public Object      _star_(Element r)                                              { return new Rep(r, null, false, true); }
+    public Object      _star_(Element r)                                              { return new Rep(r, null, false, true).build(); }
     public Element     epsilon(Object o, Object b)                                    { return epsilon; }
     public Element     _rightparen_(Object e)                                         { return SELF; }
 
     public Element     epsilon(Object o, Object b)                                    { return epsilon; }
     public Element     _rightparen_(Object e)                                         { return SELF; }
 
@@ -67,7 +67,7 @@ public class MetaGrammar extends ReflectiveWalker {
 
     public Object   _backslash__leftbrace_(String s)      { return SELF; }
     public Object   _leftbrace_(String s)                 { return SELF; }
 
     public Object   _backslash__leftbrace_(String s)      { return SELF; }
     public Object   _leftbrace_(String s)                 { return SELF; }
-    public Object   _plus_(final Element r) { return new Rep(r, null, false, false); }
+    public Object   _plus_(final Element r) { return new Rep(r, null, false, false).build(); }
     public Object[] _slash_(Object[] o, Object sep) {
         if (o.length <= 1) return o;
         Object[] ret = new Object[o.length * 2 - 1];
     public Object[] _slash_(Object[] o, Object sep) {
         if (o.length <= 1) return o;
         Object[] ret = new Object[o.length * 2 - 1];
@@ -78,10 +78,10 @@ public class MetaGrammar extends ReflectiveWalker {
         }
         return ret;
     }
         }
         return ret;
     }
-    public Object _plus__slash_(final Element r, Object s) { return new Rep(r, (Element)s, false, false); }
-    public Object _star__slash_(final Element r, Object s) { return new Rep(r, (Element)s, false, true); }
-    public Object _star__star_(final Element r) { return new Rep(r, null, true, true); }
-    public Object _plus__plus_(final Element r) { return new Rep(r, null, true, false); }
+    public Object _plus__slash_(final Element r, Object s) { return new Rep(r, (Element)s, false, false).build(); }
+    public Object _star__slash_(final Element r, Object s) { return new Rep(r, (Element)s, false, true).build(); }
+    public Object _star__star_(final Element r) { return new Rep(r, null, true, true).build(); }
+    public Object _plus__plus_(final Element r) { return new Rep(r, null, true, false).build(); }
     public Element _question_(final Element r) { return Repeat.maybe(r); }
     public MetaGrammar gram(Object o, MetaGrammar g, Object o2) { return g; }
     public MetaGrammar  grammar(Object[] o) { return this; }
     public Element _question_(final Element r) { return Repeat.maybe(r); }
     public MetaGrammar gram(Object o, MetaGrammar g, Object o2) { return g; }
     public MetaGrammar  grammar(Object[] o) { return this; }
@@ -179,11 +179,9 @@ public class MetaGrammar extends ReflectiveWalker {
             for(int i=0; i<o.length; i++) {
                 Object oi = o[i];
                 if (oi instanceof MyDrop)      { oi = ((MyDrop)oi).o; drops[j] = true; }
             for(int i=0; i<o.length; i++) {
                 Object oi = o[i];
                 if (oi instanceof MyDrop)      { oi = ((MyDrop)oi).o; drops[j] = true; }
-                //if      (oi instanceof PreSequence) o2[j] = ((PreSequence)oi).buildUnion();
-                /*else*/ if (oi==SELF)                  o2[j] = u.new Subset("(("+u+"))", set);
-                else if (oi instanceof MyLift)      { o2[j] = CharToken.string(tag = ((MyLift)oi).s); drops[j] = true; }
-                else if (oi instanceof Rep)         o2[j] = ((Rep)oi).build();
-                else                                  o2[j] = (Element)oi;
+                if (oi==SELF)                    o2[j] = u.new Subset("(("+u+"))", set);
+                else if (oi instanceof MyLift) { o2[j] = CharToken.string(tag = ((MyLift)oi).s); drops[j] = true; }
+                else                             o2[j] = (Element)oi;
 
                 if (dropAll.contains(o2[j])) drops[j] = true;
 
 
                 if (dropAll.contains(o2[j])) drops[j] = true;