mode-vbscript.js 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. ace.define("ace/mode/vbscript_highlight_rules",[], function(require, exports, module) {
  2. "use strict";
  3. var oop = require("../lib/oop");
  4. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  5. var VBScriptHighlightRules = function() {
  6. var keywordMapper = this.createKeywordMapper({
  7. "keyword.control.asp": "If|Then|Else|ElseIf|End|While|Wend|For|To|Each|Case|Select|Return"
  8. + "|Continue|Do|Until|Loop|Next|With|Exit|Function|Property|Type|Enum|Sub|IIf",
  9. "storage.type.asp": "Dim|Call|Class|Const|Dim|Redim|Set|Let|Get|New|Randomize|Option|Explicit",
  10. "storage.modifier.asp": "Private|Public|Default",
  11. "keyword.operator.asp": "Mod|And|Not|Or|Xor|as",
  12. "constant.language.asp": "Empty|False|Nothing|Null|True",
  13. "support.class.asp": "Application|ObjectContext|Request|Response|Server|Session",
  14. "support.class.collection.asp": "Contents|StaticObjects|ClientCertificate|Cookies|Form|QueryString|ServerVariables",
  15. "support.constant.asp": "TotalBytes|Buffer|CacheControl|Charset|ContentType|Expires|ExpiresAbsolute"
  16. + "|IsClientConnected|PICS|Status|ScriptTimeout|CodePage|LCID|SessionID|Timeout",
  17. "support.function.asp": "Lock|Unlock|SetAbort|SetComplete|BinaryRead|AddHeader|AppendToLog"
  18. + "|BinaryWrite|Clear|Flush|Redirect|Write|CreateObject|HTMLEncode|MapPath|URLEncode|Abandon|Convert|Regex",
  19. "support.function.event.asp": "Application_OnEnd|Application_OnStart"
  20. + "|OnTransactionAbort|OnTransactionCommit|Session_OnEnd|Session_OnStart",
  21. "support.function.vb.asp": "Array|Add|Asc|Atn|CBool|CByte|CCur|CDate|CDbl|Chr|CInt|CLng"
  22. + "|Conversions|Cos|CreateObject|CSng|CStr|Date|DateAdd|DateDiff|DatePart|DateSerial"
  23. + "|DateValue|Day|Derived|Math|Escape|Eval|Exists|Exp|Filter|FormatCurrency"
  24. + "|FormatDateTime|FormatNumber|FormatPercent|GetLocale|GetObject|GetRef|Hex"
  25. + "|Hour|InputBox|InStr|InStrRev|Int|Fix|IsArray|IsDate|IsEmpty|IsNull|IsNumeric"
  26. + "|IsObject|Item|Items|Join|Keys|LBound|LCase|Left|Len|LoadPicture|Log|LTrim|RTrim"
  27. + "|Trim|Maths|Mid|Minute|Month|MonthName|MsgBox|Now|Oct|Remove|RemoveAll|Replace"
  28. + "|RGB|Right|Rnd|Round|ScriptEngine|ScriptEngineBuildVersion|ScriptEngineMajorVersion"
  29. + "|ScriptEngineMinorVersion|Second|SetLocale|Sgn|Sin|Space|Split|Sqr|StrComp|String|StrReverse"
  30. + "|Tan|Time|Timer|TimeSerial|TimeValue|TypeName|UBound|UCase|Unescape|VarType|Weekday|WeekdayName|Year",
  31. "support.type.vb.asp": "vbtrue|vbfalse|vbcr|vbcrlf|vbformfeed|vblf|vbnewline|vbnullchar|vbnullstring|"
  32. + "int32|vbtab|vbverticaltab|vbbinarycompare|vbtextcomparevbsunday|vbmonday|vbtuesday|vbwednesday"
  33. + "|vbthursday|vbfriday|vbsaturday|vbusesystemdayofweek|vbfirstjan1|vbfirstfourdays|vbfirstfullweek"
  34. + "|vbgeneraldate|vblongdate|vbshortdate|vblongtime|vbshorttime|vbobjecterror|vbEmpty|vbNull|vbInteger"
  35. + "|vbLong|vbSingle|vbDouble|vbCurrency|vbDate|vbString|vbObject|vbError|vbBoolean|vbVariant"
  36. + "|vbDataObject|vbDecimal|vbByte|vbArray"
  37. }, "identifier", true);
  38. this.$rules = {
  39. "start": [
  40. {
  41. token: [
  42. "meta.ending-space"
  43. ],
  44. regex: "$"
  45. },
  46. {
  47. token: [null],
  48. regex: "^(?=\\t)",
  49. next: "state_3"
  50. },
  51. {
  52. token: [null],
  53. regex: "^(?= )",
  54. next: "state_4"
  55. },
  56. {
  57. token: [
  58. "text",
  59. "storage.type.function.asp",
  60. "text",
  61. "entity.name.function.asp",
  62. "text",
  63. "punctuation.definition.parameters.asp",
  64. "variable.parameter.function.asp",
  65. "punctuation.definition.parameters.asp"
  66. ],
  67. regex: "^(\\s*)(Function|Sub)(\\s+)([a-zA-Z_]\\w*)(\\s*)(\\()([^)]*)(\\))"
  68. },
  69. {
  70. token: "punctuation.definition.comment.asp",
  71. regex: "'|REM(?=\\s|$)",
  72. next: "comment",
  73. caseInsensitive: true
  74. },
  75. {
  76. token: "storage.type.asp",
  77. regex: "On Error Resume Next|On Error GoTo",
  78. caseInsensitive: true
  79. },
  80. {
  81. token: "punctuation.definition.string.begin.asp",
  82. regex: '"',
  83. next: "string"
  84. },
  85. {
  86. token: [
  87. "punctuation.definition.variable.asp"
  88. ],
  89. regex: "(\\$)[a-zA-Z_x7f-xff][a-zA-Z0-9_x7f-xff]*?\\b\\s*"
  90. },
  91. {
  92. token: "constant.numeric.asp",
  93. regex: "-?\\b(?:(?:0(?:x|X)[0-9a-fA-F]*)|(?:(?:[0-9]+\\.?[0-9]*)|(?:\\.[0-9]+))(?:(?:e|E)(?:\\+|-)?[0-9]+)?)(?:L|l|UL|ul|u|U|F|f)?\\b"
  94. },
  95. {
  96. regex: "\\w+",
  97. token: keywordMapper
  98. },
  99. {
  100. token: ["entity.name.function.asp"],
  101. regex: "(?:(\\b[a-zA-Z_x7f-xff][a-zA-Z0-9_x7f-xff]*?\\b)(?=\\(\\)?))"
  102. },
  103. {
  104. token: ["keyword.operator.asp"],
  105. regex: "\\-|\\+|\\*\\/|\\>|\\<|\\=|\\&"
  106. }
  107. ],
  108. "state_3": [
  109. {
  110. token: [
  111. "meta.odd-tab.tabs",
  112. "meta.even-tab.tabs"
  113. ],
  114. regex: "(\\t)(\\t)?"
  115. },
  116. {
  117. token: "meta.leading-space",
  118. regex: "(?=[^\\t])",
  119. next: "start"
  120. },
  121. {
  122. token: "meta.leading-space",
  123. regex: ".",
  124. next: "state_3"
  125. }
  126. ],
  127. "state_4": [
  128. {
  129. token: ["meta.odd-tab.spaces", "meta.even-tab.spaces"],
  130. regex: "( )( )?"
  131. },
  132. {
  133. token: "meta.leading-space",
  134. regex: "(?=[^ ])",
  135. next: "start"
  136. },
  137. {
  138. defaultToken: "meta.leading-space"
  139. }
  140. ],
  141. "comment": [
  142. {
  143. token: "comment.line.apostrophe.asp",
  144. regex: "$|(?=(?:%>))",
  145. next: "start"
  146. },
  147. {
  148. defaultToken: "comment.line.apostrophe.asp"
  149. }
  150. ],
  151. "string": [
  152. {
  153. token: "constant.character.escape.apostrophe.asp",
  154. regex: '""'
  155. },
  156. {
  157. token: "string.quoted.double.asp",
  158. regex: '"',
  159. next: "start"
  160. },
  161. {
  162. defaultToken: "string.quoted.double.asp"
  163. }
  164. ]
  165. };
  166. };
  167. oop.inherits(VBScriptHighlightRules, TextHighlightRules);
  168. exports.VBScriptHighlightRules = VBScriptHighlightRules;
  169. });
  170. ace.define("ace/mode/vbscript",[], function(require, exports, module) {
  171. "use strict";
  172. var oop = require("../lib/oop");
  173. var TextMode = require("./text").Mode;
  174. var VBScriptHighlightRules = require("./vbscript_highlight_rules").VBScriptHighlightRules;
  175. var Mode = function() {
  176. this.HighlightRules = VBScriptHighlightRules;
  177. this.$behaviour = this.$defaultBehaviour;
  178. };
  179. oop.inherits(Mode, TextMode);
  180. (function() {
  181. this.lineCommentStart = ["'", "REM"];
  182. this.$id = "ace/mode/vbscript";
  183. }).call(Mode.prototype);
  184. exports.Mode = Mode;
  185. });
  186. (function() {
  187. ace.require(["ace/mode/vbscript"], function(m) {
  188. if (typeof module == "object" && typeof exports == "object" && module) {
  189. module.exports = m;
  190. }
  191. });
  192. })();