!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("vb",function(t,n){var r="error";function i(e){return new RegExp("^(("+e.join(")|(")+"))\\b","i")}var o=new RegExp("^[\\+\\-\\*/%&\\\\|\\^~<>!]"),a=new RegExp("^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]"),c=new RegExp("^((==)|(<>)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*))"),d=new RegExp("^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))"),u=new RegExp("^((//=)|(>>=)|(<<=)|(\\*\\*=))"),s=new RegExp("^[_A-Za-z][_A-Za-z0-9]*"),l=["class","module","sub","enum","select","while","if","function","get","set","property","try","structure","synclock","using","with"],m=["else","elseif","case","catch","finally"],f=["next","loop"],h=["and","andalso","or","orelse","xor","in","not","is","isnot","like"],p=i(h),b=["#const","#else","#elseif","#end","#if","#region","addhandler","addressof","alias","as","byref","byval","cbool","cbyte","cchar","cdate","cdbl","cdec","cint","clng","cobj","compare","const","continue","csbyte","cshort","csng","cstr","cuint","culng","cushort","declare","default","delegate","dim","directcast","each","erase","error","event","exit","explicit","false","for","friend","gettype","goto","handles","implements","imports","infer","inherits","interface","isfalse","istrue","lib","me","mod","mustinherit","mustoverride","my","mybase","myclass","namespace","narrowing","new","nothing","notinheritable","notoverridable","of","off","on","operator","option","optional","out","overloads","overridable","overrides","paramarray","partial","private","protected","public","raiseevent","readonly","redim","removehandler","resume","return","shadows","shared","static","step","stop","strict","then","throw","to","true","trycast","typeof","until","until","when","widening","withevents","writeonly"],g=["object","boolean","char","string","byte","sbyte","short","ushort","int16","uint16","integer","uinteger","int32","uint32","long","ulong","int64","uint64","decimal","single","double","float","date","datetime","intptr","uintptr"],y=i(b),v=i(g),w='"',k=i(l),x=i(m),I=i(f),E=i(["end"]),L=i(["do"]);function z(e,t){t.currentIndent++}function C(e,t){t.currentIndent--}function R(e,t){if(e.eatSpace())return null;var i,l;if("'"===e.peek())return e.skipToEnd(),"comment";if(e.match(/^((&H)|(&O))?[0-9\.a-f]/i,!1)){var m=!1;if(e.match(/^\d*\.\d+F?/i)?m=!0:e.match(/^\d+\.\d*F?/)?m=!0:e.match(/^\.\d+F?/)&&(m=!0),m)return e.eat(/J/i),"number";var f=!1;if(e.match(/^&H[0-9a-f]+/i)?f=!0:e.match(/^&O[0-7]+/i)?f=!0:e.match(/^[1-9]\d*F?/)?(e.eat(/J/i),f=!0):e.match(/^0(?![\dx])/i)&&(f=!0),f)return e.eat(/L/i),"number"}return e.match(w)?(t.tokenize=(i=e.current(),l=1==i.length,function(e,t){for(;!e.eol();){if(e.eatWhile(/[^'"]/),e.match(i))return t.tokenize=R,"string";e.eat(/['"]/)}if(l){if(n.singleLineStringErrors)return r;t.tokenize=R}return"string"}),t.tokenize(e,t)):e.match(u)||e.match(d)?null:e.match(c)||e.match(o)||e.match(p)?"operator":e.match(a)?null:e.match(L)?(z(0,t),t.doInCurrentLine=!0,"keyword"):e.match(k)?(t.doInCurrentLine?t.doInCurrentLine=!1:z(0,t),"keyword"):e.match(x)?"keyword":e.match(E)?(C(0,t),C(0,t),"keyword"):e.match(I)?(C(0,t),"keyword"):e.match(v)?"keyword":e.match(y)?"keyword":e.match(s)?"variable":(e.next(),r)}return e.registerHelper("hintWords","vb",l.concat(m).concat(f).concat(h).concat(b).concat(g)),{electricChars:"dDpPtTfFeE ",startState:function(){return{tokenize:R,lastToken:null,currentIndent:0,nextLineIndent:0,doInCurrentLine:!1}},token:function(e,t){e.sol()&&(t.currentIndent+=t.nextLineIndent,t.nextLineIndent=0,t.doInCurrentLine=0);var n=function(e,t){var n=t.tokenize(e,t),i=e.current();if("."===i)return"variable"===(n=t.tokenize(e,t))?"variable":r;var o="[({".indexOf(i);return-1!==o&&z(0,t),-1!==(o="])}".indexOf(i))&&C(0,t)?r:n}(e,t);return t.lastToken={style:n,content:e.current()},n},indent:function(e,n){var r=n.replace(/^\s+|\s+$/g,"");return r.match(I)||r.match(E)||r.match(x)?t.indentUnit*(e.currentIndent-1):e.currentIndent<0?0:e.currentIndent*t.indentUnit},lineComment:"'"}}),e.defineMIME("text/x-vb","vb")});