81c815664e53f84459fe8c5d6d1023a6.js 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. ace.define("ace/mode/mips_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){/* This file was autogenerated from mips.tmLanguage (uuid: ) */
  2. "use strict";
  3. var oop = require("../lib/oop");
  4. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  5. var MIPSHighlightRules = function () {
  6. var escapeRe = /\\(?:['"?\\abfnrtv]|[0-7]{1,3}|x[a-fA-F\d]{2}|u[a-fA-F\d]{4}U[a-fA-F\d]{8}|.)/.source;
  7. this.$rules = {
  8. start: [{
  9. token: "storage.modifier.mips",
  10. regex: /\.\b(?:align|ascii|asciiz|byte|double|extern|float|globl|space|word)\b/,
  11. comment: "Assembler directives for data storage"
  12. }, {
  13. token: "entity.name.section.mips",
  14. regex: /\.\b(?:data|text|kdata|ktext|)\b/,
  15. comment: "Segements: .data .text"
  16. }, {
  17. token: "variable.parameter.mips",
  18. regex: /\$(?:(?:3[01]|[12]?[0-9]|[0-9])|zero|at|v[01]|a[0-3]|s[0-7]|t[0-9]|k[01]|gp|sp|fp|ra)/,
  19. comment: "Registers by id $1, $2, ..."
  20. }, {
  21. token: "variable.parameter.mips",
  22. regex: /\$f(?:[0-9]|[1-2][0-9]|3[0-1])/,
  23. comment: "Floating point registers"
  24. }, {
  25. token: "support.function.source.mips",
  26. regex: /\b(?:(?:add|sub|div|l|mov|mult|neg|s|c\.eq|c\.le|c\.lt)\.[ds]|cvt\.s\.[dw]|cvt\.d\.[sw]|cvt\.w\.[ds]|bc1[tf])\b/,
  27. comment: "The MIPS floating-point instruction set"
  28. }, {
  29. token: "support.function.source.mips",
  30. regex: /\b(?:add|addu|addi|addiu|sub|subu|and|andi|or|not|ori|nor|xor|xori|slt|sltu|slti|sltiu|sll|sllv|rol|srl|sra|srlv|ror|j|jr|jal|beq|bne|lw|sw|lb|sb|lui|move|mfhi|mflo|mthi|mtlo)\b/,
  31. comment: "Just the hardcoded instructions provided by the MIPS assembly language"
  32. }, {
  33. token: "support.function.other.mips",
  34. regex: /\b(?:abs|b|beqz|bge|bgt|bgtu|ble|bleu|blt|bltu|bnez|div|divu|la|li|move|mul|neg|not|rem|remu|seq|sge|sgt|sle|sne)\b/,
  35. comment: "Pseudo instructions"
  36. }, {
  37. token: "entity.name.function.mips",
  38. regex: /\bsyscall\b/,
  39. comment: "Other"
  40. }, {
  41. token: "string",
  42. regex: "(?:'\")(?:" + escapeRe + "|.)?(?:'\")"
  43. }, {
  44. token: "string.start",
  45. regex: '\'',
  46. stateName: "qstring",
  47. next: [
  48. { token: "string", regex: /\\\s*$/, next: "qqstring" },
  49. { token: "constant.language.escape", regex: escapeRe },
  50. { token: "string.end", regex: '\'|$', next: "start" },
  51. { defaultToken: "string" }
  52. ]
  53. }, {
  54. token: "string.start",
  55. regex: '"',
  56. stateName: "qqstring",
  57. next: [
  58. { token: "string", regex: /\\\s*$/, next: "qqstring" },
  59. { token: "constant.language.escape", regex: escapeRe },
  60. { token: "string.end", regex: '"|$', next: "start" },
  61. { defaultToken: "string" }
  62. ]
  63. }, {
  64. token: "constant.numeric.mips",
  65. regex: /\b(?:\d+|0(?:x|X)[a-fA-F0-9]+)\b/,
  66. comment: "Numbers like +12, -3, 55, 0x3F"
  67. }, {
  68. token: "entity.name.tag.mips",
  69. regex: /\b[\w]+\b:/,
  70. comment: "Labels at line start: begin_repeat: add ..."
  71. }, {
  72. token: "comment.assembly",
  73. regex: /#.*$/,
  74. comment: "Single line comments"
  75. }]
  76. };
  77. this.normalizeRules();
  78. };
  79. MIPSHighlightRules.metaData = {
  80. fileTypes: ["s", "asm"],
  81. name: "MIPS",
  82. scopeName: "source.mips"
  83. };
  84. oop.inherits(MIPSHighlightRules, TextHighlightRules);
  85. exports.MIPSHighlightRules = MIPSHighlightRules;
  86. });
  87. 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";
  88. var oop = require("../../lib/oop");
  89. var Range = require("../../range").Range;
  90. var BaseFoldMode = require("./fold_mode").FoldMode;
  91. var FoldMode = exports.FoldMode = function (commentRegex) {
  92. if (commentRegex) {
  93. this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start));
  94. this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end));
  95. }
  96. };
  97. oop.inherits(FoldMode, BaseFoldMode);
  98. (function () {
  99. this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
  100. this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
  101. this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/;
  102. this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
  103. this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
  104. this._getFoldWidgetBase = this.getFoldWidget;
  105. this.getFoldWidget = function (session, foldStyle, row) {
  106. var line = session.getLine(row);
  107. if (this.singleLineBlockCommentRe.test(line)) {
  108. if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
  109. return "";
  110. }
  111. var fw = this._getFoldWidgetBase(session, foldStyle, row);
  112. if (!fw && this.startRegionRe.test(line))
  113. return "start"; // lineCommentRegionStart
  114. return fw;
  115. };
  116. this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) {
  117. var line = session.getLine(row);
  118. if (this.startRegionRe.test(line))
  119. return this.getCommentRegionBlock(session, line, row);
  120. var match = line.match(this.foldingStartMarker);
  121. if (match) {
  122. var i = match.index;
  123. if (match[1])
  124. return this.openingBracketBlock(session, match[1], row, i);
  125. var range = session.getCommentFoldRange(row, i + match[0].length, 1);
  126. if (range && !range.isMultiLine()) {
  127. if (forceMultiline) {
  128. range = this.getSectionRange(session, row);
  129. }
  130. else if (foldStyle != "all")
  131. range = null;
  132. }
  133. return range;
  134. }
  135. if (foldStyle === "markbegin")
  136. return;
  137. var match = line.match(this.foldingStopMarker);
  138. if (match) {
  139. var i = match.index + match[0].length;
  140. if (match[1])
  141. return this.closingBracketBlock(session, match[1], row, i);
  142. return session.getCommentFoldRange(row, i, -1);
  143. }
  144. };
  145. this.getSectionRange = function (session, row) {
  146. var line = session.getLine(row);
  147. var startIndent = line.search(/\S/);
  148. var startRow = row;
  149. var startColumn = line.length;
  150. row = row + 1;
  151. var endRow = row;
  152. var maxRow = session.getLength();
  153. while (++row < maxRow) {
  154. line = session.getLine(row);
  155. var indent = line.search(/\S/);
  156. if (indent === -1)
  157. continue;
  158. if (startIndent > indent)
  159. break;
  160. var subRange = this.getFoldWidgetRange(session, "all", row);
  161. if (subRange) {
  162. if (subRange.start.row <= startRow) {
  163. break;
  164. }
  165. else if (subRange.isMultiLine()) {
  166. row = subRange.end.row;
  167. }
  168. else if (startIndent == indent) {
  169. break;
  170. }
  171. }
  172. endRow = row;
  173. }
  174. return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
  175. };
  176. this.getCommentRegionBlock = function (session, line, row) {
  177. var startColumn = line.search(/\s*$/);
  178. var maxRow = session.getLength();
  179. var startRow = row;
  180. var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
  181. var depth = 1;
  182. while (++row < maxRow) {
  183. line = session.getLine(row);
  184. var m = re.exec(line);
  185. if (!m)
  186. continue;
  187. if (m[1])
  188. depth--;
  189. else
  190. depth++;
  191. if (!depth)
  192. break;
  193. }
  194. var endRow = row;
  195. if (endRow > startRow) {
  196. return new Range(startRow, startColumn, endRow, line.length);
  197. }
  198. };
  199. }).call(FoldMode.prototype);
  200. });
  201. ace.define("ace/mode/mips",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/mips_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module){/*
  202. THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
  203. */
  204. "use strict";
  205. var oop = require("../lib/oop");
  206. var TextMode = require("./text").Mode;
  207. var MIPSHighlightRules = require("./mips_highlight_rules").MIPSHighlightRules;
  208. var FoldMode = require("./folding/cstyle").FoldMode;
  209. var Mode = function () {
  210. this.HighlightRules = MIPSHighlightRules;
  211. this.foldingRules = new FoldMode();
  212. };
  213. oop.inherits(Mode, TextMode);
  214. (function () {
  215. this.lineCommentStart = ["#"];
  216. this.$id = "ace/mode/mips";
  217. }).call(Mode.prototype);
  218. exports.Mode = Mode;
  219. }); (function() {
  220. ace.require(["ace/mode/mips"], function(m) {
  221. if (typeof module == "object" && typeof exports == "object" && module) {
  222. module.exports = m;
  223. }
  224. });
  225. })();