Skip to content

Instantly share code, notes, and snippets.

@askucher
Last active August 15, 2019 21:46
Show Gist options
  • Save askucher/4ffe22d43cba7ef727ae8208c525228b to your computer and use it in GitHub Desktop.
Save askucher/4ffe22d43cba7ef727ae8208c525228b to your computer and use it in GitHub Desktop.
Cloud9 ACE Editor LSX Highlighting

Cloud9 ACE Editor LSX Highlighting

Install

cd c9sdk

curl https://gist.githubusercontent.com/askucher/4ffe22d43cba7ef727ae8208c525228b/raw/79e27fa5423c06ba5ef0e2a635aa729223687473/livescript.js > ./plugins/node_modules/ace/lib/ace/mode/livescript.js
define(function(e,t,n){var r,o,a,g;r="(?![\\d\\s])[$\\w\\xAA-\\uFFDC](?:(?!\\s)[$\\w\\xAA-\\uFFDC]|-[A-Za-z])*",t.Mode=o=function(t){var n,o=function(e,t){function n(){}n.prototype=(e.superclass=t).prototype,(e.prototype=new n).constructor=e,"function"==typeof t.extended&&t.extended(e);return e}(((function(e,t){var n={}.hasOwnProperty;for(var r in t)n.call(t,r)&&(e[r]=t[r]);return e}(a,t)).displayName="LiveScriptMode",a),t).prototype;function a(){var t;this.$tokenizer=new(e("../tokenizer").Tokenizer)(a.Rules),(t=e("../mode/matching_brace_outdent"))&&(this.$outdent=new t.MatchingBraceOutdent),this.$id="ace/mode/livescript",this.$behaviour=new(e("./behaviour/cstyle").CstyleBehaviour)}return n=RegExp("(?:[({[=:]|[-~]>|\\b(?:e(?:lse|xport)|d(?:o|efault)|t(?:ry|hen)|finally|import(?:\\s*all)?|const|var|let|new|catch(?:\\s*"+r+")?))\\s*$"),o.getNextLineIndent=function(e,t,r){var o,a;return o=this.$getIndent(t),(a=this.$tokenizer.getLineTokens(t,e).tokens).length&&"comment"===a[a.length-1].type||"start"===e&&n.test(t)&&(o+=r),o},o.lineCommentStart="#",o.blockComment={start:"###",end:"###"},o.checkOutdent=function(e,t,n){var r;return null!=(r=this.$outdent)?r.checkOutdent(t,n):void 0},o.autoOutdent=function(e,t,n){var r;return null!=(r=this.$outdent)?r.autoOutdent(t,n):void 0},a}(e("../mode/text").Mode),a="(?![$\\w]|-[A-Za-z]|\\s*:(?![:=]))",g={defaultToken:"string"},o.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|loop)"+a},{token:"constant.language",regex:"(?:true|false|yes|no|on|off|null|void|undefined)"+a},{token:"invalid.illegal",regex:"(?:p(?:ackage|r(?:ivate|otected)|ublic)|i(?:mplements|nterface)|enum|static|yield)"+a},{token:"language.support.class",regex:"(?:R(?:e(?:gExp|ferenceError)|angeError)|S(?:tring|yntaxError)|E(?:rror|valError)|Array|Boolean|Date|Function|Number|Object|TypeError|URIError)"+a},{token:"keyword.operator",regex:"(.+.pug[^( ]+)|(.+.pug)",next:"pug"},{token:"language.support.function",regex:"(?:is(?:NaN|Finite)|parse(?:Int|Float)|Math|JSON|(?:en|de)codeURI(?:Component)?)"+a},{token:"variable.language",regex:"(?:t(?:hat|il|o)|f(?:rom|allthrough)|it|by|e)"+a},{token:"identifier",regex:r+"\\s*:(?![:=])"},{token:"variable",regex:r},{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:"[\\^!|&%+\\-]+"},{token:"text",regex:"\\s+"}],sass:[{token:"support.variable",regex:"^[^ ]",next:"start"},{token:"keyword.operator",regex:"^[^:]+$"},{token:"support.variable",regex:"[$][a-z-]+:"},{token:"support.variable",regex:"[$][a-z-]+"},{token:"comment",regex:"[a-z-]+:"}],pugproptext:[{token:"support.variable",regex:"#{[^}]+}"},{token:"comment",regex:'"',next:"pug"}],pugprop:[{token:"support.variable",regex:"[^ ]+",next:"pug"}],pug:[{token:"comment",regex:'[a-z_A-Z-]+="',next:"pugproptext"},{token:"comment",regex:"[a-z_A-Z-]+=",next:"pugprop"},{token:"support.variable",regex:"#{[^}]+}"},{token:"text",regex:"^",next:"start"}],heregex:[{token:"string.regex",regex:".*?//[gimy$?]{0,4}",next:"start"},{token:"string.regex",regex:"\\s*#{"},{token:"comment.regex",regex:"\\s+(?:#.*)?"},{defaultToken:"string.regex"}],key:[{token:"keyword.operator",regex:"(?<=^[.])[a-zA-Z][a-zA-Z0-9_-]+$",next:"sass"},{token:"keyword.operator",regex:"[.?@!]+"},{token:"identifier",regex:r,next:"start"},{token:"text",regex:"",next:"start"}],comment:[{token:"comment.doc",regex:".*?\\*/",next:"start"},{defaultToken:"comment.doc"}],qdoc:[{token:"string",regex:".*?'''",next:"key"},g],qqdoc:[{token:"string",regex:'.*?"""',next:"key"},g],qstring:[{token:"string",regex:"[^\\\\']*(?:\\\\.[^\\\\']*)*'",next:"key"},g],qqstring:[{token:"string",regex:'[^\\\\"]*(?:\\\\.[^\\\\"]*)*"',next:"key"},g],js:[{token:"string",regex:"[^\\\\`]*(?:\\\\.[^\\\\`]*)*`",next:"key"},g],words:[{token:"string",regex:".*?\\]>",next:"key"},g]}});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment