Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/wp-file-.../lib/codemirr.../mode/lua
File: lua.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
// LUA mode. Ported to CodeMirror 2 from Franciszek Wawrzak's
[3] Fix | Delete
// CodeMirror 1 mode.
[4] Fix | Delete
// highlights keywords, strings, comments (no leveling supported! ("[==[")), tokens, basic indenting
[5] Fix | Delete
[6] Fix | Delete
(function(mod) {
[7] Fix | Delete
if (typeof exports == "object" && typeof module == "object") // CommonJS
[8] Fix | Delete
mod(require("../../lib/codemirror"));
[9] Fix | Delete
else if (typeof define == "function" && define.amd) // AMD
[10] Fix | Delete
define(["../../lib/codemirror"], mod);
[11] Fix | Delete
else // Plain browser env
[12] Fix | Delete
mod(CodeMirror);
[13] Fix | Delete
})(function(CodeMirror) {
[14] Fix | Delete
"use strict";
[15] Fix | Delete
[16] Fix | Delete
CodeMirror.defineMode("lua", function(config, parserConfig) {
[17] Fix | Delete
var indentUnit = config.indentUnit;
[18] Fix | Delete
[19] Fix | Delete
function prefixRE(words) {
[20] Fix | Delete
return new RegExp("^(?:" + words.join("|") + ")", "i");
[21] Fix | Delete
}
[22] Fix | Delete
function wordRE(words) {
[23] Fix | Delete
return new RegExp("^(?:" + words.join("|") + ")$", "i");
[24] Fix | Delete
}
[25] Fix | Delete
var specials = wordRE(parserConfig.specials || []);
[26] Fix | Delete
[27] Fix | Delete
// long list of standard functions from lua manual
[28] Fix | Delete
var builtins = wordRE([
[29] Fix | Delete
"_G","_VERSION","assert","collectgarbage","dofile","error","getfenv","getmetatable","ipairs","load",
[30] Fix | Delete
"loadfile","loadstring","module","next","pairs","pcall","print","rawequal","rawget","rawset","require",
[31] Fix | Delete
"select","setfenv","setmetatable","tonumber","tostring","type","unpack","xpcall",
[32] Fix | Delete
[33] Fix | Delete
"coroutine.create","coroutine.resume","coroutine.running","coroutine.status","coroutine.wrap","coroutine.yield",
[34] Fix | Delete
[35] Fix | Delete
"debug.debug","debug.getfenv","debug.gethook","debug.getinfo","debug.getlocal","debug.getmetatable",
[36] Fix | Delete
"debug.getregistry","debug.getupvalue","debug.setfenv","debug.sethook","debug.setlocal","debug.setmetatable",
[37] Fix | Delete
"debug.setupvalue","debug.traceback",
[38] Fix | Delete
[39] Fix | Delete
"close","flush","lines","read","seek","setvbuf","write",
[40] Fix | Delete
[41] Fix | Delete
"io.close","io.flush","io.input","io.lines","io.open","io.output","io.popen","io.read","io.stderr","io.stdin",
[42] Fix | Delete
"io.stdout","io.tmpfile","io.type","io.write",
[43] Fix | Delete
[44] Fix | Delete
"math.abs","math.acos","math.asin","math.atan","math.atan2","math.ceil","math.cos","math.cosh","math.deg",
[45] Fix | Delete
"math.exp","math.floor","math.fmod","math.frexp","math.huge","math.ldexp","math.log","math.log10","math.max",
[46] Fix | Delete
"math.min","math.modf","math.pi","math.pow","math.rad","math.random","math.randomseed","math.sin","math.sinh",
[47] Fix | Delete
"math.sqrt","math.tan","math.tanh",
[48] Fix | Delete
[49] Fix | Delete
"os.clock","os.date","os.difftime","os.execute","os.exit","os.getenv","os.remove","os.rename","os.setlocale",
[50] Fix | Delete
"os.time","os.tmpname",
[51] Fix | Delete
[52] Fix | Delete
"package.cpath","package.loaded","package.loaders","package.loadlib","package.path","package.preload",
[53] Fix | Delete
"package.seeall",
[54] Fix | Delete
[55] Fix | Delete
"string.byte","string.char","string.dump","string.find","string.format","string.gmatch","string.gsub",
[56] Fix | Delete
"string.len","string.lower","string.match","string.rep","string.reverse","string.sub","string.upper",
[57] Fix | Delete
[58] Fix | Delete
"table.concat","table.insert","table.maxn","table.remove","table.sort"
[59] Fix | Delete
]);
[60] Fix | Delete
var keywords = wordRE(["and","break","elseif","false","nil","not","or","return",
[61] Fix | Delete
"true","function", "end", "if", "then", "else", "do",
[62] Fix | Delete
"while", "repeat", "until", "for", "in", "local" ]);
[63] Fix | Delete
[64] Fix | Delete
var indentTokens = wordRE(["function", "if","repeat","do", "\\(", "{"]);
[65] Fix | Delete
var dedentTokens = wordRE(["end", "until", "\\)", "}"]);
[66] Fix | Delete
var dedentPartial = prefixRE(["end", "until", "\\)", "}", "else", "elseif"]);
[67] Fix | Delete
[68] Fix | Delete
function readBracket(stream) {
[69] Fix | Delete
var level = 0;
[70] Fix | Delete
while (stream.eat("=")) ++level;
[71] Fix | Delete
stream.eat("[");
[72] Fix | Delete
return level;
[73] Fix | Delete
}
[74] Fix | Delete
[75] Fix | Delete
function normal(stream, state) {
[76] Fix | Delete
var ch = stream.next();
[77] Fix | Delete
if (ch == "-" && stream.eat("-")) {
[78] Fix | Delete
if (stream.eat("[") && stream.eat("["))
[79] Fix | Delete
return (state.cur = bracketed(readBracket(stream), "comment"))(stream, state);
[80] Fix | Delete
stream.skipToEnd();
[81] Fix | Delete
return "comment";
[82] Fix | Delete
}
[83] Fix | Delete
if (ch == "\"" || ch == "'")
[84] Fix | Delete
return (state.cur = string(ch))(stream, state);
[85] Fix | Delete
if (ch == "[" && /[\[=]/.test(stream.peek()))
[86] Fix | Delete
return (state.cur = bracketed(readBracket(stream), "string"))(stream, state);
[87] Fix | Delete
if (/\d/.test(ch)) {
[88] Fix | Delete
stream.eatWhile(/[\w.%]/);
[89] Fix | Delete
return "number";
[90] Fix | Delete
}
[91] Fix | Delete
if (/[\w_]/.test(ch)) {
[92] Fix | Delete
stream.eatWhile(/[\w\\\-_.]/);
[93] Fix | Delete
return "variable";
[94] Fix | Delete
}
[95] Fix | Delete
return null;
[96] Fix | Delete
}
[97] Fix | Delete
[98] Fix | Delete
function bracketed(level, style) {
[99] Fix | Delete
return function(stream, state) {
[100] Fix | Delete
var curlev = null, ch;
[101] Fix | Delete
while ((ch = stream.next()) != null) {
[102] Fix | Delete
if (curlev == null) {if (ch == "]") curlev = 0;}
[103] Fix | Delete
else if (ch == "=") ++curlev;
[104] Fix | Delete
else if (ch == "]" && curlev == level) { state.cur = normal; break; }
[105] Fix | Delete
else curlev = null;
[106] Fix | Delete
}
[107] Fix | Delete
return style;
[108] Fix | Delete
};
[109] Fix | Delete
}
[110] Fix | Delete
[111] Fix | Delete
function string(quote) {
[112] Fix | Delete
return function(stream, state) {
[113] Fix | Delete
var escaped = false, ch;
[114] Fix | Delete
while ((ch = stream.next()) != null) {
[115] Fix | Delete
if (ch == quote && !escaped) break;
[116] Fix | Delete
escaped = !escaped && ch == "\\";
[117] Fix | Delete
}
[118] Fix | Delete
if (!escaped) state.cur = normal;
[119] Fix | Delete
return "string";
[120] Fix | Delete
};
[121] Fix | Delete
}
[122] Fix | Delete
[123] Fix | Delete
return {
[124] Fix | Delete
startState: function(basecol) {
[125] Fix | Delete
return {basecol: basecol || 0, indentDepth: 0, cur: normal};
[126] Fix | Delete
},
[127] Fix | Delete
[128] Fix | Delete
token: function(stream, state) {
[129] Fix | Delete
if (stream.eatSpace()) return null;
[130] Fix | Delete
var style = state.cur(stream, state);
[131] Fix | Delete
var word = stream.current();
[132] Fix | Delete
if (style == "variable") {
[133] Fix | Delete
if (keywords.test(word)) style = "keyword";
[134] Fix | Delete
else if (builtins.test(word)) style = "builtin";
[135] Fix | Delete
else if (specials.test(word)) style = "variable-2";
[136] Fix | Delete
}
[137] Fix | Delete
if ((style != "comment") && (style != "string")){
[138] Fix | Delete
if (indentTokens.test(word)) ++state.indentDepth;
[139] Fix | Delete
else if (dedentTokens.test(word)) --state.indentDepth;
[140] Fix | Delete
}
[141] Fix | Delete
return style;
[142] Fix | Delete
},
[143] Fix | Delete
[144] Fix | Delete
indent: function(state, textAfter) {
[145] Fix | Delete
var closing = dedentPartial.test(textAfter);
[146] Fix | Delete
return state.basecol + indentUnit * (state.indentDepth - (closing ? 1 : 0));
[147] Fix | Delete
},
[148] Fix | Delete
[149] Fix | Delete
lineComment: "--",
[150] Fix | Delete
blockCommentStart: "--[[",
[151] Fix | Delete
blockCommentEnd: "]]"
[152] Fix | Delete
};
[153] Fix | Delete
});
[154] Fix | Delete
[155] Fix | Delete
CodeMirror.defineMIME("text/x-lua", "lua");
[156] Fix | Delete
[157] Fix | Delete
});
[158] Fix | Delete
[159] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function