use of org.batfish.grammar.flatjuniper.FlatJuniperParser.StatementContext 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);
}
Aggregations