Lightweight form of highlight -- proceed over this line and update state, but don't save a style array.
550934
function processLine(cm, line, state) {
    var mode = cm.doc.mode;
    var stream = new StringStream(line.text, cm.options.tabSize);
    if (line.text == "" && mode.blankLine) mode.blankLine(state);
    while (!stream.eol() && stream.pos <= cm.options.maxHighlightLength) {
      mode.token(stream, state);
      stream.start = stream.pos;
    }
  }
178713
private void highlightLinesAfter( String content, int line )
    throws BadLocationException
  {
    int offset = _root.getElement( line ).getEndOffset();
    // Start/End delimiter not found, nothing to do
    int startDelimiter = indexOf( content, getStartDelimiter(), offset );
    int endDelimiter = indexOf( content, getEndDelimiter(), offset );
    if( startDelimiter < 0 )
    {
      startDelimiter = content.length();
    }
    if( endDelimiter < 0 )
    {
      endDelimiter = content.length();
    }
    int delimiter = Math.min( startDelimiter, endDelimiter );
    if( delimiter < offset )
    {
      return;
    }
    // Start/End delimiter found, reapply highlighting
    int endLine = _root.getElementIndex( delimiter );
    for( int i = line + 1; i < endLine; i++ )
    {
      Element branch = _root.getElement( i );
      Element leaf = getCharacterElement( branch.getStartOffset() );
      AttributeSet as = leaf.getAttributes();
      if( as.isEqual( _comment ) )
      {
        applyHighlighting( content, i );
      }
    }
  }
231966
function (str, highlight) {
      this.currentMatch.replace = this.filterString(str, highlight);
      this.currentMatch.hasMatches = str !== this.currentMatch.replace;

      return this;
    }
246258
def _highlight_lines(self, tokensource):
        
        hls = self.hl_lines

        for i, (t, value) in enumerate(tokensource):
            if t != 1:
                yield t, value
            if i + 1 in hls:  # i + 1 because Python indexes start at 0
                if self.noclasses:
                    style = ''
                    if self.style.highlight_color is not None:
                        style = (' style="background-color: %s"' %
                                 (self.style.highlight_color,))
                    yield 1, '<span%s>%s</span>' % (style, value)
                else:
                    yield 1, '<span class="hll">%s</span>' % value
            else:
                yield 1, value
280412
function highlight(js) {
  return js
    .replace(/</g, '&lt;')
    .replace(/>/g, '&gt;')
    .replace(/\/\/(.*)/gm, '<span class="comment">//$1</span>')
    .replace(/('.*?')/gm, '<span class="string">$1</span>')
    .replace(/(\d+\.\d+)/gm, '<span class="number">$1</span>')
    .replace(/(\d+)/gm, '<span class="number">$1</span>')
    .replace(
      /\bnew[ \t]+(\w+)/gm,
      '<span class="keyword">new</span> <span class="init">$1</span>'
    )
    .replace(
      /\b(function|new|throw|return|var|if|else)\b/gm,
      '<span class="keyword">$1</span>'
    );
}
7030
def _highlight_line_udiff(self, line, next):
        
        start = 0
        limit = min(len(line['line']), len(next['line']))
        while start < limit and line['line'][start] == next['line'][start]:
            start += 1
        end = -1
        limit -= start
        while -end <= limit and line['line'][end] == next['line'][end]:
            end -= 1
        end += 1
        if start or end:
            def do(l):
                last = end + len(l['line'])
                if l['action'] == 'add':
                    tag = 'ins'
                else:
                    tag = 'del'
                l['line'] = '%s<%s>%s</%s>%s' % (
                    l['line'][:start],
                    tag,
                    l['line'][start:last],
                    tag,
                    l['line'][last:]
                )
            do(line)
            do(next)
9706
def update(self, event, annotation):
        """"""
        # Decide whether or not to hide previous highlights...
        for artist in self.highlights.values():
            if self.display == 'multiple':
                continue
            if self.display == 'one-per-axes':
                if event.artist.axes is not artist.axes:
                    continue
            artist.set_visible(False)
        self.show_highlight(event.artist)
        DataCursor.update(self, event, annotation)
1305962
public void processHighlighter () {
		if (highlights == null) return;
		highlights.clear();
		if (highlighter != null) highlighter.process(this, highlights);
		chunkUpdateScheduled = true;
	}
822175
public void highlight(Object control)
    {
        // Manage highlighting of controls.
        if (this.currentControl == control)
            return; // same thing selected

        // Turn off highlight if on.
        if (this.currentControl != null)
        {
            this.currentControl.getAttributes().setImageOpacity(-1); // use default opacity
            this.currentControl = null;
        }

        // Turn on highlight if object selected.
        if (control != null && control instanceof ScreenAnnotation)
        {
            this.currentControl = (ScreenAnnotation) control;
            this.currentControl.getAttributes().setImageOpacity(1);
        }
    }
1276079
function tryAppending(appended, tryNext) {
    try {
       return highlighter.highlight(code + appended)
    } catch (e) {
      return tryNext(code)
    }
  }
