CodeMirror.defineMode("coffeescript",function(e){function t(e){return new RegExp("^(("+e.join(")|(")+"))\\b")}function n(e,t){if(e.sol()){var n=t.scopes[0].offset;if(e.eatSpace()){var i=e.indentation();return i>n?"indent":n>i?"dedent":null}n>0&&c(e,t)}if(e.eatSpace())return null;var f=e.peek();if(e.match("####"))return e.skipToEnd(),"comment";if(e.match("###"))return t.tokenize=o,t.tokenize(e,t);if("#"===f)return e.skipToEnd(),"comment";if(e.match(/^-?[0-9\.]/,!1)){var g=!1;if(e.match(/^-?\d*\.\d+(e[\+\-]?\d+)?/i)&&(g=!0),e.match(/^-?\d+\.\d*/)&&(g=!0),e.match(/^-?\.\d+/)&&(g=!0),g)return"."==e.peek()&&e.backUp(1),"number";var x=!1;if(e.match(/^-?0x[0-9a-f]+/i)&&(x=!0),e.match(/^-?[1-9]\d*(e[\+\-]?\d+)?/)&&(x=!0),e.match(/^-?0(?![\dx])/i)&&(x=!0),x)return"number"}if(e.match(v))return t.tokenize=r(e.current(),"string"),t.tokenize(e,t);if(e.match(z)){if("/"!=e.current()||e.match(/^.*\//,!1))return t.tokenize=r(e.current(),"string-2"),t.tokenize(e,t);e.backUp(1)}return e.match(l)||e.match(d)?"punctuation":e.match(p)||e.match(s)||e.match(k)?"operator":e.match(u)?"punctuation":e.match(y)?"atom":e.match(b)?"keyword":e.match(h)?"variable":e.match(m)?"property":(e.next(),a)}function r(t,r){var o=1==t.length;return function(i,c){for(;!i.eol();)if(i.eatWhile(/[^'"\/\\]/),i.eat("\\")){if(i.next(),o&&i.eol())return r}else{if(i.match(t))return c.tokenize=n,r;i.eat(/['"\/]/)}return o&&(e.mode.singleLineStringErrors?r=a:c.tokenize=n),r}}function o(e,t){for(;!e.eol();){if(e.eatWhile(/[^#]/),e.match("###")){t.tokenize=n;break}e.eatWhile("#")}return"comment"}function i(t,n,r){r=r||"coffee";var o=0;if("coffee"===r){for(var i=0;i"!==r&&"=>"!==r||t.lambda||"coffee"!=t.scopes[0].type||""!==e.peek())&&"indent"!==n||i(e,t);var o="[({".indexOf(r);return-1!==o&&i(e,t,"])}".slice(o,o+1)),g.exec(r)&&i(e,t),"then"==r&&c(e,t),"dedent"===n&&c(e,t)?a:(o="])}".indexOf(r),-1!==o&&c(e,t)?a:(t.dedent>0&&e.eol()&&"coffee"==t.scopes[0].type&&(t.scopes.length>1&&t.scopes.shift(),t.dedent-=1),n))}var a="error",s=new RegExp("^[\\+\\-\\*/%&|\\^~<>!?]"),u=new RegExp("^[\\(\\)\\[\\]\\{\\},:`=;\\.]"),p=new RegExp("^((->)|(=>)|(\\+\\+)|(\\+\\=)|(\\-\\-)|(\\-\\=)|(\\*\\*)|(\\*\\=)|(\\/\\/)|(\\/\\=)|(==)|(!=)|(<=)|(>=)|(<>)|(<<)|(>>)|(//))"),d=new RegExp("^((\\.\\.)|(\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))"),l=new RegExp("^((\\.\\.\\.)|(//=)|(>>=)|(<<=)|(\\*\\*=))"),h=new RegExp("^[_A-Za-z$][_A-Za-z$0-9]*"),m=new RegExp("^(@|this.)[_A-Za-z$][_A-Za-z$0-9]*"),k=t(["and","or","not","is","isnt","in","instanceof","typeof"]),g=["for","while","loop","if","unless","else","switch","try","catch","finally","class"],x=["break","by","continue","debugger","delete","do","in","of","new","return","then","this","throw","when","until"],b=t(g.concat(x));g=t(g);var v=new RegExp("^('{3}|\"{3}|['\"])"),z=new RegExp("^(/{3}|/)"),w=["Infinity","NaN","undefined","null","true","false","on","off","yes","no"],y=t(w),E={startState:function(e){return{tokenize:n,scopes:[{offset:e||0,type:"coffee"}],lastToken:null,lambda:!1,dedent:0}},token:function(e,t){var n=f(e,t);return t.lastToken={style:n,content:e.current()},e.eol()&&e.lambda&&(t.lambda=!1),n},indent:function(e){return e.tokenize!=n?0:e.scopes[0].offset}};return E}),CodeMirror.defineMIME("text/x-coffeescript","coffeescript");