MCPcopy Index your code
hub / github.com/csev/py4e / runMode

Function runMode

tools/pythonauto/static/codemirror/codemirror.js:4411–4442  ·  view source on GitHub ↗
(cm, text, mode, state, f, forceToEnd)

Source from the content-addressed store, hash-verified

4409 // array, which contains alternating fragments of text and CSS
4410 // classes.
4411 function runMode(cm, text, mode, state, f, forceToEnd) {
4412 var flattenSpans = mode.flattenSpans;
4413 if (flattenSpans == null) flattenSpans = cm.options.flattenSpans;
4414 var curStart = 0, curStyle = null;
4415 var stream = new StringStream(text, cm.options.tabSize), style;
4416 if (text == "" && mode.blankLine) mode.blankLine(state);
4417 while (!stream.eol()) {
4418 if (stream.pos > cm.options.maxHighlightLength) {
4419 flattenSpans = false;
4420 if (forceToEnd) processLine(cm, text, state, stream.pos);
4421 stream.pos = text.length;
4422 style = null;
4423 } else {
4424 style = mode.token(stream, state);
4425 }
4426 if (cm.options.addModeClass) {
4427 var mName = CodeMirror.innerMode(mode, state).mode.name;
4428 if (mName) style = "m-" + (style ? mName + " " + style : mName);
4429 }
4430 if (!flattenSpans || curStyle != style) {
4431 if (curStart < stream.start) f(stream.start, curStyle);
4432 curStart = stream.start; curStyle = style;
4433 }
4434 stream.start = stream.pos;
4435 }
4436 while (curStart < stream.pos) {
4437 // Webkit seems to refuse to render text nodes longer than 57444 characters
4438 var pos = Math.min(stream.pos, curStart + 50000);
4439 f(pos, curStyle);
4440 curStart = pos;
4441 }
4442 }
4443
4444 function highlightLine(cm, line, state, forceToEnd) {
4445 // A styles array always starts with a number identifying the

Callers 1

highlightLineFunction · 0.70

Calls 2

processLineFunction · 0.70
fFunction · 0.50

Tested by

no test coverage detected