CodeMirror.defineMode("vb",function(e,n){function t(e){return new RegExp("^(("+e.join(")|(")+"))\\b","i")}function r(e,n){n.currentIndent++}function i(e,n){n.currentIndent--}function a(e,n){if(e.eatSpace())return null;var t=e.peek();if("'"===t)return e.skipToEnd(),"comment";if(e.match(/^((&H)|(&O))?[0-9\.a-f]/i,!1)){var a=!1;if(e.match(/^\d*\.\d+F?/i)?a=!0:e.match(/^\d+\.\d*F?/)?a=!0:e.match(/^\.\d+F?/)&&(a=!0),a)return e.eat(/J/i),"number";var c=!1;if(e.match(/^&H[0-9a-f]+/i)?c=!0:e.match(/^&O[0-7]+/i)?c=!0:e.match(/^[1-9]\d*F?/)?(e.eat(/J/i),c=!0):e.match(/^0(?![\dx])/i)&&(c=!0),c)return e.eat(/L/i),"number"}return e.match(y)?(n.tokenize=o(e.current()),n.tokenize(e,n)):e.match(m)||e.match(f)?null:e.match(h)||e.match(d)||e.match(g)?"operator":e.match(l)?null:e.match(R)?(r(e,n),n.doInCurrentLine=!0,"keyword"):e.match(E)?(n.doInCurrentLine?n.doInCurrentLine=!1:r(e,n),"keyword"):e.match(L)?"keyword":e.match(C)?(i(e,n),i(e,n),"keyword"):e.match(z)?(i(e,n),"keyword"):e.match(I)?"keyword":e.match(w)?"keyword":e.match(s)?"variable":(e.next(),u)}function o(e){var t=1==e.length,r="string";return function(i,o){for(;!i.eol();){if(i.eatWhile(/[^'"]/),i.match(e))return o.tokenize=a,r;i.eat(/['"]/)}if(t){if(n.singleLineStringErrors)return u;o.tokenize=a}return r}}function c(e,n){var t=n.tokenize(e,n),a=e.current();if("."===a)return t=n.tokenize(e,n),a=e.current(),"variable"===t?"variable":u;var o="[({".indexOf(a);return-1!==o&&r(e,n),"dedent"===F&&i(e,n)?u:(o="])}".indexOf(a),-1!==o&&i(e,n)?u:t)}var u="error",d=new RegExp("^[\\+\\-\\*/%&\\\\|\\^~<>!]"),l=new RegExp("^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]"),h=new RegExp("^((==)|(<>)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*))"),f=new RegExp("^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))"),m=new RegExp("^((//=)|(>>=)|(<<=)|(\\*\\*=))"),s=new RegExp("^[_A-Za-z][_A-Za-z0-9]*"),p=["class","module","sub","enum","select","while","if","function","get","set","property","try"],k=["else","elseif","case","catch"],x=["next","loop"],g=t(["and","or","not","xor","in"]),v=["as","dim","break","continue","optional","then","until","goto","byval","byref","new","handles","property","return","const","private","protected","friend","public","shared","static","true","false"],b=["integer","string","double","decimal","boolean","short","char","float","single"],w=t(v),I=t(b),y='"',E=t(p),L=t(k),z=t(x),C=t(["end"]),R=t(["do"]),F=null,M={electricChars:"dDpPtTfFeE ",startState:function(){return{tokenize:a,lastToken:null,currentIndent:0,nextLineIndent:0,doInCurrentLine:!1}},token:function(e,n){e.sol()&&(n.currentIndent+=n.nextLineIndent,n.nextLineIndent=0,n.doInCurrentLine=0);var t=c(e,n);return n.lastToken={style:t,content:e.current()},t},indent:function(n,t){var r=t.replace(/^\s+|\s+$/g,"");return r.match(z)||r.match(C)||r.match(L)?e.indentUnit*(n.currentIndent-1):n.currentIndent<0?0:n.currentIndent*e.indentUnit}};return M}),CodeMirror.defineMIME("text/x-vb","vb");