docs: protected void computeRegions(List<ReplaceRegion> regions, Iterable<ILeafNode> leafNodes, String toSearch, String... ends) {
  		for (ILeafNode leafNode : leafNodes) {
  			String text = leafNode.getText();
  			int offset = leafNode.getOffset();
  			int position = text.indexOf(toSearch);
  			int textLength = text.length();
  			while (position != -1) {
  				int beginIndex = position + toSearch.length();
  				// Skip leading whitespaces
  				if(Character.isWhitespace(text.charAt(beginIndex))){
  					while(beginIndex < textLength && Character.isWhitespace(text.charAt(beginIndex))){
  						beginIndex ++;
  					}
  				}
  				int endIndex = -1;
  				for (int i = ends.length -1; i >= 0; i--) {
  					String end = ends[i];
  					int endCandidate = text.indexOf(end, beginIndex);
  					if (endCandidate != -1)  {
  						if (endIndex == -1) {
  							endIndex = endCandidate;
  						} else {
  							if (endIndex > endCandidate) {
  								endIndex = endCandidate;
  							}
  						}
  					}
  				}
  				if (endIndex == -1) { 
  					break;
  				} else {
  					String simpleName = text.substring(beginIndex, endIndex).replaceAll(" ", "");
  					if(simpleName.length() > 0 && simpleName.matches("[0-9a-zA-Z\\.\\$_]*")){
  						ReplaceRegion region = new ReplaceRegion(offset + beginIndex, simpleName.length(), simpleName);
  						regions.add(region);
  					}
  				} 
  				position = text.indexOf(toSearch, endIndex);
  			}
  		}
  	}