X-Git-Url: http://git.megacz.com/?p=sbp.git;a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fsbp%2FSequence.java;h=0ac3500bfd476d358c509062fdc2785dce43b54b;hp=61a18e8746aefe9730e1487db017dfbe29f32b62;hb=c8a17fdd2e149fe5feecd96c71b7f2cab286ab96;hpb=92d14ef4956f39a591363709ed95bfa2999dc319 diff --git a/src/edu/berkeley/sbp/Sequence.java b/src/edu/berkeley/sbp/Sequence.java index 61a18e8..0ac3500 100644 --- a/src/edu/berkeley/sbp/Sequence.java +++ b/src/edu/berkeley/sbp/Sequence.java @@ -85,7 +85,7 @@ public abstract class Sequence extends Element implements Iterable { return epsilonForm; } - protected abstract Forest postReduce(Input.Location loc, Forest[] args, Position p); + protected abstract Forest postReduce(Input.Region loc, Forest[] args, Position p); // Position ////////////////////////////////////////////////////////////////////////////// @@ -127,8 +127,8 @@ public abstract class Sequence extends Element implements Iterable { // Position ///////////////////////////////////////////////////////////////////////////////// - final Forest rewrite(Input.Location loc) { return rewrite(loc, true); } - private final Forest rewrite(Input.Location loc, boolean epsilonCheck) { + final Forest rewrite(Input.Region loc) { return rewrite(loc, true); } + private final Forest rewrite(Input.Region loc, boolean epsilonCheck) { if (epsilonCheck && this==firstp()) return epsilonForm(); for(int i=0; i { private final Object result; public Constant(Element[] e, Object result) { super(e); this.result = result; } Sequence _clone() { return new Constant(elements, result); } - public Forest postReduce(Input.Location loc, Forest[] args, Position p) { + public Forest postReduce(Input.Region loc, Forest[] args, Position p) { return (Forest)Forest.leaf(loc, result, p); } static class Drop extends Constant { @@ -199,7 +199,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.Location loc, Forest[] args, Position p) { return (Forest)Forest.singleton(loc, args[idx], p); } + public Forest postReduce(Input.Region loc, Forest[] args, Position p) { return (Forest)Forest.singleton(loc, args[idx], p); } Sequence _clone() { return new Singleton(elements,idx); } } @@ -210,7 +210,7 @@ public abstract class Sequence extends Element implements Iterable { public Unwrap(Element[] e, Object tag) { super(e); this.drops = null; this.tag = tag; } public Unwrap(Element[] e, Object tag, boolean[] drops) { super(e); this.drops = drops; this.tag = tag; } Sequence _clone() { return new Unwrap(elements, drops); } - public Forest postReduce(Input.Location loc, Forest[] args, Position p) { + public Forest postReduce(Input.Region loc, Forest[] args, Position p) { for(int i=0; i { this.drops = drops == null ? new boolean[e.length] : drops; for(int i=0; i Forest postReduce(Input.Location loc, Forest[] args, Position p) { + public Forest postReduce(Input.Region loc, Forest[] args, Position p) { Forest[] args2 = new Forest[count]; int j = 0; for(int i=0; i