Current File : /home/pacjaorg/public_html/kmm/media/vendor/codemirror/mode/lua/lua.min.js |
(function(a){typeof exports=="object"&&typeof module=="object"?a(require("../../lib/codemirror")):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)})(function(a){"use strict";a.defineMode("lua",function(d,f){var g=d.indentUnit;function h(e){return new RegExp("^(?:"+e.join("|")+")","i")}function o(e){return new RegExp("^(?:"+e.join("|")+")$","i")}var m=o(f.specials||[]),p=o(["_G","_VERSION","assert","collectgarbage","dofile","error","getfenv","getmetatable","ipairs","load","loadfile","loadstring","module","next","pairs","pcall","print","rawequal","rawget","rawset","require","select","setfenv","setmetatable","tonumber","tostring","type","unpack","xpcall","coroutine.create","coroutine.resume","coroutine.running","coroutine.status","coroutine.wrap","coroutine.yield","debug.debug","debug.getfenv","debug.gethook","debug.getinfo","debug.getlocal","debug.getmetatable","debug.getregistry","debug.getupvalue","debug.setfenv","debug.sethook","debug.setlocal","debug.setmetatable","debug.setupvalue","debug.traceback","close","flush","lines","read","seek","setvbuf","write","io.close","io.flush","io.input","io.lines","io.open","io.output","io.popen","io.read","io.stderr","io.stdin","io.stdout","io.tmpfile","io.type","io.write","math.abs","math.acos","math.asin","math.atan","math.atan2","math.ceil","math.cos","math.cosh","math.deg","math.exp","math.floor","math.fmod","math.frexp","math.huge","math.ldexp","math.log","math.log10","math.max","math.min","math.modf","math.pi","math.pow","math.rad","math.random","math.randomseed","math.sin","math.sinh","math.sqrt","math.tan","math.tanh","os.clock","os.date","os.difftime","os.execute","os.exit","os.getenv","os.remove","os.rename","os.setlocale","os.time","os.tmpname","package.cpath","package.loaded","package.loaders","package.loadlib","package.path","package.preload","package.seeall","string.byte","string.char","string.dump","string.find","string.format","string.gmatch","string.gsub","string.len","string.lower","string.match","string.rep","string.reverse","string.sub","string.upper","table.concat","table.insert","table.maxn","table.remove","table.sort"]),b=o(["and","break","elseif","false","nil","not","or","return","true","function","end","if","then","else","do","while","repeat","until","for","in","local"]),v=o(["function","if","repeat","do","\\(","{"]),k=o(["end","until","\\)","}"]),w=h(["end","until","\\)","}","else","elseif"]);function s(e){for(var n=0;e.eat("=");)++n;return e.eat("["),n}function u(e,n){var t=e.next();return t=="-"&&e.eat("-")?e.eat("[")&&e.eat("[")?(n.cur=c(s(e),"comment"))(e,n):(e.skipToEnd(),"comment"):t=='"'||t=="'"?(n.cur=x(t))(e,n):t=="["&&/[\[=]/.test(e.peek())?(n.cur=c(s(e),"string"))(e,n):/\d/.test(t)?(e.eatWhile(/[\w.%]/),"number"):/[\w_]/.test(t)?(e.eatWhile(/[\w\\\-_.]/),"variable"):null}function c(e,n){return function(t,i){for(var r=null,l;(l=t.next())!=null;)if(r==null)l=="]"&&(r=0);else if(l=="=")++r;else if(l=="]"&&r==e){i.cur=u;break}else r=null;return n}}function x(e){return function(n,t){for(var i=!1,r;(r=n.next())!=null&&!(r==e&&!i);)i=!i&&r=="\\";return i||(t.cur=u),"string"}}return{startState:function(e){return{basecol:e||0,indentDepth:0,cur:u}},token:function(e,n){if(e.eatSpace())return null;var t=n.cur(e,n),i=e.current();return t=="variable"&&(b.test(i)?t="keyword":p.test(i)?t="builtin":m.test(i)&&(t="variable-2")),t!="comment"&&t!="string"&&(v.test(i)?++n.indentDepth:k.test(i)&&--n.indentDepth),t},indent:function(e,n){var t=w.test(n);return e.basecol+g*(e.indentDepth-(t?1:0))},electricInput:/^\s*(?:end|until|else|\)|\})$/,lineComment:"--",blockCommentStart:"--[[",blockCommentEnd:"]]"}}),a.defineMIME("text/x-lua","lua")});