cleanups, reorg, and commenting
[sbp.git] / src / edu / berkeley / sbp / GSS.java
index c96ceee..ca8e1d5 100644 (file)
@@ -31,6 +31,7 @@ class GSS {
         public Forest.Many finalResult;
         private PriorityQueue<Reduction> reductionQueue = new PriorityQueue<Reduction>();
 
+        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;
         }