first commit
This commit is contained in:
42
codemirror/mode/vbscript/index.html
vendored
Normal file
42
codemirror/mode/vbscript/index.html
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>CodeMirror: VBScript mode</title>
|
||||
<link rel="stylesheet" href="../../lib/codemirror.css">
|
||||
<script src="../../lib/codemirror.js"></script>
|
||||
<script src="vbscript.js"></script>
|
||||
<link rel="stylesheet" href="../../doc/docs.css">
|
||||
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>CodeMirror: VBScript mode</h1>
|
||||
|
||||
<div><textarea id="code" name="code">
|
||||
' Pete Guhl
|
||||
' 03-04-2012
|
||||
'
|
||||
' Basic VBScript support for codemirror2
|
||||
|
||||
Const ForReading = 1, ForWriting = 2, ForAppending = 8
|
||||
|
||||
Call Sub020_PostBroadcastToUrbanAirship(strUserName, strPassword, intTransmitID, strResponse)
|
||||
|
||||
If Not IsNull(strResponse) AND Len(strResponse) = 0 Then
|
||||
boolTransmitOkYN = False
|
||||
Else
|
||||
' WScript.Echo "Oh Happy Day! Oh Happy DAY!"
|
||||
boolTransmitOkYN = True
|
||||
End If
|
||||
</textarea></div>
|
||||
|
||||
<script>
|
||||
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
||||
lineNumbers: true
|
||||
});
|
||||
</script>
|
||||
|
||||
<p><strong>MIME types defined:</strong> <code>text/vbscript</code>.</p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
26
codemirror/mode/vbscript/vbscript.js
vendored
Normal file
26
codemirror/mode/vbscript/vbscript.js
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
CodeMirror.defineMode("vbscript", function() {
|
||||
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;
|
||||
|
||||
return {
|
||||
token: function(stream) {
|
||||
if (stream.eatSpace()) return null;
|
||||
var ch = stream.next();
|
||||
if (ch == "'") {
|
||||
stream.skipToEnd();
|
||||
return "comment";
|
||||
}
|
||||
if (ch == '"') {
|
||||
stream.skipTo('"');
|
||||
return "string";
|
||||
}
|
||||
|
||||
if (/\w/.test(ch)) {
|
||||
stream.eatWhile(/\w/);
|
||||
if (regexVBScriptKeyword.test(stream.current())) return "keyword";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
CodeMirror.defineMIME("text/vbscript", "vbscript");
|
||||
Reference in New Issue
Block a user