summaryrefslogtreecommitdiff
path: root/public/vendor/codemirror/addon/runmode
diff options
context:
space:
mode:
Diffstat (limited to 'public/vendor/codemirror/addon/runmode')
-rw-r--r--public/vendor/codemirror/addon/runmode/colorize.js40
-rw-r--r--public/vendor/codemirror/addon/runmode/runmode-standalone.js157
-rw-r--r--public/vendor/codemirror/addon/runmode/runmode.js72
-rw-r--r--public/vendor/codemirror/addon/runmode/runmode.node.js179
4 files changed, 0 insertions, 448 deletions
diff --git a/public/vendor/codemirror/addon/runmode/colorize.js b/public/vendor/codemirror/addon/runmode/colorize.js
deleted file mode 100644
index eb7060d0..00000000
--- a/public/vendor/codemirror/addon/runmode/colorize.js
+++ /dev/null
@@ -1,40 +0,0 @@
-// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
-
-(function(mod) {
- if (typeof exports == "object" && typeof module == "object") // CommonJS
- mod(require("../../lib/codemirror"), require("./runmode"));
- else if (typeof define == "function" && define.amd) // AMD
- define(["../../lib/codemirror", "./runmode"], mod);
- else // Plain browser env
- mod(CodeMirror);
-})(function(CodeMirror) {
- "use strict";
-
- var isBlock = /^(p|li|div|h\\d|pre|blockquote|td)$/;
-
- function textContent(node, out) {
- if (node.nodeType == 3) return out.push(node.nodeValue);
- for (var ch = node.firstChild; ch; ch = ch.nextSibling) {
- textContent(ch, out);
- if (isBlock.test(node.nodeType)) out.push("\n");
- }
- }
-
- CodeMirror.colorize = function(collection, defaultMode) {
- if (!collection) collection = document.body.getElementsByTagName("pre");
-
- for (var i = 0; i < collection.length; ++i) {
- var node = collection[i];
- var mode = node.getAttribute("data-lang") || defaultMode;
- if (!mode) continue;
-
- var text = [];
- textContent(node, text);
- node.innerHTML = "";
- CodeMirror.runMode(text.join(""), mode, node);
-
- node.className += " cm-s-default";
- }
- };
-});
diff --git a/public/vendor/codemirror/addon/runmode/runmode-standalone.js b/public/vendor/codemirror/addon/runmode/runmode-standalone.js
deleted file mode 100644
index f4f352c8..00000000
--- a/public/vendor/codemirror/addon/runmode/runmode-standalone.js
+++ /dev/null
@@ -1,157 +0,0 @@
-// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
-
-window.CodeMirror = {};
-
-(function() {
-"use strict";
-
-function splitLines(string){ return string.split(/\r?\n|\r/); };
-
-function StringStream(string) {
- this.pos = this.start = 0;
- this.string = string;
- this.lineStart = 0;
-}
-StringStream.prototype = {
- eol: function() {return this.pos >= this.string.length;},
- sol: function() {return this.pos == 0;},
- peek: function() {return this.string.charAt(this.pos) || null;},
- next: function() {
- if (this.pos < this.string.length)
- return this.string.charAt(this.pos++);
- },
- eat: function(match) {
- var ch = this.string.charAt(this.pos);
- if (typeof match == "string") var ok = ch == match;
- else var ok = ch && (match.test ? match.test(ch) : match(ch));
- if (ok) {++this.pos; return ch;}
- },
- eatWhile: function(match) {
- var start = this.pos;
- while (this.eat(match)){}
- return this.pos > start;
- },
- eatSpace: function() {
- var start = this.pos;
- while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) ++this.pos;
- return this.pos > start;
- },
- skipToEnd: function() {this.pos = this.string.length;},
- skipTo: function(ch) {
- var found = this.string.indexOf(ch, this.pos);
- if (found > -1) {this.pos = found; return true;}
- },
- backUp: function(n) {this.pos -= n;},
- column: function() {return this.start - this.lineStart;},
- indentation: function() {return 0;},
- match: function(pattern, consume, caseInsensitive) {
- if (typeof pattern == "string") {
- var cased = function(str) {return caseInsensitive ? str.toLowerCase() : str;};
- var substr = this.string.substr(this.pos, pattern.length);
- if (cased(substr) == cased(pattern)) {
- if (consume !== false) this.pos += pattern.length;
- return true;
- }
- } else {
- var match = this.string.slice(this.pos).match(pattern);
- if (match && match.index > 0) return null;
- if (match && consume !== false) this.pos += match[0].length;
- return match;
- }
- },
- current: function(){return this.string.slice(this.start, this.pos);},
- hideFirstChars: function(n, inner) {
- this.lineStart += n;
- try { return inner(); }
- finally { this.lineStart -= n; }
- }
-};
-CodeMirror.StringStream = StringStream;
-
-CodeMirror.startState = function (mode, a1, a2) {
- return mode.startState ? mode.startState(a1, a2) : true;
-};
-
-var modes = CodeMirror.modes = {}, mimeModes = CodeMirror.mimeModes = {};
-CodeMirror.defineMode = function (name, mode) {
- if (arguments.length > 2)
- mode.dependencies = Array.prototype.slice.call(arguments, 2);
- modes[name] = mode;
-};
-CodeMirror.defineMIME = function (mime, spec) { mimeModes[mime] = spec; };
-CodeMirror.resolveMode = function(spec) {
- if (typeof spec == "string" && mimeModes.hasOwnProperty(spec)) {
- spec = mimeModes[spec];
- } else if (spec && typeof spec.name == "string" && mimeModes.hasOwnProperty(spec.name)) {
- spec = mimeModes[spec.name];
- }
- if (typeof spec == "string") return {name: spec};
- else return spec || {name: "null"};
-};
-CodeMirror.getMode = function (options, spec) {
- spec = CodeMirror.resolveMode(spec);
- var mfactory = modes[spec.name];
- if (!mfactory) throw new Error("Unknown mode: " + spec);
- return mfactory(options, spec);
-};
-CodeMirror.registerHelper = CodeMirror.registerGlobalHelper = Math.min;
-CodeMirror.defineMode("null", function() {
- return {token: function(stream) {stream.skipToEnd();}};
-});
-CodeMirror.defineMIME("text/plain", "null");
-
-CodeMirror.runMode = function (string, modespec, callback, options) {
- var mode = CodeMirror.getMode({ indentUnit: 2 }, modespec);
-
- if (callback.nodeType == 1) {
- var tabSize = (options && options.tabSize) || 4;
- var node = callback, col = 0;
- node.innerHTML = "";
- callback = function (text, style) {
- if (text == "\n") {
- node.appendChild(document.createElement("br"));
- col = 0;
- return;
- }
- var content = "";
- // replace tabs
- for (var pos = 0; ;) {
- var idx = text.indexOf("\t", pos);
- if (idx == -1) {
- content += text.slice(pos);
- col += text.length - pos;
- break;
- } else {
- col += idx - pos;
- content += text.slice(pos, idx);
- var size = tabSize - col % tabSize;
- col += size;
- for (var i = 0; i < size; ++i) content += " ";
- pos = idx + 1;
- }
- }
-
- if (style) {
- var sp = node.appendChild(document.createElement("span"));
- sp.className = "cm-" + style.replace(/ +/g, " cm-");
- sp.appendChild(document.createTextNode(content));
- } else {
- node.appendChild(document.createTextNode(content));
- }
- };
- }
-
- var lines = splitLines(string), state = (options && options.state) || CodeMirror.startState(mode);
- for (var i = 0, e = lines.length; i < e; ++i) {
- if (i) callback("\n");
- var stream = new CodeMirror.StringStream(lines[i]);
- if (!stream.string && mode.blankLine) mode.blankLine(state);
- while (!stream.eol()) {
- var style = mode.token(stream, state);
- callback(stream.current(), style, i, stream.start, state);
- stream.start = stream.pos;
- }
- }
-};
-})();
diff --git a/public/vendor/codemirror/addon/runmode/runmode.js b/public/vendor/codemirror/addon/runmode/runmode.js
deleted file mode 100644
index a51c6d0d..00000000
--- a/public/vendor/codemirror/addon/runmode/runmode.js
+++ /dev/null
@@ -1,72 +0,0 @@
-// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
-
-(function(mod) {
- if (typeof exports == "object" && typeof module == "object") // CommonJS
- mod(require("../../lib/codemirror"));
- else if (typeof define == "function" && define.amd) // AMD
- define(["../../lib/codemirror"], mod);
- else // Plain browser env
- mod(CodeMirror);
-})(function(CodeMirror) {
-"use strict";
-
-CodeMirror.runMode = function(string, modespec, callback, options) {
- var mode = CodeMirror.getMode(CodeMirror.defaults, modespec);
- var ie = /MSIE \d/.test(navigator.userAgent);
- var ie_lt9 = ie && (document.documentMode == null || document.documentMode < 9);
-
- if (callback.appendChild) {
- var tabSize = (options && options.tabSize) || CodeMirror.defaults.tabSize;
- var node = callback, col = 0;
- node.innerHTML = "";
- callback = function(text, style) {
- if (text == "\n") {
- // Emitting LF or CRLF on IE8 or earlier results in an incorrect display.
- // Emitting a carriage return makes everything ok.
- node.appendChild(document.createTextNode(ie_lt9 ? '\r' : text));
- col = 0;
- return;
- }
- var content = "";
- // replace tabs
- for (var pos = 0;;) {
- var idx = text.indexOf("\t", pos);
- if (idx == -1) {
- content += text.slice(pos);
- col += text.length - pos;
- break;
- } else {
- col += idx - pos;
- content += text.slice(pos, idx);
- var size = tabSize - col % tabSize;
- col += size;
- for (var i = 0; i < size; ++i) content += " ";
- pos = idx + 1;
- }
- }
-
- if (style) {
- var sp = node.appendChild(document.createElement("span"));
- sp.className = "cm-" + style.replace(/ +/g, " cm-");
- sp.appendChild(document.createTextNode(content));
- } else {
- node.appendChild(document.createTextNode(content));
- }
- };
- }
-
- var lines = CodeMirror.splitLines(string), state = (options && options.state) || CodeMirror.startState(mode);
- for (var i = 0, e = lines.length; i < e; ++i) {
- if (i) callback("\n");
- var stream = new CodeMirror.StringStream(lines[i]);
- if (!stream.string && mode.blankLine) mode.blankLine(state);
- while (!stream.eol()) {
- var style = mode.token(stream, state);
- callback(stream.current(), style, i, stream.start, state);
- stream.start = stream.pos;
- }
- }
-};
-
-});
diff --git a/public/vendor/codemirror/addon/runmode/runmode.node.js b/public/vendor/codemirror/addon/runmode/runmode.node.js
deleted file mode 100644
index b22a5187..00000000
--- a/public/vendor/codemirror/addon/runmode/runmode.node.js
+++ /dev/null
@@ -1,179 +0,0 @@
-// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
-
-/* Just enough of CodeMirror to run runMode under node.js */
-
-function splitLines(string){return string.split(/\r\n?|\n/);};
-
-// Counts the column offset in a string, taking tabs into account.
-// Used mostly to find indentation.
-var countColumn = function(string, end, tabSize, startIndex, startValue) {
- if (end == null) {
- end = string.search(/[^\s\u00a0]/);
- if (end == -1) end = string.length;
- }
- for (var i = startIndex || 0, n = startValue || 0;;) {
- var nextTab = string.indexOf("\t", i);
- if (nextTab < 0 || nextTab >= end)
- return n + (end - i);
- n += nextTab - i;
- n += tabSize - (n % tabSize);
- i = nextTab + 1;
- }
-};
-
-function StringStream(string, tabSize) {
- this.pos = this.start = 0;
- this.string = string;
- this.tabSize = tabSize || 8;
- this.lastColumnPos = this.lastColumnValue = 0;
- this.lineStart = 0;
-};
-
-StringStream.prototype = {
- eol: function() {return this.pos >= this.string.length;},
- sol: function() {return this.pos == this.lineStart;},
- peek: function() {return this.string.charAt(this.pos) || undefined;},
- next: function() {
- if (this.pos < this.string.length)
- return this.string.charAt(this.pos++);
- },
- eat: function(match) {
- var ch = this.string.charAt(this.pos);
- if (typeof match == "string") var ok = ch == match;
- else var ok = ch && (match.test ? match.test(ch) : match(ch));
- if (ok) {++this.pos; return ch;}
- },
- eatWhile: function(match) {
- var start = this.pos;
- while (this.eat(match)){}
- return this.pos > start;
- },
- eatSpace: function() {
- var start = this.pos;
- while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) ++this.pos;
- return this.pos > start;
- },
- skipToEnd: function() {this.pos = this.string.length;},
- skipTo: function(ch) {
- var found = this.string.indexOf(ch, this.pos);
- if (found > -1) {this.pos = found; return true;}
- },
- backUp: function(n) {this.pos -= n;},
- column: function() {
- if (this.lastColumnPos < this.start) {
- this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue);
- this.lastColumnPos = this.start;
- }
- return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0);
- },
- indentation: function() {
- return countColumn(this.string, null, this.tabSize) -
- (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0);
- },
- match: function(pattern, consume, caseInsensitive) {
- if (typeof pattern == "string") {
- var cased = function(str) {return caseInsensitive ? str.toLowerCase() : str;};
- var substr = this.string.substr(this.pos, pattern.length);
- if (cased(substr) == cased(pattern)) {
- if (consume !== false) this.pos += pattern.length;
- return true;
- }
- } else {
- var match = this.string.slice(this.pos).match(pattern);
- if (match && match.index > 0) return null;
- if (match && consume !== false) this.pos += match[0].length;
- return match;
- }
- },
- current: function(){return this.string.slice(this.start, this.pos);},
- hideFirstChars: function(n, inner) {
- this.lineStart += n;
- try { return inner(); }
- finally { this.lineStart -= n; }
- }
-};
-exports.StringStream = StringStream;
-
-exports.startState = function(mode, a1, a2) {
- return mode.startState ? mode.startState(a1, a2) : true;
-};
-
-var modes = exports.modes = {}, mimeModes = exports.mimeModes = {};
-exports.defineMode = function(name, mode) {
- if (arguments.length > 2)
- mode.dependencies = Array.prototype.slice.call(arguments, 2);
- modes[name] = mode;
-};
-exports.defineMIME = function(mime, spec) { mimeModes[mime] = spec; };
-
-exports.defineMode("null", function() {
- return {token: function(stream) {stream.skipToEnd();}};
-});
-exports.defineMIME("text/plain", "null");
-
-exports.resolveMode = function(spec) {
- if (typeof spec == "string" && mimeModes.hasOwnProperty(spec)) {
- spec = mimeModes[spec];
- } else if (spec && typeof spec.name == "string" && mimeModes.hasOwnProperty(spec.name)) {
- spec = mimeModes[spec.name];
- }
- if (typeof spec == "string") return {name: spec};
- else return spec || {name: "null"};
-};
-
-function copyObj(obj, target, overwrite) {
- if (!target) target = {};
- for (var prop in obj)
- if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop)))
- target[prop] = obj[prop];
- return target;
-}
-
-// This can be used to attach properties to mode objects from
-// outside the actual mode definition.
-var modeExtensions = exports.modeExtensions = {};
-exports.extendMode = function(mode, properties) {
- var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {});
- copyObj(properties, exts);
-};
-
-exports.getMode = function(options, spec) {
- var spec = exports.resolveMode(spec);
- var mfactory = modes[spec.name];
- if (!mfactory) return exports.getMode(options, "text/plain");
- var modeObj = mfactory(options, spec);
- if (modeExtensions.hasOwnProperty(spec.name)) {
- var exts = modeExtensions[spec.name];
- for (var prop in exts) {
- if (!exts.hasOwnProperty(prop)) continue;
- if (modeObj.hasOwnProperty(prop)) modeObj["_" + prop] = modeObj[prop];
- modeObj[prop] = exts[prop];
- }
- }
- modeObj.name = spec.name;
- if (spec.helperType) modeObj.helperType = spec.helperType;
- if (spec.modeProps) for (var prop in spec.modeProps)
- modeObj[prop] = spec.modeProps[prop];
-
- return modeObj;
-};
-exports.registerHelper = exports.registerGlobalHelper = Math.min;
-
-exports.runMode = function(string, modespec, callback, options) {
- var mode = exports.getMode({indentUnit: 2}, modespec);
- var lines = splitLines(string), state = (options && options.state) || exports.startState(mode);
- for (var i = 0, e = lines.length; i < e; ++i) {
- if (i) callback("\n");
- var stream = new exports.StringStream(lines[i]);
- if (!stream.string && mode.blankLine) mode.blankLine(state);
- while (!stream.eol()) {
- var style = mode.token(stream, state);
- callback(stream.current(), style, i, stream.start, state);
- stream.start = stream.pos;
- }
- }
-};
-
-require.cache[require.resolve("../../lib/codemirror")] = require.cache[require.resolve("./runmode.node")];
-require.cache[require.resolve("../../addon/runmode/runmode")] = require.cache[require.resolve("./runmode.node")];