Search in sources :

Example 6 with HierarchyPath

use of org.batfish.grammar.flatjuniper.Hierarchy.HierarchyTree.HierarchyPath in project batfish by batfish.

the class GroupTreeBuilder method exitS_groups_named.

@Override
public void exitS_groups_named(S_groups_namedContext ctx) {
    String groupName = ctx.name.getText();
    HierarchyTree tree = _hierarchy.getTree(groupName);
    if (tree == null) {
        tree = _hierarchy.newTree(groupName);
    }
    StatementContext statement = ctx.s_groups_tail().statement();
    if (statement == null) {
        return;
    }
    Interval interval = ctx.s_groups_tail().getSourceInterval();
    List<Token> unfilteredTokens = _combinedParser.getTokens().getTokens(interval.a, interval.b);
    HierarchyPath path = new HierarchyPath();
    for (Token currentToken : unfilteredTokens) {
        if (currentToken.getChannel() != Lexer.HIDDEN) {
            String text = currentToken.getText();
            if (currentToken.getType() == FlatJuniperLexer.WILDCARD) {
                path.addWildcardNode(text);
            } else {
                path.addNode(text);
            }
        }
    }
    path.setStatement(statement);
    tree.addPath(path, _currentSetLine, null);
}
Also used : HierarchyPath(org.batfish.grammar.flatjuniper.Hierarchy.HierarchyTree.HierarchyPath) HierarchyTree(org.batfish.grammar.flatjuniper.Hierarchy.HierarchyTree) Token(org.antlr.v4.runtime.Token) StatementContext(org.batfish.grammar.flatjuniper.FlatJuniperParser.StatementContext) Interval(org.antlr.v4.runtime.misc.Interval)

Example 7 with HierarchyPath

use of org.batfish.grammar.flatjuniper.Hierarchy.HierarchyTree.HierarchyPath in project batfish by batfish.

the class WildcardPruner method enterSet_line_tail.

@Override
public void enterSet_line_tail(Set_line_tailContext ctx) {
    _enablePathRecording = true;
    _currentPath = new HierarchyPath();
}
Also used : HierarchyPath(org.batfish.grammar.flatjuniper.Hierarchy.HierarchyTree.HierarchyPath)

Example 8 with HierarchyPath

use of org.batfish.grammar.flatjuniper.Hierarchy.HierarchyTree.HierarchyPath in project batfish by batfish.

the class InitialTreeBuilder method enterSet_line.

@Override
public void enterSet_line(Set_lineContext ctx) {
    _addLine = true;
    _enablePathRecording = true;
    _currentPath = new HierarchyPath();
}
Also used : HierarchyPath(org.batfish.grammar.flatjuniper.Hierarchy.HierarchyTree.HierarchyPath)

Example 9 with HierarchyPath

use of org.batfish.grammar.flatjuniper.Hierarchy.HierarchyTree.HierarchyPath in project batfish by batfish.

the class InitialTreeBuilder method enterSet_line_tail.

@Override
public void enterSet_line_tail(Set_line_tailContext ctx) {
    _enablePathRecording = true;
    _currentPath = new HierarchyPath();
}
Also used : HierarchyPath(org.batfish.grammar.flatjuniper.Hierarchy.HierarchyTree.HierarchyPath)

Example 10 with HierarchyPath

use of org.batfish.grammar.flatjuniper.Hierarchy.HierarchyTree.HierarchyPath in project batfish by batfish.

the class WildcardApplicator method enterSet_line_tail.

@Override
public void enterSet_line_tail(Set_line_tailContext ctx) {
    _enablePathRecording = true;
    _currentPath = new HierarchyPath();
}
Also used : HierarchyPath(org.batfish.grammar.flatjuniper.Hierarchy.HierarchyTree.HierarchyPath)

Aggregations

HierarchyPath (org.batfish.grammar.flatjuniper.Hierarchy.HierarchyTree.HierarchyPath)11 Token (org.antlr.v4.runtime.Token)1 Interval (org.antlr.v4.runtime.misc.Interval)1 ParseTree (org.antlr.v4.runtime.tree.ParseTree)1 BatfishException (org.batfish.common.BatfishException)1 StatementContext (org.batfish.grammar.flatjuniper.FlatJuniperParser.StatementContext)1 HierarchyTree (org.batfish.grammar.flatjuniper.Hierarchy.HierarchyTree)1