2
0

vbscript.js 871 B

1234567891011121314151617181920212223242526
  1. CodeMirror.defineMode("vbscript", function() {
  2. var regexVBScriptKeyword = /^(?:Call|Case|CDate|Clear|CInt|CLng|Const|CStr|Description|Dim|Do|Each|Else|ElseIf|End|Err|Error|Exit|False|For|Function|If|LCase|Loop|LTrim|Next|Nothing|Now|Number|On|Preserve|Quit|ReDim|Resume|RTrim|Select|Set|Sub|Then|To|Trim|True|UBound|UCase|Until|VbCr|VbCrLf|VbLf|VbTab)$/im;
  3. return {
  4. token: function(stream) {
  5. if (stream.eatSpace()) return null;
  6. var ch = stream.next();
  7. if (ch == "'") {
  8. stream.skipToEnd();
  9. return "comment";
  10. }
  11. if (ch == '"') {
  12. stream.skipTo('"');
  13. return "string";
  14. }
  15. if (/\w/.test(ch)) {
  16. stream.eatWhile(/\w/);
  17. if (regexVBScriptKeyword.test(stream.current())) return "keyword";
  18. }
  19. return null;
  20. }
  21. };
  22. });
  23. CodeMirror.defineMIME("text/vbscript", "vbscript");