1
|
ace.define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
|
2
|
"use strict";
|
3
|
|
4
|
var oop = require("../lib/oop");
|
5
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
6
|
|
7
|
var DocCommentHighlightRules = function() {
|
8
|
this.$rules = {
|
9
|
"start" : [ {
|
10
|
token : "comment.doc.tag",
|
11
|
regex : "@[\\w\\d_]+" // TODO: fix email addresses
|
12
|
},
|
13
|
DocCommentHighlightRules.getTagRule(),
|
14
|
{
|
15
|
defaultToken : "comment.doc",
|
16
|
caseInsensitive: true
|
17
|
}]
|
18
|
};
|
19
|
};
|
20
|
|
21
|
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
22
|
|
23
|
DocCommentHighlightRules.getTagRule = function(start) {
|
24
|
return {
|
25
|
token : "comment.doc.tag.storage.type",
|
26
|
regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
|
27
|
};
|
28
|
};
|
29
|
|
30
|
DocCommentHighlightRules.getStartRule = function(start) {
|
31
|
return {
|
32
|
token : "comment.doc", // doc comment
|
33
|
regex : "\\/\\*(?=\\*)",
|
34
|
next : start
|
35
|
};
|
36
|
};
|
37
|
|
38
|
DocCommentHighlightRules.getEndRule = function (start) {
|
39
|
return {
|
40
|
token : "comment.doc", // closing comment
|
41
|
regex : "\\*\\/",
|
42
|
next : start
|
43
|
};
|
44
|
};
|
45
|
|
46
|
|
47
|
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
48
|
|
49
|
});
|
50
|
|
51
|
ace.define("ace/mode/asl_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(require, exports, module) {
|
52
|
"use strict";
|
53
|
|
54
|
var oop = require("../lib/oop");
|
55
|
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
|
56
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
57
|
|
58
|
var ASLHighlightRules = function() {
|
59
|
var keywords = (
|
60
|
"Default|DefinitionBlock|Device|Method|Else|ElseIf|For|Function|If|Include|Method|Return|" +
|
61
|
"Scope|Switch|Case|While|Break|BreakPoint|Continue|NoOp|Wait"
|
62
|
);
|
63
|
|
64
|
var keywordOperators = (
|
65
|
"Add|And|Decrement|Divide|Increment|Index|LAnd|LEqual|LGreater|LGreaterEqual|" +
|
66
|
"LLess|LLessEqual|LNot|LNotEqual|LOr|Mod|Multiply|NAnd|NOr|Not|Or|RefOf|Revision|" +
|
67
|
"ShiftLeft|ShiftRight|Subtract|XOr|DerefOf"
|
68
|
);
|
69
|
|
70
|
var buildinFunctions = (
|
71
|
"AccessAs|Acquire|Alias|BankField|Buffer|Concatenate|ConcatenateResTemplate|" +
|
72
|
"CondRefOf|Connection|CopyObject|CreateBitField|CreateByteField|CreateDWordField|" +
|
73
|
"CreateField|CreateQWordField|CreateWordField|DataTableRegion|Debug|" +
|
74
|
"DMA|DWordIO|DWordMemory|DWordSpace|EisaId|EISAID|EndDependentFn|Event|ExtendedIO|" +
|
75
|
"ExtendedMemory|ExtendedSpace|External|Fatal|Field|FindSetLeftBit|FindSetRightBit|" +
|
76
|
"FixedDMA|FixedIO|Fprintf|FromBCD|GpioInt|GpioIo|I2CSerialBusV2|IndexField|" +
|
77
|
"Interrupt|IO|IRQ|IRQNoFlags|Load|LoadTable|Match|Memory32|Memory32Fixed|" +
|
78
|
"Mid|Mutex|Name|Notify|Offset|ObjectType|OperationRegion|Package|PowerResource|Printf|" +
|
79
|
"QWordIO|QWordMemory|QWordSpace|RawDataBuffer|Register|Release|Reset|ResourceTemplate|" +
|
80
|
"Signal|SizeOf|Sleep|SPISerialBusV2|Stall|StartDependentFn|StartDependentFnNoPri|" +
|
81
|
"Store|ThermalZone|Timer|ToBCD|ToBuffer|ToDecimalString|ToInteger|ToPLD|ToString|" +
|
82
|
"ToUUID|UARTSerialBusV2|Unicode|Unload|VendorLong|VendorShort|WordBusNumber|WordIO|" +
|
83
|
"WordSpace"
|
84
|
);
|
85
|
|
86
|
var flags = (
|
87
|
"AttribQuick|AttribSendReceive|AttribByte|AttribBytes|AttribRawBytes|" +
|
88
|
"AttribRawProcessBytes|AttribWord|AttribBlock|AttribProcessCall|AttribBlockProcessCall|" +
|
89
|
"AnyAcc|ByteAcc|WordAcc|DWordAcc|QWordAcc|BufferAcc|" +
|
90
|
"AddressRangeMemory|AddressRangeReserved|AddressRangeNVS|AddressRangeACPI|" +
|
91
|
"RegionSpaceKeyword|FFixedHW|PCC|" +
|
92
|
"AddressingMode7Bit|AddressingMode10Bit|" +
|
93
|
"DataBitsFive|DataBitsSix|DataBitsSeven|DataBitsEight|DataBitsNine|" +
|
94
|
"BusMaster|NotBusMaster|" +
|
95
|
"ClockPhaseFirst|ClockPhaseSecond|ClockPolarityLow|ClockPolarityHigh|" +
|
96
|
"SubDecode|PosDecode|" +
|
97
|
"BigEndianing|LittleEndian|" +
|
98
|
"FlowControlNone|FlowControlXon|FlowControlHardware|" +
|
99
|
"Edge|Level|ActiveHigh|ActiveLow|ActiveBoth|Decode16|Decode10|" +
|
100
|
"IoRestrictionNone|IoRestrictionInputOnly|IoRestrictionOutputOnly|" +
|
101
|
"IoRestrictionNoneAndPreserve|Lock|NoLock|MTR|MEQ|MLE|MLT|MGE|MGT|" +
|
102
|
"MaxFixed|MaxNotFixed|Cacheable|WriteCombining|Prefetchable|NonCacheable|" +
|
103
|
"MinFixed|MinNotFixed|" +
|
104
|
"ParityTypeNone|ParityTypeSpace|ParityTypeMark|ParityTypeOdd|ParityTypeEven|" +
|
105
|
"PullDefault|PullUp|PullDown|PullNone|PolarityHigh|PolarityLow|" +
|
106
|
"ISAOnlyRanges|NonISAOnlyRanges|EntireRange|ReadWrite|ReadOnly|" +
|
107
|
"UserDefRegionSpace|SystemIO|SystemMemory|PCI_Config|EmbeddedControl|" +
|
108
|
"SMBus|SystemCMOS|PciBarTarget|IPMI|GeneralPurposeIO|GenericSerialBus|" +
|
109
|
"ResourceConsumer|ResourceProducer|Serialized|NotSerialized|" +
|
110
|
"Shared|Exclusive|SharedAndWake|ExclusiveAndWake|ControllerInitiated|DeviceInitiated|" +
|
111
|
"StopBitsZero|StopBitsOne|StopBitsOnePlusHalf|StopBitsTwo|" +
|
112
|
"Width8Bit|Width16Bit|Width32Bit|Width64Bit|Width128Bit|Width256Bit|" +
|
113
|
"SparseTranslation|DenseTranslation|TypeTranslation|TypeStatic|" +
|
114
|
"Preserve|WriteAsOnes|WriteAsZeros|Transfer8|Transfer16|Transfer8_16|" +
|
115
|
"ThreeWireMode|FourWireMode"
|
116
|
);
|
117
|
|
118
|
var storageTypes = (
|
119
|
"UnknownObj|IntObj|StrObj|BuffObj|PkgObj|FieldUnitObj|DeviceObj|" +
|
120
|
"EventObj|MethodObj|MutexObj|OpRegionObj|PowerResObj|ProcessorObj|" +
|
121
|
"ThermalZoneObj|BuffFieldObj|DDBHandleObj"
|
122
|
);
|
123
|
|
124
|
var buildinConstants = (
|
125
|
"__FILE__|__PATH__|__LINE__|__DATE__|__IASL__"
|
126
|
);
|
127
|
|
128
|
var deprecated = (
|
129
|
"Memory24|Processor"
|
130
|
);
|
131
|
|
132
|
var keywordMapper = this.createKeywordMapper({
|
133
|
"keyword": keywords,
|
134
|
"keyword.operator": keywordOperators,
|
135
|
"function.buildin": buildinFunctions,
|
136
|
"constant.language": buildinConstants,
|
137
|
"storage.type": storageTypes,
|
138
|
"constant.character": flags,
|
139
|
"invalid.deprecated": deprecated
|
140
|
}, "identifier");
|
141
|
|
142
|
this.$rules = {
|
143
|
"start" : [
|
144
|
{
|
145
|
token : "comment",
|
146
|
regex : "\\/\\/.*$"
|
147
|
},
|
148
|
DocCommentHighlightRules.getStartRule("doc-start"),
|
149
|
{
|
150
|
token : "comment", // multi line comment
|
151
|
regex : "\\/\\*",
|
152
|
next : "comment"
|
153
|
},
|
154
|
DocCommentHighlightRules.getStartRule("doc-start"),
|
155
|
{
|
156
|
token : "comment", // ignored fields / comments
|
157
|
regex : "\\\[",
|
158
|
next : "ignoredfield"
|
159
|
}, {
|
160
|
token : "variable",
|
161
|
regex : "\\Local[0-7]|\\Arg[0-6]"
|
162
|
}, {
|
163
|
token : "keyword", // pre-compiler directives
|
164
|
regex : "#\\s*(?:define|elif|else|endif|error|if|ifdef|ifndef|include|includebuffer|line|pragma|undef|warning)\\b",
|
165
|
next : "directive"
|
166
|
}, {
|
167
|
token : "string", // single line
|
168
|
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
169
|
}, {
|
170
|
token : "constant.character", // single line
|
171
|
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
172
|
}, {
|
173
|
token : "constant.numeric", // hex
|
174
|
regex : /0[xX][0-9a-fA-F]+\b/
|
175
|
}, {
|
176
|
token : "constant.numeric",
|
177
|
regex : /(One(s)?|Zero|True|False|[0-9]+)\b/
|
178
|
}, {
|
179
|
token : keywordMapper,
|
180
|
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
181
|
}, {
|
182
|
token : "keyword.operator",
|
183
|
regex : "/|!|\\$|%|&|\\||\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|\\^|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\|="
|
184
|
}, {
|
185
|
token : "lparen",
|
186
|
regex : "[[({]"
|
187
|
}, {
|
188
|
token : "rparen",
|
189
|
regex : "[\\])}]"
|
190
|
}, {
|
191
|
token : "text",
|
192
|
regex : "\\s+"
|
193
|
}
|
194
|
],
|
195
|
"comment" : [
|
196
|
{
|
197
|
token : "comment", // closing comment
|
198
|
regex : "\\*\\/",
|
199
|
next : "start"
|
200
|
}, {
|
201
|
defaultToken : "comment"
|
202
|
}
|
203
|
],
|
204
|
"ignoredfield" : [
|
205
|
{
|
206
|
token : "comment", // closing ignored fields / comments
|
207
|
regex : "\\\]",
|
208
|
next : "start"
|
209
|
}, {
|
210
|
defaultToken : "comment"
|
211
|
}
|
212
|
],
|
213
|
"directive" : [
|
214
|
{
|
215
|
token : "constant.other.multiline",
|
216
|
regex : /\\/
|
217
|
},
|
218
|
{
|
219
|
token : "constant.other.multiline",
|
220
|
regex : /.*\\/
|
221
|
},
|
222
|
{
|
223
|
token : "constant.other",
|
224
|
regex : "\\s*<.+?>*s",
|
225
|
next : "start"
|
226
|
},
|
227
|
{
|
228
|
token : "constant.other", // single line
|
229
|
regex : '\\s*["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]*s',
|
230
|
next : "start"
|
231
|
},
|
232
|
{
|
233
|
token : "constant.other", // single line
|
234
|
regex : "\\s*['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']",
|
235
|
next : "start"
|
236
|
},
|
237
|
{
|
238
|
token : "constant.other",
|
239
|
regex : /[^\\\/]+/,
|
240
|
next : "start"
|
241
|
}
|
242
|
]
|
243
|
};
|
244
|
|
245
|
this.embedRules(DocCommentHighlightRules, "doc-",
|
246
|
[ DocCommentHighlightRules.getEndRule("start") ]);
|
247
|
};
|
248
|
|
249
|
oop.inherits(ASLHighlightRules, TextHighlightRules);
|
250
|
|
251
|
exports.ASLHighlightRules = ASLHighlightRules;
|
252
|
});
|
253
|
|
254
|
ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
|
255
|
"use strict";
|
256
|
|
257
|
var oop = require("../../lib/oop");
|
258
|
var Range = require("../../range").Range;
|
259
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
260
|
|
261
|
var FoldMode = exports.FoldMode = function(commentRegex) {
|
262
|
if (commentRegex) {
|
263
|
this.foldingStartMarker = new RegExp(
|
264
|
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
|
265
|
);
|
266
|
this.foldingStopMarker = new RegExp(
|
267
|
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
|
268
|
);
|
269
|
}
|
270
|
};
|
271
|
oop.inherits(FoldMode, BaseFoldMode);
|
272
|
|
273
|
(function() {
|
274
|
|
275
|
this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
|
276
|
this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
|
277
|
this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
|
278
|
this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
|
279
|
this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
|
280
|
this._getFoldWidgetBase = this.getFoldWidget;
|
281
|
this.getFoldWidget = function(session, foldStyle, row) {
|
282
|
var line = session.getLine(row);
|
283
|
|
284
|
if (this.singleLineBlockCommentRe.test(line)) {
|
285
|
if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
|
286
|
return "";
|
287
|
}
|
288
|
|
289
|
var fw = this._getFoldWidgetBase(session, foldStyle, row);
|
290
|
|
291
|
if (!fw && this.startRegionRe.test(line))
|
292
|
return "start"; // lineCommentRegionStart
|
293
|
|
294
|
return fw;
|
295
|
};
|
296
|
|
297
|
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
|
298
|
var line = session.getLine(row);
|
299
|
|
300
|
if (this.startRegionRe.test(line))
|
301
|
return this.getCommentRegionBlock(session, line, row);
|
302
|
|
303
|
var match = line.match(this.foldingStartMarker);
|
304
|
if (match) {
|
305
|
var i = match.index;
|
306
|
|
307
|
if (match[1])
|
308
|
return this.openingBracketBlock(session, match[1], row, i);
|
309
|
|
310
|
var range = session.getCommentFoldRange(row, i + match[0].length, 1);
|
311
|
|
312
|
if (range && !range.isMultiLine()) {
|
313
|
if (forceMultiline) {
|
314
|
range = this.getSectionRange(session, row);
|
315
|
} else if (foldStyle != "all")
|
316
|
range = null;
|
317
|
}
|
318
|
|
319
|
return range;
|
320
|
}
|
321
|
|
322
|
if (foldStyle === "markbegin")
|
323
|
return;
|
324
|
|
325
|
var match = line.match(this.foldingStopMarker);
|
326
|
if (match) {
|
327
|
var i = match.index + match[0].length;
|
328
|
|
329
|
if (match[1])
|
330
|
return this.closingBracketBlock(session, match[1], row, i);
|
331
|
|
332
|
return session.getCommentFoldRange(row, i, -1);
|
333
|
}
|
334
|
};
|
335
|
|
336
|
this.getSectionRange = function(session, row) {
|
337
|
var line = session.getLine(row);
|
338
|
var startIndent = line.search(/\S/);
|
339
|
var startRow = row;
|
340
|
var startColumn = line.length;
|
341
|
row = row + 1;
|
342
|
var endRow = row;
|
343
|
var maxRow = session.getLength();
|
344
|
while (++row < maxRow) {
|
345
|
line = session.getLine(row);
|
346
|
var indent = line.search(/\S/);
|
347
|
if (indent === -1)
|
348
|
continue;
|
349
|
if (startIndent > indent)
|
350
|
break;
|
351
|
var subRange = this.getFoldWidgetRange(session, "all", row);
|
352
|
|
353
|
if (subRange) {
|
354
|
if (subRange.start.row <= startRow) {
|
355
|
break;
|
356
|
} else if (subRange.isMultiLine()) {
|
357
|
row = subRange.end.row;
|
358
|
} else if (startIndent == indent) {
|
359
|
break;
|
360
|
}
|
361
|
}
|
362
|
endRow = row;
|
363
|
}
|
364
|
|
365
|
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
|
366
|
};
|
367
|
this.getCommentRegionBlock = function(session, line, row) {
|
368
|
var startColumn = line.search(/\s*$/);
|
369
|
var maxRow = session.getLength();
|
370
|
var startRow = row;
|
371
|
|
372
|
var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
|
373
|
var depth = 1;
|
374
|
while (++row < maxRow) {
|
375
|
line = session.getLine(row);
|
376
|
var m = re.exec(line);
|
377
|
if (!m) continue;
|
378
|
if (m[1]) depth--;
|
379
|
else depth++;
|
380
|
|
381
|
if (!depth) break;
|
382
|
}
|
383
|
|
384
|
var endRow = row;
|
385
|
if (endRow > startRow) {
|
386
|
return new Range(startRow, startColumn, endRow, line.length);
|
387
|
}
|
388
|
};
|
389
|
|
390
|
}).call(FoldMode.prototype);
|
391
|
|
392
|
});
|
393
|
|
394
|
ace.define("ace/mode/asl",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/asl_highlight_rules","ace/mode/folding/cstyle"], function (require, exports, module) {
|
395
|
"use strict";
|
396
|
|
397
|
var oop = require("../lib/oop");
|
398
|
var TextMode = require("./text").Mode;
|
399
|
var ASLHighlightRules = require("./asl_highlight_rules").ASLHighlightRules;
|
400
|
var FoldMode = require("./folding/cstyle").FoldMode;
|
401
|
|
402
|
var Mode = function () {
|
403
|
this.HighlightRules = ASLHighlightRules;
|
404
|
this.foldingRules = new FoldMode();
|
405
|
this.$behaviour = this.$defaultBehaviour;
|
406
|
};
|
407
|
oop.inherits(Mode, TextMode);
|
408
|
|
409
|
(function () {
|
410
|
this.$id = "ace/mode/asl";
|
411
|
}).call(Mode.prototype);
|
412
|
|
413
|
exports.Mode = Mode;
|
414
|
}); (function() {
|
415
|
ace.require(["ace/mode/asl"], function(m) {
|
416
|
if (typeof module == "object" && typeof exports == "object" && module) {
|
417
|
module.exports = m;
|
418
|
}
|
419
|
});
|
420
|
})();
|
421
|
|