コード例 #1
0
  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;
  }
コード例 #2
0
 protected static boolean nodeExactlyEnclosesRegion(
     IASTNode parent, Token firstToken, Token lastToken) {
   return parent.findFirstToken() == firstToken && parent.findLastToken() == lastToken;
 }