CommentMatcher
class CommentMatcher
Class used to encapsulate functions used for the heuristic comment matching. Comments are matched to the closest AST node with priority on predecessor nodes in the same line as the comment, then successor nodes and lastly enclosing nodes.
Functions
Link copied to clipboard
fun getEnclosingChild(node: Node, location: Region, artifactLocation: PhysicalLocation.ArtifactLocation?): Node
Searches amongst the children of the node to find the child that contains the provided region.
Link copied to clipboard
fun matchCommentToNode(comment: String, location: Region, tu: TranslationUnitDeclaration, artifactLocation: PhysicalLocation.ArtifactLocation? = null)
This function matches a comment to the closest node according to a heuristic: Comments are assigned to the closest successor node on their ast hierarchy level. Only Exception, if they don't have a successor starting in the same line but they have a predecessor in the same line, the comment is matched to that closest predecessor.