From: adam Date: Sun, 9 Sep 2007 03:54:51 +0000 (-0400) Subject: add support for test cases which do not expand their result X-Git-Url: http://git.megacz.com/?p=sbp.git;a=commitdiff_plain;h=80f8bc14a13b5e4912004e081ec96dc6ed807385 add support for test cases which do not expand their result darcs-hash:20070909035451-5007d-386dc39111d15d695849b6df41656411e097def3.gz --- diff --git a/src/edu/berkeley/sbp/GSS.java b/src/edu/berkeley/sbp/GSS.java index 7c1fb19..27eb279 100644 --- a/src/edu/berkeley/sbp/GSS.java +++ b/src/edu/berkeley/sbp/GSS.java @@ -113,7 +113,7 @@ class GSS { public boolean isFrontier() { return hash!=null; } /** perform all shift operations, adding promoted nodes to next */ - private void shift(Phase next, Forest result) throws ParseFailed { + private void shift(Phase next, Forest f) throws ParseFailed { this.next = next; // this massively improves GC performance if (prev != null) { @@ -130,7 +130,9 @@ class GSS { finalResult.merge(r.getForest()); } if (token == null) continue; - n.state().invokeShifts(token, this, new Result(result, n, null)); + Result result = new Result(f, null, null); + result.addParent(n); + n.state().invokeShifts(token, this, result); } numNewNodes = next==null ? 0 : next.hash.size(); viewPos = this.pos; @@ -189,6 +191,7 @@ class GSS { if (!state.canReduce(token)) return false; } while(false); Node n = new Node(Phase.this, result, state, fromEmptyReduction); // ALLOC + /** FIXME: this null-result can be used to notice bogus/dead states */ for(Object s : state.conjunctStates) newNode(new Result(null, n, null), (State)s, fromEmptyReduction); return !n.state().doomed(); diff --git a/src/edu/berkeley/sbp/misc/RegressionTests.java b/src/edu/berkeley/sbp/misc/RegressionTests.java index eae22d1..0246395 100644 --- a/src/edu/berkeley/sbp/misc/RegressionTests.java +++ b/src/edu/berkeley/sbp/misc/RegressionTests.java @@ -88,9 +88,10 @@ public class RegressionTests { Tree tt = r2.expand1(); for(int i=0; i> results = res==null ? new HashSet>() : res.expand(); diff --git a/tests/testcase.g b/tests/testcase.g index 5307361..b25251d 100644 --- a/tests/testcase.g +++ b/tests/testcase.g @@ -6,7 +6,7 @@ Output = "output" grammar.Quoted ";" /ws Outputs:: = Output */ ws TestCase:: = "testcase" grammar.Quoted "{" Input - Outputs + (^"ignore output;" | Outputs) (SubGrammar:: grammar.Grammar) "}" /ws ws = grammar.ws