aboutsummaryrefslogtreecommitdiff
path: root/imports/codemirror/mode/vbscript
diff options
context:
space:
mode:
authorJon Reid2012-05-04 14:56:24 -0700
committerJon Reid2012-05-04 14:56:24 -0700
commita6dd2917edcfeca1be7553e03281ddd538422ae1 (patch)
treee6846626bf1e967e80bcd652f6a76bb97abb1789 /imports/codemirror/mode/vbscript
parent7fc185cc08b2ba912dbc7bce96f6a465c1dd6dbf (diff)
parent8964e070fa760d23c2de272ca36b8d9beba6007d (diff)
downloadninja-a6dd2917edcfeca1be7553e03281ddd538422ae1.tar.gz
Merge remote-tracking branch 'ninja-jduran/TimelineUber' into timeline-local
Diffstat (limited to 'imports/codemirror/mode/vbscript')
-rw-r--r--imports/codemirror/mode/vbscript/index.html42
-rw-r--r--imports/codemirror/mode/vbscript/vbscript.js26
2 files changed, 68 insertions, 0 deletions
diff --git a/imports/codemirror/mode/vbscript/index.html b/imports/codemirror/mode/vbscript/index.html
new file mode 100644
index 00000000..dd207cae
--- /dev/null
+++ b/imports/codemirror/mode/vbscript/index.html
@@ -0,0 +1,42 @@
1<!doctype html>
2<html>
3 <head>
4 <title>CodeMirror: VBScript mode</title>
5 <link rel="stylesheet" href="../../lib/codemirror.css">
6 <script src="../../lib/codemirror.js"></script>
7 <script src="vbscript.js"></script>
8 <link rel="stylesheet" href="../../doc/docs.css">
9 <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
10 </head>
11 <body>
12 <h1>CodeMirror: VBScript mode</h1>
13
14<div><textarea id="code" name="code">
15' Pete Guhl
16' 03-04-2012
17'
18' Basic VBScript support for codemirror2
19
20Const ForReading = 1, ForWriting = 2, ForAppending = 8
21
22Call Sub020_PostBroadcastToUrbanAirship(strUserName, strPassword, intTransmitID, strResponse)
23
24If Not IsNull(strResponse) AND Len(strResponse) = 0 Then
25 boolTransmitOkYN = False
26Else
27 ' WScript.Echo "Oh Happy Day! Oh Happy DAY!"
28 boolTransmitOkYN = True
29End If
30</textarea></div>
31
32 <script>
33 var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
34 lineNumbers: true,
35 matchBrackets: true
36 });
37 </script>
38
39 <p><strong>MIME types defined:</strong> <code>text/vbscript</code>.</p>
40 </body>
41</html>
42
diff --git a/imports/codemirror/mode/vbscript/vbscript.js b/imports/codemirror/mode/vbscript/vbscript.js
new file mode 100644
index 00000000..65d6c212
--- /dev/null
+++ b/imports/codemirror/mode/vbscript/vbscript.js
@@ -0,0 +1,26 @@
1CodeMirror.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
26CodeMirror.defineMIME("text/vbscript", "vbscript");