X-Git-Url: http://git.megacz.com/?p=sbp.git;a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fsbp%2FParser.java;h=c77ad6e2827d03c5bc210e907239d2561e9cba47;hp=e884a4bc768af4ab14ed5314a104c69e302a7693;hb=2cca97362e80d5a3cd3e02d791a10cd7c6f6b29c;hpb=cd8ef445dd069efec7d47ab1df0c1f93caa2beac diff --git a/src/edu/berkeley/sbp/Parser.java b/src/edu/berkeley/sbp/Parser.java index e884a4b..c77ad6e 100644 --- a/src/edu/berkeley/sbp/Parser.java +++ b/src/edu/berkeley/sbp/Parser.java @@ -25,15 +25,17 @@ public abstract class Parser { public Forest parse(Input input) throws IOException, ParseFailed { GSS gss = new GSS(); Input.Location loc = input.getLocation(); - GSS.Phase current = gss.new Phase(null, this, null, input.next(), loc, null); + Token tok = input.next(); + GSS.Phase current = gss.new Phase(null, this, null, tok, loc, input.getLocation(), null); 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((Token)current.token, loc); - GSS.Phase next = gss.new Phase(current, this, current, input.next(), loc, forest); + loc = input.getLocation(); + Token nextToken = input.next(); + GSS.Phase next = gss.new Phase(current, this, current, nextToken, loc, input.getLocation(), forest); if (!helpgc) { FileOutputStream fos = new FileOutputStream("out-"+idx+".dot"); PrintWriter p = new PrintWriter(new OutputStreamWriter(fos));