intermediate checkpoint
[sbp.git] / src / edu / berkeley / sbp / misc / RegressionTests.java
index 9429b69..a3d471d 100644 (file)
@@ -37,7 +37,11 @@ public class RegressionTests {
                 System.out.println("\nready...");
                 System.in.read();
             }
+            System.gc();
+            long now = System.currentTimeMillis();
             Forest<String> r2 = parser.parse(cs);
+            System.out.println();
+            System.out.println("elapsed = " + (System.currentTimeMillis()-now) + "ms");
             if (profile) {
                 System.out.println("\ndone");
                 System.in.read();
@@ -74,13 +78,21 @@ public class RegressionTests {
             return ret;
         }
         public boolean execute() throws Exception {
-            Forest<String> res = new CharToken.CharToStringParser(grammar).parse(inp);
+            Forest<String> res = null;
+            Parser.Failed pfe = null;
+            try {
+                res = new CharToken.CharToStringParser(grammar).parse(inp);
+            } catch (Parser.Failed pf) {
+                pfe = pf;
+            }
+            //ystem.out.println("res=="+res);
             Collection<Tree<String>> results = res==null ? new HashSet<Tree<String>>() : res.expand(false);
             System.out.print("\r");
             if (results.size() == 0 && output.length > 0) {
                 System.out.print("\033[31m");
                 System.out.println("PARSE FAILED");
                 System.out.print("\033[0m");
+                if (pfe != null) pfe.printStackTrace();
             } else {
                 System.out.print("\r                                                                                                              \r");
             }