bundles/org.eclipse.orion.client.editor/web/orion/editor/mirror.js
function(lineIndex, line, state) {
			if (!this.mode) {
				return;
			}
			var model = this.model;
			if (model.getLineStart(lineIndex) === model.getLineEnd(lineIndex) && this.mode.blankLine) {
				this.mode.blankLine(state);
			}
			var style = line.style || [];
			var text = model.getLine(lineIndex);
			var stream = new Stream(text);
			var isChanged = !line.style;
			var newStyle = [], ws;
			for (var i=0; !stream.eol(); i++) {
				var tok = this.mode.token(stream, state) || null;
				var tokStr = stream.current();
				ws = this._whitespaceStyle(tok, tokStr, stream.tokenStart);
				if (ws) {
					// TODO Replace this (null) token with whitespace tokens. Do something smart
					// to figure out isChanged, I guess
				}
				var newS = [stream.tokenStart, stream.pos, tok]; // shape is [start, end, token]
				var oldS = style[i];
				newStyle.push(newS);
				isChanged = isChanged || !oldS || oldS[0] !== newS[0] || oldS[1] !== newS[1] || oldS[2] !== newS[2];
				stream.advance();
			}
			isChanged = isChanged || (newStyle.length !== style.length);
			if (isChanged) { line.style = newStyle.length ? newStyle : null; }
			return isChanged;
		}
function(lineIndex, line, state) {
			if (!this.mode) {
				return;
			}
			var model = this.model;
			if (model.getLineStart(lineIndex) === model.getLineEnd(lineIndex) && this.mode.blankLine) {
				this.mode.blankLine(state);
			}
			var style = line.style || [];
			var text = model.getLine(lineIndex);
			var stream = new Stream(text);
			var isChanged = !line.style;
			var newStyle = [], ws;
			for (var i=0; !stream.eol(); i++) {
				var tok = this.mode.token(stream, state) || null;
				var tokStr = stream.current();
				ws = this._whitespaceStyle(tok, tokStr, stream.tokenStart);
				if (ws) {
					// TODO Replace this (null) token with whitespace tokens. Do something smart
					// to figure out isChanged, I guess
				}
				var newS = [stream.tokenStart, stream.pos, tok]; // shape is [start, end, token]
				var oldS = style[i];
				newStyle.push(newS);
				isChanged = isChanged || !oldS || oldS[0] !== newS[0] || oldS[1] !== newS[1] || oldS[2] !== newS[2];
				stream.advance();
			}
			isChanged = isChanged || (newStyle.length !== style.length);
			if (isChanged) { line.style = newStyle.length ? newStyle : null; }
			return isChanged;
		}
function ( lineIndex , line , state ) { if ( ! this . mode ) { return ; } var model = this . model ; if ( model . getLineStart ( lineIndex ) === model . getLineEnd ( lineIndex ) && this . mode . blankLine ) { this . mode . blankLine ( state ) ; } var style = line . style || [ ] ; var text = model . getLine ( lineIndex ) ; var stream = new Stream ( text ) ; var isChanged = ! line . style ; var newStyle = [ ] , ws ; for ( var i = 0 ; ! stream . eol ( ) ; i ++ ) { var tok = this . mode . token ( stream , state ) || null ; var tokStr = stream . current ( ) ; ws = this . _whitespaceStyle ( tok , tokStr , stream . tokenStart ) ; if ( ws ) { // TODO Replace this (null) token with whitespace tokens. Do something smart // to figure out isChanged, I guess } var newS = [ stream . tokenStart , stream . pos , tok ] ; // shape is [start, end, token] var oldS = style [ i ] ; newStyle . push ( newS ) ; isChanged = isChanged || ! oldS || oldS [ 0 ] !== newS [ 0 ] || oldS [ 1 ] !== newS [ 1 ] || oldS [ 2 ] !== newS [ 2 ] ; stream . advance ( ) ; } isChanged = isChanged || ( newStyle . length !== style . length ) ; if ( isChanged ) { line . style = newStyle . length ? newStyle : null ; } return isChanged ; }
Highlights a single line.
@param {Number} lineIndex
@param {Object} line
@param {Object} state The state to use for parsing from the start of the line.
Highlights a single line .