public Constant(Element[] e, Object result) { super(e); this.result = result; }
Sequence _clone() { return new Constant(elements, result); }
public <T> Forest<T> postReduce(Input.Region loc, Forest<T>[] args, Position p) {
public Constant(Element[] e, Object result) { super(e); this.result = result; }
Sequence _clone() { return new Constant(elements, result); }
public <T> Forest<T> postReduce(Input.Region loc, Forest<T>[] args, Position p) {
- return (Forest<T>)Forest.leaf(loc, result, p);
+ return (Forest<T>)Forest.create(loc, result, null, false);
}
static class Drop extends Constant {
Sequence _clone() { return new Drop(elements, lame); }
}
static class Drop extends Constant {
Sequence _clone() { return new Drop(elements, lame); }
private final int idx;
public Singleton(Element e) { this(new Element[] { e }, 0); }
public Singleton(Element[] e, int idx) { super(e); this.idx = idx; }
private final int idx;
public Singleton(Element e) { this(new Element[] { e }, 0); }
public Singleton(Element[] e, int idx) { super(e); this.idx = idx; }
- public <T> Forest<T> postReduce(Input.Region loc, Forest<T>[] args, Position p) { return (Forest<T>)Forest.singleton(loc, args[idx], p); }
+ public <T> Forest<T> postReduce(Input.Region loc, Forest<T>[] args, Position p) { return args[idx]; }
Sequence _clone() { return new Unwrap(elements, drops); }
public <T> Forest<T> postReduce(Input.Region loc, Forest<T>[] args, Position p) {
for(int i=0; i<args.length; i++) if (args[i]==null) throw new Error();
Sequence _clone() { return new Unwrap(elements, drops); }
public <T> Forest<T> postReduce(Input.Region loc, Forest<T>[] args, Position p) {
for(int i=0; i<args.length; i++) if (args[i]==null) throw new Error();
- if (drops==null) return Forest.create(loc, (T)tag, args, true, false, p);
+ if (drops==null) return Forest.create(loc, (T)tag, args, true);
int count = 0;
for(int i=0; i<drops.length; i++) if (!drops[i]) count++;
Forest<T>[] args2 = new Forest[count];
int j = 0;
for(int i=0; i<args.length; i++) if (!drops[i]) args2[j++] = args[i];
int count = 0;
for(int i=0; i<drops.length; i++) if (!drops[i]) count++;
Forest<T>[] args2 = new Forest[count];
int j = 0;
for(int i=0; i<args.length; i++) if (!drops[i]) args2[j++] = args[i];
- return Forest.create(loc, (T)tag, args2, true, false, p);
+ return Forest.create(loc, (T)tag, args2, true);
int j = 0;
for(int i=0; i<args.length; i++) if (!drops[i]) args2[j++] = args[i];
//System.out.println("reduce \""+tag+"\"");
int j = 0;
for(int i=0; i<args.length; i++) if (!drops[i]) args2[j++] = args[i];
//System.out.println("reduce \""+tag+"\"");
- return Forest.create(loc, (T)tag, args2, false, false, p);
+ return Forest.create(loc, (T)tag, args2, false);