checkpoint
[sbp.git] / src / edu / berkeley / sbp / meta / Production.java
index 08588d9..bcd2407 100644 (file)
@@ -11,10 +11,13 @@ import java.io.*;
 
 public  class Production {
     public String tag;
+    public String nonTerminal;
     public boolean[] drops;
     public Element[] elements;
-    public String nonTerminal;
     public int count = 0;
+
+    public String tag() { return tag==null ? nonTerminal : tag; }
+
     public Production(String tag, Element[] elements, boolean[] drops) { this(tag, tag, elements, drops); }
     public Production(String tag, String nonTerminal, Element[] elements, boolean[] drops) {
         this.tag = tag;
@@ -96,19 +99,21 @@ public  class Production {
     public Sequence makeSequence(Object o) { return makeSequence(Bindable.create(o)); }
     public Sequence makeSequence(final Bindable _bindable) {
 
+        /*
         if (_bindable.getArgTypes().length > 0 &&
             _bindable.getArgTypes()[0] == Input.Region.class) {
             Functor<Input.Region,Object> func = new Functor<Input.Region,Object>() {
                 int[] map = buildSequence(_bindable);
                 public Object invoke(final Input.Region region) { return _bindable.createBinding(map, region); }
             };
-            return Sequence.regionRewritingSequence(func, elements, drops);
+            return Sequence.newRegionRewritingSequence(func, elements, drops);
         }
+        */
 
         if (_bindable.isAnnotationPresent(bind.raw.class))
-            return Sequence.rewritingSequence(new Tree.RawBindingFunctor(_bindable.createBinding()), elements, drops);
+            return Sequence.create(new RawBindingFunctor(tag(), _bindable.createBinding()), elements, drops, false);
         int[] map = buildSequence(_bindable);
-        return Sequence.rewritingSequence(new Tree.BindingFunctor(_bindable.createBinding()), elements, drops);
+        return Sequence.create(new BindingFunctor(tag(), _bindable.createBinding()), elements, drops, false);
     }
 
 }