use of org.sonar.uast.UastNode in project sonar-go by SonarSource.
the class HighlightingVisitor method scanRecursively.
public void scanRecursively(UastNode node, boolean parentIsATypeDefinition) {
UastNode.Token token = node.token;
boolean isATypeDefinition = parentIsATypeDefinition || node.kinds.contains(Kind.TYPE);
if (token != null) {
if (node.kinds.contains(Kind.COMMENT)) {
highlight(token, node.kinds.contains(Kind.STRUCTURED_COMMENT) ? TypeOfText.STRUCTURED_COMMENT : TypeOfText.COMMENT);
} else if (node.kinds.contains(Kind.KEYWORD)) {
highlight(token, TypeOfText.KEYWORD);
} else if (node.kinds.contains(Kind.LITERAL)) {
highlight(token, node.kinds.contains(Kind.STRING_LITERAL) ? TypeOfText.STRING : TypeOfText.CONSTANT);
} else if (isATypeDefinition) {
highlight(token, TypeOfText.KEYWORD_LIGHT);
}
}
for (UastNode child : node.children) {
scanRecursively(child, isATypeDefinition);
}
}
Aggregations