protected static boolean nodeExactlyEnclosesRegion( IASTNode node, IFortranAST ast, ITextSelection selection) { Token firstInNode = node.findFirstToken(); Token lastInNode = node.findLastToken(); Token firstInSel = findFirstTokenAfter(ast, selection.getOffset()); Token lastInSel = findLastTokenBefore( ast, OffsetLength.getPositionPastEnd(selection.getOffset(), selection.getLength())); return firstInNode != null && lastInNode != null && firstInSel != null && lastInSel != null && firstInNode == firstInSel && lastInNode == lastInSel; }
protected static boolean nodeExactlyEnclosesRegion( IASTNode parent, Token firstToken, Token lastToken) { return parent.findFirstToken() == firstToken && parent.findLastToken() == lastToken; }