checkpoint
authoradam <adam@megacz.com>
Mon, 19 Dec 2005 07:42:23 +0000 (02:42 -0500)
committeradam <adam@megacz.com>
Mon, 19 Dec 2005 07:42:23 +0000 (02:42 -0500)
darcs-hash:20051219074223-5007d-0daea4e82403f1100c2c5b823241e4e530d74dbe.gz

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

index f1ae308..092710b 100644 (file)
@@ -110,9 +110,13 @@ public class MetaGrammar extends ReflectiveWalker {
         if (o2==null) o2 = new Object[0];
         Object[] o3 = new Object[o1.length + o2.length + 1];
         System.arraycopy(o1, 0, o3, 0, o1.length);
-        o3[o1.length] = new MyLift(s);
+        Element es = string(s);
+        //dropAll.add(es);
+        o3[o1.length] = es;
         System.arraycopy(o2, 0, o3, o1.length+1, o2.length);
-        return new PreSequence(o3);
+        PreSequence ret = new PreSequence(o3, s);
+        ret.drops[o1.length] = o3.length>1;
+        return ret;
     }
     public PreSequence _slash_(PreSequence p, Object sep) { return p.sparse(sep); }
 
@@ -143,11 +147,6 @@ public class MetaGrammar extends ReflectiveWalker {
         return set(ret);
     }
 
-    public class MyLift {
-        public final String s;
-        public MyLift(String s) { this.s = s; }
-    }
-
     public class PreSequence {
         public final HashSet<Sequence> and  = new HashSet<Sequence>();
         public final HashSet<Sequence> not  = new HashSet<Sequence>();
@@ -210,7 +209,6 @@ public class MetaGrammar extends ReflectiveWalker {
                 for(int i=0; i<o.length; i++) {
                     Object oi = o[i];
                     if (oi==SELF)                    o2[j] = u.new Subset("(("+u+"))", set);
-                    else if (oi instanceof MyLift) { o2[j] = string(tag = ((MyLift)oi).s); drops[j] = o.length>1; }
                     else                             o2[j] = (Element)oi;
 
                     if (MetaGrammar.dropAll.contains(o2[j])) drops[j] = true;