- public static class TargetReducer implements Tree.TreeFunctor<Object,Object> {
- private Production p;
- private int[] map;
- private String name;
- private Reflection.Bindable _bindable;
- private boolean _israw;
- public TargetReducer(Production p, int[] map, String name, Reflection.Bindable b, boolean raw) {
- this.p = p;
- this.map = map;
- this.name = name;
- this._bindable = b;
- this._israw = raw;
- }
- public String toString() { return name; }
- public Object invoke(Iterable<Tree<Object>> t) {
- if (_israw) return _bindable.impose(new Object[] { t });
- ArrayList ret = new ArrayList();
- for(Tree tc : t) {
- if (tc.head() != null && tc.head() instanceof Functor)
- ret.add(((Tree.TreeFunctor<Object,Object>)tc.head()).invoke(tc.children()));
- else if (tc.numChildren() == 0)
- ret.add(tc.head());
- else {
- System.err.println("FIXME: don't know what to do about " + tc);
- ret.add(null);
- }
+ }
+
+ public static class TargetReducer implements Tree.TreeFunctor<Object,Object> {
+ private int[] map;
+ private String name;
+ private Bindable _bindable;
+ private boolean _israw;
+ public TargetReducer(Production p, int[] map, String name, Bindable b, boolean raw) {
+ this.map = map;
+ this.name = name;
+ this._bindable = b;
+ this._israw = raw;
+ }
+ public String toString() { return name; }
+ public Object invoke(Iterable<Tree<Object>> t) {
+ if (_israw) return _bindable.impose(new Object[] { t });
+ ArrayList ret = new ArrayList();
+ for(Tree tc : t) {
+ if (tc.head() != null && tc.head() instanceof Functor)
+ ret.add(((Tree.TreeFunctor<Object,Object>)tc.head()).invoke(tc.children()));
+ else if (tc.numChildren() == 0)
+ ret.add(tc.head());
+ else {
+ System.err.println("FIXME: don't know what to do about " + tc);
+ ret.add(null);