OLD | NEW |
1 // Content of the function is equal to runmode-standalone.js file | 1 // Content of the function is equal to runmode-standalone.js file |
2 // from CodeMirror distribution | 2 // from CodeMirror distribution |
3 (function(window) { | 3 (function(window) { |
4 /* Just enough of CodeMirror to run runMode under node.js */ | |
5 | |
6 window.CodeMirror = {}; | 4 window.CodeMirror = {}; |
7 | 5 |
8 (function() { | 6 (function() { |
9 "use strict"; | 7 "use strict"; |
10 | 8 |
11 function splitLines(string){ return string.split(/\r?\n|\r/); }; | 9 function splitLines(string){ return string.split(/\r?\n|\r/); }; |
12 | 10 |
13 function StringStream(string) { | 11 function StringStream(string) { |
14 this.pos = this.start = 0; | 12 this.pos = this.start = 0; |
15 this.string = string; | 13 this.string = string; |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 if (i) callback("\n"); | 143 if (i) callback("\n"); |
146 var stream = new CodeMirror.StringStream(lines[i]); | 144 var stream = new CodeMirror.StringStream(lines[i]); |
147 while (!stream.eol()) { | 145 while (!stream.eol()) { |
148 var style = mode.token(stream, state); | 146 var style = mode.token(stream, state); |
149 callback(stream.current(), style, i, stream.start, state); | 147 callback(stream.current(), style, i, stream.start, state); |
150 stream.start = stream.pos; | 148 stream.start = stream.pos; |
151 } | 149 } |
152 } | 150 } |
153 }; | 151 }; |
154 })(); | 152 })(); |
| 153 |
155 }(this)) | 154 }(this)) |
OLD | NEW |