use of com.google.security.zynamics.binnavi.parsers.filter.FilterParser in project binnavi by google.
the class CFilterRuleParser method parse.
/**
* Parses a filter string.
*
* @param filterString The filter string to parse.
*
* @return The root node of the parsed AST.
*
* @throws RecognitionException Thrown if parsing the filter string failed.
*/
public static IAbstractNode parse(final String filterString) throws RecognitionException {
final CharStream charStream = new ANTLRStringStream(filterString);
final FilterLexer lexer = new FilterLexer(charStream);
final CommonTokenStream tokens = new CommonTokenStream();
tokens.setTokenSource(lexer);
final FilterParser parser = new FilterParser(tokens);
parser.setTreeAdaptor(adaptor);
final FilterParser.prog_return parserResult = parser.prog();
final CommonTree ast = (CommonTree) parserResult.getTree();
return convert(ast);
}
Aggregations