hoisted getLocation() out of Token and into Token.Stream
[sbp.git] / src / edu / berkeley / sbp / GSS.java
index 2d9f6ff..69d9eed 100644 (file)
@@ -59,9 +59,11 @@ class GSS {
 
         boolean closed = false;
 
-        public Phase(Phase previous, Token token) {
+        private Token.Location location;
+        public Phase(Phase previous, Token token, Token.Location location) {
             this.pos = previous==null ? 0 : previous.pos+1;
             this.token = token;
+            this.location = location;
         }
 
         public boolean isDone() { return token == null; }
@@ -72,7 +74,7 @@ class GSS {
                 throw new Parser.Failed(error, getLocation());
         }
 
-        public Token.Location getLocation() { return token==null ? null : token.getLocation(); }
+        public Token.Location getLocation() { return location; }
 
         /** add a new node (merging with existing nodes if possible)
          *  @param parent             the parent of the new node