?
Path : /home/admin/public_html/old/media/editors/codemirror/mode/kotlin/ |
Current File : /home/admin/public_html/old/media/editors/codemirror/mode/kotlin/kotlin.min.js |
!function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)}(function(a){"use strict";a.defineMode("kotlin",function(a,b){function c(a){for(var b={},c=a.split(" "),d=0;d<c.length;++d)b[c[d]]=!0;return b}function d(a,b){var c=a.next();if('"'==c||"'"==c)return e(c,a,b);if("."==c&&a.eat("*"))return"word";if(/[\[\]{}\(\),;\:\.]/.test(c))return m=c,null;if(/\d/.test(c))return a.eat(/eE/)&&(a.eat(/\+\-/),a.eatWhile(/\d/)),"number";if("/"==c){if(a.eat("*"))return b.tokenize.push(h),h(a,b);if(a.eat("/"))return a.skipToEnd(),"comment";if(i(b.lastToken))return e(c,a,b)}if("-"==c&&a.eat(">"))return m="->",null;if(/[\-+*&%=<>!?|\/~]/.test(c))return a.eatWhile(/[\-+*&%=<>|~]/),"operator";a.eatWhile(/[\w\$_]/);var d=a.current();return r.propertyIsEnumerable(d)?"atom":p.propertyIsEnumerable(d)?(q.propertyIsEnumerable(d)&&(m="newstatement"),"softKeyword"):o.propertyIsEnumerable(d)?(q.propertyIsEnumerable(d)&&(m="newstatement"),"keyword"):"word"}function e(a,b,c){function d(b,c){for(var h,i=!1,j=!e;null!=(h=b.next());){if(h==a&&!i){if(!e)break;if(b.match(a+a)){j=!0;break}}if('"'==a&&"$"==h&&!i&&b.eat("{"))return c.tokenize.push(f()),"string";if("$"==h&&!i&&!b.eat(" "))return c.tokenize.push(g()),"string";i=!i&&"\\"==h}return n&&c.tokenize.push(d),j&&c.tokenize.pop(),"string"}var e=!1;if("/"!=a&&b.eat(a)){if(!b.eat(a))return"string";e=!0}return c.tokenize.push(d),d(b,c)}function f(){function a(a,c){if("}"==a.peek()){if(b--,0==b)return c.tokenize.pop(),c.tokenize[c.tokenize.length-1](a,c)}else"{"==a.peek()&&b++;return d(a,c)}var b=1;return a.isBase=!0,a}function g(){function a(a,b){if(a.eat(/[\w]/)){var c=a.eatWhile(/[\w]/);if(c)return b.tokenize.pop(),"word"}return b.tokenize.pop(),"string"}return a.isBase=!0,a}function h(a,b){for(var c,d=!1;c=a.next();){if("/"==c&&d){b.tokenize.pop();break}d="*"==c}return"comment"}function i(a){return!a||"operator"==a||"->"==a||/[\.\[\{\(,;:]/.test(a)||"newstatement"==a||"keyword"==a||"proplabel"==a}function j(a,b,c,d,e){this.indented=a,this.column=b,this.type=c,this.align=d,this.prev=e}function k(a,b,c){return a.context=new j(a.indented,b,c,null,a.context)}function l(a){var b=a.context.type;return(")"==b||"]"==b||"}"==b)&&(a.indented=a.context.indented),a.context=a.context.prev}var m,n=b.multiLineStrings,o=c("package continue return object while break class data trait throw super when type this else This try val var fun for is in if do as true false null get set"),p=c("import where by get set abstract enum open annotation override private public internal protected catch out vararg inline finally final ref"),q=c("catch class do else finally for if where try while enum"),r=c("null true false this");return d.isBase=!0,{startState:function(b){return{tokenize:[d],context:new j((b||0)-a.indentUnit,0,"top",!1),indented:0,startOfLine:!0,lastToken:null}},token:function(a,b){var c=b.context;if(a.sol()&&(null==c.align&&(c.align=!1),b.indented=a.indentation(),b.startOfLine=!0,"statement"!=c.type||i(b.lastToken)||(l(b),c=b.context)),a.eatSpace())return null;m=null;var d=b.tokenize[b.tokenize.length-1](a,b);if("comment"==d)return d;if(null==c.align&&(c.align=!0),";"!=m&&":"!=m||"statement"!=c.type)if("->"==m&&"statement"==c.type&&"}"==c.prev.type)l(b),b.context.align=!1;else if("{"==m)k(b,a.column(),"}");else if("["==m)k(b,a.column(),"]");else if("("==m)k(b,a.column(),")");else if("}"==m){for(;"statement"==c.type;)c=l(b);for("}"==c.type&&(c=l(b));"statement"==c.type;)c=l(b)}else m==c.type?l(b):("}"==c.type||"top"==c.type||"statement"==c.type&&"newstatement"==m)&&k(b,a.column(),"statement");else l(b);return b.startOfLine=!1,b.lastToken=m||d,d},indent:function(b,c){if(!b.tokenize[b.tokenize.length-1].isBase)return 0;var d=c&&c.charAt(0),e=b.context;"statement"!=e.type||i(b.lastToken)||(e=e.prev);var f=d==e.type;return"statement"==e.type?e.indented+("{"==d?0:a.indentUnit):e.align?e.column+(f?0:1):e.indented+(f?0:a.indentUnit)},closeBrackets:{triples:"'\""},electricChars:"{}"}}),a.defineMIME("text/x-kotlin","kotlin")});