2836e58974a8e2730a9b6bec1921dd3d.js 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. ace.define("ace/mode/batchfile_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){/* This file was autogenerated from C:\Users\LED\AppData\Roaming\Sublime Text 2\Packages\Batch File\Batch File.tmLanguage (uuid: ) */
  2. "use strict";
  3. var oop = require("../lib/oop");
  4. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  5. var BatchFileHighlightRules = function () {
  6. this.$rules = { start: [{ token: 'keyword.command.dosbatch',
  7. regex: '\\b(?:append|assoc|at|attrib|break|cacls|cd|chcp|chdir|chkdsk|chkntfs|cls|cmd|color|comp|compact|convert|copy|date|del|dir|diskcomp|diskcopy|doskey|echo|endlocal|erase|fc|find|findstr|format|ftype|graftabl|help|keyb|label|md|mkdir|mode|more|move|path|pause|popd|print|prompt|pushd|rd|recover|ren|rename|replace|restore|rmdir|set|setlocal|shift|sort|start|subst|time|title|tree|type|ver|verify|vol|xcopy)\\b',
  8. caseInsensitive: true },
  9. { token: 'keyword.control.statement.dosbatch',
  10. regex: '\\b(?:goto|call|exit)\\b',
  11. caseInsensitive: true },
  12. { token: 'keyword.control.conditional.if.dosbatch',
  13. regex: '\\bif\\s+not\\s+(?:exist|defined|errorlevel|cmdextversion)\\b',
  14. caseInsensitive: true },
  15. { token: 'keyword.control.conditional.dosbatch',
  16. regex: '\\b(?:if|else)\\b',
  17. caseInsensitive: true },
  18. { token: 'keyword.control.repeat.dosbatch',
  19. regex: '\\bfor\\b',
  20. caseInsensitive: true },
  21. { token: 'keyword.operator.dosbatch',
  22. regex: '\\b(?:EQU|NEQ|LSS|LEQ|GTR|GEQ)\\b' },
  23. { token: ['doc.comment', 'comment'],
  24. regex: '(?:^|\\b)(rem)($|\\s.*$)',
  25. caseInsensitive: true },
  26. { token: 'comment.line.colons.dosbatch',
  27. regex: '::.*$' },
  28. { include: 'variable' },
  29. { token: 'punctuation.definition.string.begin.shell',
  30. regex: '"',
  31. push: [
  32. { token: 'punctuation.definition.string.end.shell', regex: '"', next: 'pop' },
  33. { include: 'variable' },
  34. { defaultToken: 'string.quoted.double.dosbatch' }
  35. ] },
  36. { token: 'keyword.operator.pipe.dosbatch', regex: '[|]' },
  37. { token: 'keyword.operator.redirect.shell',
  38. regex: '&>|\\d*>&\\d*|\\d*(?:>>|>|<)|\\d*<&|\\d*<>' }],
  39. variable: [
  40. { token: 'constant.numeric', regex: '%%\\w+|%[*\\d]|%\\w+%' },
  41. { token: 'constant.numeric', regex: '%~\\d+' },
  42. { token: ['markup.list', 'constant.other', 'markup.list'],
  43. regex: '(%)(\\w+)(%?)' }
  44. ] };
  45. this.normalizeRules();
  46. };
  47. BatchFileHighlightRules.metaData = { name: 'Batch File',
  48. scopeName: 'source.dosbatch',
  49. fileTypes: ['bat'] };
  50. oop.inherits(BatchFileHighlightRules, TextHighlightRules);
  51. exports.BatchFileHighlightRules = BatchFileHighlightRules;
  52. });
  53. 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";
  54. var oop = require("../../lib/oop");
  55. var Range = require("../../range").Range;
  56. var BaseFoldMode = require("./fold_mode").FoldMode;
  57. var FoldMode = exports.FoldMode = function (commentRegex) {
  58. if (commentRegex) {
  59. this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start));
  60. this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end));
  61. }
  62. };
  63. oop.inherits(FoldMode, BaseFoldMode);
  64. (function () {
  65. this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
  66. this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
  67. this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/;
  68. this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
  69. this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
  70. this._getFoldWidgetBase = this.getFoldWidget;
  71. this.getFoldWidget = function (session, foldStyle, row) {
  72. var line = session.getLine(row);
  73. if (this.singleLineBlockCommentRe.test(line)) {
  74. if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
  75. return "";
  76. }
  77. var fw = this._getFoldWidgetBase(session, foldStyle, row);
  78. if (!fw && this.startRegionRe.test(line))
  79. return "start"; // lineCommentRegionStart
  80. return fw;
  81. };
  82. this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) {
  83. var line = session.getLine(row);
  84. if (this.startRegionRe.test(line))
  85. return this.getCommentRegionBlock(session, line, row);
  86. var match = line.match(this.foldingStartMarker);
  87. if (match) {
  88. var i = match.index;
  89. if (match[1])
  90. return this.openingBracketBlock(session, match[1], row, i);
  91. var range = session.getCommentFoldRange(row, i + match[0].length, 1);
  92. if (range && !range.isMultiLine()) {
  93. if (forceMultiline) {
  94. range = this.getSectionRange(session, row);
  95. }
  96. else if (foldStyle != "all")
  97. range = null;
  98. }
  99. return range;
  100. }
  101. if (foldStyle === "markbegin")
  102. return;
  103. var match = line.match(this.foldingStopMarker);
  104. if (match) {
  105. var i = match.index + match[0].length;
  106. if (match[1])
  107. return this.closingBracketBlock(session, match[1], row, i);
  108. return session.getCommentFoldRange(row, i, -1);
  109. }
  110. };
  111. this.getSectionRange = function (session, row) {
  112. var line = session.getLine(row);
  113. var startIndent = line.search(/\S/);
  114. var startRow = row;
  115. var startColumn = line.length;
  116. row = row + 1;
  117. var endRow = row;
  118. var maxRow = session.getLength();
  119. while (++row < maxRow) {
  120. line = session.getLine(row);
  121. var indent = line.search(/\S/);
  122. if (indent === -1)
  123. continue;
  124. if (startIndent > indent)
  125. break;
  126. var subRange = this.getFoldWidgetRange(session, "all", row);
  127. if (subRange) {
  128. if (subRange.start.row <= startRow) {
  129. break;
  130. }
  131. else if (subRange.isMultiLine()) {
  132. row = subRange.end.row;
  133. }
  134. else if (startIndent == indent) {
  135. break;
  136. }
  137. }
  138. endRow = row;
  139. }
  140. return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
  141. };
  142. this.getCommentRegionBlock = function (session, line, row) {
  143. var startColumn = line.search(/\s*$/);
  144. var maxRow = session.getLength();
  145. var startRow = row;
  146. var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
  147. var depth = 1;
  148. while (++row < maxRow) {
  149. line = session.getLine(row);
  150. var m = re.exec(line);
  151. if (!m)
  152. continue;
  153. if (m[1])
  154. depth--;
  155. else
  156. depth++;
  157. if (!depth)
  158. break;
  159. }
  160. var endRow = row;
  161. if (endRow > startRow) {
  162. return new Range(startRow, startColumn, endRow, line.length);
  163. }
  164. };
  165. }).call(FoldMode.prototype);
  166. });
  167. ace.define("ace/mode/batchfile",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/batchfile_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module){/*
  168. THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
  169. */
  170. "use strict";
  171. var oop = require("../lib/oop");
  172. var TextMode = require("./text").Mode;
  173. var BatchFileHighlightRules = require("./batchfile_highlight_rules").BatchFileHighlightRules;
  174. var FoldMode = require("./folding/cstyle").FoldMode;
  175. var Mode = function () {
  176. this.HighlightRules = BatchFileHighlightRules;
  177. this.foldingRules = new FoldMode();
  178. this.$behaviour = this.$defaultBehaviour;
  179. };
  180. oop.inherits(Mode, TextMode);
  181. (function () {
  182. this.lineCommentStart = "::";
  183. this.blockComment = "";
  184. this.$id = "ace/mode/batchfile";
  185. }).call(Mode.prototype);
  186. exports.Mode = Mode;
  187. }); (function() {
  188. ace.require(["ace/mode/batchfile"], function(m) {
  189. if (typeof module == "object" && typeof exports == "object" && module) {
  190. module.exports = m;
  191. }
  192. });
  193. })();