X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;ds=sidebyside;f=src%2Fedu%2Fberkeley%2Fsbp%2FSequence.java;h=091f7aec4df3914439679c8938954b805f085597;hb=c8d1c3a25e2bfa9645c4b91d3dde9c4857f636f2;hp=1b336ffe18c50bb634b7606aa3be8705c46bd108;hpb=aaa5d101e054dc548e7ef7831b1fcb7913a4d4d4;p=sbp.git diff --git a/src/edu/berkeley/sbp/Sequence.java b/src/edu/berkeley/sbp/Sequence.java index 1b336ff..091f7ae 100644 --- a/src/edu/berkeley/sbp/Sequence.java +++ b/src/edu/berkeley/sbp/Sequence.java @@ -80,10 +80,10 @@ public abstract class Sequence extends Element implements Iterable { } // DO NOT MESS WITH THE FOLLOWING LINE!!! - private Forest.Ref epsilonForm = null; + private Forest.Many epsilonForm = null; Forest epsilonForm() { if (epsilonForm!=null) return epsilonForm; - epsilonForm = new Forest.Ref(); + epsilonForm = new Forest.Many(); epsilonForm.merge(firstp().rewrite(null, false)); return epsilonForm; } @@ -184,7 +184,7 @@ public abstract class Sequence extends Element implements Iterable { public Constant(Element[] e, Object result) { super(e); this.result = result; } Sequence _clone() { return new Constant(elements, result); } public Forest postReduce(Input.Region loc, Forest[] args, Position p) { - return (Forest)Forest.leaf(loc, result, p); + return (Forest)Forest.create(loc, result, null, false); } static class Drop extends Constant { Sequence _clone() { return new Drop(elements, lame); } @@ -202,7 +202,7 @@ public abstract class Sequence extends Element implements Iterable { 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 Forest postReduce(Input.Region loc, Forest[] args, Position p) { return (Forest)Forest.singleton(loc, args[idx], p); } + public Forest postReduce(Input.Region loc, Forest[] args, Position p) { return args[idx]; } Sequence _clone() { return new Singleton(elements,idx); } } @@ -215,13 +215,13 @@ public abstract class Sequence extends Element implements Iterable { Sequence _clone() { return new Unwrap(elements, drops); } public Forest postReduce(Input.Region loc, Forest[] args, Position p) { for(int i=0; i[] args2 = new Forest[count]; int j = 0; for(int i=0; i { int j = 0; for(int i=0; i