Debian Codegraph @

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

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