Search in sources :

Example 1 with AssertionExtractor

use of org.batfish.grammar.assertion.AssertionExtractor in project batfish by batfish.

the class Batfish method parseAssertion.

@Override
public AssertionAst parseAssertion(String text) {
    AssertionCombinedParser parser = new AssertionCombinedParser(text, _settings);
    AssertionContext tree = (AssertionContext) parse(parser);
    ParseTreeWalker walker = new ParseTreeWalker();
    AssertionExtractor extractor = new AssertionExtractor(text, parser.getParser());
    walker.walk(extractor, tree);
    AssertionAst ast = extractor.getAst();
    return ast;
}
Also used : AssertionCombinedParser(org.batfish.grammar.assertion.AssertionCombinedParser) AssertionAst(org.batfish.datamodel.assertion.AssertionAst) AssertionExtractor(org.batfish.grammar.assertion.AssertionExtractor) AssertionContext(org.batfish.grammar.assertion.AssertionParser.AssertionContext) ParseTreeWalker(org.antlr.v4.runtime.tree.ParseTreeWalker)

Aggregations

ParseTreeWalker (org.antlr.v4.runtime.tree.ParseTreeWalker)1 AssertionAst (org.batfish.datamodel.assertion.AssertionAst)1 AssertionCombinedParser (org.batfish.grammar.assertion.AssertionCombinedParser)1 AssertionExtractor (org.batfish.grammar.assertion.AssertionExtractor)1 AssertionContext (org.batfish.grammar.assertion.AssertionParser.AssertionContext)1