code: function runMode(cm, text, mode, state, f) {
      var flattenSpans = mode.flattenSpans;
      if (flattenSpans == null) flattenSpans = cm.options.flattenSpans;
      var curText = "", curStyle = null;
      var stream = new StringStream(text, cm.options.tabSize), style;
      if (text == "" && mode.blankLine) mode.blankLine(state);
      while (!stream.eol()) {
        if (stream.pos > cm.options.maxHighlightLength) {
          flattenSpans = false;
          // Webkit seems to refuse to render text nodes longer than 57444 characters
          stream.pos = Math.min(text.length, stream.start + 50000);
          style = null;
        } else {
          style = mode.token(stream, state);
        }
        var substr = stream.current();
        stream.start = stream.pos;
        if (!flattenSpans || curStyle != style) {
          if (curText) f(curText, curStyle);
          curText = substr; curStyle = style;
        } else curText = curText + substr;
      }
      if (curText) f(curText, curStyle);
    }
docs: Run the given mode's parser over a line, update the styles array, which contains alternating fragments of text and CSS classes.