物管理前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
3.8 KiB

  1. var c="error";function i(t){return new RegExp("^(("+t.join(")|(")+"))\\b","i")}var y=new RegExp("^[\\+\\-\\*/%&\\\\|\\^~<>!]"),k=new RegExp("^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]"),w=new RegExp("^((==)|(<>)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*))"),x=new RegExp("^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))"),I=new RegExp("^((//=)|(>>=)|(<<=)|(\\*\\*=))"),z=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"],d=["else","elseif","case","catch","finally"],m=["next","loop"],h=["and","andalso","or","orelse","xor","in","not","is","isnot","like"],L=i(h),f=["#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"],p=["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"],E=i(f),R=i(p),C='"',F=i(l),g=i(d),b=i(m),v=i(["end"]),O=i(["do"]);function u(t,e){e.currentIndent++}function o(t,e){e.currentIndent--}function s(t,e){if(t.eatSpace())return null;var r=t.peek();if(r==="'")return t.skipToEnd(),"comment";if(t.match(/^((&H)|(&O))?[0-9\.a-f]/i,!1)){var n=!1;if((t.match(/^\d*\.\d+F?/i)||t.match(/^\d+\.\d*F?/)||t.match(/^\.\d+F?/))&&(n=!0),n)return t.eat(/J/i),"number";var a=!1;if(t.match(/^&H[0-9a-f]+/i)||t.match(/^&O[0-7]+/i)?a=!0:t.match(/^[1-9]\d*F?/)?(t.eat(/J/i),a=!0):t.match(/^0(?![\dx])/i)&&(a=!0),a)return t.eat(/L/i),"number"}return t.match(C)?(e.tokenize=T(t.current()),e.tokenize(t,e)):t.match(I)||t.match(x)?null:t.match(w)||t.match(y)||t.match(L)?"operator":t.match(k)?null:t.match(O)?(u(t,e),e.doInCurrentLine=!0,"keyword"):t.match(F)?(e.doInCurrentLine?e.doInCurrentLine=!1:u(t,e),"keyword"):t.match(g)?"keyword":t.match(v)?(o(t,e),o(t,e),"keyword"):t.match(b)?(o(t,e),"keyword"):t.match(R)||t.match(E)?"keyword":t.match(z)?"variable":(t.next(),c)}function T(t){var e=t.length==1,r="string";return function(n,a){for(;!n.eol();){if(n.eatWhile(/[^'"]/),n.match(t))return a.tokenize=s,r;n.eat(/['"]/)}return e&&(a.tokenize=s),r}}function j(t,e){var r=e.tokenize(t,e),n=t.current();if(n===".")return r=e.tokenize(t,e),r==="variable"?"variable":c;var a="[({".indexOf(n);return a!==-1&&u(t,e),a="])}".indexOf(n),a!==-1&&o(t,e)?c:r}const S={name:"vb",startState:function(){return{tokenize:s,lastToken:null,currentIndent:0,nextLineIndent:0,doInCurrentLine:!1}},token:function(t,e){t.sol()&&(e.currentIndent+=e.nextLineIndent,e.nextLineIndent=0,e.doInCurrentLine=0);var r=j(t,e);return e.lastToken={style:r,content:t.current()},r},indent:function(t,e,r){var n=e.replace(/^\s+|\s+$/g,"");return n.match(b)||n.match(v)||n.match(g)?r.unit*(t.currentIndent-1):t.currentIndent<0?0:t.currentIndent*r.unit},languageData:{closeBrackets:{brackets:["(","[","{",'"']},commentTokens:{line:"'"},autocomplete:l.concat(d).concat(m).concat(h).concat(f).concat(p)}};export{S as vb};