- return new Reducer() {
- public String toString() { return ""; }
- public Object reduce(Iterable<Tree> t) {
- ArrayList ret = new ArrayList();
- for(Tree tc : t) {
- if (tc.head() != null && tc.head() instanceof Reducer)
- ret.add(((Reducer)tc.head()).reduce(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);
- }
- }
- return ret.toArray(new Object[0]);
- }
- };