Debian Codegraph @

extensions/CodeEditor/modules/lib/ace/mode-mips.js

raw symbols SCIP
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", // character
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 });
88
89 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";
90 var oop = require("../../lib/oop");
91 var Range = require("../../range").Range;
92 var BaseFoldMode = require("./fold_mode").FoldMode;
93 var FoldMode = exports.FoldMode = function (commentRegex) {
94 if (commentRegex) {
95 this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start));
96 this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end));
97 }
98 };
99 oop.inherits(FoldMode, BaseFoldMode);
100 (function () {
101 this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
102 this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
103 this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/;
104 this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
105 this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
106 this._getFoldWidgetBase = this.getFoldWidget;
107 this.getFoldWidget = function (session, foldStyle, row) {
108 var line = session.getLine(row);
109 if (this.singleLineBlockCommentRe.test(line)) {
110 if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
111 return "";
112 }
113 var fw = this._getFoldWidgetBase(session, foldStyle, row);
114 if (!fw && this.startRegionRe.test(line))
115 return "start"; // lineCommentRegionStart
116 return fw;
117 };
118 this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) {
119 var line = session.getLine(row);
120 if (this.startRegionRe.test(line))
121 return this.getCommentRegionBlock(session, line, row);
122 var match = line.match(this.foldingStartMarker);
123 if (match) {
124 var i = match.index;
125 if (match[1])
126 return this.openingBracketBlock(session, match[1], row, i);
127 var range = session.getCommentFoldRange(row, i + match[0].length, 1);
128 if (range && !range.isMultiLine()) {
129 if (forceMultiline) {
130 range = this.getSectionRange(session, row);
131 }
132 else if (foldStyle != "all")
133 range = null;
134 }
135 return range;
136 }
137 if (foldStyle === "markbegin")
138 return;
139 var match = line.match(this.foldingStopMarker);
140 if (match) {
141 var i = match.index + match[0].length;
142 if (match[1])
143 return this.closingBracketBlock(session, match[1], row, i);
144 return session.getCommentFoldRange(row, i, -1);
145 }
146 };
147 this.getSectionRange = function (session, row) {
148 var line = session.getLine(row);
149 var startIndent = line.search(/\S/);
150 var startRow = row;
151 var startColumn = line.length;
152 row = row + 1;
153 var endRow = row;
154 var maxRow = session.getLength();
155 while (++row < maxRow) {
156 line = session.getLine(row);
157 var indent = line.search(/\S/);
158 if (indent === -1)
159 continue;
160 if (startIndent > indent)
161 break;
162 var subRange = this.getFoldWidgetRange(session, "all", row);
163 if (subRange) {
164 if (subRange.start.row <= startRow) {
165 break;
166 }
167 else if (subRange.isMultiLine()) {
168 row = subRange.end.row;
169 }
170 else if (startIndent == indent) {
171 break;
172 }
173 }
174 endRow = row;
175 }
176 return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
177 };
178 this.getCommentRegionBlock = function (session, line, row) {
179 var startColumn = line.search(/\s*$/);
180 var maxRow = session.getLength();
181 var startRow = row;
182 var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
183 var depth = 1;
184 while (++row < maxRow) {
185 line = session.getLine(row);
186 var m = re.exec(line);
187 if (!m)
188 continue;
189 if (m[1])
190 depth--;
191 else
192 depth++;
193 if (!depth)
194 break;
195 }
196 var endRow = row;
197 if (endRow > startRow) {
198 return new Range(startRow, startColumn, endRow, line.length);
199 }
200 };
201 }).call(FoldMode.prototype);
202
203 });
204
205 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){/*
206 THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
207 */
208 "use strict";
209 var oop = require("../lib/oop");
210 var TextMode = require("./text").Mode;
211 var MIPSHighlightRules = require("./mips_highlight_rules").MIPSHighlightRules;
212 var FoldMode = require("./folding/cstyle").FoldMode;
213 var Mode = function () {
214 this.HighlightRules = MIPSHighlightRules;
215 this.foldingRules = new FoldMode();
216 };
217 oop.inherits(Mode, TextMode);
218 (function () {
219 this.lineCommentStart = ["#"];
220 this.$id = "ace/mode/mips";
221 }).call(Mode.prototype);
222 exports.Mode = Mode;
223
224 }); (function() {
225 ace.require(["ace/mode/mips"], function(m) {
226 if (typeof module == "object" && typeof exports == "object" && module) {
227 module.exports = m;
228 }
229 });
230 })();
231