use of org.parboiled.parserunners.TracingParseRunner in project ddf by codice.
the class TestKeywordTextParser method trace.
// We have been using this for debugging purposes, its not meant to be a test.
@Ignore
@Test
public void trace() {
Map<String, String> inputToOutput = new LinkedHashMap<String, String>();
FilterBuilder filterBuilder = new GeotoolsFilterBuilder();
List<String> inputs = new ArrayList<String>();
// inputs.add("A \"(test test2)\" OR test2");
inputs.add("A B C D");
for (String input : inputs) {
KeywordTextParser parser = Parboiled.createParser(KeywordTextParser.class);
ParsingResult<ASTNode> result = new TracingParseRunner(parser.inputPhrase()).run(input);
// ParsingResult<ASTNode> result = new
// ReportingParseRunner(parser.inputPhrase()).run(input);
KeywordFilterGenerator kfg = new KeywordFilterGenerator(filterBuilder);
Filter filter = kfg.getFilterFromASTNode(result.resultValue);
inputToOutput.put(input, filter.toString());
// visualize(result);
}
for (Map.Entry<String, String> iteration : inputToOutput.entrySet()) {
System.out.println(iteration.getKey() + " : " + iteration.getValue());
}
}
Aggregations