45de113a9f4cd75a8a71a2e6f4f91c95.js 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. ace.define("ace/mode/diff_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 DiffHighlightRules = function () {
  5. this.$rules = {
  6. "start": [{
  7. regex: "^(?:\\*{15}|={67}|-{3}|\\+{3})$",
  8. token: "punctuation.definition.separator.diff",
  9. "name": "keyword"
  10. }, {
  11. regex: "^(@@)(\\s*.+?\\s*)(@@)(.*)$",
  12. token: [
  13. "constant",
  14. "constant.numeric",
  15. "constant",
  16. "comment.doc.tag"
  17. ]
  18. }, {
  19. regex: "^(\\d+)([,\\d]+)(a|d|c)(\\d+)([,\\d]+)(.*)$",
  20. token: [
  21. "constant.numeric",
  22. "punctuation.definition.range.diff",
  23. "constant.function",
  24. "constant.numeric",
  25. "punctuation.definition.range.diff",
  26. "invalid"
  27. ],
  28. "name": "meta."
  29. }, {
  30. regex: "^(\\-{3}|\\+{3}|\\*{3})( .+)$",
  31. token: [
  32. "constant.numeric",
  33. "meta.tag"
  34. ]
  35. }, {
  36. regex: "^([!+>])(.*?)(\\s*)$",
  37. token: [
  38. "support.constant",
  39. "text",
  40. "invalid"
  41. ]
  42. }, {
  43. regex: "^([<\\-])(.*?)(\\s*)$",
  44. token: [
  45. "support.function",
  46. "string",
  47. "invalid"
  48. ]
  49. }, {
  50. regex: "^(diff)(\\s+--\\w+)?(.+?)( .+)?$",
  51. token: ["variable", "variable", "keyword", "variable"]
  52. }, {
  53. regex: "^Index.+$",
  54. token: "variable"
  55. }, {
  56. regex: "^\\s+$",
  57. token: "text"
  58. }, {
  59. regex: "\\s*$",
  60. token: "invalid"
  61. }, {
  62. defaultToken: "invisible",
  63. caseInsensitive: true
  64. }
  65. ]
  66. };
  67. };
  68. oop.inherits(DiffHighlightRules, TextHighlightRules);
  69. exports.DiffHighlightRules = DiffHighlightRules;
  70. });
  71. ace.define("ace/mode/folding/diff",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(require, exports, module){"use strict";
  72. var oop = require("../../lib/oop");
  73. var BaseFoldMode = require("./fold_mode").FoldMode;
  74. var Range = require("../../range").Range;
  75. var FoldMode = exports.FoldMode = function (levels, flag) {
  76. this.regExpList = levels;
  77. this.flag = flag;
  78. this.foldingStartMarker = RegExp("^(" + levels.join("|") + ")", this.flag);
  79. };
  80. oop.inherits(FoldMode, BaseFoldMode);
  81. (function () {
  82. this.getFoldWidgetRange = function (session, foldStyle, row) {
  83. var line = session.getLine(row);
  84. var start = { row: row, column: line.length };
  85. var regList = this.regExpList;
  86. for (var i = 1; i <= regList.length; i++) {
  87. var re = RegExp("^(" + regList.slice(0, i).join("|") + ")", this.flag);
  88. if (re.test(line))
  89. break;
  90. }
  91. for (var l = session.getLength(); ++row < l;) {
  92. line = session.getLine(row);
  93. if (re.test(line))
  94. break;
  95. }
  96. if (row == start.row + 1)
  97. return;
  98. return new Range(start.row, start.column, row - 1, line.length);
  99. };
  100. }).call(FoldMode.prototype);
  101. });
  102. ace.define("ace/mode/diff",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/diff_highlight_rules","ace/mode/folding/diff"], function(require, exports, module){"use strict";
  103. var oop = require("../lib/oop");
  104. var TextMode = require("./text").Mode;
  105. var HighlightRules = require("./diff_highlight_rules").DiffHighlightRules;
  106. var FoldMode = require("./folding/diff").FoldMode;
  107. var Mode = function () {
  108. this.HighlightRules = HighlightRules;
  109. this.foldingRules = new FoldMode(["diff", "@@|\\*{5}"], "i");
  110. };
  111. oop.inherits(Mode, TextMode);
  112. (function () {
  113. this.$id = "ace/mode/diff";
  114. this.snippetFileId = "ace/snippets/diff";
  115. }).call(Mode.prototype);
  116. exports.Mode = Mode;
  117. }); (function() {
  118. ace.require(["ace/mode/diff"], function(m) {
  119. if (typeof module == "object" && typeof exports == "object" && module) {
  120. module.exports = m;
  121. }
  122. });
  123. })();