mumuki-laboratory 5.0.1 → 5.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mumuki/laboratory/version.rb +1 -1
- data/vendor/assets/javascripts/analytics.js +4 -0
- data/vendor/assets/javascripts/codemirror-modes/assembly_x86.js +967 -0
- data/vendor/assets/javascripts/codemirror-modes/autocomplete.js +44 -0
- data/vendor/assets/javascripts/codemirror-modes/clike.min.js +1 -0
- data/vendor/assets/javascripts/codemirror-modes/closebrackets.min.js +1 -0
- data/vendor/assets/javascripts/codemirror-modes/css-hint.min.js +1 -0
- data/vendor/assets/javascripts/codemirror-modes/css.min.js +1 -0
- data/vendor/assets/javascripts/codemirror-modes/elixir.js +1284 -0
- data/vendor/assets/javascripts/codemirror-modes/gobstones-autocomplete.js +4 -0
- data/vendor/assets/javascripts/codemirror-modes/gobstones.js +1046 -0
- data/vendor/assets/javascripts/codemirror-modes/haskell-autocomplete.js +1 -0
- data/vendor/assets/javascripts/codemirror-modes/haskell.min.js +1 -0
- data/vendor/assets/javascripts/codemirror-modes/html-hint.min.js +1 -0
- data/vendor/assets/javascripts/codemirror-modes/htmlmixed.min.js +1 -0
- data/vendor/assets/javascripts/codemirror-modes/javascript-hint.min.js +1 -0
- data/vendor/assets/javascripts/codemirror-modes/javascript.min.js +1 -0
- data/vendor/assets/javascripts/codemirror-modes/markdown.min.js +1 -0
- data/vendor/assets/javascripts/codemirror-modes/matchbrackets.min.js +1 -0
- data/vendor/assets/javascripts/codemirror-modes/placeholder.min.js +1 -0
- data/vendor/assets/javascripts/codemirror-modes/prolog-autocomplete.js +1 -0
- data/vendor/assets/javascripts/codemirror-modes/prolog.js +1089 -0
- data/vendor/assets/javascripts/codemirror-modes/python.min.js +1 -0
- data/vendor/assets/javascripts/codemirror-modes/ruby-autocomplete.js +3 -0
- data/vendor/assets/javascripts/codemirror-modes/ruby.min.js +1 -0
- data/vendor/assets/javascripts/codemirror-modes/shell.min.js +1 -0
- data/vendor/assets/javascripts/codemirror-modes/show-hint.min.js +1 -0
- data/vendor/assets/javascripts/codemirror-modes/sql-hint.min.js +1 -0
- data/vendor/assets/javascripts/codemirror-modes/sql.min.js +1 -0
- data/vendor/assets/javascripts/codemirror-modes/wollok-autocomplete.js +3 -0
- data/vendor/assets/javascripts/codemirror-modes/wollok.js +1035 -0
- data/vendor/assets/javascripts/codemirror-modes/xml-hint.min.js +1 -0
- data/vendor/assets/javascripts/codemirror-modes/xml.min.js +1 -0
- data/vendor/assets/javascripts/codemirror.min.js +1 -0
- data/vendor/assets/javascripts/hotjar.js +8 -0
- data/vendor/assets/javascripts/jquery-console.js +845 -0
- data/vendor/assets/javascripts/webcomponents-lite.js +12 -0
- data/vendor/assets/stylesheets/codemirror/codemirror.min.css +2 -0
- data/vendor/assets/stylesheets/codemirror/show-hint.min.css +2 -0
- metadata +39 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7376161191b6b865337d32205e393797dbe6f3ef202d8e58f7f87bd486af69fe
|
4
|
+
data.tar.gz: 398dd549618fd6e5aa30a2094439e29a611824713c292c93add592a16ee31e1a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1c38ac89f807f6b7f104f14bfd5e0de87e3267014597c4c024c1238822ceab33ba59809efce59273ac458f8668ab1b53c1e719760fd0c2f638d3970ffab11d4
|
7
|
+
data.tar.gz: a10ed64aa8225c8082c698c2490b47d82d3b2fe0f5653f6083187ec59a150e7336e56b5e21f8d38f2dc280f29fe0482f64a7a8a398417435ec6623718664d58b
|
@@ -0,0 +1,4 @@
|
|
1
|
+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
2
|
+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
3
|
+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
4
|
+
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
@@ -0,0 +1,967 @@
|
|
1
|
+
// Parts from Ace; see <https://raw.githubusercontent.com/ajaxorg/ace/master/LICENSE>
|
2
|
+
CodeMirror.defineMode("assembly_x86", function(cmCfg, modeCfg) {
|
3
|
+
|
4
|
+
// Fake define() function.
|
5
|
+
var moduleHolder = Object.create(null);
|
6
|
+
|
7
|
+
// Given a module path as a string, create the canonical version
|
8
|
+
// (no leading ./, no ending .js).
|
9
|
+
var canonicalPath = function(path) {
|
10
|
+
return path.replace(/\.\//, '').replace(/\.js$/, '');
|
11
|
+
};
|
12
|
+
|
13
|
+
// We intentionally add the `path` argument to `define()`.
|
14
|
+
var define = function(path, init) {
|
15
|
+
var exports = Object.create(null);
|
16
|
+
init(require, exports); // module (3rd parameter) isn't supported.
|
17
|
+
moduleHolder[canonicalPath(path)] = exports;
|
18
|
+
};
|
19
|
+
|
20
|
+
// path: string of the location of the JS file.
|
21
|
+
var require = function(path) { return moduleHolder[canonicalPath(path)]; };
|
22
|
+
|
23
|
+
// All dependencies here.
|
24
|
+
define("../lib/oop.js", function(require, exports, module) {
|
25
|
+
"use strict";
|
26
|
+
|
27
|
+
exports.inherits = function(ctor, superCtor) {
|
28
|
+
ctor.super_ = superCtor;
|
29
|
+
ctor.prototype = Object.create(superCtor.prototype, {
|
30
|
+
constructor: {
|
31
|
+
value: ctor,
|
32
|
+
enumerable: false,
|
33
|
+
writable: true,
|
34
|
+
configurable: true
|
35
|
+
}
|
36
|
+
});
|
37
|
+
};
|
38
|
+
|
39
|
+
exports.mixin = function(obj, mixin) {
|
40
|
+
for (var key in mixin) {
|
41
|
+
obj[key] = mixin[key];
|
42
|
+
}
|
43
|
+
return obj;
|
44
|
+
};
|
45
|
+
|
46
|
+
exports.implement = function(proto, mixin) {
|
47
|
+
exports.mixin(proto, mixin);
|
48
|
+
};
|
49
|
+
|
50
|
+
});
|
51
|
+
|
52
|
+
|
53
|
+
define("../lib/lang.js", function(require, exports, module) {
|
54
|
+
"use strict";
|
55
|
+
|
56
|
+
exports.last = function(a) {
|
57
|
+
return a[a.length - 1];
|
58
|
+
};
|
59
|
+
|
60
|
+
exports.stringReverse = function(string) {
|
61
|
+
return string.split("").reverse().join("");
|
62
|
+
};
|
63
|
+
|
64
|
+
exports.stringRepeat = function (string, count) {
|
65
|
+
var result = '';
|
66
|
+
while (count > 0) {
|
67
|
+
if (count & 1)
|
68
|
+
result += string;
|
69
|
+
|
70
|
+
if (count >>= 1)
|
71
|
+
string += string;
|
72
|
+
}
|
73
|
+
return result;
|
74
|
+
};
|
75
|
+
|
76
|
+
var trimBeginRegexp = /^\s\s*/;
|
77
|
+
var trimEndRegexp = /\s\s*$/;
|
78
|
+
|
79
|
+
exports.stringTrimLeft = function (string) {
|
80
|
+
return string.replace(trimBeginRegexp, '');
|
81
|
+
};
|
82
|
+
|
83
|
+
exports.stringTrimRight = function (string) {
|
84
|
+
return string.replace(trimEndRegexp, '');
|
85
|
+
};
|
86
|
+
|
87
|
+
exports.copyObject = function(obj) {
|
88
|
+
var copy = {};
|
89
|
+
for (var key in obj) {
|
90
|
+
copy[key] = obj[key];
|
91
|
+
}
|
92
|
+
return copy;
|
93
|
+
};
|
94
|
+
|
95
|
+
exports.copyArray = function(array){
|
96
|
+
var copy = [];
|
97
|
+
for (var i=0, l=array.length; i<l; i++) {
|
98
|
+
if (array[i] && typeof array[i] == "object")
|
99
|
+
copy[i] = this.copyObject(array[i]);
|
100
|
+
else
|
101
|
+
copy[i] = array[i];
|
102
|
+
}
|
103
|
+
return copy;
|
104
|
+
};
|
105
|
+
|
106
|
+
exports.deepCopy = function deepCopy(obj) {
|
107
|
+
if (typeof obj !== "object" || !obj)
|
108
|
+
return obj;
|
109
|
+
var copy;
|
110
|
+
if (Array.isArray(obj)) {
|
111
|
+
copy = [];
|
112
|
+
for (var key = 0; key < obj.length; key++) {
|
113
|
+
copy[key] = deepCopy(obj[key]);
|
114
|
+
}
|
115
|
+
return copy;
|
116
|
+
}
|
117
|
+
if (Object.prototype.toString.call(obj) !== "[object Object]")
|
118
|
+
return obj;
|
119
|
+
|
120
|
+
copy = {};
|
121
|
+
for (var key in obj)
|
122
|
+
copy[key] = deepCopy(obj[key]);
|
123
|
+
return copy;
|
124
|
+
};
|
125
|
+
|
126
|
+
exports.arrayToMap = function(arr) {
|
127
|
+
var map = {};
|
128
|
+
for (var i=0; i<arr.length; i++) {
|
129
|
+
map[arr[i]] = 1;
|
130
|
+
}
|
131
|
+
return map;
|
132
|
+
|
133
|
+
};
|
134
|
+
|
135
|
+
exports.createMap = function(props) {
|
136
|
+
var map = Object.create(null);
|
137
|
+
for (var i in props) {
|
138
|
+
map[i] = props[i];
|
139
|
+
}
|
140
|
+
return map;
|
141
|
+
};
|
142
|
+
|
143
|
+
/*
|
144
|
+
* splice out of 'array' anything that === 'value'
|
145
|
+
*/
|
146
|
+
exports.arrayRemove = function(array, value) {
|
147
|
+
for (var i = 0; i <= array.length; i++) {
|
148
|
+
if (value === array[i]) {
|
149
|
+
array.splice(i, 1);
|
150
|
+
}
|
151
|
+
}
|
152
|
+
};
|
153
|
+
|
154
|
+
exports.escapeRegExp = function(str) {
|
155
|
+
return str.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1');
|
156
|
+
};
|
157
|
+
|
158
|
+
exports.escapeHTML = function(str) {
|
159
|
+
return str.replace(/&/g, "&").replace(/"/g, """).replace(/'/g, "'").replace(/</g, "<");
|
160
|
+
};
|
161
|
+
|
162
|
+
exports.getMatchOffsets = function(string, regExp) {
|
163
|
+
var matches = [];
|
164
|
+
|
165
|
+
string.replace(regExp, function(str) {
|
166
|
+
matches.push({
|
167
|
+
offset: arguments[arguments.length-2],
|
168
|
+
length: str.length
|
169
|
+
});
|
170
|
+
});
|
171
|
+
|
172
|
+
return matches;
|
173
|
+
};
|
174
|
+
|
175
|
+
/* deprecated */
|
176
|
+
exports.deferredCall = function(fcn) {
|
177
|
+
var timer = null;
|
178
|
+
var callback = function() {
|
179
|
+
timer = null;
|
180
|
+
fcn();
|
181
|
+
};
|
182
|
+
|
183
|
+
var deferred = function(timeout) {
|
184
|
+
deferred.cancel();
|
185
|
+
timer = setTimeout(callback, timeout || 0);
|
186
|
+
return deferred;
|
187
|
+
};
|
188
|
+
|
189
|
+
deferred.schedule = deferred;
|
190
|
+
|
191
|
+
deferred.call = function() {
|
192
|
+
this.cancel();
|
193
|
+
fcn();
|
194
|
+
return deferred;
|
195
|
+
};
|
196
|
+
|
197
|
+
deferred.cancel = function() {
|
198
|
+
clearTimeout(timer);
|
199
|
+
timer = null;
|
200
|
+
return deferred;
|
201
|
+
};
|
202
|
+
|
203
|
+
deferred.isPending = function() {
|
204
|
+
return timer;
|
205
|
+
};
|
206
|
+
|
207
|
+
return deferred;
|
208
|
+
};
|
209
|
+
|
210
|
+
|
211
|
+
exports.delayedCall = function(fcn, defaultTimeout) {
|
212
|
+
var timer = null;
|
213
|
+
var callback = function() {
|
214
|
+
timer = null;
|
215
|
+
fcn();
|
216
|
+
};
|
217
|
+
|
218
|
+
var _self = function(timeout) {
|
219
|
+
if (timer == null)
|
220
|
+
timer = setTimeout(callback, timeout || defaultTimeout);
|
221
|
+
};
|
222
|
+
|
223
|
+
_self.delay = function(timeout) {
|
224
|
+
timer && clearTimeout(timer);
|
225
|
+
timer = setTimeout(callback, timeout || defaultTimeout);
|
226
|
+
};
|
227
|
+
_self.schedule = _self;
|
228
|
+
|
229
|
+
_self.call = function() {
|
230
|
+
this.cancel();
|
231
|
+
fcn();
|
232
|
+
};
|
233
|
+
|
234
|
+
_self.cancel = function() {
|
235
|
+
timer && clearTimeout(timer);
|
236
|
+
timer = null;
|
237
|
+
};
|
238
|
+
|
239
|
+
_self.isPending = function() {
|
240
|
+
return timer;
|
241
|
+
};
|
242
|
+
|
243
|
+
return _self;
|
244
|
+
};
|
245
|
+
});
|
246
|
+
|
247
|
+
|
248
|
+
define("./text_highlight_rules.js", function(require, exports, module) {
|
249
|
+
"use strict";
|
250
|
+
|
251
|
+
var lang = require("../lib/lang");
|
252
|
+
|
253
|
+
var TextHighlightRules = function() {
|
254
|
+
|
255
|
+
// regexp must not have capturing parentheses
|
256
|
+
// regexps are ordered -> the first match is used
|
257
|
+
|
258
|
+
this.$rules = {
|
259
|
+
"start" : [{
|
260
|
+
token : "empty_line",
|
261
|
+
regex : '^$'
|
262
|
+
}, {
|
263
|
+
defaultToken : "text"
|
264
|
+
}]
|
265
|
+
};
|
266
|
+
};
|
267
|
+
|
268
|
+
(function() {
|
269
|
+
|
270
|
+
this.addRules = function(rules, prefix) {
|
271
|
+
if (!prefix) {
|
272
|
+
for (var key in rules)
|
273
|
+
this.$rules[key] = rules[key];
|
274
|
+
return;
|
275
|
+
}
|
276
|
+
for (var key in rules) {
|
277
|
+
var state = rules[key];
|
278
|
+
for (var i = 0; i < state.length; i++) {
|
279
|
+
var rule = state[i];
|
280
|
+
if (rule.next || rule.onMatch) {
|
281
|
+
if (typeof rule.next == "string") {
|
282
|
+
if (rule.next.indexOf(prefix) !== 0)
|
283
|
+
rule.next = prefix + rule.next;
|
284
|
+
}
|
285
|
+
if (rule.nextState && rule.nextState.indexOf(prefix) !== 0)
|
286
|
+
rule.nextState = prefix + rule.nextState;
|
287
|
+
}
|
288
|
+
}
|
289
|
+
this.$rules[prefix + key] = state;
|
290
|
+
}
|
291
|
+
};
|
292
|
+
|
293
|
+
this.getRules = function() {
|
294
|
+
return this.$rules;
|
295
|
+
};
|
296
|
+
|
297
|
+
this.embedRules = function (HighlightRules, prefix, escapeRules, states, append) {
|
298
|
+
var embedRules = typeof HighlightRules == "function"
|
299
|
+
? new HighlightRules().getRules()
|
300
|
+
: HighlightRules;
|
301
|
+
if (states) {
|
302
|
+
for (var i = 0; i < states.length; i++)
|
303
|
+
states[i] = prefix + states[i];
|
304
|
+
} else {
|
305
|
+
states = [];
|
306
|
+
for (var key in embedRules)
|
307
|
+
states.push(prefix + key);
|
308
|
+
}
|
309
|
+
|
310
|
+
this.addRules(embedRules, prefix);
|
311
|
+
|
312
|
+
if (escapeRules) {
|
313
|
+
var addRules = Array.prototype[append ? "push" : "unshift"];
|
314
|
+
for (var i = 0; i < states.length; i++)
|
315
|
+
addRules.apply(this.$rules[states[i]], lang.deepCopy(escapeRules));
|
316
|
+
}
|
317
|
+
|
318
|
+
if (!this.$embeds)
|
319
|
+
this.$embeds = [];
|
320
|
+
this.$embeds.push(prefix);
|
321
|
+
};
|
322
|
+
|
323
|
+
this.getEmbeds = function() {
|
324
|
+
return this.$embeds;
|
325
|
+
};
|
326
|
+
|
327
|
+
var pushState = function(currentState, stack) {
|
328
|
+
if (currentState != "start" || stack.length)
|
329
|
+
stack.unshift(this.nextState, currentState);
|
330
|
+
return this.nextState;
|
331
|
+
};
|
332
|
+
var popState = function(currentState, stack) {
|
333
|
+
// if (stack[0] === currentState)
|
334
|
+
stack.shift();
|
335
|
+
return stack.shift() || "start";
|
336
|
+
};
|
337
|
+
|
338
|
+
this.normalizeRules = function() {
|
339
|
+
var id = 0;
|
340
|
+
var rules = this.$rules;
|
341
|
+
function processState(key) {
|
342
|
+
var state = rules[key];
|
343
|
+
state.processed = true;
|
344
|
+
for (var i = 0; i < state.length; i++) {
|
345
|
+
var rule = state[i];
|
346
|
+
var toInsert = null;
|
347
|
+
if (Array.isArray(rule)) {
|
348
|
+
toInsert = rule;
|
349
|
+
rule = {};
|
350
|
+
}
|
351
|
+
if (!rule.regex && rule.start) {
|
352
|
+
rule.regex = rule.start;
|
353
|
+
if (!rule.next)
|
354
|
+
rule.next = [];
|
355
|
+
rule.next.push({
|
356
|
+
defaultToken: rule.token
|
357
|
+
}, {
|
358
|
+
token: rule.token + ".end",
|
359
|
+
regex: rule.end || rule.start,
|
360
|
+
next: "pop"
|
361
|
+
});
|
362
|
+
rule.token = rule.token + ".start";
|
363
|
+
rule.push = true;
|
364
|
+
}
|
365
|
+
var next = rule.next || rule.push;
|
366
|
+
if (next && Array.isArray(next)) {
|
367
|
+
var stateName = rule.stateName;
|
368
|
+
if (!stateName) {
|
369
|
+
stateName = rule.token;
|
370
|
+
if (typeof stateName != "string")
|
371
|
+
stateName = stateName[0] || "";
|
372
|
+
if (rules[stateName])
|
373
|
+
stateName += id++;
|
374
|
+
}
|
375
|
+
rules[stateName] = next;
|
376
|
+
rule.next = stateName;
|
377
|
+
processState(stateName);
|
378
|
+
} else if (next == "pop") {
|
379
|
+
rule.next = popState;
|
380
|
+
}
|
381
|
+
|
382
|
+
if (rule.push) {
|
383
|
+
rule.nextState = rule.next || rule.push;
|
384
|
+
rule.next = pushState;
|
385
|
+
delete rule.push;
|
386
|
+
}
|
387
|
+
|
388
|
+
if (rule.rules) {
|
389
|
+
for (var r in rule.rules) {
|
390
|
+
if (rules[r]) {
|
391
|
+
if (rules[r].push)
|
392
|
+
rules[r].push.apply(rules[r], rule.rules[r]);
|
393
|
+
} else {
|
394
|
+
rules[r] = rule.rules[r];
|
395
|
+
}
|
396
|
+
}
|
397
|
+
}
|
398
|
+
var includeName = typeof rule == "string" ? rule : rule.include;
|
399
|
+
if (includeName) {
|
400
|
+
if (Array.isArray(includeName))
|
401
|
+
toInsert = includeName.map(function(x) { return rules[x]; });
|
402
|
+
else
|
403
|
+
toInsert = rules[includeName];
|
404
|
+
}
|
405
|
+
|
406
|
+
if (toInsert) {
|
407
|
+
var args = [i, 1].concat(toInsert);
|
408
|
+
if (rule.noEscape)
|
409
|
+
args = args.filter(function(x) {return !x.next;});
|
410
|
+
state.splice.apply(state, args);
|
411
|
+
// skip included rules since they are already processed
|
412
|
+
//i += args.length - 3;
|
413
|
+
i--;
|
414
|
+
}
|
415
|
+
|
416
|
+
if (rule.keywordMap) {
|
417
|
+
rule.token = this.createKeywordMapper(
|
418
|
+
rule.keywordMap, rule.defaultToken || "text", rule.caseInsensitive
|
419
|
+
);
|
420
|
+
delete rule.defaultToken;
|
421
|
+
}
|
422
|
+
}
|
423
|
+
}
|
424
|
+
Object.keys(rules).forEach(processState, this);
|
425
|
+
};
|
426
|
+
|
427
|
+
this.createKeywordMapper = function(map, defaultToken, ignoreCase, splitChar) {
|
428
|
+
var keywords = Object.create(null);
|
429
|
+
Object.keys(map).forEach(function(className) {
|
430
|
+
var a = map[className];
|
431
|
+
if (ignoreCase)
|
432
|
+
a = a.toLowerCase();
|
433
|
+
var list = a.split(splitChar || "|");
|
434
|
+
for (var i = list.length; i--; )
|
435
|
+
keywords[list[i]] = className;
|
436
|
+
});
|
437
|
+
// in old versions of opera keywords["__proto__"] sets prototype
|
438
|
+
// even on objects with __proto__=null
|
439
|
+
if (Object.getPrototypeOf(keywords)) {
|
440
|
+
keywords.__proto__ = null;
|
441
|
+
}
|
442
|
+
this.$keywordList = Object.keys(keywords);
|
443
|
+
map = null;
|
444
|
+
return ignoreCase
|
445
|
+
? function(value) {return keywords[value.toLowerCase()] || defaultToken; }
|
446
|
+
: function(value) {return keywords[value] || defaultToken; };
|
447
|
+
};
|
448
|
+
|
449
|
+
this.getKeywords = function() {
|
450
|
+
return this.$keywords;
|
451
|
+
};
|
452
|
+
|
453
|
+
}).call(TextHighlightRules.prototype);
|
454
|
+
|
455
|
+
exports.TextHighlightRules = TextHighlightRules;
|
456
|
+
});
|
457
|
+
|
458
|
+
|
459
|
+
define("assembly_x86_highlight_rules", function(require, exports, module) {
|
460
|
+
"use strict";
|
461
|
+
|
462
|
+
var oop = require("../lib/oop");
|
463
|
+
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
464
|
+
|
465
|
+
var AssemblyX86HighlightRules = function() {
|
466
|
+
// regexp must not have capturing parentheses. Use (?:) instead.
|
467
|
+
// regexps are ordered -> the first match is used
|
468
|
+
|
469
|
+
this.$rules = { start:
|
470
|
+
[ { token: 'keyword.control.assembly',
|
471
|
+
regex: '\\b(?:aaa|aad|aam|aas|adc|add|addpd|addps|addsd|addss|addsubpd|addsubps|aesdec|aesdeclast|aesenc|aesenclast|aesimc|aeskeygenassist|and|andpd|andps|andnpd|andnps|arpl|blendpd|blendps|blendvpd|blendvps|bound|bsf|bsr|bswap|bt|btc|btr|bts|cbw|cwde|cdqe|clc|cld|cflush|clts|cmc|cmov(?:n?e|ge?|ae?|le?|be?|n?o|n?z)|cmp|cmppd|cmpps|cmps|cnpsb|cmpsw|cmpsd|cmpsq|cmpss|cmpxchg|cmpxchg8b|cmpxchg16b|comisd|comiss|cpuid|crc32|cvtdq2pd|cvtdq2ps|cvtpd2dq|cvtpd2pi|cvtpd2ps|cvtpi2pd|cvtpi2ps|cvtps2dq|cvtps2pd|cvtps2pi|cvtsd2si|cvtsd2ss|cvts2sd|cvtsi2ss|cvtss2sd|cvtss2si|cvttpd2dq|cvtpd2pi|cvttps2dq|cvttps2pi|cvttps2dq|cvttps2pi|cvttsd2si|cvttss2si|cwd|cdq|cqo|daa|das|dec|div|divpd|divps|divsd|divss|dppd|dpps|emms|enter|extractps|f2xm1|fabs|fadd|faddp|fiadd|fbld|fbstp|fchs|fclex|fnclex|fcmov(?:n?e|ge?|ae?|le?|be?|n?o|n?z)|fcom|fcmop|fcompp|fcomi|fcomip|fucomi|fucomip|fcos|fdecstp|fdiv|fdivp|fidiv|fdivr|fdivrp|fidivr|ffree|ficom|ficomp|fild|fincstp|finit|fnint|fist|fistp|fisttp|fld|fld1|fldl2t|fldl2e|fldpi|fldlg2|fldln2|fldz|fldcw|fldenv|fmul|fmulp|fimul|fnop|fpatan|fprem|fprem1|fptan|frndint|frstor|fsave|fnsave|fscale|fsin|fsincos|fsqrt|fst|fstp|fstcw|fnstcw|fstenv|fnstenv|fsts|fnstsw|fsub|fsubp|fisub|fsubr|fsubrp|fisubr|ftst|fucom|fucomp|fucompp|fxam|fxch|fxrstor|fxsave|fxtract|fyl2x|fyl2xp1|haddpd|haddps|husbpd|hsubps|idiv|imul|in|inc|ins|insb|insw|insd|insertps|int|into|invd|invplg|invpcid|iret|iretd|iretq|lahf|lar|lddqu|ldmxcsr|lds|les|lfs|lgs|lss|lea|leave|lfence|lgdt|lidt|llgdt|lmsw|lock|lods|lodsb|lodsw|lodsd|lodsq|lsl|ltr|maskmovdqu|maskmovq|maxpd|maxps|maxsd|maxss|mfence|minpd|minps|minsd|minss|monitor|mov|movapd|movaps|movbe|movd|movq|movddup|movdqa|movdqu|movq2q|movhlps|movhpd|movhps|movlhps|movlpd|movlps|movmskpd|movmskps|movntdqa|movntdq|movnti|movntpd|movntps|movntq|movq|movq2dq|movs|movsb|movsw|movsd|movsq|movsd|movshdup|movsldup|movss|movsx|movsxd|movupd|movups|movzx|mpsadbw|mul|mulpd|mulps|mulsd|mulss|mwait|neg|not|or|orpd|orps|out|outs|outsb|outsw|outsd|pabsb|pabsw|pabsd|packsswb|packssdw|packusdw|packuswbpaddb|paddw|paddd|paddq|paddsb|paddsw|paddusb|paddusw|palignr|pand|pandn|pause|pavgb|pavgw|pblendvb|pblendw|pclmulqdq|pcmpeqb|pcmpeqw|pcmpeqd|pcmpeqq|pcmpestri|pcmpestrm|pcmptb|pcmptgw|pcmpgtd|pcmpgtq|pcmpistri|pcmpisrm|pextrb|pextrd|pextrq|pextrw|phaddw|phaddd|phaddsw|phinposuw|phsubw|phsubd|phsubsw|pinsrb|pinsrd|pinsrq|pinsrw|pmaddubsw|pmadddwd|pmaxsb|pmaxsd|pmaxsw|pmaxsw|pmaxub|pmaxud|pmaxuw|pminsb|pminsd|pminsw|pminub|pminud|pminuw|pmovmskb|pmovsx|pmovzx|pmuldq|pmulhrsw|pmulhuw|pmulhw|pmulld|pmullw|pmuludw|pop|popa|popad|popcnt|popf|popfd|popfq|por|prefetch|psadbw|pshufb|pshufd|pshufhw|pshuflw|pshufw|psignb|psignw|psignd|pslldq|psllw|pslld|psllq|psraw|psrad|psrldq|psrlw|psrld|psrlq|psubb|psubw|psubd|psubq|psubsb|psubsw|psubusb|psubusw|test|ptest|punpckhbw|punpckhwd|punpckhdq|punpckhddq|punpcklbw|punpcklwd|punpckldq|punpckldqd|push|pusha|pushad|pushf|pushfd|pxor|prcl|rcr|rol|ror|rcpps|rcpss|rdfsbase|rdgsbase|rdmsr|rdpmc|rdrand|rdtsc|rdtscp|rep|repe|repz|repne|repnz|roundpd|roundps|roundsd|roundss|rsm|rsqrps|rsqrtss|sahf|sal|sar|shl|shr|sbb|scas|scasb|scasw|scasd|set(?:n?e|ge?|ae?|le?|be?|n?o|n?z)|sfence|sgdt|shld|shrd|shufpd|shufps|sidt|sldt|smsw|sqrtpd|sqrtps|sqrtsd|sqrtss|stc|std|stmxcsr|stos|stosb|stosw|stosd|stosq|str|sub|subpd|subps|subsd|subss|swapgs|syscall|sysenter|sysexit|sysret|teset|ucomisd|ucomiss|ud2|unpckhpd|unpckhps|unpcklpd|unpcklps|vbroadcast|vcvtph2ps|vcvtp2sph|verr|verw|vextractf128|vinsertf128|vmaskmov|vpermilpd|vpermilps|vperm2f128|vtestpd|vtestps|vzeroall|vzeroupper|wait|fwait|wbinvd|wrfsbase|wrgsbase|wrmsr|xadd|xchg|xgetbv|xlat|xlatb|xor|xorpd|xorps|xrstor|xsave|xsaveopt|xsetbv|lzcnt|extrq|insertq|movntsd|movntss|vfmaddpd|vfmaddps|vfmaddsd|vfmaddss|vfmaddsubbpd|vfmaddsubps|vfmsubaddpd|vfmsubaddps|vfmsubpd|vfmsubps|vfmsubsd|vfnmaddpd|vfnmaddps|vfnmaddsd|vfnmaddss|vfnmsubpd|vfnmusbps|vfnmusbsd|vfnmusbss|cvt|xor|cli|sti|hlt|nop|lock|wait|enter|leave|ret|loop(?:n?e|n?z)?|call|j(?:mp|n?e|ge?|ae?|le?|be?|n?o|n?z))\\b',
|
472
|
+
caseInsensitive: true },
|
473
|
+
{ token: 'variable.parameter.register.assembly',
|
474
|
+
regex: '\\b(?:CS|DS|ES|FS|GS|SS|RAX|EAX|RBX|EBX|RCX|ECX|RDX|EDX|RCX|RIP|EIP|IP|RSP|ESP|SP|RSI|ESI|SI|RDI|EDI|DI|RFLAGS|EFLAGS|FLAGS|R8-15|(?:Y|X)MM(?:[0-9]|10|11|12|13|14|15)|(?:A|B|C|D)(?:X|H|L)|CR(?:[0-4]|DR(?:[0-7]|TR6|TR7|EFER)))\\b',
|
475
|
+
caseInsensitive: true },
|
476
|
+
{ token: 'constant.character.decimal.assembly',
|
477
|
+
regex: '\\b[0-9]+\\b' },
|
478
|
+
{ token: 'constant.character.hexadecimal.assembly',
|
479
|
+
regex: '\\b0x[A-F0-9]+\\b',
|
480
|
+
caseInsensitive: true },
|
481
|
+
{ token: 'constant.character.hexadecimal.assembly',
|
482
|
+
regex: '\\b[A-F0-9]+h\\b',
|
483
|
+
caseInsensitive: true },
|
484
|
+
{ token: 'string.assembly', regex: /'([^\\']|\\.)*'/ },
|
485
|
+
{ token: 'string.assembly', regex: /"([^\\"]|\\.)*"/ },
|
486
|
+
{ token: 'support.function.directive.assembly',
|
487
|
+
regex: '^\\[',
|
488
|
+
push:
|
489
|
+
[ { token: 'support.function.directive.assembly',
|
490
|
+
regex: '\\]$',
|
491
|
+
next: 'pop' },
|
492
|
+
{ defaultToken: 'support.function.directive.assembly' } ] },
|
493
|
+
{ token:
|
494
|
+
[ 'support.function.directive.assembly',
|
495
|
+
'support.function.directive.assembly',
|
496
|
+
'entity.name.function.assembly' ],
|
497
|
+
regex: '(^struc)( )([_a-zA-Z][_a-zA-Z0-9]*)' },
|
498
|
+
{ token: 'support.function.directive.assembly',
|
499
|
+
regex: '^endstruc\\b' },
|
500
|
+
{ token:
|
501
|
+
[ 'support.function.directive.assembly',
|
502
|
+
'entity.name.function.assembly',
|
503
|
+
'support.function.directive.assembly',
|
504
|
+
'constant.character.assembly' ],
|
505
|
+
regex: '^(%macro )([_a-zA-Z][_a-zA-Z0-9]*)( )([0-9]+)' },
|
506
|
+
{ token: 'support.function.directive.assembly',
|
507
|
+
regex: '^%endmacro' },
|
508
|
+
{ token:
|
509
|
+
[ 'text',
|
510
|
+
'support.function.directive.assembly',
|
511
|
+
'text',
|
512
|
+
'entity.name.function.assembly' ],
|
513
|
+
regex: '(\\s*)(%define|%xdefine|%idefine|%undef|%assign|%defstr|%strcat|%strlen|%substr|%00|%0|%rotate|%rep|%endrep|%include|\\$\\$|\\$|%unmacro|%if|%elif|%else|%endif|%(?:el)?ifdef|%(?:el)?ifmacro|%(?:el)?ifctx|%(?:el)?ifidn|%(?:el)?ifidni|%(?:el)?ifid|%(?:el)?ifnum|%(?:el)?ifstr|%(?:el)?iftoken|%(?:el)?ifempty|%(?:el)?ifenv|%pathsearch|%depend|%use|%push|%pop|%repl|%arg|%stacksize|%local|%error|%warning|%fatal|%line|%!|%comment|%endcomment|__NASM_VERSION_ID__|__NASM_VER__|__FILE__|__LINE__|__BITS__|__OUTPUT_FORMAT__|__DATE__|__TIME__|__DATE_NUM__|_TIME__NUM__|__UTC_DATE__|__UTC_TIME__|__UTC_DATE_NUM__|__UTC_TIME_NUM__|__POSIX_TIME__|__PASS__|ISTRUC|AT|IEND|BITS 16|BITS 32|BITS 64|USE16|USE32|__SECT__|ABSOLUTE|EXTERN|GLOBAL|COMMON|CPU|FLOAT)\\b( ?)((?:[_a-zA-Z][_a-zA-Z0-9]*)?)',
|
514
|
+
caseInsensitive: true },
|
515
|
+
{ token: 'support.function.directive.assembly',
|
516
|
+
regex: '\\b(?:d[bwdqtoy]|res[bwdqto]|equ|times|align|alignb|sectalign|section|ptr|byte|word|dword|qword|incbin)\\b',
|
517
|
+
caseInsensitive: true },
|
518
|
+
{ token: 'entity.name.function.assembly', regex: '^\\s*%%[\\w.]+?:$' },
|
519
|
+
{ token: 'entity.name.function.assembly', regex: '^\\s*%\\$[\\w.]+?:$' },
|
520
|
+
{ token: 'entity.name.function.assembly', regex: '^[\\w.]+?:' },
|
521
|
+
{ token: 'entity.name.function.assembly', regex: '^[\\w.]+?\\b' },
|
522
|
+
{ token: 'comment.assembly', regex: ';.*$' } ]
|
523
|
+
};
|
524
|
+
|
525
|
+
this.normalizeRules();
|
526
|
+
};
|
527
|
+
|
528
|
+
AssemblyX86HighlightRules.metaData = { fileTypes: [ 'asm' ],
|
529
|
+
name: 'Assembly x86',
|
530
|
+
scopeName: 'source.assembly' };
|
531
|
+
|
532
|
+
|
533
|
+
oop.inherits(AssemblyX86HighlightRules, TextHighlightRules);
|
534
|
+
|
535
|
+
exports.AssemblyX86HighlightRules = AssemblyX86HighlightRules;
|
536
|
+
});
|
537
|
+
|
538
|
+
|
539
|
+
// Ace highlight rules function imported below.
|
540
|
+
var HighlightRules = require("assembly_x86_highlight_rules").AssemblyX86HighlightRules;
|
541
|
+
|
542
|
+
|
543
|
+
|
544
|
+
// Ace's Syntax Tokenizer.
|
545
|
+
|
546
|
+
// tokenizing lines longer than this makes editor very slow
|
547
|
+
var MAX_TOKEN_COUNT = 1000;
|
548
|
+
var Tokenizer = function(rules) {
|
549
|
+
this.states = rules;
|
550
|
+
|
551
|
+
this.regExps = {};
|
552
|
+
this.matchMappings = {};
|
553
|
+
for (var key in this.states) {
|
554
|
+
var state = this.states[key];
|
555
|
+
var ruleRegExps = [];
|
556
|
+
var matchTotal = 0;
|
557
|
+
var mapping = this.matchMappings[key] = {defaultToken: "text"};
|
558
|
+
var flag = "g";
|
559
|
+
|
560
|
+
var splitterRurles = [];
|
561
|
+
for (var i = 0; i < state.length; i++) {
|
562
|
+
var rule = state[i];
|
563
|
+
if (rule.defaultToken)
|
564
|
+
mapping.defaultToken = rule.defaultToken;
|
565
|
+
if (rule.caseInsensitive)
|
566
|
+
flag = "gi";
|
567
|
+
if (rule.regex == null)
|
568
|
+
continue;
|
569
|
+
|
570
|
+
if (rule.regex instanceof RegExp)
|
571
|
+
rule.regex = rule.regex.toString().slice(1, -1);
|
572
|
+
|
573
|
+
// Count number of matching groups. 2 extra groups from the full match
|
574
|
+
// And the catch-all on the end (used to force a match);
|
575
|
+
var adjustedregex = rule.regex;
|
576
|
+
var matchcount = new RegExp("(?:(" + adjustedregex + ")|(.))").exec("a").length - 2;
|
577
|
+
if (Array.isArray(rule.token)) {
|
578
|
+
if (rule.token.length == 1 || matchcount == 1) {
|
579
|
+
rule.token = rule.token[0];
|
580
|
+
} else if (matchcount - 1 != rule.token.length) {
|
581
|
+
throw new Error("number of classes and regexp groups in '" +
|
582
|
+
rule.token + "'\n'" + rule.regex + "' doesn't match\n"
|
583
|
+
+ (matchcount - 1) + "!=" + rule.token.length);
|
584
|
+
} else {
|
585
|
+
rule.tokenArray = rule.token;
|
586
|
+
rule.token = null;
|
587
|
+
rule.onMatch = this.$arrayTokens;
|
588
|
+
}
|
589
|
+
} else if (typeof rule.token == "function" && !rule.onMatch) {
|
590
|
+
if (matchcount > 1)
|
591
|
+
rule.onMatch = this.$applyToken;
|
592
|
+
else
|
593
|
+
rule.onMatch = rule.token;
|
594
|
+
}
|
595
|
+
|
596
|
+
if (matchcount > 1) {
|
597
|
+
if (/\\\d/.test(rule.regex)) {
|
598
|
+
// Replace any backreferences and offset appropriately.
|
599
|
+
adjustedregex = rule.regex.replace(/\\([0-9]+)/g, function(match, digit) {
|
600
|
+
return "\\" + (parseInt(digit, 10) + matchTotal + 1);
|
601
|
+
});
|
602
|
+
} else {
|
603
|
+
matchcount = 1;
|
604
|
+
adjustedregex = this.removeCapturingGroups(rule.regex);
|
605
|
+
}
|
606
|
+
if (!rule.splitRegex && typeof rule.token != "string")
|
607
|
+
splitterRurles.push(rule); // flag will be known only at the very end
|
608
|
+
}
|
609
|
+
|
610
|
+
mapping[matchTotal] = i;
|
611
|
+
matchTotal += matchcount;
|
612
|
+
|
613
|
+
ruleRegExps.push(adjustedregex);
|
614
|
+
|
615
|
+
// makes property access faster
|
616
|
+
if (!rule.onMatch)
|
617
|
+
rule.onMatch = null;
|
618
|
+
}
|
619
|
+
|
620
|
+
splitterRurles.forEach(function(rule) {
|
621
|
+
rule.splitRegex = this.createSplitterRegexp(rule.regex, flag);
|
622
|
+
}, this);
|
623
|
+
|
624
|
+
this.regExps[key] = new RegExp("(" + ruleRegExps.join(")|(") + ")|($)", flag);
|
625
|
+
}
|
626
|
+
};
|
627
|
+
|
628
|
+
(function() {
|
629
|
+
this.$setMaxTokenCount = function(m) {
|
630
|
+
MAX_TOKEN_COUNT = m | 0;
|
631
|
+
};
|
632
|
+
|
633
|
+
this.$applyToken = function(str) {
|
634
|
+
var values = this.splitRegex.exec(str).slice(1);
|
635
|
+
var types = this.token.apply(this, values);
|
636
|
+
|
637
|
+
// required for compatibility with old modes
|
638
|
+
if (typeof types === "string")
|
639
|
+
return [{type: types, value: str}];
|
640
|
+
|
641
|
+
var tokens = [];
|
642
|
+
for (var i = 0, l = types.length; i < l; i++) {
|
643
|
+
if (values[i])
|
644
|
+
tokens[tokens.length] = {
|
645
|
+
type: types[i],
|
646
|
+
value: values[i]
|
647
|
+
};
|
648
|
+
}
|
649
|
+
return tokens;
|
650
|
+
},
|
651
|
+
|
652
|
+
this.$arrayTokens = function(str) {
|
653
|
+
if (!str)
|
654
|
+
return [];
|
655
|
+
var values = this.splitRegex.exec(str);
|
656
|
+
if (!values)
|
657
|
+
return "text";
|
658
|
+
var tokens = [];
|
659
|
+
var types = this.tokenArray;
|
660
|
+
for (var i = 0, l = types.length; i < l; i++) {
|
661
|
+
if (values[i + 1])
|
662
|
+
tokens[tokens.length] = {
|
663
|
+
type: types[i],
|
664
|
+
value: values[i + 1]
|
665
|
+
};
|
666
|
+
}
|
667
|
+
return tokens;
|
668
|
+
};
|
669
|
+
|
670
|
+
this.removeCapturingGroups = function(src) {
|
671
|
+
var r = src.replace(
|
672
|
+
/\[(?:\\.|[^\]])*?\]|\\.|\(\?[:=!]|(\()/g,
|
673
|
+
function(x, y) {return y ? "(?:" : x;}
|
674
|
+
);
|
675
|
+
return r;
|
676
|
+
};
|
677
|
+
|
678
|
+
this.createSplitterRegexp = function(src, flag) {
|
679
|
+
if (src.indexOf("(?=") != -1) {
|
680
|
+
var stack = 0;
|
681
|
+
var inChClass = false;
|
682
|
+
var lastCapture = {};
|
683
|
+
src.replace(/(\\.)|(\((?:\?[=!])?)|(\))|([\[\]])/g, function(
|
684
|
+
m, esc, parenOpen, parenClose, square, index
|
685
|
+
) {
|
686
|
+
if (inChClass) {
|
687
|
+
inChClass = square != "]";
|
688
|
+
} else if (square) {
|
689
|
+
inChClass = true;
|
690
|
+
} else if (parenClose) {
|
691
|
+
if (stack == lastCapture.stack) {
|
692
|
+
lastCapture.end = index+1;
|
693
|
+
lastCapture.stack = -1;
|
694
|
+
}
|
695
|
+
stack--;
|
696
|
+
} else if (parenOpen) {
|
697
|
+
stack++;
|
698
|
+
if (parenOpen.length != 1) {
|
699
|
+
lastCapture.stack = stack
|
700
|
+
lastCapture.start = index;
|
701
|
+
}
|
702
|
+
}
|
703
|
+
return m;
|
704
|
+
});
|
705
|
+
|
706
|
+
if (lastCapture.end != null && /^\)*$/.test(src.substr(lastCapture.end)))
|
707
|
+
src = src.substring(0, lastCapture.start) + src.substr(lastCapture.end);
|
708
|
+
}
|
709
|
+
return new RegExp(src, (flag||"").replace("g", ""));
|
710
|
+
};
|
711
|
+
|
712
|
+
/**
|
713
|
+
* Returns an object containing two properties: `tokens`, which contains all the tokens; and `state`, the current state.
|
714
|
+
* @returns {Object}
|
715
|
+
**/
|
716
|
+
this.getLineTokens = function(line, startState) {
|
717
|
+
if (startState && typeof startState != "string") {
|
718
|
+
var stack = startState.slice(0);
|
719
|
+
startState = stack[0];
|
720
|
+
} else
|
721
|
+
var stack = [];
|
722
|
+
|
723
|
+
var currentState = startState || "start";
|
724
|
+
var state = this.states[currentState];
|
725
|
+
if (!state) {
|
726
|
+
currentState = "start";
|
727
|
+
state = this.states[currentState];
|
728
|
+
}
|
729
|
+
var mapping = this.matchMappings[currentState];
|
730
|
+
var re = this.regExps[currentState];
|
731
|
+
re.lastIndex = 0;
|
732
|
+
|
733
|
+
var match, tokens = [];
|
734
|
+
var lastIndex = 0;
|
735
|
+
|
736
|
+
var token = {type: null, value: ""};
|
737
|
+
|
738
|
+
while (match = re.exec(line)) {
|
739
|
+
var type = mapping.defaultToken;
|
740
|
+
var rule = null;
|
741
|
+
var value = match[0];
|
742
|
+
var index = re.lastIndex;
|
743
|
+
|
744
|
+
if (index - value.length > lastIndex) {
|
745
|
+
var skipped = line.substring(lastIndex, index - value.length);
|
746
|
+
if (token.type == type) {
|
747
|
+
token.value += skipped;
|
748
|
+
} else {
|
749
|
+
if (token.type)
|
750
|
+
tokens.push(token);
|
751
|
+
token = {type: type, value: skipped};
|
752
|
+
}
|
753
|
+
}
|
754
|
+
|
755
|
+
for (var i = 0; i < match.length-2; i++) {
|
756
|
+
if (match[i + 1] === undefined)
|
757
|
+
continue;
|
758
|
+
|
759
|
+
rule = state[mapping[i]];
|
760
|
+
|
761
|
+
if (rule.onMatch)
|
762
|
+
type = rule.onMatch(value, currentState, stack);
|
763
|
+
else
|
764
|
+
type = rule.token;
|
765
|
+
|
766
|
+
if (rule.next) {
|
767
|
+
if (typeof rule.next == "string")
|
768
|
+
currentState = rule.next;
|
769
|
+
else
|
770
|
+
currentState = rule.next(currentState, stack);
|
771
|
+
|
772
|
+
state = this.states[currentState];
|
773
|
+
if (!state) {
|
774
|
+
window.console && console.error && console.error(currentState, "doesn't exist");
|
775
|
+
currentState = "start";
|
776
|
+
state = this.states[currentState];
|
777
|
+
}
|
778
|
+
mapping = this.matchMappings[currentState];
|
779
|
+
lastIndex = index;
|
780
|
+
re = this.regExps[currentState];
|
781
|
+
re.lastIndex = index;
|
782
|
+
}
|
783
|
+
break;
|
784
|
+
}
|
785
|
+
|
786
|
+
if (value) {
|
787
|
+
if (typeof type == "string") {
|
788
|
+
if ((!rule || rule.merge !== false) && token.type === type) {
|
789
|
+
token.value += value;
|
790
|
+
} else {
|
791
|
+
if (token.type)
|
792
|
+
tokens.push(token);
|
793
|
+
token = {type: type, value: value};
|
794
|
+
}
|
795
|
+
} else if (type) {
|
796
|
+
if (token.type)
|
797
|
+
tokens.push(token);
|
798
|
+
token = {type: null, value: ""};
|
799
|
+
for (var i = 0; i < type.length; i++)
|
800
|
+
tokens.push(type[i]);
|
801
|
+
}
|
802
|
+
}
|
803
|
+
|
804
|
+
if (lastIndex == line.length)
|
805
|
+
break;
|
806
|
+
|
807
|
+
lastIndex = index;
|
808
|
+
|
809
|
+
if (tokens.length > MAX_TOKEN_COUNT) {
|
810
|
+
// chrome doens't show contents of text nodes with very long text
|
811
|
+
while (lastIndex < line.length) {
|
812
|
+
if (token.type)
|
813
|
+
tokens.push(token);
|
814
|
+
token = {
|
815
|
+
value: line.substring(lastIndex, lastIndex += 2000),
|
816
|
+
type: "overflow"
|
817
|
+
};
|
818
|
+
}
|
819
|
+
currentState = "start";
|
820
|
+
stack = [];
|
821
|
+
break;
|
822
|
+
}
|
823
|
+
}
|
824
|
+
|
825
|
+
if (token.type)
|
826
|
+
tokens.push(token);
|
827
|
+
|
828
|
+
if (stack.length > 1) {
|
829
|
+
if (stack[0] !== currentState)
|
830
|
+
stack.unshift(currentState);
|
831
|
+
}
|
832
|
+
return {
|
833
|
+
tokens : tokens,
|
834
|
+
state : stack.length ? stack : currentState
|
835
|
+
};
|
836
|
+
};
|
837
|
+
|
838
|
+
}).call(Tokenizer.prototype);
|
839
|
+
|
840
|
+
// Token conversion.
|
841
|
+
// See <https://github.com/ajaxorg/ace/wiki/Creating-or-Extending-an-Edit-Mode#common-tokens>
|
842
|
+
// This is not an exact match nor the best match that can be made.
|
843
|
+
var tokenFromAceToken = {
|
844
|
+
empty: null,
|
845
|
+
text: null,
|
846
|
+
|
847
|
+
// Keyword
|
848
|
+
keyword: 'keyword',
|
849
|
+
control: 'keyword',
|
850
|
+
operator: 'operator',
|
851
|
+
|
852
|
+
// Constants
|
853
|
+
constant: 'atom',
|
854
|
+
numeric: 'number',
|
855
|
+
character: 'atom',
|
856
|
+
escape: 'atom',
|
857
|
+
|
858
|
+
// Variables
|
859
|
+
variable: 'variable',
|
860
|
+
parameter: 'variable-3',
|
861
|
+
language: 'variable-2', // Python's `self` uses that.
|
862
|
+
|
863
|
+
// Comments
|
864
|
+
comment: 'comment',
|
865
|
+
line: 'comment',
|
866
|
+
'double-slash': 'comment',
|
867
|
+
'double-dash': 'comment',
|
868
|
+
'number-sign': 'comment',
|
869
|
+
percentage: 'comment',
|
870
|
+
block: 'comment',
|
871
|
+
documentation: 'comment',
|
872
|
+
|
873
|
+
// String
|
874
|
+
string: 'string',
|
875
|
+
quoted: 'string',
|
876
|
+
single: 'string',
|
877
|
+
double: 'string',
|
878
|
+
triple: 'string',
|
879
|
+
unquoted: 'string',
|
880
|
+
interpolated: 'string',
|
881
|
+
regexp: 'string-2',
|
882
|
+
|
883
|
+
meta: 'meta',
|
884
|
+
literal: 'qualifier',
|
885
|
+
support: 'builtin',
|
886
|
+
|
887
|
+
// Markup
|
888
|
+
markup: 'tag',
|
889
|
+
underline: 'link',
|
890
|
+
link: 'link',
|
891
|
+
bold: 'strong',
|
892
|
+
heading: 'header',
|
893
|
+
italic: 'em',
|
894
|
+
list: 'variable-2',
|
895
|
+
numbered: 'variable-2',
|
896
|
+
unnumbered: 'variable-2',
|
897
|
+
quote: 'quote',
|
898
|
+
raw: 'variable-2', // Markdown's raw block uses that.
|
899
|
+
|
900
|
+
// Invalid
|
901
|
+
invalid: 'error',
|
902
|
+
illegal: 'invalidchar',
|
903
|
+
deprecated: 'error'
|
904
|
+
};
|
905
|
+
|
906
|
+
// Takes a list of Ace tokens, returns a (string) CodeMirror token.
|
907
|
+
var cmTokenFromAceTokens = function(tokens) {
|
908
|
+
var token = null;
|
909
|
+
for (var i = 0; i < tokens.length; i++) {
|
910
|
+
// Find the most specific token.
|
911
|
+
if (tokenFromAceToken[tokens[i]] !== undefined) {
|
912
|
+
token = tokenFromAceToken[tokens[i]];
|
913
|
+
}
|
914
|
+
}
|
915
|
+
return token;
|
916
|
+
};
|
917
|
+
|
918
|
+
// Consume a token from plannedTokens.
|
919
|
+
var consumeToken = function(stream, state) {
|
920
|
+
var plannedToken = state.plannedTokens.shift();
|
921
|
+
if (plannedToken === undefined) {
|
922
|
+
return null;
|
923
|
+
}
|
924
|
+
stream.match(plannedToken.value);
|
925
|
+
var tokens = plannedToken.type.split('.');
|
926
|
+
return cmTokenFromAceTokens(tokens);
|
927
|
+
};
|
928
|
+
|
929
|
+
var matchToken = function(stream, state) {
|
930
|
+
// Anormal start: we already have planned tokens to consume.
|
931
|
+
if (state.plannedTokens.length > 0) {
|
932
|
+
return consumeToken(stream, state);
|
933
|
+
}
|
934
|
+
|
935
|
+
// Normal start.
|
936
|
+
var currentState = state.current;
|
937
|
+
var currentLine = stream.match(/.*$/, false)[0];
|
938
|
+
var tokenized = tokenizer.getLineTokens(currentLine, currentState);
|
939
|
+
// We got a {tokens, state} object.
|
940
|
+
// Each token is a {value, type} object.
|
941
|
+
state.plannedTokens = tokenized.tokens;
|
942
|
+
state.current = tokenized.state;
|
943
|
+
|
944
|
+
// Consume a token.
|
945
|
+
return consumeToken(stream, state);
|
946
|
+
}
|
947
|
+
|
948
|
+
// Initialize all state.
|
949
|
+
var aceHighlightRules = new HighlightRules();
|
950
|
+
var tokenizer = new Tokenizer(aceHighlightRules.$rules);
|
951
|
+
|
952
|
+
return {
|
953
|
+
startState: function() {
|
954
|
+
return {
|
955
|
+
current: 'start',
|
956
|
+
// List of {value, type}, with type being an Ace token string.
|
957
|
+
plannedTokens: []
|
958
|
+
};
|
959
|
+
},
|
960
|
+
blankLine: function(state) { matchToken('', state); },
|
961
|
+
token: matchToken
|
962
|
+
};
|
963
|
+
});
|
964
|
+
|
965
|
+
CodeMirror.defineMIME("text/x-assembly_x86", "assembly_x86");
|
966
|
+
CodeMirror.defineMIME("text/x-qsim", "assembly_x86");
|
967
|
+
CodeMirror.defineMIME("qsim", "assembly_x86");
|