forked from Gitlink/forgeplus
35 lines
61 KiB
JavaScript
Executable File
35 lines
61 KiB
JavaScript
Executable File
// 记录下从js_min_all移除的cm相关的脚本
|
||
|
||
|
||
// ----------------------------- ----------------------------- active-line.js
|
||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
||
!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";var t="CodeMirror-activeline",n="CodeMirror-activeline-background",i="CodeMirror-activeline-gutter";function r(e){for(var r=0;r<e.state.activeLines.length;r++)e.removeLineClass(e.state.activeLines[r],"wrap",t),e.removeLineClass(e.state.activeLines[r],"background",n),e.removeLineClass(e.state.activeLines[r],"gutter",i)}function o(e,o){for(var a=[],s=0;s<o.length;s++){var c=o[s],l=e.getOption("styleActiveLine");if("object"==typeof l&&l.nonEmpty?c.anchor.line==c.head.line:c.empty()){var f=e.getLineHandleVisualStart(c.head.line);a[a.length-1]!=f&&a.push(f)}}(function(e,t){if(e.length!=t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0})(e.state.activeLines,a)||e.operation(function(){r(e);for(var o=0;o<a.length;o++)e.addLineClass(a[o],"wrap",t),e.addLineClass(a[o],"background",n),e.addLineClass(a[o],"gutter",i);e.state.activeLines=a})}function a(e,t){o(e,t.ranges)}e.defineOption("styleActiveLine",!1,function(t,n,i){var s=i!=e.Init&&i;n!=s&&(s&&(t.off("beforeSelectionChange",a),r(t),delete t.state.activeLines),n&&(t.state.activeLines=[],o(t,t.listSelections()),t.on("beforeSelectionChange",a)))})});
|
||
|
||
// --------------------------------------------------------------------------------------
|
||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
||
// mode javascript
|
||
// TODO actually recognize syntax of TypeScript constructs
|
||
!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("javascript",function(t,r){var n,a,i=t.indentUnit,o=r.statementIndent,c=r.jsonld,l=r.json||c,u=r.typescript,f=r.wordCharacters||/[\w$\xa1-\uffff]/,s=function(){function e(e){return{type:e,style:"keyword"}}var t=e("keyword a"),r=e("keyword b"),n=e("keyword c"),a=e("operator"),i={type:"atom",style:"atom"},o={if:e("if"),while:t,with:t,else:r,do:r,try:r,finally:r,return:n,break:n,continue:n,new:n,delete:n,throw:n,debugger:n,var:e("var"),const:e("var"),let:e("var"),function:e("function"),catch:e("catch"),for:e("for"),switch:e("switch"),case:e("case"),default:e("default"),in:a,typeof:a,instanceof:a,true:i,false:i,null:i,undefined:i,NaN:i,Infinity:i,this:e("this"),module:e("module"),class:e("class"),super:e("atom"),yield:n,export:e("export"),import:e("import"),extends:n};if(u){var c={type:"variable",style:"variable-3"},l={interface:e("interface"),extends:e("extends"),constructor:e("constructor"),public:e("public"),private:e("private"),protected:e("protected"),static:e("static"),string:c,number:c,bool:c,any:c};for(var f in l)o[f]=l[f]}return o}(),d=/[+\-*&%=<>!?|~^]/,p=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function v(e,t,r){return n=e,a=r,t}function m(e,t){var r,n=e.next();if('"'==n||"'"==n)return t.tokenize=(r=n,function(e,t){var n,a=!1;if(c&&"@"==e.peek()&&e.match(p))return t.tokenize=m,v("jsonld-keyword","meta");for(;null!=(n=e.next())&&(n!=r||a);)a=!a&&"\\"==n;return a||(t.tokenize=m),v("string","string")}),t.tokenize(e,t);if("."==n&&e.match(/^\d+(?:[eE][+\-]?\d+)?/))return v("number","number");if("."==n&&e.match(".."))return v("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(n))return v(n);if("="==n&&e.eat(">"))return v("=>","operator");if("0"==n&&e.eat(/x/i))return e.eatWhile(/[\da-f]/i),v("number","number");if(/\d/.test(n))return e.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),v("number","number");if("/"==n)return e.eat("*")?(t.tokenize=y,y(e,t)):e.eat("/")?(e.skipToEnd(),v("comment","comment")):"operator"==t.lastType||"keyword c"==t.lastType||"sof"==t.lastType||/^[\[{}\(,;:]$/.test(t.lastType)?(function(e){for(var t,r=!1,n=!1;null!=(t=e.next());){if(!r){if("/"==t&&!n)return;"["==t?n=!0:n&&"]"==t&&(n=!1)}r=!r&&"\\"==t}}(e),e.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/),v("regexp","string-2")):(e.eatWhile(d),v("operator","operator",e.current()));if("`"==n)return t.tokenize=b,b(e,t);if("#"==n)return e.skipToEnd(),v("error","error");if(d.test(n))return e.eatWhile(d),v("operator","operator",e.current());if(f.test(n)){e.eatWhile(f);var a=e.current(),i=s.propertyIsEnumerable(a)&&s[a];return i&&"."!=t.lastType?v(i.type,i.style,a):v("variable","variable",a)}}function y(e,t){for(var r,n=!1;r=e.next();){if("/"==r&&n){t.tokenize=m;break}n="*"==r}return v("comment","comment")}function b(e,t){for(var r,n=!1;null!=(r=e.next());){if(!n&&("`"==r||"$"==r&&e.eat("{"))){t.tokenize=m;break}n=!n&&"\\"==r}return v("quasi","string-2",e.current())}var k="([{}])";function x(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var r=e.string.indexOf("=>",e.start);if(!(r<0)){for(var n=0,a=!1,i=r-1;i>=0;--i){var o=e.string.charAt(i),c=k.indexOf(o);if(c>=0&&c<3){if(!n){++i;break}if(0==--n)break}else if(c>=3&&c<6)++n;else if(f.test(o))a=!0;else{if(/["'\/]/.test(o))return;if(a&&!n){++i;break}}}a&&!n&&(t.fatArrowAt=i)}}var h={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,"jsonld-keyword":!0};function g(e,t,r,n,a,i){this.indented=e,this.column=t,this.type=r,this.prev=a,this.info=i,null!=n&&(this.align=n)}function w(e,t){for(var r=e.localVars;r;r=r.next)if(r.name==t)return!0;for(var n=e.context;n;n=n.prev)for(r=n.vars;r;r=r.next)if(r.name==t)return!0}var j={state:null,column:null,marked:null,cc:null};function M(){for(var e=arguments.length-1;e>=0;e--)j.cc.push(arguments[e])}function V(){return M.apply(null,arguments),!0}function E(e){function t(t){for(var r=t;r;r=r.next)if(r.name==e)return!0;return!1}var n=j.state;if(n.context){if(j.marked="def",t(n.localVars))return;n.localVars={name:e,next:n.localVars}}else{if(t(n.globalVars))return;r.globalVars&&(n.globalVars={name:e,next:n.globalVars})}}var I={name:"this",next:{name:"arguments"}};function z(){j.state.context={prev:j.state.context,vars:j.state.localVars},j.state.localVars=I}function T(){j.state.localVars=j.state.context.vars,j.state.context=j.state.context.prev}function A(e,t){var r=function(){var r=j.state,n=r.indented;if("stat"==r.lexical.type)n=r.lexical.indented;else for(var a=r.lexical;a&&")"==a.type&&a.align;a=a.prev)n=a.indented;r.lexical=new g(n,j.stream.column(),e,null,r.lexical,t)};return r.lex=!0,r}function C(){var e=j.state;e.lexical.prev&&(")"==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function $(e){return function t(r){return r==e?V():";"==e?M():V(t)}}function q(e,t){return"var"==e?V(A("vardef",t.length),te,$(";"),C):"keyword a"==e?V(A("form"),O,q,C):"keyword b"==e?V(A("form"),q,C):"{"==e?V(A("}"),Z,C):";"==e?V():"if"==e?("else"==j.state.lexical.info&&j.state.cc[j.state.cc.length-1]==C&&j.state.cc.pop()(),V(A("form"),O,q,C,oe)):"function"==e?V(de):"for"==e?V(A("form"),ce,q,C):"variable"==e?V(A("stat"),J):"switch"==e?V(A("form"),O,A("}","switch"),$("{"),Z,C,C):"case"==e?V(O,$(":")):"default"==e?V($(":")):"catch"==e?V(A("form"),z,$("("),pe,$(")"),q,C,T):"module"==e?V(A("form"),z,ke,T,C):"class"==e?V(A("form"),ve,C):"export"==e?V(A("form"),xe,C):"import"==e?V(A("form"),he,C):M(A("stat"),O,$(";"),C)}function O(e){return S(e,!1)}function P(e){return S(e,!0)}function S(e,t){if(j.state.fatArrowAt==j.stream.start){var r=t?G:F;if("("==e)return V(z,A(")"),X(re,")"),C,$("=>"),r,T);if("variable"==e)return M(z,re,$("=>"),r,T)}var n=t?U:H;return h.hasOwnProperty(e)?V(n):"function"==e?V(de,n):"keyword c"==e?V(t?N:W):"("==e?V(A(")"),W,Ve,$(")"),C,n):"operator"==e||"spread"==e?V(t?P:O):"["==e?V(A("]"),je,C,n):"{"==e?Y(L,"}",null,n):"quasi"==e?M(B,n):V()}function W(e){return e.match(/[;\}\)\],]/)?M():M(O)}function N(e){return e.match(/[;\}\)\],]/)?M():M(P)}function H(e,t){return","==e?V(O):U(e,t,!1)}function U(e,t,r){var n=0==r?H:U,a=0==r?O:P;return"=>"==e?V(z,r?G:F,T):"operator"==e?/\+\+|--/.test(t)?V(n):"?"==t?V(O,$(":"),a):V(a):"quasi"==e?M(B,n):";"!=e?"("==e?Y(P,")","call",n):"."==e?V(K,n):"["==e?V(A("]"),W,$("]"),C,n):void 0:void 0}function B(e,t){return"quasi"!=e?M():"${"!=t.slice(t.length-2)?V(B):V(O,D)}function D(e){if("}"==e)return j.marked="string-2",j.state.tokenize=b,V(B)}function F(e){return x(j.stream,j.state),M("{"==e?q:O)}function G(e){return x(j.stream,j.state),M("{"==e?q:P)}function J(e){return":"==e?V(C,q):M(H,$(";"),C)}function K(e){if("variable"==e)return j.marked="property",V()}function L(e,t){return"variable"==e||"keyword"==j.style?(j.marked="property",V("get"==t||"set"==t?Q:R)):"number"==e||"string"==e?(j.marked=c?"property":j.style+" property",V(R)):"jsonld-keyword"==e?V(R):"["==e?V(O,$("]"),R):void 0}function Q(e){return"variable"!=e?M(R):(j.marked="property",V(de))}function R(e){return":"==e?V(P):"("==e?M(de):void 0}function X(e,t){function r(n){if(","==n){var a=j.state.lexical;return"call"==a.info&&(a.pos=(a.pos||0)+1),V(e,r)}return n==t?V():V($(t))}return function(n){return n==t?V():M(e,r)}}function Y(e,t,r){for(var n=3;n<arguments.length;n++)j.cc.push(arguments[n]);return V(A(t,r),X(e,t),C)}function Z(e){return"}"==e?V():M(q,Z)}function _(e){if(u&&":"==e)return V(ee)}function ee(e){if("variable"==e)return j.marked="variable-3",V()}function te(){return M(re,_,ae,ie)}function re(e,t){return"variable"==e?(E(t),V()):"["==e?Y(re,"]"):"{"==e?Y(ne,"}"):void 0}function ne(e,t){return"variable"!=e||j.stream.match(/^\s*:/,!1)?("variable"==e&&(j.marked="property"),V($(":"),re,ae)):(E(t),V(ae))}function ae(e,t){if("="==t)return V(P)}function ie(e){if(","==e)return V(te)}function oe(e,t){if("keyword b"==e&&"else"==t)return V(A("form","else"),q,C)}function ce(e){if("("==e)return V(A(")"),le,$(")"),C)}function le(e){return"var"==e?V(te,$(";"),fe):";"==e?V(fe):"variable"==e?V(ue):M(O,$(";"),fe)}function ue(e,t){return"in"==t||"of"==t?(j.marked="keyword",V(O)):V(H,fe)}function fe(e,t){return";"==e?V(se):"in"==t||"of"==t?(j.marked="keyword",V(O)):M(O,$(";"),se)}function se(e){")"!=e&&V(O)}function de(e,t){return"*"==t?(j.marked="keyword",V(de)):"variable"==e?(E(t),V(de)):"("==e?V(z,A(")"),X(pe,")"),C,q,T):void 0}function pe(e){return"spread"==e?V(pe):M(re,_)}function ve(e,t){if("variable"==e)return E(t),V(me)}function me(e,t){return"extends"==t?V(O,me):"{"==e?V(A("}"),ye,C):void 0}function ye(e,t){return"variable"==e||"keyword"==j.style?(j.marked="property","get"==t||"set"==t?V(be,de,ye):V(de,ye)):"*"==t?(j.marked="keyword",V(ye)):";"==e?V(ye):"}"==e?V():void 0}function be(e){return"variable"!=e?M():(j.marked="property",V())}function ke(e,t){return"string"==e?V(q):"variable"==e?(E(t),V(we)):void 0}function xe(e,t){return"*"==t?(j.marked="keyword",V(we,$(";"))):"default"==t?(j.marked="keyword",V(O,$(";"))):M(q)}function he(e){return"string"==e?V():M(ge,we)}function ge(e,t){return"{"==e?Y(ge,"}"):("variable"==e&&E(t),V())}function we(e,t){if("from"==t)return j.marked="keyword",V(O)}function je(e){return"]"==e?V():M(P,Me)}function Me(e){return"for"==e?M(Ve,$("]")):","==e?V(X(N,"]")):M(X(P,"]"))}function Ve(e){return"for"==e?V(ce,Ve):"if"==e?V(O,Ve):void 0}return C.lex=!0,{startState:function(e){var t={tokenize:m,lastType:"sof",cc:[],lexical:new g((e||0)-i,0,"block",!1),localVars:r.localVars,context:r.localVars&&{vars:r.localVars},indented:0};return r.globalVars&&"object"==typeof r.globalVars&&(t.globalVars=r.globalVars),t},token:function(e,t){if(e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),x(e,t)),t.tokenize!=y&&e.eatSpace())return null;var r=t.tokenize(e,t);return"comment"==n?r:(t.lastType="operator"!=n||"++"!=a&&"--"!=a?n:"incdec",function(e,t,r,n,a){var i=e.cc;for(j.state=e,j.stream=a,j.marked=null,j.cc=i,j.style=t,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;)if((i.length?i.pop():l?O:q)(r,n)){for(;i.length&&i[i.length-1].lex;)i.pop()();return j.marked?j.marked:"variable"==r&&w(e,n)?"variable-2":t}}(t,r,n,a,e))},indent:function(t,n){if(t.tokenize==y)return e.Pass;if(t.tokenize!=m)return 0;var a=n&&n.charAt(0),c=t.lexical;if(!/^\s*else\b/.test(n))for(var l=t.cc.length-1;l>=0;--l){var u=t.cc[l];if(u==C)c=c.prev;else if(u!=oe)break}"stat"==c.type&&"}"==a&&(c=c.prev),o&&")"==c.type&&"stat"==c.prev.type&&(c=c.prev);var f=c.type,s=a==f;return"vardef"==f?c.indented+("operator"==t.lastType||","==t.lastType?c.info+1:0):"form"==f&&"{"==a?c.indented:"form"==f?c.indented+i:"stat"==f?c.indented+(function(e,t){return"operator"==e.lastType||","==e.lastType||d.test(t.charAt(0))||/[,.]/.test(t.charAt(0))}(t,n)?o||i:0):"switch"!=c.info||s||0==r.doubleIndentSwitch?c.align?c.column+(s?0:1):c.indented+(s?0:i):c.indented+(/^(?:case|default)\b/.test(n)?i:2*i)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:l?null:"/*",blockCommentEnd:l?null:"*/",lineComment:l?null:"//",fold:"brace",helperType:l?"json":"javascript",jsonldMode:c,jsonMode:l}}),e.registerHelper("wordChars","javascript",/[\w$]/),e.defineMIME("text/javascript","javascript"),e.defineMIME("text/ecmascript","javascript"),e.defineMIME("application/javascript","javascript"),e.defineMIME("application/x-javascript","javascript"),e.defineMIME("application/ecmascript","javascript"),e.defineMIME("application/json",{name:"javascript",json:!0}),e.defineMIME("application/x-json",{name:"javascript",json:!0}),e.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),e.defineMIME("text/typescript",{name:"javascript",typescript:!0}),e.defineMIME("application/typescript",{name:"javascript",typescript:!0})});
|
||
|
||
|
||
|
||
/*CodeMirror addon hint -----------------------------------------------Start*/
|
||
/* https://github.com/farzher/fuzzysort */
|
||
!function(e,r){"function"==typeof define&&define.amd?define([],r):"object"==typeof module&&module.exports?module.exports=r():e.fuzzysort=r()}(this,function(){var e="undefined"!=typeof require&&"undefined"==typeof window,r=new Map,n=new Map,o=[];o.total=0;var t=[],i=[];function a(){r.clear(),n.clear(),t=[],i=[]}function l(e){for(var r=-9007199254740991,n=e.length-1;n>=0;--n){var o=e[n];if(null!==o){var t=o.score;t>r&&(r=t)}}return-9007199254740991===r?null:r}function f(e,r){var n=e[r];if(void 0!==n)return n;var o=r;Array.isArray(r)||(o=r.split("."));for(var t=o.length,i=-1;e&&++i<t;)e=e[o[i]];return e}function u(e){return"object"==typeof e}var s=function(){var e=[],r=0,n={};function o(){for(var n=0,o=e[n],t=1;t<r;){var i=t+1;n=t,i<r&&e[i].score<e[t].score&&(n=i),e[n-1>>1]=e[n],t=1+(n<<1)}for(var a=n-1>>1;n>0&&o.score<e[a].score;a=(n=a)-1>>1)e[n]=e[a];e[n]=o}return n.add=function(n){var o=r;e[r++]=n;for(var t=o-1>>1;o>0&&n.score<e[t].score;t=(o=t)-1>>1)e[o]=e[t];e[o]=n},n.poll=function(){if(0!==r){var n=e[0];return e[0]=e[--r],o(),n}},n.peek=function(n){if(0!==r)return e[0]},n.replaceTop=function(r){e[0]=r,o()},n},p=s();return function d(c){var g={single:function(e,r,n){return e?(u(e)||(e=g.getPreparedSearch(e)),r?(u(r)||(r=g.getPrepared(r)),((n&&void 0!==n.allowTypo?n.allowTypo:!c||void 0===c.allowTypo||c.allowTypo)?g.algorithm:g.algorithmNoTypo)(e,r,e[0])):null):null},go:function(e,r,n){if(!e)return o;var t=(e=g.prepareSearch(e))[0],i=n&&n.threshold||c&&c.threshold||-9007199254740991,a=n&&n.limit||c&&c.limit||9007199254740991,s=(n&&void 0!==n.allowTypo?n.allowTypo:!c||void 0===c.allowTypo||c.allowTypo)?g.algorithm:g.algorithmNoTypo,d=0,v=0,h=r.length;if(n&&n.keys)for(var w=n.scoreFn||l,x=n.keys,y=x.length,m=h-1;m>=0;--m){for(var T=r[m],k=new Array(y),b=y-1;b>=0;--b)(_=f(T,B=x[b]))?(u(_)||(_=g.getPrepared(_)),k[b]=s(e,_,t)):k[b]=null;k.obj=T;var I=w(k);null!==I&&(I<i||(k.score=I,d<a?(p.add(k),++d):(++v,I>p.peek().score&&p.replaceTop(k))))}else if(n&&n.key){var B=n.key;for(m=h-1;m>=0;--m)(_=f(T=r[m],B))&&(u(_)||(_=g.getPrepared(_)),null!==(C=s(e,_,t))&&(C.score<i||(C={target:C.target,_targetLowerCodes:null,_nextBeginningIndexes:null,score:C.score,indexes:C.indexes,obj:T},d<a?(p.add(C),++d):(++v,C.score>p.peek().score&&p.replaceTop(C)))))}else for(m=h-1;m>=0;--m){var _,C;(_=r[m])&&(u(_)||(_=g.getPrepared(_)),null!==(C=s(e,_,t))&&(C.score<i||(d<a?(p.add(C),++d):(++v,C.score>p.peek().score&&p.replaceTop(C)))))}if(0===d)return o;var A=new Array(d);for(m=d-1;m>=0;--m)A[m]=p.poll();return A.total=d+v,A},goAsync:function(r,n,t){var i=!1,a=new Promise(function(a,p){if(!r)return a(o);var d=(r=g.prepareSearch(r))[0],v=s(),h=n.length-1,w=t&&t.threshold||c&&c.threshold||-9007199254740991,x=t&&t.limit||c&&c.limit||9007199254740991,y=(t&&void 0!==t.allowTypo?t.allowTypo:!c||void 0===c.allowTypo||c.allowTypo)?g.algorithm:g.algorithmNoTypo,m=0,T=0;function k(){if(i)return p("canceled");var s=Date.now();if(t&&t.keys)for(var c=t.scoreFn||l,b=t.keys,I=b.length;h>=0;--h){for(var B=n[h],_=new Array(I),C=I-1;C>=0;--C)(P=f(B,L=b[C]))?(u(P)||(P=g.getPrepared(P)),_[C]=y(r,P,d)):_[C]=null;_.obj=B;var A=c(_);if(null!==A&&!(A<w)&&(_.score=A,m<x?(v.add(_),++m):(++T,A>v.peek().score&&v.replaceTop(_)),h%1e3==0&&Date.now()-s>=10))return void(e?setImmediate(k):setTimeout(k))}else if(t&&t.key){for(var L=t.key;h>=0;--h)if((P=f(B=n[h],L))&&(u(P)||(P=g.getPrepared(P)),null!==(j=y(r,P,d))&&!(j.score<w)&&(j={target:j.target,_targetLowerCodes:null,_nextBeginningIndexes:null,score:j.score,indexes:j.indexes,obj:B},m<x?(v.add(j),++m):(++T,j.score>v.peek().score&&v.replaceTop(j)),h%1e3==0&&Date.now()-s>=10)))return void(e?setImmediate(k):setTimeout(k))}else for(;h>=0;--h){var P,j;if((P=n[h])&&(u(P)||(P=g.getPrepared(P)),null!==(j=y(r,P,d))&&!(j.score<w)&&(m<x?(v.add(j),++m):(++T,j.score>v.peek().score&&v.replaceTop(j)),h%1e3==0&&Date.now()-s>=10)))return void(e?setImmediate(k):setTimeout(k))}if(0===m)return a(o);for(var N=new Array(m),S=m-1;S>=0;--S)N[S]=v.poll();N.total=m+T,a(N)}e?setImmediate(k):k()});return a.cancel=function(){i=!0},a},highlight:function(e,r,n){if(null===e)return null;void 0===r&&(r="<b>"),void 0===n&&(n="</b>");for(var o="",t=0,i=!1,a=e.target,l=a.length,f=e.indexes,u=0;u<l;++u){var s=a[u];if(f[t]===u){if(i||(i=!0,o+=r),++t===f.length){o+=s+n+a.substr(u+1);break}}else i&&(i=!1,o+=n);o+=s}return o},prepare:function(e){if(e)return{target:e,_targetLowerCodes:g.prepareLowerCodes(e),_nextBeginningIndexes:null,score:null,indexes:null,obj:null}},prepareSlow:function(e){if(e)return{target:e,_targetLowerCodes:g.prepareLowerCodes(e),_nextBeginningIndexes:g.prepareNextBeginningIndexes(e),score:null,indexes:null,obj:null}},prepareSearch:function(e){if(e)return g.prepareLowerCodes(e)},getPrepared:function(e){if(e.length>999)return g.prepare(e);var n=r.get(e);return void 0!==n?n:(n=g.prepare(e),r.set(e,n),n)},getPreparedSearch:function(e){if(e.length>999)return g.prepareSearch(e);var r=n.get(e);return void 0!==r?r:(r=g.prepareSearch(e),n.set(e,r),r)},algorithm:function(e,r,n){for(var o=r._targetLowerCodes,a=e.length,l=o.length,f=0,u=0,s=0,p=0;;){if(n===o[u]){if(t[p++]=u,++f===a)break;n=e[0===s?f:s===f?f+1:s===f-1?f-1:f]}if(++u>=l)for(;;){if(f<=1)return null;if(0===s){if(n===e[--f])continue;s=f}else{if(1===s)return null;if((n=e[1+(f=--s)])===e[f])continue}u=t[(p=f)-1]+1;break}}f=0;var d=0,c=!1,v=0,h=r._nextBeginningIndexes;null===h&&(h=r._nextBeginningIndexes=g.prepareNextBeginningIndexes(r.target));var w=u=0===t[0]?0:h[t[0]-1];if(u!==l)for(;;)if(u>=l){if(f<=0){if(++d>a-2)break;if(e[d]===e[d+1])continue;u=w;continue}--f,u=h[i[--v]]}else if(e[0===d?f:d===f?f+1:d===f-1?f-1:f]===o[u]){if(i[v++]=u,++f===a){c=!0;break}++u}else u=h[u];if(c)var x=i,y=v;else x=t,y=p;for(var m=0,T=-1,k=0;k<a;++k)T!==(u=x[k])-1&&(m-=u),T=u;for(c?0!==d&&(m+=-20):(m*=1e3,0!==s&&(m+=-20)),m-=l-a,r.score=m,r.indexes=new Array(y),k=y-1;k>=0;--k)r.indexes[k]=x[k];return r},algorithmNoTypo:function(e,r,n){for(var o=r._targetLowerCodes,a=e.length,l=o.length,f=0,u=0,s=0;;){if(n===o[u]){if(t[s++]=u,++f===a)break;n=e[f]}if(++u>=l)return null}f=0;var p=!1,d=0,c=r._nextBeginningIndexes;if(null===c&&(c=r._nextBeginningIndexes=g.prepareNextBeginningIndexes(r.target)),(u=0===t[0]?0:c[t[0]-1])!==l)for(;;)if(u>=l){if(f<=0)break;--f,u=c[i[--d]]}else if(e[f]===o[u]){if(i[d++]=u,++f===a){p=!0;break}++u}else u=c[u];if(p)var v=i,h=d;else v=t,h=s;for(var w=0,x=-1,y=0;y<a;++y)x!==(u=v[y])-1&&(w-=u),x=u;for(p||(w*=1e3),w-=l-a,r.score=w,r.indexes=new Array(h),y=h-1;y>=0;--y)r.indexes[y]=v[y];return r},prepareLowerCodes:function(e){for(var r=e.length,n=[],o=e.toLowerCase(),t=0;t<r;++t)n[t]=o.charCodeAt(t);return n},prepareBeginningIndexes:function(e){for(var r=e.length,n=[],o=0,t=!1,i=!1,a=0;a<r;++a){var l=e.charCodeAt(a),f=l>=65&&l<=90,u=f||l>=97&&l<=122||l>=48&&l<=57,s=f&&!t||!i||!u;t=f,i=u,s&&(n[o++]=a)}return n},prepareNextBeginningIndexes:function(e){for(var r=e.length,n=g.prepareBeginningIndexes(e),o=[],t=n[0],i=0,a=0;a<r;++a)t>a?o[a]=t:(t=n[++i],o[a]=void 0===t?r:t);return o},cleanup:a,new:d};return g}()});
|
||
/* showHint */
|
||
!function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)}(function(t){"use strict";var i="CodeMirror-hint",e="CodeMirror-hint-active";function n(t,i){this.cm=t,this.options=i,this.widget=null,this.debounce=0,this.tick=0,this.startPos=this.cm.getCursor("start"),this.startLen=this.cm.getLine(this.startPos.line).length-this.cm.getSelection().length;var e=this;t.on("cursorActivity",this.activityFunc=function(){e.cursorActivity()})}t.showHint=function(t,i,e){if(!i)return t.showHint(e);e&&e.async&&(i.async=!0);var n={hint:i};if(e)for(var o in e)n[o]=e[o];return t.showHint(n)},t.defineExtension("showHint",function(i){i=function(t,i,e){var n=t.options.hintOptions,o={};for(var s in a)o[s]=a[s];if(n)for(var s in n)void 0!==n[s]&&(o[s]=n[s]);if(e)for(var s in e)void 0!==e[s]&&(o[s]=e[s]);o.hint.resolve&&(o.hint=o.hint.resolve(t,i));return o}(this,this.getCursor("start"),i);var e=this.listSelections();if(!(e.length>1)){if(this.somethingSelected()){if(!i.hint.supportsSelection)return;for(var o=0;o<e.length;o++)if(e[o].head.line!=e[o].anchor.line)return}this.state.completionActive&&this.state.completionActive.close();var s=this.state.completionActive=new n(this,i);s.options.hint&&(t.signal(this,"startCompletion",this),s.update(!0))}});var o=window.requestAnimationFrame||function(t){return setTimeout(t,1e3/60)},s=window.cancelAnimationFrame||clearTimeout;function c(t){return"string"==typeof t?t:t.text}function r(t,i){for(;i&&i!=t;){if("LI"===i.nodeName.toUpperCase()&&i.parentNode==t)return i;i=i.parentNode}}function h(n,o){this.completion=n,this.data=o,this.picked=!1;var s=this,h=n.cm,l=this.hints=document.createElement("ul");l.className="CodeMirror-hints",this.selectedHint=o.selectedHint||0;for(var a=o.list,f=0;f<a.length;++f){var u=l.appendChild(document.createElement("li")),d=a[f],p=i+(f!=this.selectedHint?"":" "+e);null!=d.className&&(p=d.className+" "+p),u.className=p,d.render?d.render(u,o,d):u.appendChild(document.createTextNode(d.displayText||c(d))),u.hintId=f}var m=h.cursorCoords(n.options.alignWithWord?o.from:null),g=m.left,v=m.bottom,y=!0;l.style.left=g+"px",l.style.top=v+"px";var w=window.innerWidth||Math.max(document.body.offsetWidth,document.documentElement.offsetWidth),H=window.innerHeight||Math.max(document.body.offsetHeight,document.documentElement.offsetHeight);(n.options.container||document.body).appendChild(l);var k=l.getBoundingClientRect(),C=k.bottom-H,b=l.scrollHeight>l.clientHeight+1,x=h.getScrollInfo();if(C>0){var A=k.bottom-k.top;if(m.top-(m.bottom-k.top)-A>0)l.style.top=(v=m.top-A)+"px",y=!1;else if(A>H){l.style.height=H-5+"px",l.style.top=(v=m.bottom-k.top)+"px";var S=h.getCursor();o.from.ch!=S.ch&&(m=h.cursorCoords(S),l.style.left=(g=m.left)+"px",k=l.getBoundingClientRect())}}var T,M=k.right-w;if(M>0&&(k.right-k.left>w&&(l.style.width=w-5+"px",M-=k.right-k.left-w),l.style.left=(g=m.left-M)+"px"),b)for(var E=l.firstChild;E;E=E.nextSibling)E.style.paddingRight=h.display.nativeBarWidth+"px";(h.addKeyMap(this.keyMap=function(t,i){var e={Up:function(){i.moveFocus(-1)},Down:function(){i.moveFocus(1)},PageUp:function(){i.moveFocus(1-i.menuSize(),!0)},PageDown:function(){i.moveFocus(i.menuSize()-1,!0)},Home:function(){i.setFocus(0)},End:function(){i.setFocus(i.length-1)},Enter:i.pick,Tab:i.pick,Esc:i.close},n=t.options.customKeys,o=n?{}:e;function s(t,n){var s;s="string"!=typeof n?function(t){return n(t,i)}:e.hasOwnProperty(n)?e[n]:n,o[t]=s}if(n)for(var c in n)n.hasOwnProperty(c)&&s(c,n[c]);var r=t.options.extraKeys;if(r)for(var c in r)r.hasOwnProperty(c)&&s(c,r[c]);return o}(n,{moveFocus:function(t,i){s.changeActive(s.selectedHint+t,i)},setFocus:function(t){s.changeActive(t)},menuSize:function(){return s.screenAmount()},length:a.length,close:function(){n.close()},pick:function(){s.pick()},data:o})),n.options.closeOnUnfocus)&&(h.on("blur",this.onBlur=function(){T=setTimeout(function(){n.close()},100)}),h.on("focus",this.onFocus=function(){clearTimeout(T)}));return h.on("scroll",this.onScroll=function(){var t=h.getScrollInfo(),i=h.getWrapperElement().getBoundingClientRect(),e=v+x.top-t.top,o=e-(window.pageYOffset||(document.documentElement||document.body).scrollTop);if(y||(o+=l.offsetHeight),o<=i.top||o>=i.bottom)return n.close();l.style.top=e+"px",l.style.left=g+x.left-t.left+"px"}),t.on(l,"dblclick",function(t){var i=r(l,t.target||t.srcElement);i&&null!=i.hintId&&(s.changeActive(i.hintId),s.pick())}),t.on(l,"click",function(t){var i=r(l,t.target||t.srcElement);i&&null!=i.hintId&&(s.changeActive(i.hintId),n.options.completeOnSingleClick&&s.pick())}),t.on(l,"mousedown",function(){setTimeout(function(){h.focus()},20)}),t.signal(o,"select",a[0],l.firstChild),!0}function l(t,i,e,n){if(t.async)t(i,n,e);else{var o=t(i,e);o&&o.then?o.then(n):n(o)}}n.prototype={close:function(){this.active()&&(this.cm.state.completionActive=null,this.tick=null,this.cm.off("cursorActivity",this.activityFunc),this.widget&&this.data&&t.signal(this.data,"close"),this.widget&&this.widget.close(),t.signal(this.cm,"endCompletion",this.cm))},active:function(){return this.cm.state.completionActive==this},pick:function(i,e){var n=i.list[e];n.hint?n.hint(this.cm,i,n):this.cm.replaceRange(c(n),n.from||i.from,n.to||i.to,"complete"),t.signal(i,"pick",n),this.close()},cursorActivity:function(){this.debounce&&(s(this.debounce),this.debounce=0);var t=this.cm.getCursor(),i=this.cm.getLine(t.line);if(t.line!=this.startPos.line||i.length-t.ch!=this.startLen-this.startPos.ch||t.ch<this.startPos.ch||this.cm.somethingSelected()||t.ch&&this.options.closeCharacters.test(i.charAt(t.ch-1)))this.close();else{var e=this;this.debounce=o(function(){e.update()}),this.widget&&this.widget.disable()}},update:function(t){if(null!=this.tick){var i=this,e=++this.tick;l(this.options.hint,this.cm,this.options,function(n){i.tick==e&&i.finishUpdate(n,t)})}},finishUpdate:function(i,e){this.data&&t.signal(this.data,"update");var n,o,s=this.widget&&this.widget.picked;if((this.widget&&this.widget.close(),!(i&&this.data&&(n=this.data,o=i,t.cmpPos(o.from,n.from)>0&&n.to.ch-n.from.ch!=o.to.ch-o.from.ch)))&&(this.data=i,i&&i.list.length))if(s&&1==i.list.length)this.pick(i,0);else{if(1==i.list.length&&i.to.ch-i.from.ch===i.list[0].length)return;this.widget=new h(this,i),t.signal(i,"shown")}}},h.prototype={close:function(){if(this.completion.widget==this){this.completion.widget=null,this.hints.parentNode.removeChild(this.hints),this.completion.cm.removeKeyMap(this.keyMap);var t=this.completion.cm;this.completion.options.closeOnUnfocus&&(t.off("blur",this.onBlur),t.off("focus",this.onFocus)),t.off("scroll",this.onScroll)}},disable:function(){this.completion.cm.removeKeyMap(this.keyMap);var t=this;this.keyMap={Enter:function(){t.picked=!0}},this.completion.cm.addKeyMap(this.keyMap)},pick:function(){this.completion.pick(this.data,this.selectedHint)},changeActive:function(i,n){if(i>=this.data.list.length?i=n?this.data.list.length-1:0:i<0&&(i=n?0:this.data.list.length-1),this.selectedHint!=i){var o=this.hints.childNodes[this.selectedHint];o.className=o.className.replace(" "+e,""),(o=this.hints.childNodes[this.selectedHint=i]).className+=" "+e,o.offsetTop<this.hints.scrollTop?this.hints.scrollTop=o.offsetTop-3:o.offsetTop+o.offsetHeight>this.hints.scrollTop+this.hints.clientHeight&&(this.hints.scrollTop=o.offsetTop+o.offsetHeight-this.hints.clientHeight+3),t.signal(this.data,"select",this.data.list[this.selectedHint],o)}},screenAmount:function(){return Math.floor(this.hints.clientHeight/this.hints.firstChild.offsetHeight)||1}},t.registerHelper("hint","auto",{resolve:function(i,e){var n,o=i.getHelpers(e,"hint");if(o.length){var s=function(t,i,e){var n=function(t,i){if(!t.somethingSelected())return i;for(var e=[],n=0;n<i.length;n++)i[n].supportsSelection&&e.push(i[n]);return e}(t,o);!function o(s){if(s==n.length)return i(null);l(n[s],t,e,function(t){t&&t.list.length>0?i(t):o(s+1)})}(0)};return s.async=!0,s.supportsSelection=!0,s}if(n=i.getHelper(i.getCursor(),"hintWords")){t.signal(i,"hinting",n);var c=i.state.myhints,r=n.slice(0);return c&&c.forEach(function(t){-1===n.indexOf(t)&&r.push(t)}),function(i){return t.hint.fromList(i,{words:r})}}return t.hint.anyword?function(i,e){return t.hint.anyword(i,e)}:function(){}}}),t.registerHelper("hint","fromList",function(i,e){var n=i.getCursor(),o=i.getTokenAt(n),s=t.Pos(n.line,o.end);if(o.string&&/\w/.test(o.string[o.string.length-1]))var c=o.string,r=t.Pos(n.line,o.start);else c="",r=s;var h=[];if(fuzzysort&&fuzzysort.go){var l=fuzzysort.go(c,e.words);l&&l.forEach(function(t){h.push(t.target)})}else for(var a=0;a<e.words.length;a++){var f=e.words[a];f.slice(0,c.length)==c&&h.push(f)}if(h.length)return{list:h,from:r,to:s}}),t.commands.autocomplete=t.showHint;var a={hint:t.hint.auto,completeSingle:!0,alignWithWord:!0,closeCharacters:/[\s()\[\]{};:>,]/,closeOnUnfocus:!0,completeOnSingleClick:!0,container:null,customKeys:null,extraKeys:null};t.defineOption("hintOptions",null)});
|
||
/* javascript-hint 注释掉,使得show-hint.js 的resolveAutoHints方法进入这个判断:} else if (words = cm.getHelper(cm.getCursor(), "hintWords")) { */
|
||
// !function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)}(function(t){var e=t.Pos;function r(t,e){for(var r=0,n=t.length;r<n;++r)e(t[r])}function n(t,e){if(!Array.prototype.indexOf){for(var r=t.length;r--;)if(t[r]===e)return!0;return!1}return-1!=t.indexOf(e)}function i(i,o,s,a){var f=i.getCursor(),c=s(i,f);if(!/\b(?:string|comment)\b/.test(c.type)){c.state=t.innerMode(i.getMode(),c.state).state,/^[\w$_]*$/.test(c.string)?c.end>f.ch&&(c.end=f.ch,c.string=c.string.slice(0,f.ch-c.start)):c={start:f.ch,end:f.ch,string:"",state:c.state,type:"."==c.string?"property":null};for(var p=c;"property"==p.type;){if("."!=(p=s(i,e(f.line,p.start))).string)return;if(p=s(i,e(f.line,p.start)),!l)var l=[];l.push(p)}t.signal(i,"hinting");var u=i.state.myhints;return i.state.needToClearJSHint&&(o=[],i.state.needToClearJSHint=!1),u&&u.forEach(function(t){n(o,t)||o.push(t)}),{list:function(t,e,i,o){var s=[],a=t.string,f=o&&o.globalScope||window;function c(t){if(fuzzysort&&fuzzysort.single){var e=fuzzysort.single(a,t);e&&e.score<=0&&!n(s,t)&&s.push(t)}else 0!=t.lastIndexOf(a,0)||n(s,t)||s.push(t)}if(e&&e.length){var p,l=e.pop();for(l.type&&0===l.type.indexOf("variable")?(o&&o.additionalContext&&(p=o.additionalContext[l.string]),o&&!1===o.useGlobalScope||(p=p||f[l.string])):"string"==l.type?p="":"atom"==l.type?p=1:"function"==l.type&&(null==f.jQuery||"$"!=l.string&&"jQuery"!=l.string||"function"!=typeof f.jQuery?null!=f._&&"_"==l.string&&"function"==typeof f._&&(p=f._()):p=f.jQuery());null!=p&&e.length;)p=p[e.pop().string];null!=p&&function(t){"string"==typeof t?r(stringProps,c):t instanceof Array?r(arrayProps,c):t instanceof Function&&r(funcProps,c);!function(t,e){if(Object.getOwnPropertyNames&&Object.getPrototypeOf)for(var r=t;r;r=Object.getPrototypeOf(r))Object.getOwnPropertyNames(r).forEach(e);else for(var n in t)e(n)}(t,c)}(p)}else{var u=fuzzysort.go(a,i);u&&u.forEach(function(t){s.push(t.target)})}return s}(c,l,o,a),from:e(f.line,c.start),to:e(f.line,c.end)}}}function o(t,e){var r=t.getTokenAt(e);return e.ch==r.start+1&&"."==r.string.charAt(0)?(r.end=r.start,r.string=".",r.type="property"):/^\.[\w$_]*$/.test(r.string)&&(r.type="property",r.start++,r.string=r.string.replace(/\./,"")),r}t.registerHelper("hint","javascript",function(t,e){return i(t,s,function(t,e){return t.getTokenAt(e)},e)}),t.registerHelper("hint","coffeescript",function(t,e){return i(t,coffeescriptKeywords,o,e)});var s="double float int long short null true false enum super this void auto for register static const friend mutable explicit virtual template typename printf break continue return do while if else for instanceof switch case default try catch finally throw throws assert import package boolean byte char delete private inline struct union signed unsigned export extern namespace using operator sizeof typedef typeid and del from not as elif or with pass except print exec raise is def lambda private protected public abstract class extends final implements interface native new static strictfp synchronized transient main String string System println vector bool boolean FALSE TRUE function".split(" ")});
|
||
/* anyword-hint */
|
||
!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";var r=/[\w$]+/;e.registerHelper("hint","anyword",function(t,o){for(var i=o&&o.word||r,n=o&&o.range||500,f=t.getCursor(),s=t.getLine(f.line),a=f.ch,c=a;c&&i.test(s.charAt(c-1));)--c;for(var l=c!=a&&s.slice(c,a),d=o&&o.list||[],u={},p=new RegExp(i.source,"g"),g=-1;g<=1;g+=2)for(var h=f.line,m=Math.min(Math.max(h+g*n,t.firstLine()),t.lastLine())+g;h!=m;h+=g)for(var y,b=t.getLine(h);y=p.exec(b);)h==f.line&&y[0]===l||l&&0!=y[0].lastIndexOf(l,0)||Object.prototype.hasOwnProperty.call(u,y[0])||(u[y[0]]=!0,d.push(y[0]));return{list:d,from:e.Pos(f.line,c),to:e.Pos(f.line,a)}})});
|
||
/*CodeMirror addon hint -----------------------------------------------End*/
|
||
|
||
// CodeMirror python
|
||
!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){return new RegExp("^(("+e.join(")|(")+"))\\b")}var n=t(["and","or","not","is"]),r=["as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","lambda","pass","raise","return","try","while","with","yield","in"],i=["abs","all","any","bin","bool","bytearray","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip","__import__","NotImplemented","Ellipsis","__debug__"];function o(e){return e.scopes[e.scopes.length-1]}e.registerHelper("hintWords","python",r.concat(i)),e.defineMode("python",function(a,s){for(var c="error",l=s.delimiters||s.singleDelimiters||/^[\(\)\[\]\{\}@,:`=;\.\\]/,u=[s.singleOperators,s.doubleOperators,s.doubleDelimiters,s.tripleDelimiters,s.operators||/^([-+*/%\/&|^]=?|[<>=]+|\/\/=?|\*\*=?|!=|[~!@])/],f=0;f<u.length;f++)u[f]||u.splice(f--,1);var p=s.hangingIndent||a.indentUnit,d=r,m=i;null!=s.extra_keywords&&(d=d.concat(s.extra_keywords)),null!=s.extra_builtins&&(m=m.concat(s.extra_builtins));var h=!(s.version&&Number(s.version)<3);if(h){var b=s.identifiers||/^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*/;d=d.concat(["nonlocal","False","True","None","async","await"]),m=m.concat(["ascii","bytes","exec","print"]);var y=new RegExp("^(([rbuf]|(br)|(fr))?('{3}|\"{3}|['\"]))","i")}else{b=s.identifiers||/^[_A-Za-z][_A-Za-z0-9]*/;d=d.concat(["exec","print"]),m=m.concat(["apply","basestring","buffer","cmp","coerce","execfile","file","intern","long","raw_input","reduce","reload","unichr","unicode","xrange","False","True","None"]);y=new RegExp("^(([rubf]|(ur)|(br))?('{3}|\"{3}|['\"]))","i")}var g=t(d),k=t(m);function x(e,t){var n=e.sol()&&"\\"!=t.lastToken;if(n&&(t.indent=e.indentation()),n&&"py"==o(t).type){var r=o(t).offset;if(e.eatSpace()){var i=e.indentation();return i>r?_(t):i<r&&z(e,t)&&"#"!=e.peek()&&(t.errorToken=!0),null}var a=v(e,t);return r>0&&z(e,t)&&(a+=" "+c),a}return v(e,t)}function v(e,t){if(e.eatSpace())return null;if(e.match(/^#.*/))return"comment";if(e.match(/^[0-9\.]/,!1)){var r=!1;if(e.match(/^[\d_]*\.\d+(e[\+\-]?\d+)?/i)&&(r=!0),e.match(/^[\d_]+\.\d*/)&&(r=!0),e.match(/^\.\d+/)&&(r=!0),r)return e.eat(/J/i),"number";var i=!1;if(e.match(/^0x[0-9a-f_]+/i)&&(i=!0),e.match(/^0b[01_]+/i)&&(i=!0),e.match(/^0o[0-7_]+/i)&&(i=!0),e.match(/^[1-9][\d_]*(e[\+\-]?[\d_]+)?/)&&(e.eat(/J/i),i=!0),e.match(/^0(?![\dx])/i)&&(i=!0),i)return e.eat(/L/i),"number"}if(e.match(y))return-1!==e.current().toLowerCase().indexOf("f")?(t.tokenize=function(e,t){for(;"rubf".indexOf(e.charAt(0).toLowerCase())>=0;)e=e.substr(1);var n=1==e.length,r="string";function i(t,n){return t.match(e)?(n.tokenize=o,r):t.match("{")?"punctuation":t.match("}")?(n.tokenize=o,"punctuation"):v(t,n)}function o(o,a){for(;!o.eol();)if(o.eatWhile(/[^'"\{\}\\]/),o.eat("\\")){if(o.next(),n&&o.eol())return r}else{if(o.match(e))return a.tokenize=t,r;if(o.match("{{"))return r;if(o.match("{",!1))return a.tokenize=i,o.current()?r:(o.next(),"punctuation");if(o.match("}}"))return r;if(o.match("}"))return c;o.eat(/['"]/)}if(n){if(s.singleLineStringErrors)return c;a.tokenize=t}return r}return o.isString=!0,o}(e.current(),t.tokenize),t.tokenize(e,t)):(t.tokenize=function(e){for(;"rubf".indexOf(e.charAt(0).toLowerCase())>=0;)e=e.substr(1);var t=1==e.length,n="string";function r(r,i){for(;!r.eol();)if(r.eatWhile(/[^'"\\]/),r.eat("\\")){if(r.next(),t&&r.eol())return n}else{if(r.match(e))return i.tokenize=x,n;r.eat(/['"]/)}if(t){if(s.singleLineStringErrors)return c;i.tokenize=x}return n}return r.isString=!0,r}(e.current()),t.tokenize(e,t));for(var o=0;o<u.length;o++)if(e.match(u[o]))return"operator";return e.match(l)?"punctuation":"."==t.lastToken&&e.match(b)?"property":e.match(g)||e.match(n)?"keyword":e.match(k)?"builtin":e.match(/^(self|cls)\b/)?"variable-2":e.match(b)?"def"==t.lastToken||"class"==t.lastToken?"def":"variable":(e.next(),c)}function _(e){for(;"py"!=o(e).type;)e.scopes.pop();e.scopes.push({offset:o(e).offset+a.indentUnit,type:"py",align:null})}function z(e,t){for(var n=e.indentation();t.scopes.length>1&&o(t).offset>n;){if("py"!=o(t).type)return!0;t.scopes.pop()}return o(t).offset!=n}function w(e,t){e.sol()&&(t.beginningOfLine=!0);var n=t.tokenize(e,t),r=e.current();if(t.beginningOfLine&&"@"==r)return e.match(b,!1)?"meta":h?"operator":c;if(/\S/.test(r)&&(t.beginningOfLine=!1),"variable"!=n&&"builtin"!=n||"meta"!=t.lastToken||(n="meta"),"pass"!=r&&"return"!=r||(t.dedent+=1),"lambda"==r&&(t.lambda=!0),":"!=r||t.lambda||"py"!=o(t).type||_(t),1==r.length&&!/string|comment/.test(n)){var i="[({".indexOf(r);if(-1!=i&&function(e,t,n){var r=e.match(/^([\s\[\{\(]|#.*)*$/,!1)?null:e.column()+1;t.scopes.push({offset:t.indent+p,type:n,align:r})}(e,t,"])}".slice(i,i+1)),-1!=(i="])}".indexOf(r))){if(o(t).type!=r)return c;t.indent=t.scopes.pop().offset-p}}return t.dedent>0&&e.eol()&&"py"==o(t).type&&(t.scopes.length>1&&t.scopes.pop(),t.dedent-=1),n}return{startState:function(e){return{tokenize:x,scopes:[{offset:e||0,type:"py",align:null}],indent:e||0,lastToken:null,lambda:!1,dedent:0}},token:function(e,t){var n=t.errorToken;n&&(t.errorToken=!1);var r=w(e,t);return r&&"comment"!=r&&(t.lastToken="keyword"==r||"punctuation"==r?e.current():r),"punctuation"==r&&(r=null),e.eol()&&t.lambda&&(t.lambda=!1),n?r+" "+c:r},indent:function(t,n){if(t.tokenize!=x)return t.tokenize.isString?e.Pass:0;var r=o(t),i=r.type==n.charAt(0);return null!=r.align?r.align-(i?1:0):r.offset-(i?p:0)},electricInput:/^\s*[\}\]\)]$/,closeBrackets:{triples:"'\""},lineComment:"#",fold:"indent"}}),e.defineMIME("text/x-python","python");var a;e.defineMIME("text/x-cython",{name:"python",extra_keywords:(a="by cdef cimport cpdef ctypedef enum except extern gil include nogil property public readonly struct union DEF IF ELIF ELSE",a.split(" "))})});
|
||
// CodeMirror c-like(java)
|
||
!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t,n,r,o,a){this.indented=e,this.column=t,this.type=n,this.info=r,this.align=o,this.prev=a}function n(e,n,r,o){var a=e.indented;return e.context&&"statement"==e.context.type&&"statement"!=r&&(a=e.context.indented),e.context=new t(a,n,r,o,null,e.context)}function r(e){var t=e.context.type;return")"!=t&&"]"!=t&&"}"!=t||(e.indented=e.context.indented),e.context=e.context.prev}function o(e,t,n){return"variable"==t.prevToken||"type"==t.prevToken||(!!/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(e.string.slice(0,n))||(!(!t.typeAtEndOfLine||e.column()!=e.indentation())||void 0))}function a(e){for(;;){if(!e||"top"==e.type)return!0;if("}"==e.type&&"namespace"!=e.prev.info)return!1;e=e.prev}}function i(e){for(var t={},n=e.split(" "),r=0;r<n.length;++r)t[n[r]]=!0;return t}function l(e,t){return"function"==typeof e?e(t):e.propertyIsEnumerable(t)}e.defineMode("clike",function(i,s){var c,u,d=i.indentUnit,f=s.statementIndentUnit||d,p=s.dontAlignCalls,m=s.keywords||{},h=s.types||{},y=s.builtin||{},g=s.blockKeywords||{},x=s.defKeywords||{},b=s.atoms||{},k=s.hooks||{},w=s.multiLineStrings,v=!1!==s.indentStatements,_=!1!==s.indentSwitch,S=s.namespaceSeparator,C=s.isPunctuationChar||/[\[\]{}\(\),;\:\.]/,T=s.numberStart||/[\d\.]/,M=s.number||/^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)?/i,P=s.isOperatorChar||/[+\-*&%=<>!?|\/]/,L=s.isIdentifierChar||/[\w\$_\xa1-\uffff]/;function D(e,t){var n,r=e.next();if(k[r]){var o=k[r](e,t);if(!1!==o)return o}if('"'==r||"'"==r)return t.tokenize=(n=r,function(e,t){for(var r,o=!1,a=!1;null!=(r=e.next());){if(r==n&&!o){a=!0;break}o=!o&&"\\"==r}return(a||!o&&!w)&&(t.tokenize=null),"string"}),t.tokenize(e,t);if(C.test(r))return c=r,null;if(T.test(r)){if(e.backUp(1),e.match(M))return"number";e.next()}if("/"==r){if(e.eat("*"))return t.tokenize=z,z(e,t);if(e.eat("/"))return e.skipToEnd(),"comment"}if(P.test(r)){for(;!e.match(/^\/[\/*]/,!1)&&e.eat(P););return"operator"}if(e.eatWhile(L),S)for(;e.match(S);)e.eatWhile(L);var a=e.current();return l(m,a)?(l(g,a)&&(c="newstatement"),l(x,a)&&(u=!0),"keyword"):l(h,a)?"type":l(y,a)?(l(g,a)&&(c="newstatement"),"builtin"):l(b,a)?"atom":"variable"}function z(e,t){for(var n,r=!1;n=e.next();){if("/"==n&&r){t.tokenize=null;break}r="*"==n}return"comment"}function I(e,t){s.typeFirstDefinitions&&e.eol()&&a(t.context)&&(t.typeAtEndOfLine=o(e,t,e.pos))}return{startState:function(e){return{tokenize:null,context:new t((e||0)-d,0,"top",null,!1),indented:0,startOfLine:!0,prevToken:null}},token:function(e,t){var i=t.context;if(e.sol()&&(null==i.align&&(i.align=!1),t.indented=e.indentation(),t.startOfLine=!0),e.eatSpace())return I(e,t),null;c=u=null;var l=(t.tokenize||D)(e,t);if("comment"==l||"meta"==l)return l;if(null==i.align&&(i.align=!0),";"==c||":"==c||","==c&&e.match(/^\s*(?:\/\/.*)?$/,!1))for(;"statement"==t.context.type;)r(t);else if("{"==c)n(t,e.column(),"}");else if("["==c)n(t,e.column(),"]");else if("("==c)n(t,e.column(),")");else if("}"==c){for(;"statement"==i.type;)i=r(t);for("}"==i.type&&(i=r(t));"statement"==i.type;)i=r(t)}else c==i.type?r(t):v&&(("}"==i.type||"top"==i.type)&&";"!=c||"statement"==i.type&&"newstatement"==c)&&n(t,e.column(),"statement",e.current());if("variable"==l&&("def"==t.prevToken||s.typeFirstDefinitions&&o(e,t,e.start)&&a(t.context)&&e.match(/^\s*\(/,!1))&&(l="def"),k.token){var d=k.token(e,t,l);void 0!==d&&(l=d)}return"def"==l&&!1===s.styleDefs&&(l="variable"),t.startOfLine=!1,t.prevToken=u?"def":l||c,I(e,t),l},indent:function(t,n){if(t.tokenize!=D&&null!=t.tokenize||t.typeAtEndOfLine)return e.Pass;var r=t.context,o=n&&n.charAt(0);if("statement"==r.type&&"}"==o&&(r=r.prev),s.dontIndentStatements)for(;"statement"==r.type&&s.dontIndentStatements.test(r.info);)r=r.prev;if(k.indent){var a=k.indent(t,r,n);if("number"==typeof a)return a}var i=o==r.type,l=r.prev&&"switch"==r.prev.info;if(s.allmanIndentation&&/[{(]/.test(o)){for(;"top"!=r.type&&"}"!=r.type;)r=r.prev;return r.indented}return"statement"==r.type?r.indented+("{"==o?0:f):!r.align||p&&")"==r.type?")"!=r.type||i?r.indented+(i?0:d)+(i||!l||/^(?:case|default)\b/.test(n)?0:d):r.indented+f:r.column+(i?0:1)},electricInput:_?/^\s*(?:case .*?:|default:|\{\}?|\})$/:/^\s*[{}]$/,blockCommentStart:"/*",blockCommentEnd:"*/",blockCommentContinue:" * ",lineComment:"//",fold:"brace"}});var s="auto if break case register continue return default do sizeof static else struct switch extern typedef union for goto while enum const volatile",c="int long char short double float unsigned signed void size_t ptrdiff_t";function u(e,t){if(!t.startOfLine)return!1;for(var n,r=null;n=e.peek();){if("\\"==n&&e.match(/^.$/)){r=u;break}if("/"==n&&e.match(/^\/[\/\*]/,!1))break;e.next()}return t.tokenize=r,"meta"}function d(e,t){return"type"==t.prevToken&&"type"}function f(e){return e.eatWhile(/[\w\.']/),"number"}function p(e,t){if(e.backUp(1),e.match(/(R|u8R|uR|UR|LR)/)){var n=e.match(/"([^\s\\()]{0,16})\(/);return!!n&&(t.cpp11RawStringDelim=n[1],t.tokenize=h,h(e,t))}return e.match(/(u8|u|U|L)/)?!!e.match(/["']/,!1)&&"string":(e.next(),!1)}function m(e,t){for(var n;null!=(n=e.next());)if('"'==n&&!e.eat('"')){t.tokenize=null;break}return"string"}function h(e,t){var n=t.cpp11RawStringDelim.replace(/[^\w\s]/g,"\\$&");return e.match(new RegExp(".*?\\)"+n+'"'))?t.tokenize=null:e.skipToEnd(),"string"}function y(t,n){"string"==typeof t&&(t=[t]);var r=[];function o(e){if(e)for(var t in e)e.hasOwnProperty(t)&&r.push(t)}o(n.keywords),o(n.types),o(n.builtin),o(n.atoms),r.length&&(n.helperType=t[0],e.registerHelper("hintWords",t[0],r));for(var a=0;a<t.length;++a)e.defineMIME(t[a],n)}function g(e,t){for(var n=!1;!e.eol();){if(!n&&e.match('"""')){t.tokenize=null;break}n="\\"==e.next()&&!n}return"string"}y(["text/x-csrc","text/x-c","text/x-chdr"],{name:"clike",keywords:i(s),types:i(c+" bool _Complex _Bool float_t double_t intptr_t intmax_t int8_t int16_t int32_t int64_t uintptr_t uintmax_t uint8_t uint16_t uint32_t uint64_t"),blockKeywords:i("case do else for if switch while struct"),defKeywords:i("struct"),typeFirstDefinitions:!0,atoms:i("NULL true false"),hooks:{"#":u,"*":d},modeProps:{fold:["brace","include"]}}),y(["text/x-c++src","text/x-c++hdr"],{name:"clike",keywords:i(s+" asm dynamic_cast namespace reinterpret_cast try explicit new static_cast typeid catch operator template typename class friend private this using const_cast inline public throw virtual delete mutable protected alignas alignof constexpr decltype nullptr noexcept thread_local final static_assert override"),types:i(c+" bool wchar_t"),blockKeywords:i("catch class do else finally for if struct switch try while"),defKeywords:i("class namespace struct enum union"),typeFirstDefinitions:!0,atoms:i("true false NULL"),dontIndentStatements:/^template$/,isIdentifierChar:/[\w\$_~\xa1-\uffff]/,hooks:{"#":u,"*":d,u:p,U:p,L:p,R:p,0:f,1:f,2:f,3:f,4:f,5:f,6:f,7:f,8:f,9:f,token:function(e,t,n){if("variable"==n&&"("==e.peek()&&(";"==t.prevToken||null==t.prevToken||"}"==t.prevToken)&&(r=e.current(),(o=/(\w+)::~?(\w+)$/.exec(r))&&o[1]==o[2]))return"def";var r,o}},namespaceSeparator:"::",modeProps:{fold:["brace","include"]}}),y("text/x-java",{name:"clike",keywords:i("abstract assert break case catch class const continue default do else enum extends final finally float for goto if implements import instanceof interface native new package private protected public return static strictfp super switch synchronized this throw throws transient try volatile while @interface"),types:i("byte short int long float double boolean char void Boolean Byte Character Double Float Integer Long Number Object Short String StringBuffer StringBuilder Void"),blockKeywords:i("catch class do else finally for if switch try while"),defKeywords:i("class interface enum @interface"),typeFirstDefinitions:!0,atoms:i("true false null"),number:/^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+\.?\d*|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,hooks:{"@":function(e){return!e.match("interface",!1)&&(e.eatWhile(/[\w\$_]/),"meta")}},modeProps:{fold:["brace","import"]}}),y("text/x-csharp",{name:"clike",keywords:i("abstract as async await base break case catch checked class const continue default delegate do else enum event explicit extern finally fixed for foreach goto if implicit in interface internal is lock namespace new operator out override params private protected public readonly ref return sealed sizeof stackalloc static struct switch this throw try typeof unchecked unsafe using virtual void volatile while add alias ascending descending dynamic from get global group into join let orderby partial remove select set value var yield"),types:i("Action Boolean Byte Char DateTime DateTimeOffset Decimal Double Func Guid Int16 Int32 Int64 Object SByte Single String Task TimeSpan UInt16 UInt32 UInt64 bool byte char decimal double short int long object sbyte float string ushort uint ulong"),blockKeywords:i("catch class do else finally for foreach if struct switch try while"),defKeywords:i("class interface namespace struct var"),typeFirstDefinitions:!0,atoms:i("true false null"),hooks:{"@":function(e,t){return e.eat('"')?(t.tokenize=m,m(e,t)):(e.eatWhile(/[\w\$_]/),"meta")}}}),y("text/x-scala",{name:"clike",keywords:i("abstract case catch class def do else extends final finally for forSome if implicit import lazy match new null object override package private protected return sealed super this throw trait try type val var while with yield _ assert assume require print println printf readLine readBoolean readByte readShort readChar readInt readLong readFloat readDouble"),types:i("AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either Enumeration Equiv Error Exception Fractional Function IndexedSeq Int Integral Iterable Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"),multiLineStrings:!0,blockKeywords:i("catch class enum do else finally for forSome if match switch try while"),defKeywords:i("class enum def object package trait type val var"),atoms:i("true false null"),indentStatements:!1,indentSwitch:!1,isOperatorChar:/[+\-*&%=<>!?|\/#:@]/,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,t){return!!e.match('""')&&(t.tokenize=g,t.tokenize(e,t))},"'":function(e){return e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"},"=":function(e,n){var r=n.context;return!("}"!=r.type||!r.align||!e.eat(">"))&&(n.context=new t(r.indented,r.column,r.type,r.info,null,r.prev),"operator")},"/":function(e,t){return!!e.eat("*")&&(t.tokenize=function e(t){return function(n,r){for(var o;o=n.next();){if("*"==o&&n.eat("/")){if(1==t){r.tokenize=null;break}return r.tokenize=e(t-1),r.tokenize(n,r)}if("/"==o&&n.eat("*"))return r.tokenize=e(t+1),r.tokenize(n,r)}return"comment"}}(1),t.tokenize(e,t))}},modeProps:{closeBrackets:{triples:'"'}}}),y("text/x-kotlin",{name:"clike",keywords:i("package as typealias class interface this super val operator var fun for is in This throw return annotation break continue object if else while do try when !in !is as? file import where by get set abstract enum open inner override private public internal protected catch finally out final vararg reified dynamic companion constructor init sealed field property receiver param sparam lateinit data inline noinline tailrec external annotation crossinline const operator infix suspend actual expect setparam"),types:i("Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void Annotation Any BooleanArray ByteArray Char CharArray DeprecationLevel DoubleArray Enum FloatArray Function Int IntArray Lazy LazyThreadSafetyMode LongArray Nothing ShortArray Unit"),intendSwitch:!1,indentStatements:!1,multiLineStrings:!0,number:/^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+(\.\d+)?|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,blockKeywords:i("catch class do else finally for if where try while enum"),defKeywords:i("class val var object interface fun"),atoms:i("true false null this"),hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,t){var n;return t.tokenize=(n=e.match('""'),function(e,t){for(var r,o=!1,a=!1;!e.eol();){if(!n&&!o&&e.match('"')){a=!0;break}if(n&&e.match('"""')){a=!0;break}r=e.next(),!o&&"$"==r&&e.match("{")&&e.skipTo("}"),o=!o&&"\\"==r&&!n}return!a&&n||(t.tokenize=null),"string"}),t.tokenize(e,t)}},modeProps:{closeBrackets:{triples:'"'}}}),y(["x-shader/x-vertex","x-shader/x-fragment"],{name:"clike",keywords:i("sampler1D sampler2D sampler3D samplerCube sampler1DShadow sampler2DShadow const attribute uniform varying break continue discard return for while do if else struct in out inout"),types:i("float int bool void vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 mat2 mat3 mat4"),blockKeywords:i("for while do if else struct"),builtin:i("radians degrees sin cos tan asin acos atan pow exp log exp2 sqrt inversesqrt abs sign floor ceil fract mod min max clamp mix step smoothstep length distance dot cross normalize ftransform faceforward reflect refract matrixCompMult lessThan lessThanEqual greaterThan greaterThanEqual equal notEqual any all not texture1D texture1DProj texture1DLod texture1DProjLod texture2D texture2DProj texture2DLod texture2DProjLod texture3D texture3DProj texture3DLod texture3DProjLod textureCube textureCubeLod shadow1D shadow2D shadow1DProj shadow2DProj shadow1DLod shadow2DLod shadow1DProjLod shadow2DProjLod dFdx dFdy fwidth noise1 noise2 noise3 noise4"),atoms:i("true false gl_FragColor gl_SecondaryColor gl_Normal gl_Vertex gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_FogCoord gl_PointCoord gl_Position gl_PointSize gl_ClipVertex gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor gl_TexCoord gl_FogFragCoord gl_FragCoord gl_FrontFacing gl_FragData gl_FragDepth gl_ModelViewMatrix gl_ProjectionMatrix gl_ModelViewProjectionMatrix gl_TextureMatrix gl_NormalMatrix gl_ModelViewMatrixInverse gl_ProjectionMatrixInverse gl_ModelViewProjectionMatrixInverse gl_TexureMatrixTranspose gl_ModelViewMatrixInverseTranspose gl_ProjectionMatrixInverseTranspose gl_ModelViewProjectionMatrixInverseTranspose gl_TextureMatrixInverseTranspose gl_NormalScale gl_DepthRange gl_ClipPlane gl_Point gl_FrontMaterial gl_BackMaterial gl_LightSource gl_LightModel gl_FrontLightModelProduct gl_BackLightModelProduct gl_TextureColor gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR gl_EyePlaneQ gl_FogParameters gl_MaxLights gl_MaxClipPlanes gl_MaxTextureUnits gl_MaxTextureCoords gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingFloats gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits gl_MaxDrawBuffers"),indentSwitch:!1,hooks:{"#":u},modeProps:{fold:["brace","include"]}}),y("text/x-nesc",{name:"clike",keywords:i(s+"as atomic async call command component components configuration event generic implementation includes interface module new norace nx_struct nx_union post provides signal task uses abstract extends"),types:i(c),blockKeywords:i("case do else for if switch while struct"),atoms:i("null true false"),hooks:{"#":u},modeProps:{fold:["brace","include"]}}),y("text/x-objectivec",{name:"clike",keywords:i(s+"inline restrict _Bool _Complex _Imaginary BOOL Class bycopy byref id IMP in inout nil oneway out Protocol SEL self super atomic nonatomic retain copy readwrite readonly"),types:i(c),atoms:i("YES NO NULL NILL ON OFF true false"),hooks:{"@":function(e){return e.eatWhile(/[\w\$]/),"keyword"},"#":u,indent:function(e,t,n){if("statement"==t.type&&/^@\w/.test(n))return t.indented}},modeProps:{fold:"brace"}}),y("text/x-squirrel",{name:"clike",keywords:i("base break clone continue const default delete enum extends function in class foreach local resume return this throw typeof yield constructor instanceof static"),types:i(c),blockKeywords:i("case catch class else for foreach if switch try while"),defKeywords:i("function local class"),typeFirstDefinitions:!0,atoms:i("true false null"),hooks:{"#":u},modeProps:{fold:["brace","include"]}});var x=null;y("text/x-ceylon",{name:"clike",keywords:i("abstracts alias assembly assert assign break case catch class continue dynamic else exists extends finally for function given if import in interface is let module new nonempty object of out outer package return satisfies super switch then this throw try value void while"),types:function(e){var t=e.charAt(0);return t===t.toUpperCase()&&t!==t.toLowerCase()},blockKeywords:i("case catch class dynamic else finally for function if interface module new object switch try while"),defKeywords:i("class dynamic function interface module object package value"),builtin:i("abstract actual aliased annotation by default deprecated doc final formal late license native optional sealed see serializable shared suppressWarnings tagged throws variable"),isPunctuationChar:/[\[\]{}\(\),;\:\.`]/,isOperatorChar:/[+\-*&%=<>!?|^~:\/]/,numberStart:/[\d#$]/,number:/^(?:#[\da-fA-F_]+|\$[01_]+|[\d_]+[kMGTPmunpf]?|[\d_]+\.[\d_]+(?:[eE][-+]?\d+|[kMGTPmunpf]|)|)/i,multiLineStrings:!0,typeFirstDefinitions:!0,atoms:i("true false null larger smaller equal empty finished"),indentSwitch:!1,styleDefs:!1,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,t){return t.tokenize=function e(t){return function(n,r){for(var o,a=!1,i=!1;!n.eol();){if(!a&&n.match('"')&&("single"==t||n.match('""'))){i=!0;break}if(!a&&n.match("``")){x=e(t),i=!0;break}o=n.next(),a="single"==t&&!a&&"\\"==o}return i&&(r.tokenize=null),"string"}}(e.match('""')?"triple":"single"),t.tokenize(e,t)},"`":function(e,t){return!(!x||!e.match("`"))&&(t.tokenize=x,x=null,t.tokenize(e,t))},"'":function(e){return e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"},token:function(e,t,n){if(("variable"==n||"type"==n)&&"."==t.prevToken)return"variable-2"}},modeProps:{fold:["brace","import"],closeBrackets:{triples:'"'}}})});
|
||
// CodeMirror matchbrackets
|
||
!function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)}(function(t){var e=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),n=t.Pos,r={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"};function i(t,e,i){var c=t.getLineHandle(e.line),o=e.ch-1,l=i&&i.afterCursor;null==l&&(l=/(^| )cm-fat-cursor($| )/.test(t.getWrapperElement().className));var h=!l&&o>=0&&r[c.text.charAt(o)]||r[c.text.charAt(++o)];if(!h)return null;var s=">"==h.charAt(1)?1:-1;if(i&&i.strict&&s>0!=(o==e.ch))return null;var u=t.getTokenTypeAt(n(e.line,o+1)),f=a(t,n(e.line,o+(s>0?1:0)),s,u||null,i);return null==f?null:{from:n(e.line,o),to:f&&f.pos,match:f&&f.ch==h.charAt(0),forward:s>0}}function a(t,e,i,a,c){for(var o=c&&c.maxScanLineLength||1e4,l=c&&c.maxScanLines||1e3,h=[],s=c&&c.bracketRegex?c.bracketRegex:/[(){}[\]]/,u=i>0?Math.min(e.line+l,t.lastLine()+1):Math.max(t.firstLine()-1,e.line-l),f=e.line;f!=u;f+=i){var m=t.getLine(f);if(m){var g=i>0?0:m.length-1,d=i>0?m.length:-1;if(!(m.length>o))for(f==e.line&&(g=e.ch-(i<0?1:0));g!=d;g+=i){var k=m.charAt(g);if(s.test(k)&&(void 0===a||t.getTokenTypeAt(n(f,g+1))==a))if(">"==r[k].charAt(1)==i>0)h.push(k);else{if(!h.length)return{pos:n(f,g),ch:k};h.pop()}}}}return f-i!=(i>0?t.lastLine():t.firstLine())&&null}function c(t,r,a){for(var c=t.state.matchBrackets.maxHighlightLineLength||1e3,o=[],l=t.listSelections(),h=0;h<l.length;h++){var s=l[h].empty()&&i(t,l[h].head,a);if(s&&t.getLine(s.from.line).length<=c){var u=s.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";o.push(t.markText(s.from,n(s.from.line,s.from.ch+1),{className:u})),s.to&&t.getLine(s.to.line).length<=c&&o.push(t.markText(s.to,n(s.to.line,s.to.ch+1),{className:u}))}}if(o.length){e&&t.state.focused&&t.focus();var f=function(){t.operation(function(){for(var t=0;t<o.length;t++)o[t].clear()})};if(!r)return f;setTimeout(f,800)}}function o(t){t.operation(function(){t.state.matchBrackets.currentlyHighlighted&&(t.state.matchBrackets.currentlyHighlighted(),t.state.matchBrackets.currentlyHighlighted=null),t.state.matchBrackets.currentlyHighlighted=c(t,!1,t.state.matchBrackets)})}t.defineOption("matchBrackets",!1,function(e,n,r){r&&r!=t.Init&&(e.off("cursorActivity",o),e.state.matchBrackets&&e.state.matchBrackets.currentlyHighlighted&&(e.state.matchBrackets.currentlyHighlighted(),e.state.matchBrackets.currentlyHighlighted=null)),n&&(e.state.matchBrackets="object"==typeof n?n:{},e.on("cursorActivity",o))}),t.defineExtension("matchBrackets",function(){c(this,!0)}),t.defineExtension("findMatchingBracket",function(t,e,n){return(n||"boolean"==typeof e)&&(n?(n.strict=e,e=n):e=e?{strict:!0}:null),i(this,t,e)}),t.defineExtension("scanForBracket",function(t,e,n,r){return a(this,t,e,n,r)})});
|