X-Git-Url: http://git.megacz.com/?p=sbp.git;a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fsbp%2FGSS.java;h=bd2ecd6539b2bc91963b944a48ccca080634b70c;hp=7408eba088e290735c11aa6e29e6a00227eb8d0d;hb=6a2ea790f843e058c7e67d3c7d1deebadcfe1fd5;hpb=06d4d872050cac83ebd1a0abbf0e00d18ed3c44d diff --git a/src/edu/berkeley/sbp/GSS.java b/src/edu/berkeley/sbp/GSS.java index 7408eba..bd2ecd6 100644 --- a/src/edu/berkeley/sbp/GSS.java +++ b/src/edu/berkeley/sbp/GSS.java @@ -16,9 +16,10 @@ class GSS { public int resets = 0; public int waits = 0; - HashMapBag inhibited = new HashMapBag(); - HashMapBag waiting = new HashMapBag(); - HashMapBag performed = new HashMapBag(); + HashMapBag inhibited = new HashMapBag(); + HashMapBag expectedInhibit = new HashMapBag(); + HashMapBag waiting = new HashMapBag(); + HashMapBag performed = new HashMapBag(); /** FIXME */ public Forest.Ref finalResult; @@ -42,12 +43,12 @@ class GSS { private boolean good; private Phase next = null; private Phase prev; - private Token.Location location; + private Input.Location location; public final Parser parser; private Forest forest; - public Phase(Phase prev, Parser parser, Phase previous, Tok token, Token.Location location, Forest forest) { + public Phase(Phase prev, Parser parser, Phase previous, Tok token, Input.Location location, Forest forest) { this.prev = prev; this.forest = forest; this.parser = parser; @@ -63,6 +64,8 @@ class GSS { performed.clear(); hash = new IntPairMap(); singularReductions = new IntPairMap(); + expectedInhibit.clear(); + expectedInhibit.addAll(inhibited); good = false; closed = false; reducing = false; @@ -78,7 +81,7 @@ class GSS { return true; } - public Token.Location getLocation() { return location; } + public Input.Location getLocation() { return location; } /** add a new node (merging with existing nodes if possible) * @param parent the parent of the new node @@ -175,6 +178,7 @@ class GSS { throw new Reset(); } inhibited.add(p, seq); + expectedInhibit.remove(p, seq); } } @@ -196,6 +200,11 @@ class GSS { reducing_list[i] = null; n.performReductions(); } + if (expectedInhibit.size() > 0) { + inhibited.removeAll(expectedInhibit); + System.out.println("\n!!!!\n"); + throw new Reset(); + } } catch (Reset r) { reset(); reduce();