import java.util.*;
import java.io.*;
-public class MetaGrammar extends ReflectiveWalker {
+public class MetaGrammar extends StringWalker {
public static Union make() throws Exception {
return ((MetaGrammar)new MetaGrammar().walk(meta)).done();
return n;
}
+ public String string(Iterable<Tree<String>> children) {
+ String ret = "";
+ for(Tree<String> t : children) ret += string(t);
+ return ret;
+ }
public String string(Tree<String> tree) {
String ret = "";
if (tree.head()!=null) ret += tree.head();
- for(Tree<String> t : tree.children()) ret += string(t);
+ ret += string(tree.children());
return ret;
}
}
+ public Object walk(String tag, Object[] argo) {
+ if (argo.length==0) return super.walk(tag, argo);
+ if (argo==null) return tag;
+ if (tag==null || "".equals(tag)) return argo;
+ return super.walk(tag, argo);
+ }
+
//////////////////////////////////////////////////////////////////////////////
public class PreSequence {