checkpoint
[sbp.git] / src / edu / berkeley / sbp / Parser.java
index c5ebd7e..0504a11 100644 (file)
@@ -15,9 +15,9 @@ public abstract class Parser<Tok, Result> {
     protected Parser(Table<Tok> pt)               { this.pt = pt; }
 
     /** implement this method to create the output forest corresponding to a lone shifted input token */
-    public abstract Forest<Result> shiftToken(Tok t, Input.Location loc);
+    protected abstract Forest<Result> shiftToken(Tok t, Input.Location newloc);
 
-    public boolean helpgc = true;
+    boolean helpgc = true;
 
     public String toString() { return pt.toString(); }
 
@@ -26,9 +26,10 @@ public abstract class Parser<Tok, Result> {
         GSS gss = new GSS();
         Input.Location loc = input.getLocation();
         GSS.Phase current = gss.new Phase<Tok>(null, this, null, input.next(), loc, null);
-        current.newNode(null, Forest.leaf(null, null, null), pt.start, true);
+        current.newNode(null, Forest.create(null, null, null, false), pt.start, true);
         int count = 1;
         for(int idx=0;;idx++) {
+            Input.Location oldloc = loc;
             loc = input.getLocation();
             current.reduce();
             Forest forest = current.token==null ? null : shiftToken((Tok)current.token, loc);