X-Git-Url: http://git.megacz.com/?p=sbp.git;a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fsbp%2FGSS.java;fp=src%2Fedu%2Fberkeley%2Fsbp%2FGSS.java;h=ca8e1d505368093ab6d2f3598a6215291d9bda13;hp=c96ceeec43d7a2b2532d9e7b51545c4efb00b7f9;hb=dc9bb3a45ed306e2e35549076842b3e74efecb48;hpb=449c39e0dafd7c736bfcd8d56bbd08b7a99e25a4 diff --git a/src/edu/berkeley/sbp/GSS.java b/src/edu/berkeley/sbp/GSS.java index c96ceee..ca8e1d5 100644 --- a/src/edu/berkeley/sbp/GSS.java +++ b/src/edu/berkeley/sbp/GSS.java @@ -31,6 +31,7 @@ class GSS { public Forest.Many finalResult; private PriorityQueue reductionQueue = new PriorityQueue(); + Parser parser() { return parser; } public void addReduction(Reduction r) { //System.out.println("+ " + r); parser.spin(); @@ -61,9 +62,9 @@ class GSS { newNode(primordealResult, startState, true); } public Phase(Phase prev, Forest forest) throws ParseFailed, IOException { - this.location = input.getLocation(); + this.prevLocation = input.getLocation(); this.token = (Tok)input.next(); - this.prevLocation = prev==null ? location : prev.getLocation(); + this.location = input.getLocation(); this.prev = prev; this.forest = forest; this.pos = prev==null ? 0 : prev.pos+1; @@ -112,7 +113,7 @@ class GSS { public Input.Location getPrevLocation() { return prevLocation; } public Input.Location getLocation() { return location; } - public Input.Region getRegion() { return getPrevLocation().createRegion(getLocation()); } + public Input.Region getRegion() { return prevLocation.createRegion(location); } public Input.Location getNextLocation() { return nextLocation; } public boolean isFrontier() { return hash!=null; } @@ -176,7 +177,7 @@ class GSS { if (!state.canReduce(token)) return false; } while(false); Node n = new Node(Phase.this, result, state, fromEmptyReduction); // ALLOC - for(Object s : state.also) + for(Object s : state.conjunctStates) newNode(new Result(null, n, null), (State)s, fromEmptyReduction); return true; }