Edit File by line
/home/barbar84/www/wp-conte.../plugins/wp-file-.../lib/codemirr.../mode/spreadsh...
File: spreadsheet.js
// CodeMirror, copyright (c) by Marijn Haverbeke and others
[0] Fix | Delete
// Distributed under an MIT license: http://codemirror.net/LICENSE
[1] Fix | Delete
[2] Fix | Delete
(function(mod) {
[3] Fix | Delete
if (typeof exports == "object" && typeof module == "object") // CommonJS
[4] Fix | Delete
mod(require("../../lib/codemirror"));
[5] Fix | Delete
else if (typeof define == "function" && define.amd) // AMD
[6] Fix | Delete
define(["../../lib/codemirror"], mod);
[7] Fix | Delete
else // Plain browser env
[8] Fix | Delete
mod(CodeMirror);
[9] Fix | Delete
})(function(CodeMirror) {
[10] Fix | Delete
"use strict";
[11] Fix | Delete
[12] Fix | Delete
CodeMirror.defineMode("spreadsheet", function () {
[13] Fix | Delete
return {
[14] Fix | Delete
startState: function () {
[15] Fix | Delete
return {
[16] Fix | Delete
stringType: null,
[17] Fix | Delete
stack: []
[18] Fix | Delete
};
[19] Fix | Delete
},
[20] Fix | Delete
token: function (stream, state) {
[21] Fix | Delete
if (!stream) return;
[22] Fix | Delete
[23] Fix | Delete
//check for state changes
[24] Fix | Delete
if (state.stack.length === 0) {
[25] Fix | Delete
//strings
[26] Fix | Delete
if ((stream.peek() == '"') || (stream.peek() == "'")) {
[27] Fix | Delete
state.stringType = stream.peek();
[28] Fix | Delete
stream.next(); // Skip quote
[29] Fix | Delete
state.stack.unshift("string");
[30] Fix | Delete
}
[31] Fix | Delete
}
[32] Fix | Delete
[33] Fix | Delete
//return state
[34] Fix | Delete
//stack has
[35] Fix | Delete
switch (state.stack[0]) {
[36] Fix | Delete
case "string":
[37] Fix | Delete
while (state.stack[0] === "string" && !stream.eol()) {
[38] Fix | Delete
if (stream.peek() === state.stringType) {
[39] Fix | Delete
stream.next(); // Skip quote
[40] Fix | Delete
state.stack.shift(); // Clear flag
[41] Fix | Delete
} else if (stream.peek() === "\\") {
[42] Fix | Delete
stream.next();
[43] Fix | Delete
stream.next();
[44] Fix | Delete
} else {
[45] Fix | Delete
stream.match(/^.[^\\\"\']*/);
[46] Fix | Delete
}
[47] Fix | Delete
}
[48] Fix | Delete
return "string";
[49] Fix | Delete
[50] Fix | Delete
case "characterClass":
[51] Fix | Delete
while (state.stack[0] === "characterClass" && !stream.eol()) {
[52] Fix | Delete
if (!(stream.match(/^[^\]\\]+/) || stream.match(/^\\./)))
[53] Fix | Delete
state.stack.shift();
[54] Fix | Delete
}
[55] Fix | Delete
return "operator";
[56] Fix | Delete
}
[57] Fix | Delete
[58] Fix | Delete
var peek = stream.peek();
[59] Fix | Delete
[60] Fix | Delete
//no stack
[61] Fix | Delete
switch (peek) {
[62] Fix | Delete
case "[":
[63] Fix | Delete
stream.next();
[64] Fix | Delete
state.stack.unshift("characterClass");
[65] Fix | Delete
return "bracket";
[66] Fix | Delete
case ":":
[67] Fix | Delete
stream.next();
[68] Fix | Delete
return "operator";
[69] Fix | Delete
case "\\":
[70] Fix | Delete
if (stream.match(/\\[a-z]+/)) return "string-2";
[71] Fix | Delete
else {
[72] Fix | Delete
stream.next();
[73] Fix | Delete
return "atom";
[74] Fix | Delete
}
[75] Fix | Delete
case ".":
[76] Fix | Delete
case ",":
[77] Fix | Delete
case ";":
[78] Fix | Delete
case "*":
[79] Fix | Delete
case "-":
[80] Fix | Delete
case "+":
[81] Fix | Delete
case "^":
[82] Fix | Delete
case "<":
[83] Fix | Delete
case "/":
[84] Fix | Delete
case "=":
[85] Fix | Delete
stream.next();
[86] Fix | Delete
return "atom";
[87] Fix | Delete
case "$":
[88] Fix | Delete
stream.next();
[89] Fix | Delete
return "builtin";
[90] Fix | Delete
}
[91] Fix | Delete
[92] Fix | Delete
if (stream.match(/\d+/)) {
[93] Fix | Delete
if (stream.match(/^\w+/)) return "error";
[94] Fix | Delete
return "number";
[95] Fix | Delete
} else if (stream.match(/^[a-zA-Z_]\w*/)) {
[96] Fix | Delete
if (stream.match(/(?=[\(.])/, false)) return "keyword";
[97] Fix | Delete
return "variable-2";
[98] Fix | Delete
} else if (["[", "]", "(", ")", "{", "}"].indexOf(peek) != -1) {
[99] Fix | Delete
stream.next();
[100] Fix | Delete
return "bracket";
[101] Fix | Delete
} else if (!stream.eatSpace()) {
[102] Fix | Delete
stream.next();
[103] Fix | Delete
}
[104] Fix | Delete
return null;
[105] Fix | Delete
}
[106] Fix | Delete
};
[107] Fix | Delete
});
[108] Fix | Delete
[109] Fix | Delete
CodeMirror.defineMIME("text/x-spreadsheet", "spreadsheet");
[110] Fix | Delete
});
[111] Fix | Delete
[112] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function