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

Function interpretTokenStyle

tools/pythonauto/static/codemirror/codemirror.js:4502–4518  ·  view source on GitHub ↗
(style, builder)

Source from the content-addressed store, hash-verified

4500
4501 var styleToClassCache = {}, styleToClassCacheWithMode = {};
4502 function interpretTokenStyle(style, builder) {
4503 if (!style) return null;
4504 for (;;) {
4505 var lineClass = style.match(/(?:^|\s+)line-(background-)?(\S+)/);
4506 if (!lineClass) break;
4507 style = style.slice(0, lineClass.index) + style.slice(lineClass.index + lineClass[0].length);
4508 var prop = lineClass[1] ? "bgClass" : "textClass";
4509 if (builder[prop] == null)
4510 builder[prop] = lineClass[2];
4511 else if (!(new RegExp("(?:^|\s)" + lineClass[2] + "(?:$|\s)")).test(builder[prop]))
4512 builder[prop] += " " + lineClass[2];
4513 }
4514 if (/^\s*$/.test(style)) return null;
4515 var cache = builder.cm.options.addModeClass ? styleToClassCacheWithMode : styleToClassCache;
4516 return cache[style] ||
4517 (cache[style] = style.replace(/\S+/g, "cm-$&"));
4518 }
4519
4520 function buildLineContent(cm, realLine, measure, copyWidgets) {
4521 var merged, line = realLine, empty = true;

Callers 1

insertLineContentFunction · 0.70

Calls 1

sliceMethod · 0.80

Tested by

no test coverage detected