| 1194 | } |
| 1195 | |
| 1196 | function extractLineClasses(type, output) { |
| 1197 | if (type) { for (;;) { |
| 1198 | var lineClass = type.match(/(?:^|\s+)line-(background-)?(\S+)/); |
| 1199 | if (!lineClass) { break } |
| 1200 | type = type.slice(0, lineClass.index) + type.slice(lineClass.index + lineClass[0].length); |
| 1201 | var prop = lineClass[1] ? "bgClass" : "textClass"; |
| 1202 | if (output[prop] == null) |
| 1203 | { output[prop] = lineClass[2]; } |
| 1204 | else if (!(new RegExp("(?:^|\\s)" + lineClass[2] + "(?:$|\\s)")).test(output[prop])) |
| 1205 | { output[prop] += " " + lineClass[2]; } |
| 1206 | } } |
| 1207 | return type |
| 1208 | } |
| 1209 | |
| 1210 | // Run the given mode's parser over a line, calling f for each token. |
| 1211 | function runMode(cm, text, mode, context, f, lineClasses, forceToEnd) { |