From 671d2b94996ac71d56b2d05d5fe694ed7d84fa59 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Wed, 4 Apr 2012 12:27:35 -0700 Subject: upgrading to CodeMirror 2.23, since it has an important fix to Not close Ninja, if backspace is pressed while autocomplete dropdown is open. Signed-off-by: Ananya Sen --- imports/codemirror/mode/vbscript/index.html | 42 ++++++++++++++++++++++++++++ imports/codemirror/mode/vbscript/vbscript.js | 26 +++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 imports/codemirror/mode/vbscript/index.html create mode 100644 imports/codemirror/mode/vbscript/vbscript.js (limited to 'imports/codemirror/mode/vbscript') 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 @@ + + + + CodeMirror: VBScript mode + + + + + + + +

CodeMirror: VBScript mode

+ +
+ + + +

MIME types defined: text/vbscript.

+ + + 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 @@ +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"); -- cgit v1.2.3