Ajout du plugin codemirror.
[ckeditor.git] / skins / ckeditor / plugins / codemirror / js / codemirror.mode.javascript.min.js
1 CodeMirror.defineMode("javascript",function(U,af){var i=U.indentUnit;var v=af.statementIndent;var u=af.json;var e=af.typescript;var al=function(){function aH(aJ){return{type:aJ,style:"keyword"}}var aC=aH("keyword a"),aA=aH("keyword b"),az=aH("keyword c");var aB=aH("operator"),aF={type:"atom",style:"atom"};var aD={"if":aH("if"),"while":aC,"with":aC,"else":aA,"do":aA,"try":aA,"finally":aA,"return":az,"break":az,"continue":az,"new":az,"delete":az,"throw":az,"var":aH("var"),"const":aH("var"),let:aH("var"),"function":aH("function"),"catch":aH("catch"),"for":aH("for"),"switch":aH("switch"),"case":aH("case"),"default":aH("default"),"in":aB,"typeof":aB,"instanceof":aB,"true":aF,"false":aF,"null":aF,"undefined":aF,"NaN":aF,"Infinity":aF,"this":aH("this"),module:aH("module"),"class":aH("class"),"super":aH("atom"),yield:az,"export":aH("export"),"import":aH("import"),"extends":az};if(e){var aI={type:"variable",style:"variable-3"};var aE={"interface":aH("interface"),"extends":aH("extends"),constructor:aH("constructor"),"public":aH("public"),"private":aH("private"),"protected":aH("protected"),"static":aH("static"),string:aI,number:aI,bool:aI,any:aI};for(var aG in aE){aD[aG]=aE[aG]}}return aD}();var J=/[+\-*&%=<>!?|~^]/;function ab(aC,az){var aB=false,aA;while((aA=aC.next())!=null){if(aA==az&&!aB){return false}aB=!aB&&aA=="\\"}return aB}var M,A;function F(aB,aA,az){M=aB;A=az;return aA}function O(aD,aB){var az=aD.next();if(az=='"'||az=="'"){aB.tokenize=L(az);return aB.tokenize(aD,aB)}else{if(az=="."&&aD.match(/^\d+(?:[eE][+\-]?\d+)?/)){return F("number","number")}else{if(az=="."&&aD.match("..")){return F("spread","meta")}else{if(/[\[\]{}\(\),;\:\.]/.test(az)){return F(az)}else{if(az=="="&&aD.eat(">")){return F("=>")}else{if(az=="0"&&aD.eat(/x/i)){aD.eatWhile(/[\da-f]/i);return F("number","number")}else{if(/\d/.test(az)){aD.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/);return F("number","number")}else{if(az=="/"){if(aD.eat("*")){aB.tokenize=aq;return aq(aD,aB)}else{if(aD.eat("/")){aD.skipToEnd();return F("comment","comment")}else{if(aB.lastType=="operator"||aB.lastType=="keyword c"||aB.lastType=="sof"||/^[\[{}\(,;:]$/.test(aB.lastType)){ab(aD,"/");aD.eatWhile(/[gimy]/);return F("regexp","string-2")}else{aD.eatWhile(J);return F("operator",null,aD.current())}}}}else{if(az=="`"){aB.tokenize=ar;return ar(aD,aB)}else{if(az=="#"){aD.skipToEnd();return F("error","error")}else{if(J.test(az)){aD.eatWhile(J);return F("operator",null,aD.current())}else{aD.eatWhile(/[\w\$_]/);var aC=aD.current(),aA=al.propertyIsEnumerable(aC)&&al[aC];return(aA&&aB.lastType!=".")?F(aA.type,aA.style,aC):F("variable","variable",aC)}}}}}}}}}}}}function L(az){return function(aB,aA){if(!ab(aB,az)){aA.tokenize=O}return F("string","string")}}function aq(aC,aB){var az=false,aA;while(aA=aC.next()){if(aA=="/"&&az){aB.tokenize=O;break}az=(aA=="*")}return F("comment","comment")}function ar(aC,aA){var aB=false,az;while((az=aC.next())!=null){if(!aB&&(az=="`"||az=="$"&&aC.eat("{"))){aA.tokenize=O;break}aB=!aB&&az=="\\"}return F("quasi","string-2",aC.current())}var j="([{}])";function ao(aF,aC){if(aC.fatArrowAt){aC.fatArrowAt=null}var aB=aF.string.indexOf("=>",aF.start);if(aB<0){return}var aE=0,aA=false;for(var aG=aB-1;aG>=0;--aG){var az=aF.string.charAt(aG);var aD=j.indexOf(az);if(aD>=0&&aD<3){if(!aE){++aG;break}if(--aE==0){break}}else{if(aD>=3&&aD<6){++aE}else{if(/[$\w]/.test(az)){aA=true}else{if(aA&&!aE){++aG;break}}}}}if(aA&&!aE){aC.fatArrowAt=aG}}var a={atom:true,number:true,variable:true,string:true,regexp:true,"this":true};function D(aE,aA,az,aD,aB,aC){this.indented=aE;this.column=aA;this.type=az;this.prev=aB;this.info=aC;if(aD!=null){this.align=aD}}function n(aC,aB){for(var aA=aC.localVars;aA;aA=aA.next){if(aA.name==aB){return true}}for(var az=aC.context;az;az=az.prev){for(var aA=az.vars;aA;aA=aA.next){if(aA.name==aB){return true}}}}function d(aD,aA,az,aC,aE){var aF=aD.cc;y.state=aD;y.stream=aE;y.marked=null,y.cc=aF;if(!aD.lexical.hasOwnProperty("align")){aD.lexical.align=true}while(true){var aB=aF.length?aF.pop():u?aj:ax;if(aB(az,aC)){while(aF.length&&aF[aF.length-1].lex){aF.pop()()}if(y.marked){return y.marked}if(az=="variable"&&n(aD,aC)){return"variable-2"}return aA}}}var y={state:null,column:null,marked:null,cc:null};function V(){for(var az=arguments.length-1;az>=0;az--){y.cc.push(arguments[az])}}function Z(){V.apply(null,arguments);return true}function an(aA){function az(aD){for(var aC=aD;aC;aC=aC.next){if(aC.name==aA){return true}}return false}var aB=y.state;if(aB.context){y.marked="def";if(az(aB.localVars)){return}aB.localVars={name:aA,next:aB.localVars}}else{if(az(aB.globalVars)){return}if(af.globalVars){aB.globalVars={name:aA,next:aB.globalVars}}}}var l={name:"this",next:{name:"arguments"}};function r(){y.state.context={prev:y.state.context,vars:y.state.localVars};y.state.localVars=l}function s(){y.state.localVars=y.state.context.vars;y.state.context=y.state.context.prev}function av(aA,aB){var az=function(){var aD=y.state,aC=aD.indented;if(aD.lexical.type=="stat"){aC=aD.lexical.indented}aD.lexical=new D(aC,y.stream.column(),aA,null,aD.lexical,aB)};az.lex=true;return az}function f(){var az=y.state;if(az.lexical.prev){if(az.lexical.type==")"){az.indented=az.lexical.indented}az.lexical=az.lexical.prev}}f.lex=true;function m(az){return function(aA){if(aA==az){return Z()}else{if(az==";"){return V()}else{return Z(arguments.callee)}}}}function ax(az,aA){if(az=="var"){return Z(av("vardef",aA.length),b,m(";"),f)}if(az=="keyword a"){return Z(av("form"),aj,ax,f)}if(az=="keyword b"){return Z(av("form"),ax,f)}if(az=="{"){return Z(av("}"),t,f)}if(az==";"){return Z()}if(az=="if"){return Z(av("form"),aj,ax,f,c)}if(az=="function"){return Z(G)}if(az=="for"){return Z(av("form"),p,f,ax,f)}if(az=="variable"){return Z(av("stat"),ay)}if(az=="switch"){return Z(av("form"),aj,av("}","switch"),m("{"),t,f,f)}if(az=="case"){return Z(aj,m(":"))}if(az=="default"){return Z(m(":"))}if(az=="catch"){return Z(av("form"),r,m("("),aa,m(")"),ax,f,s)}if(az=="module"){return Z(av("form"),r,B,s,f)}if(az=="class"){return Z(av("form"),Q,P,f)}if(az=="export"){return Z(av("form"),aw,f)}if(az=="import"){return Z(av("form"),ac,f)}return V(av("stat"),aj,m(";"),f)}function aj(az){return T(az,false)}function au(az){return T(az,true)}function T(aA,aC){if(y.state.fatArrowAt==y.stream.start){var az=aC?H:R;if(aA=="("){return Z(r,am(g,")"),m("=>"),az,s)}else{if(aA=="variable"){return V(r,g,m("=>"),az,s)}}}var aB=aC?h:W;if(a.hasOwnProperty(aA)){return Z(aB)}if(aA=="function"){return Z(G)}if(aA=="keyword c"){return Z(aC?ag:ae)}if(aA=="("){return Z(av(")"),ae,ap,m(")"),f,aB)}if(aA=="operator"||aA=="spread"){return Z(aC?au:aj)}if(aA=="["){return Z(av("]"),au,ai,f,aB)}if(aA=="{"){return Z(am(o,"}"),aB)}return Z()}function ae(az){if(az.match(/[;\}\)\],]/)){return V()}return V(aj)}function ag(az){if(az.match(/[;\}\)\],]/)){return V()}return V(au)}function W(az,aA){if(az==","){return Z(aj)}return h(az,aA,false)}function h(az,aB,aD){var aA=aD==false?W:h;var aC=aD==false?aj:au;if(aB=="=>"){return Z(r,aD?H:R,s)}if(az=="operator"){if(/\+\+|--/.test(aB)){return Z(aA)}if(aB=="?"){return Z(aj,m(":"),aC)}return Z(aC)}if(az=="quasi"){y.cc.push(aA);return K(aB)}if(az==";"){return}if(az=="("){return Z(am(au,")","call"),aA)}if(az=="."){return Z(ah,aA)}if(az=="["){return Z(av("]"),ae,m("]"),f,aA)}}function K(az){if(!az){}if(az.slice(az.length-2)!="${"){return Z()}return Z(aj,k)}function k(az){if(az=="}"){y.marked="string-2";y.state.tokenize=ar;return Z()}}function R(az){ao(y.stream,y.state);if(az=="{"){return V(ax)}return V(aj)}function H(az){ao(y.stream,y.state);if(az=="{"){return V(ax)}return V(au)}function ay(az){if(az==":"){return Z(f,ax)}return V(W,m(";"),f)}function ah(az){if(az=="variable"){y.marked="property";return Z()}}function o(az,aA){if(az=="variable"){y.marked="property";if(aA=="get"||aA=="set"){return Z(C)}}else{if(az=="number"||az=="string"){y.marked=az+" property"}else{if(az=="["){return Z(aj,m("]"),E)}}}if(a.hasOwnProperty(az)){return Z(E)}}function C(az){if(az!="variable"){return V(E)}y.marked="property";return Z(G)}function E(az){if(az==":"){return Z(au)}if(az=="("){return V(G)}}function am(aC,az,aB){function aA(aE){if(aE==","){var aD=y.state.lexical;if(aD.info=="call"){aD.pos=(aD.pos||0)+1}return Z(aC,aA)}if(aE==az){return Z()}return Z(m(az))}return function(aD){if(aD==az){return Z()}if(aB===false){return V(aC,aA)}return V(av(az,aB),aC,aA,f)}}function t(az){if(az=="}"){return Z()}return V(ax,t)}function N(az){if(e&&az==":"){return Z(Y)}}function Y(az){if(az=="variable"){y.marked="variable-3";return Z()}}function b(){return V(g,N,X,S)}function g(az,aA){if(az=="variable"){an(aA);return Z()}if(az=="["){return Z(am(g,"]"))}if(az=="{"){return Z(am(at,"}"))}}function at(az,aA){if(az=="variable"&&!y.stream.match(/^\s*:/,false)){an(aA);return Z(X)}if(az=="variable"){y.marked="property"}return Z(m(":"),g,X)}function X(az,aA){if(aA=="="){return Z(au)}}function S(az){if(az==","){return Z(b)}}function c(az,aA){if(az=="keyword b"&&aA=="else"){return Z(av("form"),ax,f)}}function p(az){if(az=="("){return Z(av(")"),z,m(")"))}}function z(az){if(az=="var"){return Z(b,m(";"),x)}if(az==";"){return Z(x)}if(az=="variable"){return Z(q)}return V(aj,m(";"),x)}function q(az,aA){if(aA=="in"||aA=="of"){y.marked="keyword";return Z(aj)}return Z(W,x)}function x(az,aA){if(az==";"){return Z(w)}if(aA=="in"||aA=="of"){y.marked="keyword";return Z(aj)}return V(aj,m(";"),w)}function w(az){if(az!=")"){Z(aj)}}function G(az,aA){if(aA=="*"){y.marked="keyword";return Z(G)}if(az=="variable"){an(aA);return Z(G)}if(az=="("){return Z(r,am(aa,")"),ax,s)}}function aa(az){if(az=="spread"){return Z(aa)}return V(g,N)}function Q(az,aA){if(az=="variable"){an(aA);return Z(I)}}function I(az,aA){if(aA=="extends"){return Z(aj)}}function P(az){if(az=="{"){return Z(am(o,"}"))}}function B(az,aA){if(az=="string"){return Z(ax)}if(az=="variable"){an(aA);return Z(ad)}}function aw(az,aA){if(aA=="*"){y.marked="keyword";return Z(ad,m(";"))}if(aA=="default"){y.marked="keyword";return Z(aj,m(";"))}return V(ax)}function ac(az){if(az=="string"){return Z()}return V(ak,ad)}function ak(az,aA){if(az=="{"){return Z(am(ak,"}"))}if(az=="variable"){an(aA)}return Z()}function ad(az,aA){if(aA=="from"){y.marked="keyword";return Z(aj)}}function ai(az){if(az=="for"){return V(ap)}if(az==","){return Z(am(au,"]",false))}return V(am(au,"]",false))}function ap(az){if(az=="for"){return Z(p,ap)}if(az=="if"){return Z(aj,ap)}}return{startState:function(aA){var az={tokenize:O,lastType:"sof",cc:[],lexical:new D((aA||0)-i,0,"block",false),localVars:af.localVars,context:af.localVars&&{vars:af.localVars},indented:0};if(af.globalVars){az.globalVars=af.globalVars}return az},token:function(aB,aA){if(aB.sol()){if(!aA.lexical.hasOwnProperty("align")){aA.lexical.align=false}aA.indented=aB.indentation();ao(aB,aA)}if(aA.tokenize!=aq&&aB.eatSpace()){return null}var az=aA.tokenize(aB,aA);if(M=="comment"){return az}aA.lastType=M=="operator"&&(A=="++"||A=="--")?"incdec":M;return d(aA,az,M,A,aB)},indent:function(aF,az){if(aF.tokenize==aq){return CodeMirror.Pass}if(aF.tokenize!=O){return 0}var aE=az&&az.charAt(0),aC=aF.lexical;for(var aB=aF.cc.length-1;aB>=0;--aB){var aG=aF.cc[aB];if(aG==f){aC=aC.prev}else{if(aG!=c){break}}}if(aC.type=="stat"&&aE=="}"){aC=aC.prev}if(v&&aC.type==")"&&aC.prev.type=="stat"){aC=aC.prev}var aD=aC.type,aA=aE==aD;if(aD=="vardef"){return aC.indented+(aF.lastType=="operator"||aF.lastType==","?aC.info+1:0)}else{if(aD=="form"&&aE=="{"){return aC.indented}else{if(aD=="form"){return aC.indented+i}else{if(aD=="stat"){return aC.indented+(aF.lastType=="operator"||aF.lastType==","?v||i:0)}else{if(aC.info=="switch"&&!aA&&af.doubleIndentSwitch!=false){return aC.indented+(/^(?:case|default)\b/.test(az)?i:2*i)}else{if(aC.align){return aC.column+(aA?0:1)}else{return aC.indented+(aA?0:i)}}}}}}},electricChars:":{}",blockCommentStart:u?null:"/*",blockCommentEnd:u?null:"*/",lineComment:u?null:"//",fold:"brace",helperType:u?"json":"javascript",jsonMode:u}});CodeMirror.defineMIME("text/javascript","javascript");CodeMirror.defineMIME("text/ecmascript","javascript");CodeMirror.defineMIME("application/javascript","javascript");CodeMirror.defineMIME("application/ecmascript","javascript");CodeMirror.defineMIME("application/json",{name:"javascript",json:true});CodeMirror.defineMIME("application/x-json",{name:"javascript",json:true});CodeMirror.defineMIME("text/typescript",{name:"javascript",typescript:true});CodeMirror.defineMIME("application/typescript",{name:"javascript",typescript:true});