1327080
def highlightByAlternate(self):
        
        palette = QtGui.QApplication.palette()
        palette.setColor(palette.HighlightedText, palette.color(palette.Text))
        
        clr = palette.color(palette.AlternateBase)
        palette.setColor(palette.Highlight, clr.darker(110))
        self.setPalette(palette)
294679
def _syntax_style_changed(self):
        """"""
        if self._highlighter is None:
            # ignore premature calls
            return
        if self.syntax_style:
            self._highlighter._style = create_style_class(self.syntax_style)
            self._highlighter._clear_caches()
        else:
            self._highlighter.set_style_sheet(self.style_sheet)
1170296
def highlightBlock(self, text, prevContextStack):
        
        if prevContextStack is not None:
            contextStack = prevContextStack
        else:
            contextStack = self._defaultContextStack

        highlightedSegments = []
        lineContinue = False
        currentColumnIndex = 0
        textTypeMap = []

        if len(text) > 0:
            while currentColumnIndex < len(text):
                _logger.debug('In context %s', contextStack.currentContext().name)

                length, newContextStack, segments, textTypeMapPart, lineContinue = \
                    contextStack.currentContext().parseBlock(contextStack, currentColumnIndex, text)

                highlightedSegments += segments
                contextStack = newContextStack
                textTypeMap += textTypeMapPart
                currentColumnIndex += length

            if not lineContinue:
                while contextStack.currentContext().lineEndContext is not None:
                    oldStack = contextStack
                    contextStack = contextStack.currentContext().lineEndContext.getNextContextStack(contextStack)
                    if oldStack == contextStack:  # avoid infinite while loop if nothing to switch
                        break

                # this code is not tested, because lineBeginContext is not defined by any xml file
                if contextStack.currentContext().lineBeginContext is not None:
                    contextStack = contextStack.currentContext().lineBeginContext.getNextContextStack(contextStack)
        elif contextStack.currentContext().lineEmptyContext is not None:
            contextStack = contextStack.currentContext().lineEmptyContext.getNextContextStack(contextStack)

        lineData = (contextStack, textTypeMap)
        return lineData, highlightedSegments
268223
def highlightBlock(self, string):
        
        prev_data = self.currentBlock().previous().userData()
        if prev_data is not None:
            self._lexer._saved_state_stack = prev_data.syntax_stack
        elif hasattr(self._lexer, '_saved_state_stack'):
            del self._lexer._saved_state_stack

        # Lex the text using Pygments
        index = 0
        for token, text in self._lexer.get_tokens(string):
            length = len(text)
            self.setFormat(index, length, self._get_format(token))
            index += length

        if hasattr(self._lexer, '_saved_state_stack'):
            data = PygmentsBlockUserData(
                syntax_stack=self._lexer._saved_state_stack)
            self.currentBlock().setUserData(data)
            # Clean up for the next go-round.
            del self._lexer._saved_state_stack
437623
def highlight(self, **kwargs):
        

        self.debug_log("Highlighting element")

        style = kwargs.get('style')
        highlight_time = kwargs.get('highlight_time', .3)

        driver = self._element._parent

        try:
            original_style = self._element.get_attribute('style')

            driver.execute_script(
                "arguments[0].setAttribute('style', arguments[1]);",
                self._element,
                style
            )
        except Exception as e:
            self.error_log("highlight exception: %s" % str(e))

        sleep(highlight_time)

        try:
            driver.execute_script(
                "arguments[0].setAttribute('style', arguments[1]);",
                self._element,
                original_style
            )
        except Exception as e:
            self.error_log("highlight exception: %s" % str(e))

        return True
1341818
def _highlight_cursorlines(self, cli, new_screen, cpos, x, y, width, height):
        
        cursor_line_token = (':', ) + self.cursorline_token
        cursor_column_token = (':', ) + self.cursorcolumn_token

        data_buffer = new_screen.data_buffer

        # Highlight cursor line.
        if self.cursorline(cli):
            row = data_buffer[cpos.y]
            for x in range(x, x + width):
                original_char = row[x]
                row[x] = _CHAR_CACHE[
                    original_char.char, original_char.token + cursor_line_token]

        # Highlight cursor column.
        if self.cursorcolumn(cli):
            for y2 in range(y, y + height):
                row = data_buffer[y2]
                original_char = row[cpos.x]
                row[cpos.x] = _CHAR_CACHE[
                   original_char.char, original_char.token + cursor_column_token]

        # Highlight color columns
        for cc in self.get_colorcolumns(cli):
            assert isinstance(cc, ColorColumn)
            color_column_token = (':', ) + cc.token
            column = cc.position

            for y2 in range(y, y + height):
                row = data_buffer[y2]
                original_char = row[column]
                row[column] = _CHAR_CACHE[
                   original_char.char, original_char.token + color_column_token]
397932
function skipMarker(state, line) {
    var pos, marker,
        start = state.bMarks[line] + state.tShift[line],
        max = state.eMarks[line];

    if (start >= max) { return -1; }

    // Check bullet
    marker = state.src.charCodeAt(start++);
    if (marker !== 0x7E/* ~ */ && marker !== 0x3A/* : */) { return -1; }

    pos = state.skipSpaces(start);

    // require space after ":"
    if (start === pos) { return -1; }

    // no empty definitions, e.g. "  : "
    if (pos >= max) { return -1; }

    return start;
  }