code: public static IParseTree[] findSpanningLogicalRange( IParseTree start, IParseTree end )
    {
      while( end != null )
      {
        IParseTree deepestAtStart = start;
        while( deepestAtStart != null )
        {
          if( deepestAtStart.isSiblingOf( end ) )
          {
            IParseTree[] returnVal = new IParseTree[2];
  
            if( deepestAtStart.getOffset() < end.getOffset() )
            {
              returnVal[0] = deepestAtStart;
            }
            else
            {
              returnVal[0] = end;
            }
  
            if( deepestAtStart.getExtent() > end.getExtent() )
            {
              returnVal[1] = deepestAtStart;
            }
            else
            {
              returnVal[1] = end;
            }
  
            return returnVal;
          }
          deepestAtStart = deepestAtStart.getParent();
        }
        end = end.getParent();
      }
      return null;
    }
docs: Given two parse tree positions, find the bounding pair that captures the start and end in one logical unit