From 4dd8eda928e25ea95ef7d17d448150d77752420b Mon Sep 17 00:00:00 2001 From: Bolutife Ogunsola Date: Thu, 19 Mar 2015 18:03:01 +0100 Subject: [PATCH 1/2] VBScript is case insensitive --- lib/ace/mode/vbscript_highlight_rules.js | 43 +++++++++++++++--------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/lib/ace/mode/vbscript_highlight_rules.js b/lib/ace/mode/vbscript_highlight_rules.js index c706002d..ef829922 100644 --- a/lib/ace/mode/vbscript_highlight_rules.js +++ b/lib/ace/mode/vbscript_highlight_rules.js @@ -3,7 +3,7 @@ * * Copyright (c) 2012, Ajax.org B.V. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright @@ -14,7 +14,7 @@ * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -85,29 +85,35 @@ var VBScriptHighlightRules = function() { { token: "punctuation.definition.comment.asp", regex: "'|REM", - next: "comment" + next: "comment", + caseInsensitive: true }, { token: [ "keyword.control.asp" ], - regex: "\\b(?:If|Then|Else|ElseIf|Else If|End If|While|Wend|For|To|Each|Case|Select|End Select|Return|Continue|Do|Until|Loop|Next|With|Exit Do|Exit For|Exit Function|Exit Property|Exit Sub|IIf)\\b" + regex: "\\b(?:If|Then|Else|ElseIf|Else If|End If|While|Wend|For|To|Each|Case|Select|End Select|Return|Continue|Do|Until|Loop|Next|With|Exit Do|Exit For|Exit Function|Exit Property|Exit Sub|IIf)\\b", + caseInsensitive: true }, { token: "keyword.operator.asp", - regex: "\\b(?:Mod|And|Not|Or|Xor|as)\\b" + regex: "\\b(?:Mod|And|Not|Or|Xor|as)\\b", + caseInsensitive: true }, { token: "storage.type.asp", - regex: "Dim|Call|Class|Const|Dim|Redim|Function|Sub|Private Sub|Public Sub|End sub|End Function|Set|Let|Get|New|Randomize|Option Explicit|On Error Resume Next|On Error GoTo" + regex: "Dim|Call|Class|Const|Dim|Redim|Function|Sub|Private Sub|Public Sub|End sub|End Function|Set|Let|Get|New|Randomize|Option Explicit|On Error Resume Next|On Error GoTo", + caseInsensitive: true }, { token: "storage.modifier.asp", - regex: "\\b(?:Private|Public|Default)\\b" + regex: "\\b(?:Private|Public|Default)\\b", + caseInsensitive: true }, { token: "constant.language.asp", - regex: "\\b(?:Empty|False|Nothing|Null|True)\\b" + regex: "\\b(?:Empty|False|Nothing|Null|True)\\b", + caseInsensitive: true }, { token: "punctuation.definition.string.begin.asp", @@ -122,23 +128,28 @@ var VBScriptHighlightRules = function() { }, { token: "support.class.asp", - regex: "\\b(?:Application|ObjectContext|Request|Response|Server|Session)\\b" + regex: "\\b(?:Application|ObjectContext|Request|Response|Server|Session)\\b", + caseInsensitive: true }, { token: "support.class.collection.asp", - regex: "\\b(?:Contents|StaticObjects|ClientCertificate|Cookies|Form|QueryString|ServerVariables)\\b" + regex: "\\b(?:Contents|StaticObjects|ClientCertificate|Cookies|Form|QueryString|ServerVariables)\\b", + caseInsensitive: true }, { token: "support.constant.asp", - regex: "\\b(?:TotalBytes|Buffer|CacheControl|Charset|ContentType|Expires|ExpiresAbsolute|IsClientConnected|PICS|Status|ScriptTimeout|CodePage|LCID|SessionID|Timeout)\\b" + regex: "\\b(?:TotalBytes|Buffer|CacheControl|Charset|ContentType|Expires|ExpiresAbsolute|IsClientConnected|PICS|Status|ScriptTimeout|CodePage|LCID|SessionID|Timeout)\\b", + caseInsensitive: true }, { token: "support.function.asp", - regex: "\\b(?:Lock|Unlock|SetAbort|SetComplete|BinaryRead|AddHeader|AppendToLog|BinaryWrite|Clear|End|Flush|Redirect|Write|CreateObject|HTMLEncode|MapPath|URLEncode|Abandon|Convert|Regex)\\b" + regex: "\\b(?:Lock|Unlock|SetAbort|SetComplete|BinaryRead|AddHeader|AppendToLog|BinaryWrite|Clear|End|Flush|Redirect|Write|CreateObject|HTMLEncode|MapPath|URLEncode|Abandon|Convert|Regex)\\b", + caseInsensitive: true }, { token: "support.function.event.asp", - regex: "\\b(?:Application_OnEnd|Application_OnStart|OnTransactionAbort|OnTransactionCommit|Session_OnEnd|Session_OnStart)\\b" + regex: "\\b(?:Application_OnEnd|Application_OnStart|OnTransactionAbort|OnTransactionCommit|Session_OnEnd|Session_OnStart)\\b", + caseInsensitive: true }, // { // token: [ @@ -148,7 +159,8 @@ var VBScriptHighlightRules = function() { // }, { token: "support.function.vb.asp", - regex: "\\b(?:Array|Add|Asc|Atn|CBool|CByte|CCur|CDate|CDbl|Chr|CInt|CLng|Conversions|Cos|CreateObject|CSng|CStr|Date|DateAdd|DateDiff|DatePart|DateSerial|DateValue|Day|Derived|Math|Escape|Eval|Exists|Exp|Filter|FormatCurrency|FormatDateTime|FormatNumber|FormatPercent|GetLocale|GetObject|GetRef|Hex|Hour|InputBox|InStr|InStrRev|Int|Fix|IsArray|IsDate|IsEmpty|IsNull|IsNumeric|IsObject|Item|Items|Join|Keys|LBound|LCase|Left|Len|LoadPicture|Log|LTrim|RTrim|Trim|Maths|Mid|Minute|Month|MonthName|MsgBox|Now|Oct|Remove|RemoveAll|Replace|RGB|Right|Rnd|Round|ScriptEngine|ScriptEngineBuildVersion|ScriptEngineMajorVersion|ScriptEngineMinorVersion|Second|SetLocale|Sgn|Sin|Space|Split|Sqr|StrComp|String|StrReverse|Tan|Time|Timer|TimeSerial|TimeValue|TypeName|UBound|UCase|Unescape|VarType|Weekday|WeekdayName|Year)\\b" + regex: "\\b(?:Array|Add|Asc|Atn|CBool|CByte|CCur|CDate|CDbl|Chr|CInt|CLng|Conversions|Cos|CreateObject|CSng|CStr|Date|DateAdd|DateDiff|DatePart|DateSerial|DateValue|Day|Derived|Math|Escape|Eval|Exists|Exp|Filter|FormatCurrency|FormatDateTime|FormatNumber|FormatPercent|GetLocale|GetObject|GetRef|Hex|Hour|InputBox|InStr|InStrRev|Int|Fix|IsArray|IsDate|IsEmpty|IsNull|IsNumeric|IsObject|Item|Items|Join|Keys|LBound|LCase|Left|Len|LoadPicture|Log|LTrim|RTrim|Trim|Maths|Mid|Minute|Month|MonthName|MsgBox|Now|Oct|Remove|RemoveAll|Replace|RGB|Right|Rnd|Round|ScriptEngine|ScriptEngineBuildVersion|ScriptEngineMajorVersion|ScriptEngineMinorVersion|Second|SetLocale|Sgn|Sin|Space|Split|Sqr|StrComp|String|StrReverse|Tan|Time|Timer|TimeSerial|TimeValue|TypeName|UBound|UCase|Unescape|VarType|Weekday|WeekdayName|Year)\\b", + caseInsensitive: true }, { token: [ @@ -158,7 +170,8 @@ var VBScriptHighlightRules = function() { }, { token: "support.type.vb.asp", - regex: "\\b(?:vbtrue|vbfalse|vbcr|vbcrlf|vbformfeed|vblf|vbnewline|vbnullchar|vbnullstring|int32|vbtab|vbverticaltab|vbbinarycompare|vbtextcomparevbsunday|vbmonday|vbtuesday|vbwednesday|vbthursday|vbfriday|vbsaturday|vbusesystemdayofweek|vbfirstjan1|vbfirstfourdays|vbfirstfullweek|vbgeneraldate|vblongdate|vbshortdate|vblongtime|vbshorttime|vbobjecterror|vbEmpty|vbNull|vbInteger|vbLong|vbSingle|vbDouble|vbCurrency|vbDate|vbString|vbObject|vbError|vbBoolean|vbVariant|vbDataObject|vbDecimal|vbByte|vbArray)\\b" + regex: "\\b(?:vbtrue|vbfalse|vbcr|vbcrlf|vbformfeed|vblf|vbnewline|vbnullchar|vbnullstring|int32|vbtab|vbverticaltab|vbbinarycompare|vbtextcomparevbsunday|vbmonday|vbtuesday|vbwednesday|vbthursday|vbfriday|vbsaturday|vbusesystemdayofweek|vbfirstjan1|vbfirstfourdays|vbfirstfullweek|vbgeneraldate|vblongdate|vbshortdate|vblongtime|vbshorttime|vbobjecterror|vbEmpty|vbNull|vbInteger|vbLong|vbSingle|vbDouble|vbCurrency|vbDate|vbString|vbObject|vbError|vbBoolean|vbVariant|vbDataObject|vbDecimal|vbByte|vbArray)\\b", + caseInsensitive: true }, { token: [ From 9c6720edca7e506175f026d9f6bb4928c30dc0d4 Mon Sep 17 00:00:00 2001 From: Bolutife Ogunsola Date: Thu, 19 Mar 2015 19:11:49 +0100 Subject: [PATCH 2/2] Update tokens test file for vbscript --- lib/ace/mode/_test/tokens_vbscript.json | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/ace/mode/_test/tokens_vbscript.json b/lib/ace/mode/_test/tokens_vbscript.json index a49f976d..05d5dd22 100644 --- a/lib/ace/mode/_test/tokens_vbscript.json +++ b/lib/ace/mode/_test/tokens_vbscript.json @@ -199,7 +199,5 @@ ["string.quoted.double.asp"," ... updated.\""] ],[ "start", - ["support.function.asp","End"], - ["text"," "], - ["storage.type.asp","Sub"] + ["storage.type.asp","End Sub"] ]] \ No newline at end of file