8ed43cdfdd838056af84f9840f79af2d.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. ace.define("ace/mode/toml_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 TomlHighlightRules = function () {
  5. var keywordMapper = this.createKeywordMapper({
  6. "constant.language.boolean": "true|false"
  7. }, "identifier");
  8. var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b";
  9. this.$rules = {
  10. "start": [
  11. {
  12. token: "comment.toml",
  13. regex: /#.*$/
  14. },
  15. {
  16. token: "string",
  17. regex: '"(?=.)',
  18. next: "qqstring"
  19. },
  20. {
  21. token: ["variable.keygroup.toml"],
  22. regex: "(?:^\\s*)(\\[\\[([^\\]]+)\\]\\])"
  23. },
  24. {
  25. token: ["variable.keygroup.toml"],
  26. regex: "(?:^\\s*)(\\[([^\\]]+)\\])"
  27. },
  28. {
  29. token: keywordMapper,
  30. regex: identifierRe
  31. },
  32. {
  33. token: "support.date.toml",
  34. regex: "\\d{4}-\\d{2}-\\d{2}(T)\\d{2}:\\d{2}:\\d{2}(Z)"
  35. },
  36. {
  37. token: "constant.numeric.toml",
  38. regex: "-?\\d+(\\.?\\d+)?"
  39. }
  40. ],
  41. "qqstring": [
  42. {
  43. token: "string",
  44. regex: "\\\\$",
  45. next: "qqstring"
  46. },
  47. {
  48. token: "constant.language.escape",
  49. regex: '\\\\[0tnr"\\\\]'
  50. },
  51. {
  52. token: "string",
  53. regex: '"|$',
  54. next: "start"
  55. },
  56. {
  57. defaultToken: "string"
  58. }
  59. ]
  60. };
  61. };
  62. oop.inherits(TomlHighlightRules, TextHighlightRules);
  63. exports.TomlHighlightRules = TomlHighlightRules;
  64. });
  65. ace.define("ace/mode/folding/ini",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module){"use strict";
  66. var oop = require("../../lib/oop");
  67. var Range = require("../../range").Range;
  68. var BaseFoldMode = require("./fold_mode").FoldMode;
  69. var FoldMode = exports.FoldMode = function () {
  70. };
  71. oop.inherits(FoldMode, BaseFoldMode);
  72. (function () {
  73. this.foldingStartMarker = /^\s*\[([^\])]*)]\s*(?:$|[;#])/;
  74. this.getFoldWidgetRange = function (session, foldStyle, row) {
  75. var re = this.foldingStartMarker;
  76. var line = session.getLine(row);
  77. var m = line.match(re);
  78. if (!m)
  79. return;
  80. var startName = m[1] + ".";
  81. var startColumn = line.length;
  82. var maxRow = session.getLength();
  83. var startRow = row;
  84. var endRow = row;
  85. while (++row < maxRow) {
  86. line = session.getLine(row);
  87. if (/^\s*$/.test(line))
  88. continue;
  89. m = line.match(re);
  90. if (m && m[1].lastIndexOf(startName, 0) !== 0)
  91. break;
  92. endRow = row;
  93. }
  94. if (endRow > startRow) {
  95. var endColumn = session.getLine(endRow).length;
  96. return new Range(startRow, startColumn, endRow, endColumn);
  97. }
  98. };
  99. }).call(FoldMode.prototype);
  100. });
  101. ace.define("ace/mode/toml",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/toml_highlight_rules","ace/mode/folding/ini"], function(require, exports, module){"use strict";
  102. var oop = require("../lib/oop");
  103. var TextMode = require("./text").Mode;
  104. var TomlHighlightRules = require("./toml_highlight_rules").TomlHighlightRules;
  105. var FoldMode = require("./folding/ini").FoldMode;
  106. var Mode = function () {
  107. this.HighlightRules = TomlHighlightRules;
  108. this.foldingRules = new FoldMode();
  109. this.$behaviour = this.$defaultBehaviour;
  110. };
  111. oop.inherits(Mode, TextMode);
  112. (function () {
  113. this.lineCommentStart = "#";
  114. this.$id = "ace/mode/toml";
  115. }).call(Mode.prototype);
  116. exports.Mode = Mode;
  117. }); (function() {
  118. ace.require(["ace/mode/toml"], function(m) {
  119. if (typeof module == "object" && typeof exports == "object" && module) {
  120. module.exports = m;
  121. }
  122. });
  123. })();