code: function findItem(editor, isBackward, extractFn, rangeFn) {
  		var content = editorUtils.outputInfo(editor).content;
  		
  		var contentLength = content.length;
  		var itemRange, rng;
  		/** @type Range */
  		var prevRange = range(-1, 0);
  		/** @type Range */
  		var sel = range(editor.getSelectionRange());
  		
  		var searchPos = sel.start, loop = 100000; // endless loop protection
  		while (searchPos >= 0 && searchPos < contentLength && --loop > 0) {
  			if ( (itemRange = extractFn(content, searchPos, isBackward)) ) {
  				if (prevRange.equal(itemRange)) {
  					break;
  				}
  				
  				prevRange = itemRange.clone();
  				rng = rangeFn(itemRange.substring(content), itemRange.start, sel.clone());
  				
  				if (rng) {
  					editor.createSelection(rng.start, rng.end);
  					return true;
  				} else {
  					searchPos = isBackward ? itemRange.start : itemRange.end - 1;
  				}
  			}
  			
  			searchPos += isBackward ? -1 : 1;
  		}
  		
  		return false;
  	}
docs: Generic function for searching for items to select
  @param {IEmmetEditor} editor
  @param {Boolean} isBackward Search backward (search forward otherwise)
  @param {Function} extractFn Function that extracts item content
  @param {Function} rangeFn Function that search for next token range