0db77d70de73132c7e5979bf8e82f047.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. ace.define("ace/mode/doc_comment_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 DocCommentHighlightRules = function () {
  5. this.$rules = {
  6. "start": [{
  7. token: "comment.doc.tag",
  8. regex: "@[\\w\\d_]+" // TODO: fix email addresses
  9. },
  10. DocCommentHighlightRules.getTagRule(),
  11. {
  12. defaultToken: "comment.doc",
  13. caseInsensitive: true
  14. }]
  15. };
  16. };
  17. oop.inherits(DocCommentHighlightRules, TextHighlightRules);
  18. DocCommentHighlightRules.getTagRule = function (start) {
  19. return {
  20. token: "comment.doc.tag.storage.type",
  21. regex: "\\b(?:TODO|FIXME|XXX|HACK)\\b"
  22. };
  23. };
  24. DocCommentHighlightRules.getStartRule = function (start) {
  25. return {
  26. token: "comment.doc",
  27. regex: "\\/\\*(?=\\*)",
  28. next: start
  29. };
  30. };
  31. DocCommentHighlightRules.getEndRule = function (start) {
  32. return {
  33. token: "comment.doc",
  34. regex: "\\*\\/",
  35. next: start
  36. };
  37. };
  38. exports.DocCommentHighlightRules = DocCommentHighlightRules;
  39. });
  40. ace.define("ace/mode/scrypt_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(require, exports, module){/* This file was autogenerated from ./tmthemes/tmscrypt.tmLanguage (uuid: ) */
  41. "use strict";
  42. var oop = require("../lib/oop");
  43. var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
  44. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  45. var scryptHighlightRules = function () {
  46. var keywords = ("contract|library|loop|new|private|" +
  47. "public|if|else|struct|type|" +
  48. "require|static|const|import|exit|return|asm");
  49. var buildinConstants = ("true|false");
  50. var langClasses = ("function|auto|constructor|bytes|int|bool|SigHashPreimage|PrivKey|PubKey|Sig|Ripemd160|Sha1|Sha256|" +
  51. "SigHashType|SigHashPreimage|OpCodeType");
  52. var keywordMapper = this.createKeywordMapper({
  53. "variable.language": "this",
  54. "keyword": keywords,
  55. "constant.language": buildinConstants,
  56. "support.function": langClasses
  57. }, "identifier");
  58. this.$rules = {
  59. "start": [
  60. {
  61. token: "comment",
  62. regex: "\\/\\/.*$"
  63. },
  64. DocCommentHighlightRules.getStartRule("doc-start"),
  65. {
  66. token: "comment",
  67. regex: "\\/\\*",
  68. next: "comment"
  69. }, {
  70. token: "string",
  71. regex: '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
  72. }, {
  73. token: "string",
  74. regex: "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
  75. }, {
  76. token: "constant.numeric",
  77. regex: /0(?:[xX][0-9a-fA-F][0-9a-fA-F_]*|[bB][01][01_]*)[LlSsDdFfYy]?\b/
  78. }, {
  79. token: "constant.numeric",
  80. regex: /[+-]?\d[\d_]*(?:(?:\.[\d_]*)?(?:[eE][+-]?[\d_]+)?)?[LlSsDdFfYy]?\b/
  81. }, {
  82. token: "constant.language.boolean",
  83. regex: "(?:true|false)\\b"
  84. },
  85. {
  86. token: ["support.function.math.scrypt", "text", "text"],
  87. regex: /\b(abs|min|max|within|ripemd160|sha1|sha256|hash160|hash256|checkSig|checkMultiSig|num2bin|pack|unpack|len|reverseBytes|repeat)(\s*)(\()/
  88. }, {
  89. token: [
  90. "entity.name.type.scrypt",
  91. "text",
  92. "text",
  93. "text",
  94. "variable.object.property.scrypt"
  95. ],
  96. regex: /\b(SigHash)(\s*)(\.)(\s*)(ANYONECANPAY|ALL|FORKID|NONE|SINGLE)\b/
  97. },
  98. {
  99. token: [
  100. "entity.name.type.scrypt",
  101. "text",
  102. "text",
  103. "text",
  104. "variable.object.property.scrypt"
  105. ],
  106. regex: /\b(OpCode)(\s*)(\.)(\s*)(OP_PUSHDATA1|OP_PUSHDATA2|OP_PUSHDATA4|OP_0|OP_FALSE|OP_1NEGATE|OP_1|OP_TRUE|OP_2|OP_3|OP_4|OP_5|OP_6|OP_7|OP_8|OP_9|OP_10|OP_11|OP_12|OP_13|OP_14|OP_15|OP_16|OP_1ADD|OP_1SUB|OP_NEGATE|OP_ABS|OP_NOT|OP_0NOTEQUAL|OP_ADD|OP_SUB|OP_MUL|OP_DIV|OP_MOD|OP_LSHIFT|OP_RSHIFT|OP_BOOLAND|OP_BOOLOR|OP_NUMEQUAL|OP_NUMEQUALVERIFY|OP_NUMNOTEQUAL|OP_LESSTHAN|OP_GREATERTHAN|OP_LESSTHANOREQUAL|OP_GREATERTHANOREQUAL|OP_MIN|OP_MAX|OP_WITHIN|OP_CAT|OP_SPLIT|OP_BIN2NUM|OP_NUM2BIN|OP_SIZE|OP_NOP|OP_IF|OP_NOTIF|OP_ELSE|OP_ENDIF|OP_VERIFY|OP_RETURN|OP_TOALTSTACK|OP_FROMALTSTACK|OP_IFDUP|OP_DEPTH|OP_DROP|OP_DUP|OP_NIP|OP_OVER|OP_PICK|OP_ROLL|OP_ROT|OP_SWAP|OP_TUCK|OP_2DROP|OP_2DUP|OP_3DUP|OP_2OVER|OP_2ROT|OP_2SWAP|OP_RIPEMD160|OP_SHA1|OP_SHA256|OP_HASH160|OP_HASH256|OP_CODESEPARATOR|OP_CHECKSIG|OP_CHECKSIGVERIFY|OP_CHECKMULTISIG|OP_CHECKMULTISIGVERIFY|OP_INVERT|OP_AND|OP_OR|OP_XOR|OP_EQUAL|OP_EQUALVERIFY)\b/
  107. }, {
  108. token: "entity.name.type.scrypt",
  109. regex: /\b(?:P2PKH|P2PK|Tx|HashPuzzleRipemd160|HashPuzzleSha1|HashPuzzleSha256|HashPuzzleHash160|OpCode|SigHash)\b/
  110. }, {
  111. token: [
  112. "punctuation.separator.period.scrypt",
  113. 'text',
  114. "entity.name.function.scrypt",
  115. "text",
  116. "punctuation.definition.parameters.begin.bracket.round.scrypt"
  117. ],
  118. regex: /(\.)([^\S$\r]*)([\w][\w\d]*)(\s*)(\()/,
  119. push: [{
  120. token: "punctuation.definition.parameters.end.bracket.round.scrypt",
  121. regex: /\)/,
  122. next: "pop"
  123. }, {
  124. defaultToken: "start"
  125. }]
  126. }, {
  127. token: keywordMapper,
  128. regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
  129. }, {
  130. token: "keyword.operator",
  131. regex: "!|\\$|%|&|\\||\\^|\\*|\\/|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<>|<|>|!|&&|\\|\\||\\?|\\:|\\*=|\\/=|%=|\\+=|\\-=|&=|\\|=|\\^="
  132. }, {
  133. token: "lparen",
  134. regex: "[[({]"
  135. }, {
  136. token: "rparen",
  137. regex: "[\\])}]"
  138. }, {
  139. token: "text",
  140. regex: "\\s+"
  141. }
  142. ],
  143. "comment": [
  144. {
  145. token: "comment",
  146. regex: "\\*\\/",
  147. next: "start"
  148. }, {
  149. defaultToken: "comment"
  150. }
  151. ]
  152. };
  153. this.embedRules(DocCommentHighlightRules, "doc-", [DocCommentHighlightRules.getEndRule("start")]);
  154. this.normalizeRules();
  155. };
  156. oop.inherits(scryptHighlightRules, TextHighlightRules);
  157. exports.scryptHighlightRules = scryptHighlightRules;
  158. });
  159. 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";
  160. var oop = require("../../lib/oop");
  161. var Range = require("../../range").Range;
  162. var BaseFoldMode = require("./fold_mode").FoldMode;
  163. var FoldMode = exports.FoldMode = function (commentRegex) {
  164. if (commentRegex) {
  165. this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start));
  166. this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end));
  167. }
  168. };
  169. oop.inherits(FoldMode, BaseFoldMode);
  170. (function () {
  171. this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
  172. this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
  173. this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/;
  174. this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
  175. this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
  176. this._getFoldWidgetBase = this.getFoldWidget;
  177. this.getFoldWidget = function (session, foldStyle, row) {
  178. var line = session.getLine(row);
  179. if (this.singleLineBlockCommentRe.test(line)) {
  180. if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
  181. return "";
  182. }
  183. var fw = this._getFoldWidgetBase(session, foldStyle, row);
  184. if (!fw && this.startRegionRe.test(line))
  185. return "start"; // lineCommentRegionStart
  186. return fw;
  187. };
  188. this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) {
  189. var line = session.getLine(row);
  190. if (this.startRegionRe.test(line))
  191. return this.getCommentRegionBlock(session, line, row);
  192. var match = line.match(this.foldingStartMarker);
  193. if (match) {
  194. var i = match.index;
  195. if (match[1])
  196. return this.openingBracketBlock(session, match[1], row, i);
  197. var range = session.getCommentFoldRange(row, i + match[0].length, 1);
  198. if (range && !range.isMultiLine()) {
  199. if (forceMultiline) {
  200. range = this.getSectionRange(session, row);
  201. }
  202. else if (foldStyle != "all")
  203. range = null;
  204. }
  205. return range;
  206. }
  207. if (foldStyle === "markbegin")
  208. return;
  209. var match = line.match(this.foldingStopMarker);
  210. if (match) {
  211. var i = match.index + match[0].length;
  212. if (match[1])
  213. return this.closingBracketBlock(session, match[1], row, i);
  214. return session.getCommentFoldRange(row, i, -1);
  215. }
  216. };
  217. this.getSectionRange = function (session, row) {
  218. var line = session.getLine(row);
  219. var startIndent = line.search(/\S/);
  220. var startRow = row;
  221. var startColumn = line.length;
  222. row = row + 1;
  223. var endRow = row;
  224. var maxRow = session.getLength();
  225. while (++row < maxRow) {
  226. line = session.getLine(row);
  227. var indent = line.search(/\S/);
  228. if (indent === -1)
  229. continue;
  230. if (startIndent > indent)
  231. break;
  232. var subRange = this.getFoldWidgetRange(session, "all", row);
  233. if (subRange) {
  234. if (subRange.start.row <= startRow) {
  235. break;
  236. }
  237. else if (subRange.isMultiLine()) {
  238. row = subRange.end.row;
  239. }
  240. else if (startIndent == indent) {
  241. break;
  242. }
  243. }
  244. endRow = row;
  245. }
  246. return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
  247. };
  248. this.getCommentRegionBlock = function (session, line, row) {
  249. var startColumn = line.search(/\s*$/);
  250. var maxRow = session.getLength();
  251. var startRow = row;
  252. var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
  253. var depth = 1;
  254. while (++row < maxRow) {
  255. line = session.getLine(row);
  256. var m = re.exec(line);
  257. if (!m)
  258. continue;
  259. if (m[1])
  260. depth--;
  261. else
  262. depth++;
  263. if (!depth)
  264. break;
  265. }
  266. var endRow = row;
  267. if (endRow > startRow) {
  268. return new Range(startRow, startColumn, endRow, line.length);
  269. }
  270. };
  271. }).call(FoldMode.prototype);
  272. });
  273. ace.define("ace/mode/scrypt",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/scrypt_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module){/*
  274. THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
  275. */
  276. "use strict";
  277. var oop = require("../lib/oop");
  278. var TextMode = require("./text").Mode;
  279. var scryptHighlightRules = require("./scrypt_highlight_rules").scryptHighlightRules;
  280. var FoldMode = require("./folding/cstyle").FoldMode;
  281. var Mode = function () {
  282. this.HighlightRules = scryptHighlightRules;
  283. this.foldingRules = new FoldMode();
  284. };
  285. oop.inherits(Mode, TextMode);
  286. (function () {
  287. this.lineCommentStart = "//";
  288. this.blockComment = { start: "/*", end: "*/" };
  289. this.$quotes = { '"': '"', "'": "'" };
  290. this.createWorker = function (session) {
  291. return null;
  292. };
  293. this.$id = "ace/mode/scrypt";
  294. }).call(Mode.prototype);
  295. exports.Mode = Mode;
  296. }); (function() {
  297. ace.require(["ace/mode/scrypt"], function(m) {
  298. if (typeof module == "object" && typeof exports == "object" && module) {
  299. module.exports = m;
  300. }
  301. });
  302. })();