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();
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");
}