~ubuntu-branches/ubuntu/utopic/codemirror-js/utopic

« back to all changes in this revision

Viewing changes to mode/vbscript/vbscript.js

  • Committer: Package Import Robot
  • Author(s): David Paleino
  • Date: 2012-04-12 12:25:28 UTC
  • Revision ID: package-import@ubuntu.com-20120412122528-8xp5a8frj4h1d3ee
Tags: upstream-2.23
ImportĀ upstreamĀ versionĀ 2.23

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
 
4
  return {
 
5
    token: function(stream) {
 
6
      if (stream.eatSpace()) return null;
 
7
      var ch = stream.next();
 
8
      if (ch == "'") {
 
9
        stream.skipToEnd();
 
10
        return "comment";
 
11
      }
 
12
      if (ch == '"') {
 
13
        stream.skipTo('"');
 
14
        return "string";
 
15
      }
 
16
 
 
17
      if (/\w/.test(ch)) {
 
18
        stream.eatWhile(/\w/);
 
19
        if (regexVBScriptKeyword.test(stream.current())) return "keyword";
 
20
      }
 
21
      return null;
 
22
    }
 
23
  };
 
24
});
 
25
 
 
26
CodeMirror.defineMIME("text/vbscript", "vbscript");