mode-vbscript.js 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. ace.define("ace/mode/vbscript_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_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. this.$rules = {
  7. "start": [
  8. {
  9. token: [
  10. "meta.ending-space"
  11. ],
  12. regex: "$"
  13. },
  14. {
  15. token: [
  16. null
  17. ],
  18. regex: "^(?=\\t)",
  19. next: "state_3"
  20. },
  21. {
  22. token: [null],
  23. regex: "^(?= )",
  24. next: "state_4"
  25. },
  26. {
  27. token: [
  28. "text",
  29. "storage.type.function.asp",
  30. "text",
  31. "entity.name.function.asp",
  32. "text",
  33. "punctuation.definition.parameters.asp",
  34. "variable.parameter.function.asp",
  35. "punctuation.definition.parameters.asp"
  36. ],
  37. regex: "^(\\s*)(Function|Sub)(\\s*)([a-zA-Z_]\\w*)(\\s*)(\\()([^)]*)(\\))"
  38. },
  39. {
  40. token: "punctuation.definition.comment.asp",
  41. regex: "'|REM",
  42. next: "comment",
  43. caseInsensitive: true
  44. },
  45. {
  46. token: [
  47. "keyword.control.asp"
  48. ],
  49. 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",
  50. caseInsensitive: true
  51. },
  52. {
  53. token: "keyword.operator.asp",
  54. regex: "\\b(?:Mod|And|Not|Or|Xor|as)\\b",
  55. caseInsensitive: true
  56. },
  57. {
  58. token: "storage.type.asp",
  59. 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",
  60. caseInsensitive: true
  61. },
  62. {
  63. token: "storage.modifier.asp",
  64. regex: "\\b(?:Private|Public|Default)\\b",
  65. caseInsensitive: true
  66. },
  67. {
  68. token: "constant.language.asp",
  69. regex: "\\b(?:Empty|False|Nothing|Null|True)\\b",
  70. caseInsensitive: true
  71. },
  72. {
  73. token: "punctuation.definition.string.begin.asp",
  74. regex: '"',
  75. next: "string"
  76. },
  77. {
  78. token: [
  79. "punctuation.definition.variable.asp"
  80. ],
  81. regex: "(\\$)[a-zA-Z_x7f-xff][a-zA-Z0-9_x7f-xff]*?\\b\\s*"
  82. },
  83. {
  84. token: "support.class.asp",
  85. regex: "\\b(?:Application|ObjectContext|Request|Response|Server|Session)\\b",
  86. caseInsensitive: true
  87. },
  88. {
  89. token: "support.class.collection.asp",
  90. regex: "\\b(?:Contents|StaticObjects|ClientCertificate|Cookies|Form|QueryString|ServerVariables)\\b",
  91. caseInsensitive: true
  92. },
  93. {
  94. token: "support.constant.asp",
  95. regex: "\\b(?:TotalBytes|Buffer|CacheControl|Charset|ContentType|Expires|ExpiresAbsolute|IsClientConnected|PICS|Status|ScriptTimeout|CodePage|LCID|SessionID|Timeout)\\b",
  96. caseInsensitive: true
  97. },
  98. {
  99. token: "support.function.asp",
  100. regex: "\\b(?:Lock|Unlock|SetAbort|SetComplete|BinaryRead|AddHeader|AppendToLog|BinaryWrite|Clear|End|Flush|Redirect|Write|CreateObject|HTMLEncode|MapPath|URLEncode|Abandon|Convert|Regex)\\b",
  101. caseInsensitive: true
  102. },
  103. {
  104. token: "support.function.event.asp",
  105. regex: "\\b(?:Application_OnEnd|Application_OnStart|OnTransactionAbort|OnTransactionCommit|Session_OnEnd|Session_OnStart)\\b",
  106. caseInsensitive: true
  107. },
  108. {
  109. token: "support.function.vb.asp",
  110. 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",
  111. caseInsensitive: true
  112. },
  113. {
  114. token: [
  115. "constant.numeric.asp"
  116. ],
  117. 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"
  118. },
  119. {
  120. token: "support.type.vb.asp",
  121. 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",
  122. caseInsensitive: true
  123. },
  124. {
  125. token: [
  126. "entity.name.function.asp"
  127. ],
  128. regex: "(?:(\\b[a-zA-Z_x7f-xff][a-zA-Z0-9_x7f-xff]*?\\b)(?=\\(\\)?))"
  129. },
  130. {
  131. token: [
  132. "keyword.operator.asp"
  133. ],
  134. regex: "\\-|\\+|\\*\\\/|\\>|\\<|\\=|\\&"
  135. }
  136. ],
  137. "state_3": [
  138. {
  139. token: [
  140. "meta.odd-tab.tabs",
  141. "meta.even-tab.tabs"
  142. ],
  143. regex: "(\\t)(\\t)?"
  144. },
  145. {
  146. token: "meta.leading-space",
  147. regex: "(?=[^\\t])",
  148. next: "start"
  149. },
  150. {
  151. token: "meta.leading-space",
  152. regex: ".",
  153. next: "state_3"
  154. }
  155. ],
  156. "state_4": [
  157. {
  158. token: ["meta.odd-tab.spaces", "meta.even-tab.spaces"],
  159. regex: "( )( )?"
  160. },
  161. {
  162. token: "meta.leading-space",
  163. regex: "(?=[^ ])",
  164. next: "start"
  165. },
  166. {
  167. defaultToken: "meta.leading-space"
  168. }
  169. ],
  170. "comment": [
  171. {
  172. token: "comment.line.apostrophe.asp",
  173. regex: "$|(?=(?:%>))",
  174. next: "start"
  175. },
  176. {
  177. defaultToken: "comment.line.apostrophe.asp"
  178. }
  179. ],
  180. "string": [
  181. {
  182. token: "constant.character.escape.apostrophe.asp",
  183. regex: '""'
  184. },
  185. {
  186. token: "string.quoted.double.asp",
  187. regex: '"',
  188. next: "start"
  189. },
  190. {
  191. defaultToken: "string.quoted.double.asp"
  192. }
  193. ]
  194. }
  195. };
  196. oop.inherits(VBScriptHighlightRules, TextHighlightRules);
  197. exports.VBScriptHighlightRules = VBScriptHighlightRules;
  198. });
  199. ace.define("ace/mode/vbscript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/vbscript_highlight_rules"], function(require, exports, module) {
  200. "use strict";
  201. var oop = require("../lib/oop");
  202. var TextMode = require("./text").Mode;
  203. var VBScriptHighlightRules = require("./vbscript_highlight_rules").VBScriptHighlightRules;
  204. var Mode = function() {
  205. this.HighlightRules = VBScriptHighlightRules;
  206. };
  207. oop.inherits(Mode, TextMode);
  208. (function() {
  209. this.lineCommentStart = ["'", "REM"];
  210. this.$id = "ace/mode/vbscript";
  211. }).call(Mode.prototype);
  212. exports.Mode = Mode;
  213. });