64e5c32afb91e13122237cf17da6baa7.js 15 KB

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