be964ce7cf6d2902db61ade8f9cd0860.js 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. ace.define("ace/mode/cirru_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 CirruHighlightRules = function () {
  5. this.$rules = {
  6. start: [{
  7. token: 'constant.numeric',
  8. regex: /[\d\.]+/
  9. }, {
  10. token: 'comment.line.double-dash',
  11. regex: /--/,
  12. next: 'comment'
  13. }, {
  14. token: 'storage.modifier',
  15. regex: /\(/
  16. }, {
  17. token: 'storage.modifier',
  18. regex: /,/,
  19. next: 'line'
  20. }, {
  21. token: 'support.function',
  22. regex: /[^\(\)"\s{}\[\]]+/,
  23. next: 'line'
  24. }, {
  25. token: 'string.quoted.double',
  26. regex: /"/,
  27. next: 'string'
  28. }, {
  29. token: 'storage.modifier',
  30. regex: /\)/
  31. }],
  32. comment: [{
  33. token: 'comment.line.double-dash',
  34. regex: / +[^\n]+/,
  35. next: 'start'
  36. }],
  37. string: [{
  38. token: 'string.quoted.double',
  39. regex: /"/,
  40. next: 'line'
  41. }, {
  42. token: 'constant.character.escape',
  43. regex: /\\/,
  44. next: 'escape'
  45. }, {
  46. token: 'string.quoted.double',
  47. regex: /[^\\"]+/
  48. }],
  49. escape: [{
  50. token: 'constant.character.escape',
  51. regex: /./,
  52. next: 'string'
  53. }],
  54. line: [{
  55. token: 'constant.numeric',
  56. regex: /[\d\.]+/
  57. }, {
  58. token: 'markup.raw',
  59. regex: /^\s*/,
  60. next: 'start'
  61. }, {
  62. token: 'storage.modifier',
  63. regex: /\$/,
  64. next: 'start'
  65. }, {
  66. token: 'variable.parameter',
  67. regex: /[^\(\)"\s{}\[\]]+/
  68. }, {
  69. token: 'storage.modifier',
  70. regex: /\(/,
  71. next: 'start'
  72. }, {
  73. token: 'storage.modifier',
  74. regex: /\)/
  75. }, {
  76. token: 'markup.raw',
  77. regex: /^ */,
  78. next: 'start'
  79. }, {
  80. token: 'string.quoted.double',
  81. regex: /"/,
  82. next: 'string'
  83. }]
  84. };
  85. };
  86. oop.inherits(CirruHighlightRules, TextHighlightRules);
  87. exports.CirruHighlightRules = CirruHighlightRules;
  88. });
  89. ace.define("ace/mode/folding/coffee",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(require, exports, module){"use strict";
  90. var oop = require("../../lib/oop");
  91. var BaseFoldMode = require("./fold_mode").FoldMode;
  92. var Range = require("../../range").Range;
  93. var FoldMode = exports.FoldMode = function () { };
  94. oop.inherits(FoldMode, BaseFoldMode);
  95. (function () {
  96. this.getFoldWidgetRange = function (session, foldStyle, row) {
  97. var range = this.indentationBlock(session, row);
  98. if (range)
  99. return range;
  100. var re = /\S/;
  101. var line = session.getLine(row);
  102. var startLevel = line.search(re);
  103. if (startLevel == -1 || line[startLevel] != "#")
  104. return;
  105. var startColumn = line.length;
  106. var maxRow = session.getLength();
  107. var startRow = row;
  108. var endRow = row;
  109. while (++row < maxRow) {
  110. line = session.getLine(row);
  111. var level = line.search(re);
  112. if (level == -1)
  113. continue;
  114. if (line[level] != "#")
  115. break;
  116. endRow = row;
  117. }
  118. if (endRow > startRow) {
  119. var endColumn = session.getLine(endRow).length;
  120. return new Range(startRow, startColumn, endRow, endColumn);
  121. }
  122. };
  123. this.getFoldWidget = function (session, foldStyle, row) {
  124. var line = session.getLine(row);
  125. var indent = line.search(/\S/);
  126. var next = session.getLine(row + 1);
  127. var prev = session.getLine(row - 1);
  128. var prevIndent = prev.search(/\S/);
  129. var nextIndent = next.search(/\S/);
  130. if (indent == -1) {
  131. session.foldWidgets[row - 1] = prevIndent != -1 && prevIndent < nextIndent ? "start" : "";
  132. return "";
  133. }
  134. if (prevIndent == -1) {
  135. if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
  136. session.foldWidgets[row - 1] = "";
  137. session.foldWidgets[row + 1] = "";
  138. return "start";
  139. }
  140. }
  141. else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
  142. if (session.getLine(row - 2).search(/\S/) == -1) {
  143. session.foldWidgets[row - 1] = "start";
  144. session.foldWidgets[row + 1] = "";
  145. return "";
  146. }
  147. }
  148. if (prevIndent != -1 && prevIndent < indent)
  149. session.foldWidgets[row - 1] = "start";
  150. else
  151. session.foldWidgets[row - 1] = "";
  152. if (indent < nextIndent)
  153. return "start";
  154. else
  155. return "";
  156. };
  157. }).call(FoldMode.prototype);
  158. });
  159. ace.define("ace/mode/cirru",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/cirru_highlight_rules","ace/mode/folding/coffee"], function(require, exports, module){"use strict";
  160. var oop = require("../lib/oop");
  161. var TextMode = require("./text").Mode;
  162. var CirruHighlightRules = require("./cirru_highlight_rules").CirruHighlightRules;
  163. var CoffeeFoldMode = require("./folding/coffee").FoldMode;
  164. var Mode = function () {
  165. this.HighlightRules = CirruHighlightRules;
  166. this.foldingRules = new CoffeeFoldMode();
  167. this.$behaviour = this.$defaultBehaviour;
  168. };
  169. oop.inherits(Mode, TextMode);
  170. (function () {
  171. this.lineCommentStart = "--";
  172. this.$id = "ace/mode/cirru";
  173. }).call(Mode.prototype);
  174. exports.Mode = Mode;
  175. }); (function() {
  176. ace.require(["ace/mode/cirru"], function(m) {
  177. if (typeof module == "object" && typeof exports == "object" && module) {
  178. module.exports = m;
  179. }
  180. });
  181. })();