34eb9d98392182a042fa67206fd33187.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. ace.define("ace/mode/nsis_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict";
  2. var oop = require("../lib/oop");
  3. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  4. var NSISHighlightRules = function () {
  5. this.$rules = {
  6. start: [{
  7. token: "keyword.compiler.nsis",
  8. regex: /^\s*!(?:include|addincludedir|addplugindir|appendfile|cd|delfile|echo|error|execute|packhdr|pragma|finalize|getdllversion|gettlbversion|system|tempfile|warning|verbose|define|undef|insertmacro|macro|macroend|makensis|searchparse|searchreplace|uninstfinalize)\b/,
  9. caseInsensitive: true
  10. }, {
  11. token: "keyword.command.nsis",
  12. regex: /^\s*(?:Abort|AddBrandingImage|AddSize|AllowRootDirInstall|AllowSkipFiles|AutoCloseWindow|BGFont|BGGradient|BrandingText|BringToFront|Call|CallInstDLL|Caption|ChangeUI|CheckBitmap|ClearErrors|CompletedText|ComponentText|CopyFiles|CRCCheck|CreateDirectory|CreateFont|CreateShortCut|Delete|DeleteINISec|DeleteINIStr|DeleteRegKey|DeleteRegValue|DetailPrint|DetailsButtonText|DirText|DirVar|DirVerify|EnableWindow|EnumRegKey|EnumRegValue|Exch|Exec|ExecShell|ExecShellWait|ExecWait|ExpandEnvStrings|File|FileBufSize|FileClose|FileErrorText|FileOpen|FileRead|FileReadByte|FileReadUTF16LE|FileReadWord|FileWriteUTF16LE|FileSeek|FileWrite|FileWriteByte|FileWriteWord|FindClose|FindFirst|FindNext|FindWindow|FlushINI|GetCurInstType|GetCurrentAddress|GetDlgItem|GetDLLVersion|GetDLLVersionLocal|GetErrorLevel|GetFileTime|GetFileTimeLocal|GetFullPathName|GetFunctionAddress|GetInstDirError|GetKnownFolderPath|GetLabelAddress|GetTempFileName|GetWinVer|Goto|HideWindow|Icon|IfAbort|IfErrors|IfFileExists|IfRebootFlag|IfRtlLanguage|IfShellVarContextAll|IfSilent|InitPluginsDir|InstallButtonText|InstallColors|InstallDir|InstallDirRegKey|InstProgressFlags|InstType|InstTypeGetText|InstTypeSetText|Int64Cmp|Int64CmpU|Int64Fmt|IntCmp|IntCmpU|IntFmt|IntOp|IntPtrCmp|IntPtrCmpU|IntPtrOp|IsWindow|LangString|LicenseBkColor|LicenseData|LicenseForceSelection|LicenseLangString|LicenseText|LoadAndSetImage|LoadLanguageFile|LockWindow|LogSet|LogText|ManifestDPIAware|ManifestLongPathAware|ManifestMaxVersionTested|ManifestSupportedOS|MessageBox|MiscButtonText|Name|Nop|OutFile|Page|PageCallbacks|PEAddResource|PEDllCharacteristics|PERemoveResource|PESubsysVer|Pop|Push|Quit|ReadEnvStr|ReadINIStr|ReadRegDWORD|ReadRegStr|Reboot|RegDLL|Rename|RequestExecutionLevel|ReserveFile|Return|RMDir|SearchPath|SectionGetFlags|SectionGetInstTypes|SectionGetSize|SectionGetText|SectionIn|SectionSetFlags|SectionSetInstTypes|SectionSetSize|SectionSetText|SendMessage|SetAutoClose|SetBrandingImage|SetCompress|SetCompressor|SetCompressorDictSize|SetCtlColors|SetCurInstType|SetDatablockOptimize|SetDateSave|SetDetailsPrint|SetDetailsView|SetErrorLevel|SetErrors|SetFileAttributes|SetFont|SetOutPath|SetOverwrite|SetRebootFlag|SetRegView|SetShellVarContext|SetSilent|ShowInstDetails|ShowUninstDetails|ShowWindow|SilentInstall|SilentUnInstall|Sleep|SpaceTexts|StrCmp|StrCmpS|StrCpy|StrLen|SubCaption|Unicode|UninstallButtonText|UninstallCaption|UninstallIcon|UninstallSubCaption|UninstallText|UninstPage|UnRegDLL|Var|VIAddVersionKey|VIFileVersion|VIProductVersion|WindowIcon|WriteINIStr|WriteRegBin|WriteRegDWORD|WriteRegExpandStr|WriteRegMultiStr|WriteRegNone|WriteRegStr|WriteUninstaller|XPStyle)\b/,
  13. caseInsensitive: true
  14. }, {
  15. token: "keyword.control.nsis",
  16. regex: /^\s*!(?:ifdef|ifndef|if|ifmacrodef|ifmacrondef|else|endif)\b/,
  17. caseInsensitive: true
  18. }, {
  19. token: "keyword.plugin.nsis",
  20. regex: /^\s*\w+::\w+/,
  21. caseInsensitive: true
  22. }, {
  23. token: "keyword.operator.comparison.nsis",
  24. regex: /[!<>]?=|<>|<|>/
  25. }, {
  26. token: "support.function.nsis",
  27. regex: /(?:\b|^\s*)(?:Function|FunctionEnd|Section|SectionEnd|SectionGroup|SectionGroupEnd|PageEx|PageExEnd)\b/,
  28. caseInsensitive: true
  29. }, {
  30. token: "support.library.nsis",
  31. regex: /\${[\w\.:-]+}/
  32. }, {
  33. token: "constant.nsis",
  34. regex: /\b(?:ARCHIVE|FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_NORMAL|FILE_ATTRIBUTE_OFFLINE|FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_TEMPORARY|HIDDEN|HKCC|HKCR(32|64)?|HKCU(32|64)?|HKDD|HKEY_CLASSES_ROOT|HKEY_CURRENT_CONFIG|HKEY_CURRENT_USER|HKEY_DYN_DATA|HKEY_LOCAL_MACHINE|HKEY_PERFORMANCE_DATA|HKEY_USERS|HKLM(32|64)?|HKPD|HKU|IDABORT|IDCANCEL|IDD_DIR|IDD_INST|IDD_INSTFILES|IDD_LICENSE|IDD_SELCOM|IDD_UNINST|IDD_VERIFY|IDIGNORE|IDNO|IDOK|IDRETRY|IDYES|MB_ABORTRETRYIGNORE|MB_DEFBUTTON1|MB_DEFBUTTON2|MB_DEFBUTTON3|MB_DEFBUTTON4|MB_ICONEXCLAMATION|MB_ICONINFORMATION|MB_ICONQUESTION|MB_ICONSTOP|MB_OK|MB_OKCANCEL|MB_RETRYCANCEL|MB_RIGHT|MB_RTLREADING|MB_SETFOREGROUND|MB_TOPMOST|MB_USERICON|MB_YESNO|MB_YESNOCANCEL|NORMAL|OFFLINE|READONLY|SHCTX|SHELL_CONTEXT|SW_HIDE|SW_SHOWDEFAULT|SW_SHOWMAXIMIZED|SW_SHOWMINIMIZED|SW_SHOWNORMAL|SYSTEM|TEMPORARY)\b/,
  35. caseInsensitive: true
  36. }, {
  37. token: "constant.library.nsis",
  38. regex: /\${(?:AtLeastServicePack|AtLeastWin7|AtLeastWin8|AtLeastWin10|AtLeastWin95|AtLeastWin98|AtLeastWin2000|AtLeastWin2003|AtLeastWin2008|AtLeastWin2008R2|AtLeastWinME|AtLeastWinNT4|AtLeastWinVista|AtLeastWinXP|AtMostServicePack|AtMostWin7|AtMostWin8|AtMostWin10|AtMostWin95|AtMostWin98|AtMostWin2000|AtMostWin2003|AtMostWin2008|AtMostWin2008R2|AtMostWinME|AtMostWinNT4|AtMostWinVista|AtMostWinXP|IsDomainController|IsNT|IsServer|IsServicePack|IsWin7|IsWin8|IsWin10|IsWin95|IsWin98|IsWin2000|IsWin2003|IsWin2008|IsWin2008R2|IsWinME|IsWinNT4|IsWinVista|IsWinXP)}/
  39. }, {
  40. token: "constant.language.boolean.true.nsis",
  41. regex: /\b(?:true|on)\b/
  42. }, {
  43. token: "constant.language.boolean.false.nsis",
  44. regex: /\b(?:false|off)\b/
  45. }, {
  46. token: "constant.language.option.nsis",
  47. regex: /(?:\b|^\s*)(?:(?:un\.)?components|(?:un\.)?custom|(?:un\.)?directory|(?:un\.)?instfiles|(?:un\.)?license|uninstConfirm|admin|all|amd64-unicode|auto|both|bottom|bzip2|current|force|hide|highest|ifdiff|ifnewer|lastused|leave|left|listonly|lzma|nevershow|none|normal|notset|right|show|silent|silentlog|textonly|top|try|user|Win10|Win7|Win8|WinVista|x86-(ansi|unicode)|zlib)\b/,
  48. caseInsensitive: true
  49. }, {
  50. token: "constant.language.slash-option.nsis",
  51. regex: /\b\/(?:a|BRANDING|CENTER|COMPONENTSONLYONCUSTOM|CUSTOMSTRING=|date|e|ENABLECANCEL|FILESONLY|file|FINAL|GLOBAL|gray|ifempty|ifndef|ignorecase|IMGID=|ITALIC|LANG=|NOCUSTOM|noerrors|NONFATAL|nonfatal|oname=|o|REBOOTOK|redef|RESIZETOFIT|r|SHORT|SILENT|SOLID|STRIKE|TRIM|UNDERLINE|utcdate|windows|x)\b/,
  52. caseInsensitive: true
  53. }, {
  54. token: "constant.numeric.nsis",
  55. regex: /\b(?:0(?:x|X)[0-9a-fA-F]+|[0-9]+(?:\.[0-9]+)?)\b/
  56. }, {
  57. token: "entity.name.function.nsis",
  58. regex: /\$\([\w\.:-]+\)/
  59. }, {
  60. token: "storage.type.function.nsis",
  61. regex: /\$\w+/
  62. }, {
  63. token: "punctuation.definition.string.begin.nsis",
  64. regex: /`/,
  65. push: [{
  66. token: "punctuation.definition.string.end.nsis",
  67. regex: /`/,
  68. next: "pop"
  69. }, {
  70. token: "constant.character.escape.nsis",
  71. regex: /\$\\./
  72. }, {
  73. defaultToken: "string.quoted.back.nsis"
  74. }]
  75. }, {
  76. token: "punctuation.definition.string.begin.nsis",
  77. regex: /"/,
  78. push: [{
  79. token: "punctuation.definition.string.end.nsis",
  80. regex: /"/,
  81. next: "pop"
  82. }, {
  83. token: "constant.character.escape.nsis",
  84. regex: /\$\\./
  85. }, {
  86. defaultToken: "string.quoted.double.nsis"
  87. }]
  88. }, {
  89. token: "punctuation.definition.string.begin.nsis",
  90. regex: /'/,
  91. push: [{
  92. token: "punctuation.definition.string.end.nsis",
  93. regex: /'/,
  94. next: "pop"
  95. }, {
  96. token: "constant.character.escape.nsis",
  97. regex: /\$\\./
  98. }, {
  99. defaultToken: "string.quoted.single.nsis"
  100. }]
  101. }, {
  102. token: [
  103. "punctuation.definition.comment.nsis",
  104. "comment.line.nsis"
  105. ],
  106. regex: /(;|#)(.*$)/
  107. }, {
  108. token: "punctuation.definition.comment.nsis",
  109. regex: /\/\*/,
  110. push: [{
  111. token: "punctuation.definition.comment.nsis",
  112. regex: /\*\//,
  113. next: "pop"
  114. }, {
  115. defaultToken: "comment.block.nsis"
  116. }]
  117. }, {
  118. token: "text",
  119. regex: /(?:!include|!insertmacro)\b/
  120. }]
  121. };
  122. this.normalizeRules();
  123. };
  124. NSISHighlightRules.metaData = {
  125. comment: "\n\ttodo: - highlight functions\n\t",
  126. fileTypes: ["nsi", "nsh"],
  127. name: "NSIS",
  128. scopeName: "source.nsis"
  129. };
  130. oop.inherits(NSISHighlightRules, TextHighlightRules);
  131. exports.NSISHighlightRules = NSISHighlightRules;
  132. });
  133. ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module){"use strict";
  134. var oop = require("../../lib/oop");
  135. var Range = require("../../range").Range;
  136. var BaseFoldMode = require("./fold_mode").FoldMode;
  137. var FoldMode = exports.FoldMode = function (commentRegex) {
  138. if (commentRegex) {
  139. this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start));
  140. this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end));
  141. }
  142. };
  143. oop.inherits(FoldMode, BaseFoldMode);
  144. (function () {
  145. this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
  146. this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
  147. this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/;
  148. this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
  149. this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
  150. this._getFoldWidgetBase = this.getFoldWidget;
  151. this.getFoldWidget = function (session, foldStyle, row) {
  152. var line = session.getLine(row);
  153. if (this.singleLineBlockCommentRe.test(line)) {
  154. if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
  155. return "";
  156. }
  157. var fw = this._getFoldWidgetBase(session, foldStyle, row);
  158. if (!fw && this.startRegionRe.test(line))
  159. return "start"; // lineCommentRegionStart
  160. return fw;
  161. };
  162. this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) {
  163. var line = session.getLine(row);
  164. if (this.startRegionRe.test(line))
  165. return this.getCommentRegionBlock(session, line, row);
  166. var match = line.match(this.foldingStartMarker);
  167. if (match) {
  168. var i = match.index;
  169. if (match[1])
  170. return this.openingBracketBlock(session, match[1], row, i);
  171. var range = session.getCommentFoldRange(row, i + match[0].length, 1);
  172. if (range && !range.isMultiLine()) {
  173. if (forceMultiline) {
  174. range = this.getSectionRange(session, row);
  175. }
  176. else if (foldStyle != "all")
  177. range = null;
  178. }
  179. return range;
  180. }
  181. if (foldStyle === "markbegin")
  182. return;
  183. var match = line.match(this.foldingStopMarker);
  184. if (match) {
  185. var i = match.index + match[0].length;
  186. if (match[1])
  187. return this.closingBracketBlock(session, match[1], row, i);
  188. return session.getCommentFoldRange(row, i, -1);
  189. }
  190. };
  191. this.getSectionRange = function (session, row) {
  192. var line = session.getLine(row);
  193. var startIndent = line.search(/\S/);
  194. var startRow = row;
  195. var startColumn = line.length;
  196. row = row + 1;
  197. var endRow = row;
  198. var maxRow = session.getLength();
  199. while (++row < maxRow) {
  200. line = session.getLine(row);
  201. var indent = line.search(/\S/);
  202. if (indent === -1)
  203. continue;
  204. if (startIndent > indent)
  205. break;
  206. var subRange = this.getFoldWidgetRange(session, "all", row);
  207. if (subRange) {
  208. if (subRange.start.row <= startRow) {
  209. break;
  210. }
  211. else if (subRange.isMultiLine()) {
  212. row = subRange.end.row;
  213. }
  214. else if (startIndent == indent) {
  215. break;
  216. }
  217. }
  218. endRow = row;
  219. }
  220. return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
  221. };
  222. this.getCommentRegionBlock = function (session, line, row) {
  223. var startColumn = line.search(/\s*$/);
  224. var maxRow = session.getLength();
  225. var startRow = row;
  226. var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
  227. var depth = 1;
  228. while (++row < maxRow) {
  229. line = session.getLine(row);
  230. var m = re.exec(line);
  231. if (!m)
  232. continue;
  233. if (m[1])
  234. depth--;
  235. else
  236. depth++;
  237. if (!depth)
  238. break;
  239. }
  240. var endRow = row;
  241. if (endRow > startRow) {
  242. return new Range(startRow, startColumn, endRow, line.length);
  243. }
  244. };
  245. }).call(FoldMode.prototype);
  246. });
  247. ace.define("ace/mode/nsis",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/nsis_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module){/*
  248. THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
  249. */
  250. "use strict";
  251. var oop = require("../lib/oop");
  252. var TextMode = require("./text").Mode;
  253. var NSISHighlightRules = require("./nsis_highlight_rules").NSISHighlightRules;
  254. var FoldMode = require("./folding/cstyle").FoldMode;
  255. var Mode = function () {
  256. this.HighlightRules = NSISHighlightRules;
  257. this.foldingRules = new FoldMode();
  258. this.$behaviour = this.$defaultBehaviour;
  259. };
  260. oop.inherits(Mode, TextMode);
  261. (function () {
  262. this.lineCommentStart = [";", "#"];
  263. this.blockComment = { start: "/*", end: "*/" };
  264. this.$id = "ace/mode/nsis";
  265. }).call(Mode.prototype);
  266. exports.Mode = Mode;
  267. }); (function() {
  268. ace.require(["ace/mode/nsis"], function(m) {
  269. if (typeof module == "object" && typeof exports == "object" && module) {
  270. module.exports = m;
  271. }
  272. });
  273. })();