/
mode-coco.js
1 lines (1 loc) · 4.27 KB
/
mode-coco.js
1
(function(){function a(a,b){function c(){}return c.prototype=(a.superclass=b).prototype,(a.prototype=new c).constructor=a,typeof b.extended=="function"&&b.extended(a),a}define("ace/mode/coco",function(b,c,d){var e,f,g,h;e="(?![\\d\\s])[$\\w\\xAA-\\uFFDC](?:(?!\\s)[$\\w\\xAA-\\uFFDC]|-[A-Za-z])*",c.Mode=f=function(c){function h(){var a;this.$tokenizer=new(b("ace/tokenizer").Tokenizer)(h.Rules);if(a=b("ace/mode/matching_brace_outdent"))this.$outdent=new a.MatchingBraceOutdent}h.displayName="CocoMode";var d,f=a(h,c).prototype,g=h;return d=RegExp("(?:[({[=:]|[-~]>|\\b(?:e(?:lse|xport)|d(?:o|efault)|t(?:ry|hen)|finally|import(?:\\s*all)?|const|var|let|new|catch(?:\\s*"+e+")?))\\s*$"),f.getNextLineIndent=function(a,b,c){var e,f;return e=this.$getIndent(b),f=this.$tokenizer.getLineTokens(b,a).tokens,(!f.length||f[f.length-1].type!=="comment")&&a==="start"&&d.test(b)&&(e+=c),e},f.toggleCommentLines=function(a,c,d,e){var f,g,h,i,j;f=/^(\s*)#/,g=new(b("ace/range").Range)(0,0,0,0);for(h=d;h<=e;++h)(j=f.test(i=c.getLine(h)))?i=i.replace(f,"$1"):i=i.replace(/^\s*/,"$&#"),g.end.row=g.start.row=h,g.end.column=i.length+1,c.replace(g,i);return 1-j*2},f.checkOutdent=function(a,b,c){var d;return(d=this.$outdent)!=null?d.checkOutdent(b,c):void 8},f.autoOutdent=function(a,b,c){var d;return(d=this.$outdent)!=null?d.autoOutdent(b,c):void 8},h}(b("ace/mode/text").Mode),g="(?![$\\w]|-[A-Za-z]|\\s*:(?![:=]))",h={token:"string",regex:".+"},f.Rules={start:[{token:"keyword",regex:"(?:t(?:h(?:is|row|en)|ry|ypeof!?)|c(?:on(?:tinue|st)|a(?:se|tch)|lass)|i(?:n(?:stanceof)?|mp(?:ort(?:\\s+all)?|lements)|[fs])|d(?:e(?:fault|lete|bugger)|o)|f(?:or(?:\\s+own)?|inally|unction)|s(?:uper|witch)|e(?:lse|x(?:tends|port)|val)|a(?:nd|rguments)|n(?:ew|ot)|un(?:less|til)|w(?:hile|ith)|o[fr]|return|break|let|var)"+g},{token:"constant.language",regex:"(?:true|false|null|void)"+g},{token:"invalid.illegal",regex:"(?:p(?:ackage|r(?:ivate|otected)|ublic)|i(?:mplements|nterface)|enum|static|yield)"+g},{token:"language.support.class",regex:"(?:R(?:e(?:gExp|ferenceError)|angeError)|S(?:tring|yntaxError)|E(?:rror|valError)|Array|Boolean|Date|Function|Number|Object|TypeError|URIError)"+g},{token:"language.support.function",regex:"(?:is(?:NaN|Finite)|parse(?:Int|Float)|Math|JSON|(?:en|de)codeURI(?:Component)?)"+g},{token:"variable.language",regex:"(?:t(?:hat|il|o)|f(?:rom|allthrough)|it|by|[e_])"+g},{token:"identifier",regex:e+"\\s*:(?![:=])"},{token:"variable",regex:e},{token:"keyword.operator",regex:"(?:\\.{3}|\\s+\\?)"},{token:"keyword.variable",regex:"(?:@+|::|\\.\\.)",next:"key"},{token:"keyword.operator",regex:"\\.\\s*",next:"key"},{token:"string",regex:"\\\\\\S[^\\s,;)}\\]]*"},{token:"string.doc",regex:"'''",next:"qdoc"},{token:"string.doc",regex:'"""',next:"qqdoc"},{token:"string",regex:"'",next:"qstring"},{token:"string",regex:'"',next:"qqstring"},{token:"string",regex:"`",next:"js"},{token:"string",regex:"<\\[",next:"words"},{token:"string.regex",regex:"//",next:"heregex"},{token:"comment.doc",regex:"/\\*",next:"comment"},{token:"comment",regex:"#.*"},{token:"string.regex",regex:"\\/(?:[^[\\/\\n\\\\]*(?:(?:\\\\.|\\[[^\\]\\n\\\\]*(?:\\\\.[^\\]\\n\\\\]*)*\\])[^[\\/\\n\\\\]*)*)\\/[gimy$]{0,4}",next:"key"},{token:"constant.numeric",regex:"(?:0x[\\da-fA-F][\\da-fA-F_]*|(?:[2-9]|[12]\\d|3[0-6])r[\\da-zA-Z][\\da-zA-Z_]*|(?:\\d[\\d_]*(?:\\.\\d[\\d_]*)?|\\.\\d[\\d_]*)(?:e[+-]?\\d[\\d_]*)?[\\w$]*)"},{token:"lparen",regex:"[({[]"},{token:"rparen",regex:"[)}\\]]",next:"key"},{token:"keyword.operator",regex:"\\S+"},{token:"text",regex:"\\s+"}],heregex:[{token:"string.regex",regex:".*?//[gimy$?]{0,4}",next:"start"},{token:"string.regex",regex:"\\s*#{"},{token:"comment.regex",regex:"\\s+(?:#.*)?"},{token:"string.regex",regex:"\\S+"}],key:[{token:"keyword.operator",regex:"[.?@!]+"},{token:"identifier",regex:e,next:"start"},{token:"text",regex:".",next:"start"}],comment:[{token:"comment.doc",regex:".*?\\*/",next:"start"},{token:"comment.doc",regex:".+"}],qdoc:[{token:"string",regex:".*?'''",next:"key"},h],qqdoc:[{token:"string",regex:'.*?"""',next:"key"},h],qstring:[{token:"string",regex:"[^\\\\']*(?:\\\\.[^\\\\']*)*'",next:"key"},h],qqstring:[{token:"string",regex:'[^\\\\"]*(?:\\\\.[^\\\\"]*)*"',next:"key"},h],js:[{token:"string",regex:"[^\\\\`]*(?:\\\\.[^\\\\`]*)*`",next:"key"},h],words:[{token:"string",regex:".*?\\]>",next:"key"},h]}})}).call(this)