static <T> Forest<T> singleton(Token.Location loc, Sequence creator) { return create(loc, null, new Forest[] { }, creator, false, true); }
static <T> Forest<T> singleton(Token.Location loc, Forest<T> body, Sequence creator) { return create(loc, null, new Forest[] { body }, creator, false, true); }
static <T> Forest<T> leaf(Token.Location loc, T tag, Sequence creator) { return create(loc, tag, null, creator, false, false); }
- static <T> Forest<T> create(Token.Location loc, T tag, Forest<T>[] tokens, Sequence creator, boolean unwrap, boolean singleton) {
+ public static <T> Forest<T> create(Token.Location loc, T tag, Forest<T>[] tokens, Sequence creator, boolean unwrap, boolean singleton) {
return new MultiForest<T>(loc, tag, tokens, creator, unwrap, singleton);
}
public String toString() {
if (toString != null) return toString;
StringBuffer ret = new StringBuffer();
+ if (results.size()==1) {
+ for(Forest.Body<T> r : results)
+ ret.append(r);
+ return toString = ret.toString();
+ }
ret.append("<?");
boolean first = true;
for(Forest.Body<T> r : results) {