Ejemplo n.º 1
0
 @Override
 public void visit(final IAstNode node) throws InvocationTargetException {
   if (node instanceof RAstNode) {
     ((RAstNode) node).acceptInR(this);
     return;
   }
   if (node.getStopOffset() >= fStartOffset && fStopOffset >= node.getOffset()) {
     node.acceptInChildren(this);
     return;
   }
 }
Ejemplo n.º 2
0
 @Override
 public void visit(final SourceComponent node) throws InvocationTargetException {
   if (fNext == null) {
     final IAstNode parent = node.getParent();
     if (node.fStopOffset >= fOffset
         &&
         // R script file or inside R chunk
         (parent == null
             || (parent.getOffset() <= fOffset && fOffset <= parent.getStopOffset()))) {
       fContainer = node;
       node.acceptInRChildren(this);
       return;
     }
   }
 }
Ejemplo n.º 3
0
 public static RAstNode findNextCommands(final IAstNode root, final int offset) {
   final NextCommandsSearchVisitor visitor = new NextCommandsSearchVisitor(offset);
   try {
     root.accept(visitor);
   } catch (final InvocationTargetException e) {
   }
   return visitor.fNext;
 }
Ejemplo n.º 4
0
 public static RAstNode findLowestFDefAssignment(final IAstNode root, final int offset) {
   final LowestFDefAssignmentSearchVisitor visitor = new LowestFDefAssignmentSearchVisitor(offset);
   try {
     root.accept(visitor);
   } catch (final OperationCanceledException e) {
   } catch (final InvocationTargetException e) {
   }
   return visitor.fAssignment;
 }
Ejemplo n.º 5
0
 public static RAstNode[] findDeepestCommands(
     final IAstNode root, final int startOffset, final int stopOffset) {
   final DeepestCommandsSearchVisitor visitor =
       new DeepestCommandsSearchVisitor(startOffset, stopOffset);
   try {
     root.accept(visitor);
   } catch (final InvocationTargetException e) {
   }
   return visitor.fCommands.toArray(new RAstNode[visitor.fCommands.size()]);
 }