| 2660 | } |
| 2661 | |
| 2662 | function extractLineClasses(type, output) { |
| 2663 | if (type) { |
| 2664 | for (;;) { |
| 2665 | var lineClass = type.match(/(?:^|\s+)line-(background-)?(\S+)/) |
| 2666 | if (!lineClass) { |
| 2667 | break |
| 2668 | } |
| 2669 | type = type.slice(0, lineClass.index) + type.slice(lineClass.index + lineClass[0].length) |
| 2670 | var prop = lineClass[1] ? "bgClass" : "textClass" |
| 2671 | if (output[prop] == null) { |
| 2672 | output[prop] = lineClass[2] |
| 2673 | } else if (!new RegExp("(?:^|s)" + lineClass[2] + "(?:$|s)").test(output[prop])) { |
| 2674 | output[prop] += " " + lineClass[2] |
| 2675 | } |
| 2676 | } |
| 2677 | } |
| 2678 | return type |
| 2679 | } |
| 2680 | |
| 2681 | // Run the given mode's parser over a line, calling f for each token. |
| 2682 | function runMode(cm, text, mode, context, f, lineClasses, forceToEnd) { |