60 lines
39 KiB
JavaScript
60 lines
39 KiB
JavaScript
|
(function(d){"object"==typeof exports&&"object"==typeof module?d(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)})(function(d){d.defineMode("xml",function(w,h){function q(t,a){function i(i){a.tokenize=i;return i(t,a)}var b=t.next();if("<"==b){if(t.eat("!"))return t.eat("[")?t.match("CDATA[")?i(x("atom","]]\>")):null:t.match("--")?i(x("comment","--\>")):t.match("DOCTYPE",!0,!0)?(t.eatWhile(/[\w\._\-]/),i(k(1))):null;if(t.eat("?"))return t.eatWhile(/[\w\._\-]/),
|
|||
|
a.tokenize=x("meta","?>"),"meta";G=t.eat("/")?"closeTag":"openTag";a.tokenize=l;return"tag bracket"}if("&"==b)return(t.eat("#")?t.eat("x")?t.eatWhile(/[a-fA-F\d]/)&&t.eat(";"):t.eatWhile(/[\d]/)&&t.eat(";"):t.eatWhile(/[\w\.\-:]/)&&t.eat(";"))?"atom":"error";t.eatWhile(/[^&<]/);return null}function l(a,b){var i=a.next();if(">"==i||"/"==i&&a.eat(">"))return b.tokenize=q,G=">"==i?"endTag":"selfcloseTag","tag bracket";if("="==i)return G="equals",null;if("<"==i)return b.tokenize=q,b.state=z,b.tagName=
|
|||
|
b.tagStart=null,(i=b.tokenize(a,b))?i+" tag error":"tag error";if(/[\'\"]/.test(i))return b.tokenize=m(i),b.stringStartCol=a.column(),b.tokenize(a,b);a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/);return"word"}function m(a){var b=function(b,d){for(;!b.eol();)if(b.next()==a){d.tokenize=l;break}return"string"};b.isInAttribute=!0;return b}function x(a,b){return function(i,d){for(;!i.eol();){if(i.match(b)){d.tokenize=q;break}i.next()}return a}}function k(a){return function(b,i){for(var d;null!=(d=
|
|||
|
b.next());){if("<"==d)return i.tokenize=k(a+1),i.tokenize(b,i);if(">"==d)if(1==a){i.tokenize=q;break}else return i.tokenize=k(a-1),i.tokenize(b,i)}return"meta"}}function r(a,b,i){this.prev=a.context;this.tagName=b;this.indent=a.indented;this.startOfLine=i;if(j.doNotIndent.hasOwnProperty(b)||a.context&&a.context.noIndent)this.noIndent=!0}function C(a){a.context&&(a.context=a.context.prev)}function n(a,b){for(var i;a.context;){i=a.context.tagName;if(!j.contextGrabbers.hasOwnProperty(i)||!j.contextGrabbers[i].hasOwnProperty(b))break;
|
|||
|
C(a)}}function z(a,b,i){return"openTag"==a?(i.tagStart=b.column(),D):"closeTag"==a?g:z}function D(a,b,i){if("word"==a)return i.tagName=b.current(),y="tag",A;y="error";return D}function g(d,A,i){if("word"==d){d=A.current();i.context&&(i.context.tagName!=d&&j.implicitlyClosed.hasOwnProperty(i.context.tagName))&&C(i);if(i.context&&i.context.tagName==d)return y="tag",b;y="tag error";return a}y="error";return a}function b(a,d,i){if("endTag"!=a)return y="error",b;C(i);return z}function a(a,d,i){y="error";
|
|||
|
return b(a,d,i)}function A(a,b,d){if("word"==a)return y="attribute",H;if("endTag"==a||"selfcloseTag"==a){var b=d.tagName,g=d.tagStart;d.tagName=d.tagStart=null;"selfcloseTag"==a||j.autoSelfClosers.hasOwnProperty(b)?n(d,b):(n(d,b),d.context=new r(d,b,g==d.indented));return z}y="error";return A}function H(a,b,d){if("equals"==a)return I;j.allowMissing||(y="error");return A(a,b,d)}function I(a,b,d){if("string"==a)return s;if("word"==a&&j.allowUnquoted)return y="string",A;y="error";return A(a,b,d)}function s(a,
|
|||
|
b,d){return"string"==a?s:A(a,b,d)}var p=w.indentUnit,u=h.multilineTagIndentFactor||1,B=h.multilineTagIndentPastTag;null==B&&(B=!0);var j=h.htmlMode?{autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},
|
|||
|
optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0}:{autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},
|
|||
|
doNotIndent:{},allowUnquoted:!1,allowMissing:!1,caseFold:!1},F=h.alignCDATA,G,y;return{startState:function(){return{tokenize:q,state:z,indented:0,tagName:null,tagStart:null,context:null}},token:function(a,b){!b.tagName&&a.sol()&&(b.indented=a.indentation());if(a.eatSpace())return null;G=null;var d=b.tokenize(a,b);if((d||G)&&"comment"!=d)y=null,b.state=b.state(G||d,a,b),y&&(d="error"==y?d+" error":y);return d},indent:function(a,b,A){var g=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?
|
|||
|
a.stringStartCol+1:a.indented+p;if(g&&g.noIndent)return d.Pass;if(a.tokenize!=l&&a.tokenize!=q)return A?A.match(/^(\s*)/)[0].length:0;if(a.tagName)return B?a.tagStart+a.tagName.length+2:a.tagStart+p*u;if(F&&/<!\[CDATA\[/.test(b))return 0;if((a=b&&/^<(\/)?([\w_:\.-]*)/.exec(b))&&a[1])for(;g;)if(g.tagName==a[2]){g=g.prev;break}else if(j.implicitlyClosed.hasOwnProperty(g.tagName))g=g.prev;else break;else if(a)for(;g;)if((b=j.contextGrabbers[g.tagName])&&b.hasOwnProperty(a[2]))g=g.prev;else break;for(;g&&
|
|||
|
!g.startOfLine;)g=g.prev;return g?g.indent+p:0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<\!--",blockCommentEnd:"--\>",configuration:h.htmlMode?"html":"xml",helperType:h.htmlMode?"html":"xml"}});d.defineMIME("text/xml","xml");d.defineMIME("application/xml","xml");d.mimeModes.hasOwnProperty("text/html")||d.defineMIME("text/html",{name:"xml",htmlMode:!0})});
|
|||
|
(function(d){"object"==typeof exports&&"object"==typeof module?d(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)})(function(d){d.defineMode("javascript",function(w,h){var q,l,m,x;function k(e,a,c){O=e;S=c;return a}function r(e,a){var c=e.next();if('"'==c||"'"==c)return a.tokenize=C(c),a.tokenize(e,a);if("."==c&&e.match(/^\d+(?:[eE][+\-]?\d+)?/))return k("number","number");if("."==c&&e.match(".."))return k("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(c))return k(c);
|
|||
|
if("="==c&&e.eat(">"))return k("=>","operator");if("0"==c&&e.eat(/x/i))return e.eatWhile(/[\da-f]/i),k("number","number");if(/\d/.test(c))return e.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),k("number","number");if("/"==c){if(e.eat("*"))return a.tokenize=n,n(e,a);if(e.eat("/"))return e.skipToEnd(),k("comment","comment");if("operator"==a.lastType||"keyword c"==a.lastType||"sof"==a.lastType||/^[\[{}\(,;:]$/.test(a.lastType)){a:for(var c=!1,b,f=!1;null!=(b=e.next());){if(!c){if("/"==b&&!f)break a;"["==
|
|||
|
b?f=!0:f&&"]"==b&&(f=!1)}c=!c&&"\\"==b}e.eatWhile(/[gimy]/);return k("regexp","string-2")}e.eatWhile(W);return k("operator","operator",e.current())}if("`"==c)return a.tokenize=z,z(e,a);if("#"==c)return e.skipToEnd(),k("error","error");if(W.test(c))return e.eatWhile(W),k("operator","operator",e.current());e.eatWhile(/[\w\$_]/);c=e.current();return(b=ca.propertyIsEnumerable(c)&&ca[c])&&"."!=a.lastType?k(b.type,b.style,c):k("variable","variable",c)}function C(e){return function(a,c){var b=!1,f;if(T&&
|
|||
|
"@"==a.peek()&&a.match(na))return c.tokenize=r,k("jsonld-keyword","meta");for(;null!=(f=a.next())&&(f!=e||b);)b=!b&&"\\"==f;b||(c.tokenize=r);return k("string","string")}}function n(e,a){for(var c=!1,b;b=e.next();){if("/"==b&&c){a.tokenize=r;break}c="*"==b}return k("comment","comment")}function z(e,a){for(var c=!1,b;null!=(b=e.next());){if(!c&&("`"==b||"$"==b&&e.eat("{"))){a.tokenize=r;break}c=!c&&"\\"==b}return k("quasi","string-2",e.current())}function D(e,a){a.fatArrowAt&&(a.fatArrowAt=null);var c=
|
|||
|
e.string.indexOf("=>",e.start);if(!(0>c)){for(var b=0,f=!1,c=c-1;0<=c;--c){var d=e.string.charAt(c),o=oa.indexOf(d);if(0<=o&&3>o){if(!b){++c;break}if(0==--b)break}else if(3<=o&&6>o)++b;else if(/[$\w]/.test(d))f=!0;else if(f&&!b){++c;break}}f&&!b&&(a.fatArrowAt=c)}}function g(e,a,c,b,f,d){this.indented=e;this.column=a;this.type=c;this.prev=f;this.info=d;null!=b&&(this.align=b)}function b(){for(var e=arguments.length-1;0<=e;e--)q.push(arguments[e])}function a(){b.apply(null,arguments);return!0}function A(e){function a(c){for(;c;c=
|
|||
|
c.next)if(c.name==e)return!0;return!1}var c=l;c.context?(m="def",a(c.localVars)||(c.localVars={name:e,next:c.localVars})):!a(c.globalVars)&&h.globalVars&&(c.globalVars={name:e,next:c.globalVars})}function H(){l.context={prev:l.context,vars:l.localVars};l.localVars=pa}function I(){l.localVars=l.context.vars;l.context=l.context.prev}function s(e,a){var c=function(){var c=l,b=c.indented;"stat"==c.lexical.type&&(b=c.lexical.indented);c.lexical=new g(b,x.column(),e,null,c.lexical,a)};c.lex=!0;return c}
|
|||
|
function p(){var e=l;e.lexical.prev&&(")"==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function u(e){function c(f){return f==e?a():";"==e?b():a(c)}return c}function B(e,c){return"var"==e?a(s("vardef",c.length),X,u(";"),p):"keyword a"==e?a(s("form"),j,B,p):"keyword b"==e?a(s("form"),B,p):"{"==e?a(s("}"),o,p):";"==e?a():"if"==e?("else"==l.lexical.info&&l.cc[l.cc.length-1]==p&&l.cc.pop()(),a(s("form"),j,B,p,da)):"function"==e?a(K):"for"==e?a(s("form"),ea,B,p):"variable"==
|
|||
|
e?a(s("stat"),Y):"switch"==e?a(s("form"),j,s("}","switch"),u("{"),o,p,p):"case"==e?a(j,u(":")):"default"==e?a(u(":")):"catch"==e?a(s("form"),H,u("("),Z,u(")"),B,p,I):"module"==e?a(s("form"),H,qa,I,p):"class"==e?a(s("form"),ra,sa,p):"export"==e?a(s("form"),ta,p):"import"==e?a(s("form"),ua,p):b(s("stat"),j,u(";"),p)}function j(e){return G(e,!1)}function F(e){return G(e,!0)}function G(e,f){if(l.fatArrowAt==x.start){var d=f?fa:ga;if("("==e)return a(H,s(")"),E(L,")"),p,u("=>"),d,I);if("variable"==e)return b(H,
|
|||
|
L,u("=>"),d,I)}d=f?i:Q;return ha.hasOwnProperty(e)?a(d):"function"==e?a(K,d):"keyword c"==e?a(f?t:y):"("==e?a(s(")"),y,U,u(")"),p,d):"operator"==e||"spread"==e?a(f?F:j):"["==e?a(s("]"),va,p,d):"{"==e?c(J,"}",null,d):"quasi"==e?b(R,d):a()}function y(e){return e.match(/[;\}\)\],]/)?b():b(j)}function t(e){return e.match(/[;\}\)\],]/)?b():b(F)}function Q(e,c){return","==e?a(j):i(e,c,!1)}function i(e,f,d){var o=!1==d?Q:i,g=!1==d?j:F;if("=>"==f)return a(H,d?fa:ga,I);if("operator"==e)return/\+\+|--/.test(f)?
|
|||
|
a(o):"?"==f?a(j,u(":"),g):a(g);if("quasi"==e)return b(R,o);if(";"!=e){if("("==e)return c(F,")","call",o);if("."==e)return a($,o);if("["==e)return a(s("]"),y,u("]"),p,o)}}function R(e,c){return"quasi"!=e?b():"${"!=c.slice(c.length-2)?a(R):a(j,ma)}function ma(e){if("}"==e)return m="string-2",l.tokenize=z,a(R)}function ga(e){D(x,l);return"{"==e?b(B):b(j)}function fa(e){D(x,l);return"{"==e?b(B):b(F)}function Y(e){return":"==e?a(p,B):b(Q,u(";"),p)}function $(e){if("variable"==e)return m="property",a()}
|
|||
|
function J(e,c){if("variable"==e){if(m="property","get"==c||"set"==c)return a(P)}else if("number"==e||"string"==e)m=T?"property":e+" property";else if("["==e)return a(j,u("]"),v);if(ha.hasOwnProperty(e))return a(v)}function P(e){if("variable"!=e)return b(v);m="property";return a(K)}function v(e){if(":"==e)return a(F);if("("==e)return b(K)}function E(e,c){function f(b){return","==b?(b=l.lexical,"call"==b.info&&(b.pos=(b.pos||0)+1),a(e,f)):b==c?a():a(u(c))}return function(d){return d==c?a():b(e,f)}}
|
|||
|
function c(e,c,b){for(var f=3;f<arguments.length;f++)q.push(arguments[f]);return a(s(c,b),E(e,c),p)}function o(e){return"}"==e?a():b(B,o)}function f(e){if(ia&&":"==e)return a(wa)}function wa(e){if("variable"==e)return m="variable-3",a()}function X(){return b(L,f,aa,xa)}function L(e,b){if("variable"==e)return A(b),a();if("["==e)return c(L,"]");if("{"==e)return c(ya,"}")}function ya(e,c){if("variable"==e&&!x.match(/^\s*:/,!1))return A(c),a(aa);"variable"==e&&(m="property");return a(u(":"),L,aa)}function aa(e,
|
|||
|
c){if("="==c)return a(F)}function xa(c){if(","==c)return a(X)}function da(c,b){if("keyword b"==c&&"else"==b)return a(s("form","else"),B,p)}function ea(c){if("("==c)return a(s(")"),za,u(")"),p)}function za(c){return"var"==c?a(X,u(";"),V):";"==c?a(V):"variable"==c?a(Aa):b(j,u(";"),V)}function Aa(c,b){return"in"==b||"of"==b?(m="keyword",a(j)):a(Q,V)}function V(c,f){return";"==c?a(ja):"in"==f||"of"==f?(m="keyword",a(j)):b(j,u(";"),ja)}function ja(c){")"!=c&&a(j)}function K(c,b){if("*"==b)return m="keyword",
|
|||
|
a(K);if("variable"==c)return A(b),a(K);if("("==c)return a(H,s(")"),E(Z,")"),p,B,I)}function Z(c){return"spread"==c?a(Z):b(L,f)}function ra(c,b){if("variable"==c)return A(b),a(Ba)}function Ba(c,b){if("extends"==b)return a(j)}function sa(a){if("{"==a)return c(J,"}")}function qa(c,b){if("string"==c)return a(B);if("variable"==c)return A(b),a(ba)}function ta(c,f){return"*"==f?(m="keyword",a(ba,u(";"))):"default"==f?(m="keyword",a(j,u(";"))):b(B)}function ua(c){return"string"==c?a():b(ka,ba)}function ka(e,
|
|||
|
b){if("{"==e)return c(ka,"}");"variable"==e&&A(b);return a()}function ba(c,b){if("from"==b)return m="keyword",a(j)}function va(c){return"]"==c?a():b(F,Ca)}function Ca(c){return"for"==c?b(U,u("]")):","==c?a(E(F,"]")):b(E(F,"]"))}function U(c){if("for"==c)return a(ea,U);if("if"==c)return a(j,U)}var M=w.indentUnit,la=h.statementIndent,T=h.jsonld,N=h.json||T,ia=h.typescript,ca=function(){function c(a){return{type:a,style:"keyword"}}var a=c("keyword a"),b=c("keyword b"),f=c("keyword c"),d=c("operator"),
|
|||
|
o={type:"atom",style:"atom"},a={"if":c("if"),"while":a,"with":a,"else":b,"do":b,"try":b,"finally":b,"return":f,"break":f,"continue":f,"new":f,"delete":f,"throw":f,"debugger":f,"var":c("var"),"const":c("var"),let:c("var"),"function":c("function"),"catch":c("catch"),"for":c("for"),"switch":c("switch"),"case":c("case"),"default":c("default"),"in":d,"typeof":d,"instanceof":d,"true":o,"false":o,"null":o,undefined:o,NaN:o,Infinity:o,"this":c("this"),module:c("module"),"class":c("class"),"super":c("atom"),
|
|||
|
yield:f,"export":c("export"),"import":c("import"),"extends":f};if(ia){var b={type:"variable",style:"variable-3"},b={"interface":c("interface"),"extends":c("extends"),constructor:c("constructor"),"public":c("public"),"private":c("private"),"protected":c("protected"),"static":c("static"),string:b,number:b,bool:b,any:b},g;for(g in b)a[g]=b[g]}return a}(),W=/[+\-*&%=<>!?|~^]/,na=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,O,S,oa="([{}])",ha={atom:!0,number:!0,
|
|||
|
variable:!0,string:!0,regexp:!0,"this":!0,"jsonld-keyword":!0};q=m=l=null;x=void 0;var pa={name:"this",next:{name:"arguments"}};p.lex=!0;return{startState:function(c){c={tokenize:r,lastType:"sof",cc:[],lexical:new g((c||0)-M,0,"block",!1),localVars:h.localVars,context:h.localVars&&{vars:h.localVars},indented:0};h.globalVars&&"object"==typeof h.globalVars&&(c.globalVars=h.globalVars);return c},token:function(c,a){c.sol()&&(a.lexical.hasOwnProperty("align")||(a.lexical.align=!1),a.indented=c.indentation(),
|
|||
|
D(c,a));if(a.tokenize!=n&&c.eatSpace())return null;var b=a.tokenize(c,a);if("comment"==O)return b;a.lastType="operator"==O&&("++"==S||"--"==S)?"incdec":O;var f;a:{var d=O,o=S,g=a.cc;l=a;x=c;m=null;q=g;a.lexical.hasOwnProperty("align")||(a.lexical.align=!0);for(;;)if((g.length?g.pop():N?j:B)(d,o)){for(;g.length&&g[g.length-1].lex;)g.pop()();if(m){f=m;break a}if(f="variable"==d)b:{for(f=a.localVars;f;f=f.next)if(f.name==o){f=!0;break b}for(d=a.context;d;d=d.prev)for(f=d.vars;f;f=f.next)if(f.name==o){f=
|
|||
|
!0;break b}f=void 0}if(f){f="variable-2";break a}f=b;break a}}return f},indent:function(c,a){if(c.tokenize==n)return d.Pass;if(c.tokenize!=r)return 0;var b=a&&a.charAt(0),f=c.lexical;if(!/^\s*else\b/.test(a))for(var o=c.cc.length-1;0<=o;--o){var g=c.cc[o];if(g==p)f=f.prev;else if(g!=da)break}"stat"==f.type&&"}"==b&&(f=f.prev);la&&(")"==f.type&&"stat"==f.prev.type)&&(f=f.prev);o=f.type;g=b==o;return"vardef"==o?f.indented+("operator"==c.lastType||","==c.lastType?f.info+1:0):"form"==o&&"{"==b?f.indented:
|
|||
|
"form"==o?f.indented+M:"stat"==o?f.indented+("operator"==c.lastType||","==c.lastType?la||M:0):"switch"==f.info&&!g&&!1!=h.doubleIndentSwitch?f.indented+(/^(?:case|default)\b/.test(a)?M:2*M):f.align?f.column+(g?0:1):f.indented+(g?0:M)},electricChars:":{}",blockCommentStart:N?null:"/*",blockCommentEnd:N?null:"*/",lineComment:N?null:"//",fold:"brace",helperType:N?"json":"javascript",jsonldMode:T,jsonMode:N}});d.registerHelper("wordChars","javascript",/[\\w$]/);d.defineMIME("text/javascript","javascript");
|
|||
|
d.defineMIME("text/ecmascript","javascript");d.defineMIME("application/javascript","javascript");d.defineMIME("application/ecmascript","javascript");d.defineMIME("application/json",{name:"javascript",json:!0});d.defineMIME("application/x-json",{name:"javascript",json:!0});d.defineMIME("application/ld+json",{name:"javascript",jsonld:!0});d.defineMIME("text/typescript",{name:"javascript",typescript:!0});d.defineMIME("application/typescript",{name:"javascript",typescript:!0})});
|
|||
|
(function(d){"object"==typeof exports&&"object"==typeof module?d(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)})(function(d){function w(a){for(var b={},d=0;d<a.length;++d)b[a[d]]=!0;return b}function h(a,b){for(var d=!1,g;null!=(g=a.next());){if(d&&"/"==g){b.tokenize=null;break}d="*"==g}return["comment","comment"]}function q(a,b){a.skipTo("--\>")?(a.match("--\>"),b.tokenize=null):a.skipToEnd();return["comment","comment"]}d.defineMode("css",
|
|||
|
function(a,b){function g(c,a){P=a;return c}function k(c,a){var b=c.next();if(r[b]){var d=r[b](c,a);if(!1!==d)return d}if("@"==b)return c.eatWhile(/[\w\\\-]/),g("def",c.current());if("="==b||("~"==b||"|"==b)&&c.eat("="))return g(null,"compare");if('"'==b||"'"==b)return a.tokenize=l(b),a.tokenize(c,a);if("#"==b)return c.eatWhile(/[\w\\\-]/),g("atom","hash");if("!"==b)return c.match(/^\s*\w*/),g("keyword","important");if(/\d/.test(b)||"."==b&&c.eat(/\d/))return c.eatWhile(/[\w.%]/),g("number","unit");
|
|||
|
if("-"===b){if(/[\d.]/.test(c.peek()))return c.eatWhile(/[\w.%]/),g("number","unit");if(c.match(/^\w+-/))return g("meta","meta")}else return/[,+>*\/]/.test(b)?g(null,"select-op"):"."==b&&c.match(/^-?[_a-z][_a-z0-9-]*/i)?g("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(b)?g(null,b):"u"==b&&c.match("rl(")?(c.backUp(1),a.tokenize=C,g("property","word")):/[\w\\\-]/.test(b)?(c.eatWhile(/[\w\\\-]/),g("property","word")):g(null,null)}function l(c){return function(a,b){for(var d=!1,i;null!=(i=a.next());){if(i==
|
|||
|
c&&!d){")"==c&&a.backUp(1);break}d=!d&&"\\"==i}if(i==c||!d&&")"!=c)b.tokenize=null;return g("string","string")}}function C(c,a){c.next();a.tokenize=c.match(/\s*[\"\')]/,!1)?null:l(")");return g(null,"(")}function h(c,a,b){this.type=c;this.indent=a;this.prev=b}function j(c,a,b){c.context=new h(b,a.indentation()+t,c.context);return b}function n(c){c.context=c.context.prev;return c.context.type}function m(c,a,b,d){for(d=d||1;0<d;d--)b.context=b.context.prev;return E[b.context.type](c,a,b)}function q(c){c=
|
|||
|
c.current().toLowerCase();v=Y.hasOwnProperty(c)?"atom":D.hasOwnProperty(c)?"keyword":"variable"}b.propertyKeywords||(b=d.resolveMode("text/css"));var t=a.indentUnit,r=b.tokenHooks,i=b.mediaTypes||{},w=b.mediaFeatures||{},x=b.propertyKeywords||{},z=b.nonStandardPropertyKeywords||{},D=b.colorKeywords||{},Y=b.valueKeywords||{},$=b.fontProperties||{},J=b.allowNested,P,v,E={top:function(c,a,b){if("{"==c)return j(b,a,"block");if("}"==c&&b.context.prev)return n(b);if("@media"==c)return j(b,a,"media");if("@font-face"==
|
|||
|
c)return"font_face_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(c))return"keyframes";if(c&&"@"==c.charAt(0))return j(b,a,"at");if("hash"==c)v="builtin";else if("word"==c)v="tag";else{if("variable-definition"==c)return"maybeprop";if("interpolation"==c)return j(b,a,"interpolation");if(":"==c)return"pseudo";if(J&&"("==c)return j(b,a,"parens")}return b.context.type},block:function(c,a,b){if("word"==c){c=a.current().toLowerCase();if(x.hasOwnProperty(c))return v="property","maybeprop";if(z.hasOwnProperty(c))return v=
|
|||
|
"string-2","maybeprop";if(J)return v=a.match(/^\s*:/,!1)?"property":"tag","block";v+=" error";return"maybeprop"}return"meta"==c?"block":!J&&("hash"==c||"qualifier"==c)?(v="error","block"):E.top(c,a,b)},maybeprop:function(c,a,b){return":"==c?j(b,a,"prop"):E[b.context.type](c,a,b)},prop:function(c,a,b){if(";"==c)return n(b);if("{"==c&&J)return j(b,a,"propBlock");if("}"==c||"{"==c)return m(c,a,b);if("("==c)return j(b,a,"parens");if("hash"==c&&!/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(a.current()))v+=
|
|||
|
" error";else if("word"==c)q(a);else if("interpolation"==c)return j(b,a,"interpolation");return"prop"},propBlock:function(c,a,b){return"}"==c?n(b):"word"==c?(v="property","maybeprop"):b.context.type},parens:function(c,a,b){if("{"==c||"}"==c)return m(c,a,b);if(")"==c)return n(b);if("("==c)return j(b,a,"parens");"word"==c&&q(a);return"parens"},pseudo:function(c,a,b){return"word"==c?(v="variable-3",b.context.type):E[b.context.type](c,a,b)},media:function(c,a,b){if("("==c)return j(b,a,"media_parens");
|
|||
|
if("}"==c)return m(c,a,b);if("{"==c)return n(b)&&j(b,a,J?"block":"top");"word"==c&&(c=a.current().toLowerCase(),v="only"==c||"not"==c||"and"==c?"keyword":i.hasOwnProperty(c)?"attribute":w.hasOwnProperty(c)?"property":"error");return b.context.type},media_parens:function(c,a,b){return")"==c?n(b):"{"==c||"}"==c?m(c,a,b,2):E.media(c,a,b)},font_face_before:function(c,a,b){return"{"==c?j(b,a,"font_face"):E[b.context.type](c,a,b)},font_face:function(c,a,b){return"}"==c?n(b):"word"==c?(v=$.hasOwnProperty(a.current().toLowerCase())?
|
|||
|
"property":"error","maybeprop"):"font_face"},keyframes:function(c,a,b){return"word"==c?(v="variable","keyframes"):"{"==c?j(b,a,"top"):E[b.context.type](c,a,b)},at:function(c,b,a){if(";"==c)return n(a);if("{"==c||"}"==c)return m(c,b,a);"word"==c?v="tag":"hash"==c&&(v="builtin");return"at"},interpolation:function(c,a,b){if("}"==c)return n(b);if("{"==c||";"==c)return m(c,a,b);"variable"!=c&&(v="error");return"interpolation"}};return{startState:function(c){return{tokenize:null,state:"top",context:new h("top",
|
|||
|
c||0,null)}},token:function(c,b){if(!b.tokenize&&c.eatSpace())return null;var a=(b.tokenize||k)(c,b);a&&"object"==typeof a&&(P=a[1],a=a[0]);v=a;b.state=E[b.state](P,c,b);return v},indent:function(b,a){var d=b.context,g=a&&a.charAt(0),i=d.indent;if("prop"==d.type&&("}"==g||")"==g))d=d.prev;if(d.prev&&("}"==g&&("block"==d.type||"top"==d.type||"interpolation"==d.type||"font_face"==d.type)||")"==g&&("parens"==d.type||"media_parens"==d.type)||"{"==g&&("at"==d.type||"media"==d.type)))i=d.indent-t;return i},
|
|||
|
electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",fold:"brace"}});var l="all aural braille handheld print projection screen tty tv embossed".split(" "),m=w(l),x="width min-width max-width height min-height max-height device-width min-device-width max-device-width device-height min-device-height max-device-height aspect-ratio min-aspect-ratio max-aspect-ratio device-aspect-ratio min-device-aspect-ratio max-device-aspect-ratio color min-color max-color color-index min-color-index max-color-index monochrome min-monochrome max-monochrome resolution min-resolution max-resolution scan grid".split(" "),
|
|||
|
k=w(x),r="align-content align-items align-self alignment-adjust alignment-baseline anchor-point animation animation-delay animation-direction animation-duration animation-fill-mode animation-iteration-count animation-name animation-play-state animation-timing-function appearance azimuth backface-visibility background background-attachment background-clip background-color background-image background-origin background-position background-repeat background-size baseline-shift binding bleed bookmark-label bookmark-level bookmark-state bookmark-target border border-bottom border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-collapse border-color border-image border-image-outset border-image-repeat border-image-slice border-image-source border-image-width border-left border-left-color border-left-style border-left-width border-radius border-right border-right-color border-right-style border-right-width border-spacing border-style border-top border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width border-width bottom box-decoration-break box-shadow box-sizing break-after break-before break-inside caption-side clear clip color color-profile column-count column-fill column-gap column-rule column-rule-color column-rule-style column-rule-width column-span column-width columns content counter-increment counter-reset crop cue cue-after cue-before cursor direction display dominant-baseline drop-initial-after-adjust drop-initial-after-align drop-initial-before-adjust drop-initial-before-align drop-initial-size drop-initial-value elevation empty-cells fit fit-position flex flex-basis flex-direction flex-flow flex-grow flex-shrink flex-wrap float float-offset flow-from flow-into font font-feature-settings font-family font-kerning font-language-override font-size font-size-adjust font-stretch font-style font-synthesis font-variant font-variant-alternates font-variant-caps font-variant-east-asian font-variant-ligatures font-variant-numeric font-variant-position font-weight grid grid-area grid-auto-columns grid-auto-flow grid-auto-position grid-auto-rows grid-column grid-column-end grid-column-start grid-row grid-row-end grid-row-start grid-template grid-template-areas grid-template-columns grid-template-rows hanging-punctuation height hyphens icon image-orientation image-rendering image-resolution inline-box-align justify-content left letter-spacing line-break line-height line-stacking line-stacking-ruby line-stacking-shift line-stacking-strategy list-style list-style-image list-style-position list-style-type margin margin-bottom margin-left margin-right margin-top marker-offset marks marquee-direction marquee-loop marquee-play-count marquee-speed marquee-style max-height max-width min-height min-width move-to nav-down nav-index nav-left nav-right nav-up object-fit object-position opacity order orphans outline outline-color outline-offset outline-style outline-width overflow overflow-style overflow-wrap overflow-x overflow-y padding padding-bottom padding-left padding-right padding-top page page-break-after page-break-before page-break-inside page-policy pause pause-after pause-before perspective perspective-origin pitch pitch-range play-during position presentation-level punctuation-trim quotes region-break-after region-break-before region-break-inside region-fragment rendering-intent resize rest rest-after rest-before richness right rotation rotation-point ruby-align ruby-overhang ruby-position ruby-span shape-image-threshold shape-inside shape-margin shape-outside size speak speak-as speak-header speak-numeral speak-punctuation speech-rate stress string-set tab-size table-layout target target-name target-new target-position text-align text-align-last text-decoration text-decoration-color text-decoration-line text-decoration-skip text-decoration-style text-emphasis text-emphasis-color text-emphasis-position text-emphasis-style text-height text-indent text-justify text-outline text-overflow text-shadow text-size-adjust text-space-c
|
|||
|
C=w(r),n="scrollbar-arrow-color scrollbar-base-color scrollbar-dark-shadow-color scrollbar-face-color scrollbar-highlight-color scrollbar-shadow-color scrollbar-3d-light-color scrollbar-track-color shape-inside searchfield-cancel-button searchfield-decoration searchfield-results-button searchfield-results-decoration zoom".split(" "),n=w(n),z="aliceblue antiquewhite aqua aquamarine azure beige bisque black blanchedalmond blue blueviolet brown burlywood cadetblue chartreuse chocolate coral cornflowerblue cornsilk crimson cyan darkblue darkcyan darkgoldenrod darkgray darkgreen darkkhaki darkmagenta darkolivegreen darkorange darkorchid darkred darksalmon darkseagreen darkslateblue darkslategray darkturquoise darkviolet deeppink deepskyblue dimgray dodgerblue firebrick floralwhite forestgreen fuchsia gainsboro ghostwhite gold goldenrod gray grey green greenyellow honeydew hotpink indianred indigo ivory khaki lavender lavenderblush lawngreen lemonchiffon lightblue lightcoral lightcyan lightgoldenrodyellow lightgray lightgreen lightpink lightsalmon lightseagreen lightskyblue lightslategray lightsteelblue lightyellow lime limegreen linen magenta maroon mediumaquamarine mediumblue mediumorchid mediumpurple mediumseagreen mediumslateblue mediumspringgreen mediumturquoise mediumvioletred midnightblue mintcream mistyrose moccasin navajowhite navy oldlace olive olivedrab orange orangered orchid palegoldenrod palegreen paleturquoise palevioletred papayawhip peachpuff peru pink plum powderblue purple red rosybrown royalblue saddlebrown salmon sandybrown seagreen seashell sienna silver skyblue slateblue slategray snow springgreen steelblue tan teal thistle tomato turquoise violet wheat white whitesmoke yellow yellowgreen".split(" "),
|
|||
|
D=w(z),g="above absolute activeborder activecaption afar after-white-space ahead alias all all-scroll alternate always amharic amharic-abegede antialiased appworkspace arabic-indic armenian asterisks auto avoid avoid-column avoid-page avoid-region background backwards baseline below bidi-override binary bengali blink block block-axis bold bolder border border-box both bottom break break-all break-word button button-bevel buttonface buttonhighlight buttonshadow buttontext cambodian capitalize caps-lock-indicator caption captiontext caret cell center checkbox circle cjk-earthly-branch cjk-heavenly-stem cjk-ideographic clear clip close-quote col-resize collapse column compact condensed contain content content-box context-menu continuous copy cover crop cross crosshair currentcolor cursive dashed decimal decimal-leading-zero default default-button destination-atop destination-in destination-out destination-over devanagari disc discard document dot-dash dot-dot-dash dotted double down e-resize ease ease-in ease-in-out ease-out element ellipse ellipsis embed end ethiopic ethiopic-abegede ethiopic-abegede-am-et ethiopic-abegede-gez ethiopic-abegede-ti-er ethiopic-abegede-ti-et ethiopic-halehame-aa-er ethiopic-halehame-aa-et ethiopic-halehame-am-et ethiopic-halehame-gez ethiopic-halehame-om-et ethiopic-halehame-sid-et ethiopic-halehame-so-et ethiopic-halehame-ti-er ethiopic-halehame-ti-et ethiopic-halehame-tig ew-resize expanded extra-condensed extra-expanded fantasy fast fill fixed flat footnotes forwards from geometricPrecision georgian graytext groove gujarati gurmukhi hand hangul hangul-consonant hebrew help hidden hide higher highlight highlighttext hiragana hiragana-iroha horizontal hsl hsla icon ignore inactiveborder inactivecaption inactivecaptiontext infinite infobackground infotext inherit initial inline inline-axis inline-block inline-table inset inside intrinsic invert italic justify kannada katakana katakana-iroha keep-all khmer landscape lao large larger left level lighter line-through linear lines list-item listbox listitem local logical loud lower lower-alpha lower-armenian lower-greek lower-hexadecimal lower-latin lower-norwegian lower-roman lowercase ltr malayalam match media-controls-background media-current-time-display media-fullscreen-button media-mute-button media-play-button media-return-to-realtime-button media-rewind-button media-seek-back-button media-seek-forward-button media-slider media-sliderthumb media-time-remaining-display media-volume-slider media-volume-slider-container media-volume-sliderthumb medium menu menulist menulist-button menulist-text menulist-textfield menutext message-box middle min-intrinsic mix mongolian monospace move multiple myanmar n-resize narrower ne-resize nesw-resize no-close-quote no-drop no-open-quote no-repeat none normal not-allowed nowrap ns-resize nw-resize nwse-resize oblique octal open-quote optimizeLegibility optimizeSpeed oriya oromo outset outside outside-shape overlay overline padding padding-box painted page paused persian plus-darker plus-lighter pointer polygon portrait pre pre-line pre-wrap preserve-3d progress push-button radio read-only read-write read-write-plaintext-only rectangle region relative repeat repeat-x repeat-y reset reverse rgb rgba ridge right round row-resize rtl run-in running s-resize sans-serif scroll scrollbar se-resize searchfield searchfield-cancel-button searchfield-decoration searchfield-results-button searchfield-results-decoration semi-condensed semi-expanded separate serif show sidama single skip-white-space slide slider-horizontal slider-vertical sliderthumb-horizontal sliderthumb-vertical slow small small-caps small-caption smaller solid somali source-atop source-in source-out source-over space square square-button start static status-bar stretch stroke sub subpixel-antialiased super sw-resize table table-caption table-cell table-column table-column-group table-footer-group table-header-group table-row table-row-group telugu text text-bottom text-top textarea textfield thai thick thin threeddarkshadow threedface threedhighlig
|
|||
|
b=w(g),a=w("font-family src unicode-range font-variant font-feature-settings font-stretch font-weight font-style".split(" ")),l=l.concat(x).concat(r).concat(n).concat(z).concat(g);d.registerHelper("hintWords","css",l);d.defineMIME("text/css",{mediaTypes:m,mediaFeatures:k,propertyKeywords:C,nonStandardPropertyKeywords:n,colorKeywords:D,valueKeywords:b,fontProperties:a,tokenHooks:{"<":function(a,b){if(!a.match("!--"))return!1;b.tokenize=q;return q(a,b)},"/":function(a,b){if(!a.eat("*"))return!1;b.tokenize=
|
|||
|
h;return h(a,b)}},name:"css"});d.defineMIME("text/x-scss",{mediaTypes:m,mediaFeatures:k,propertyKeywords:C,nonStandardPropertyKeywords:n,colorKeywords:D,valueKeywords:b,fontProperties:a,allowNested:!0,tokenHooks:{"/":function(a,b){return a.eat("/")?(a.skipToEnd(),["comment","comment"]):a.eat("*")?(b.tokenize=h,h(a,b)):["operator","operator"]},":":function(a){return a.match(/\s*{/)?[null,"{"]:!1},$:function(a){a.match(/^[\w-]+/);return a.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2",
|
|||
|
"variable"]},"#":function(a){return!a.eat("{")?!1:[null,"interpolation"]}},name:"css",helperType:"scss"});d.defineMIME("text/x-less",{mediaTypes:m,mediaFeatures:k,propertyKeywords:C,nonStandardPropertyKeywords:n,colorKeywords:D,valueKeywords:b,fontProperties:a,allowNested:!0,tokenHooks:{"/":function(a,b){return a.eat("/")?(a.skipToEnd(),["comment","comment"]):a.eat("*")?(b.tokenize=h,h(a,b)):["operator","operator"]},"@":function(a){if(a.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/,
|
|||
|
!1))return!1;a.eatWhile(/[\w\\\-]/);return a.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"]},"&":function(){return["atom","atom"]}},name:"css",helperType:"less"})});
|
|||
|
(function(d){"object"==typeof exports&&"object"==typeof module?d(require("../../lib/codemirror"),require("../xml/xml"),require("../javascript/javascript"),require("../css/css")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml","../javascript/javascript","../css/css"],d):d(CodeMirror)})(function(d){d.defineMode("htmlmixed",function(w,h){function q(d,b){var a=b.htmlState.tagName,n=k.token(d,b.htmlState);if("script"==a&&/\btag\b/.test(n)&&">"==d.current()){(a=(a=d.string.slice(Math.max(0,
|
|||
|
d.pos-100),d.pos).match(/\btype\s*=\s*("[^"]+"|'[^']+'|\S+)[^<]*$/i))?a[1]:"")&&/[\"\']/.test(a.charAt(0))&&(a=a.slice(1,a.length-1));for(var l=0;l<C.length;++l){var h=C[l];if("string"==typeof h.matches?a==h.matches:h.matches.test(a)){h.mode&&(b.token=m,b.localMode=h.mode,b.localState=h.mode.startState&&h.mode.startState(k.indent(b.htmlState,"")));break}}}else"style"==a&&(/\btag\b/.test(n)&&">"==d.current())&&(b.token=x,b.localMode=r,b.localState=r.startState(k.indent(b.htmlState,"")));return n}function l(d,
|
|||
|
b,a){var h=d.current(),n=h.search(b);-1<n?d.backUp(h.length-n):h.match(/<\/?$/)&&(d.backUp(h.length),d.match(b,!1)||d.match(h));return a}function m(d,b){return d.match(/^<\/\s*script\s*>/i,!1)?(b.token=q,b.localState=b.localMode=null,q(d,b)):l(d,/<\/\s*script\s*>/,b.localMode.token(d,b.localState))}function x(d,b){return d.match(/^<\/\s*style\s*>/i,!1)?(b.token=q,b.localState=b.localMode=null,q(d,b)):l(d,/<\/\s*style\s*>/,r.token(d,b.localState))}var k=d.getMode(w,{name:"xml",htmlMode:!0,multilineTagIndentFactor:h.multilineTagIndentFactor,
|
|||
|
multilineTagIndentPastTag:h.multilineTagIndentPastTag}),r=d.getMode(w,"css"),C=[],n=h&&h.scriptTypes;C.push({matches:/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i,mode:d.getMode(w,"javascript")});if(n)for(var z=0;z<n.length;++z){var D=n[z];C.push({matches:D.matches,mode:D.mode&&d.getMode(w,D.mode)})}C.push({matches:/./,mode:d.getMode(w,"text/plain")});return{startState:function(){var d=k.startState();return{token:q,localMode:null,localState:null,htmlState:d}},copyState:function(g){if(g.localState)var b=
|
|||
|
d.copyState(g.localMode,g.localState);return{token:g.token,localMode:g.localMode,localState:b,htmlState:d.copyState(k,g.htmlState)}},token:function(d,b){return b.token(d,b)},indent:function(g,b){return!g.localMode||/^\s*<\//.test(b)?k.indent(g.htmlState,b):g.localMode.indent?g.localMode.indent(g.localState,b):d.Pass},innerMode:function(d){return{state:d.localState||d.htmlState,mode:d.localMode||k}}}},"xml","javascript","css");d.defineMIME("text/html","htmlmixed")});
|
|||
|
(function(d){"object"==typeof exports&&"object"==typeof module?d(require("../../lib/codemirror"),require("../htmlmixed/htmlmixed")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../htmlmixed/htmlmixed"],d):d(CodeMirror)})(function(d){d.defineMode("htmlembedded",function(w,h){function q(d,h){return d.match(m,!1)?(h.token=l,k.token(d,h.scriptState)):r.token(d,h.htmlState)}function l(d,h){return d.match(x,!1)?(h.token=q,r.token(d,h.htmlState)):k.token(d,h.scriptState)}var m=h.scriptStartRegex||
|
|||
|
/^<%/i,x=h.scriptEndRegex||/^%>/i,k,r;return{startState:function(){k=k||d.getMode(w,h.scriptingModeSpec);r=r||d.getMode(w,"htmlmixed");return{token:h.startOpen?l:q,htmlState:d.startState(r),scriptState:d.startState(k)}},token:function(d,h){return h.token(d,h)},indent:function(d,h){if(d.token==q)return r.indent(d.htmlState,h);if(k.indent)return k.indent(d.scriptState,h)},copyState:function(h){return{token:h.token,htmlState:d.copyState(r,h.htmlState),scriptState:d.copyState(k,h.scriptState)}},innerMode:function(d){return d.token==
|
|||
|
l?{state:d.scriptState,mode:k}:{state:d.htmlState,mode:r}}}},"htmlmixed");d.defineMIME("application/x-ejs",{name:"htmlembedded",scriptingModeSpec:"javascript"});d.defineMIME("application/x-aspx",{name:"htmlembedded",scriptingModeSpec:"text/x-csharp"});d.defineMIME("application/x-jsp",{name:"htmlembedded",scriptingModeSpec:"text/x-java"});d.defineMIME("application/x-erb",{name:"htmlembedded",scriptingModeSpec:"ruby"})});
|