f8d59c056683c7001a96d4fac22cc664.js 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457
  1. ace.define("ace/mode/smithy_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){/* This file was autogenerated from https://raw.githubusercontent.com/awslabs/smithy-vscode/master/syntaxes/smithy.tmLanguage (uuid: ) */
  2. "use strict";
  3. var oop = require("../lib/oop");
  4. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  5. var SmithyHighlightRules = function () {
  6. this.$rules = {
  7. start: [{
  8. include: "#comment"
  9. }, {
  10. token: [
  11. "meta.keyword.statement.smithy",
  12. "variable.other.smithy",
  13. "text",
  14. "keyword.operator.smithy"
  15. ],
  16. regex: /^(\$)(\s+.+)(\s*)(=)/
  17. }, {
  18. token: [
  19. "keyword.statement.smithy",
  20. "text",
  21. "entity.name.type.namespace.smithy"
  22. ],
  23. regex: /^(namespace)(\s+)([A-Z-a-z0-9_\.#$-]+)/
  24. }, {
  25. token: [
  26. "keyword.statement.smithy",
  27. "text",
  28. "keyword.statement.smithy",
  29. "text",
  30. "entity.name.type.smithy"
  31. ],
  32. regex: /^(use)(\s+)(shape|trait)(\s+)([A-Z-a-z0-9_\.#$-]+)\b/
  33. }, {
  34. token: [
  35. "keyword.statement.smithy",
  36. "variable.other.smithy",
  37. "text",
  38. "keyword.operator.smithy"
  39. ],
  40. regex: /^(metadata)(\s+.+)(\s*)(=)/
  41. }, {
  42. token: [
  43. "keyword.statement.smithy",
  44. "text",
  45. "entity.name.type.smithy"
  46. ],
  47. regex: /^(apply|byte|short|integer|long|float|double|bigInteger|bigDecimal|boolean|blob|string|timestamp|service|resource|trait|list|map|set|structure|union|document)(\s+)([A-Z-a-z0-9_\.#$-]+)\b/
  48. }, {
  49. token: [
  50. "keyword.operator.smithy",
  51. "text",
  52. "entity.name.type.smithy",
  53. "text",
  54. "text",
  55. "support.function.smithy",
  56. "text",
  57. "text",
  58. "support.function.smithy"
  59. ],
  60. regex: /^(operation)(\s+)([A-Z-a-z0-9_\.#$-]+)(\(.*\))(?:(\s*)(->)(\s*[A-Z-a-z0-9_\.#$-]+))?(?:(\s+)(errors))?/
  61. }, {
  62. include: "#trait"
  63. }, {
  64. token: [
  65. "support.type.property-name.smithy",
  66. "punctuation.separator.dictionary.pair.smithy"
  67. ],
  68. regex: /([A-Z-a-z0-9_\.#$-]+)(:)/
  69. }, {
  70. include: "#value"
  71. }, {
  72. token: "keyword.other.smithy",
  73. regex: /\->/
  74. }],
  75. "#comment": [{
  76. include: "#doc_comment"
  77. }, {
  78. include: "#line_comment"
  79. }],
  80. "#doc_comment": [{
  81. token: "comment.block.documentation.smithy",
  82. regex: /\/\/\/.*/
  83. }],
  84. "#line_comment": [{
  85. token: "comment.line.double-slash.smithy",
  86. regex: /\/\/.*/
  87. }],
  88. "#trait": [{
  89. token: [
  90. "punctuation.definition.annotation.smithy",
  91. "storage.type.annotation.smithy"
  92. ],
  93. regex: /(@)([0-9a-zA-Z\.#-]+)/
  94. }, {
  95. token: [
  96. "punctuation.definition.annotation.smithy",
  97. "punctuation.definition.object.end.smithy",
  98. "meta.structure.smithy"
  99. ],
  100. regex: /(@)([0-9a-zA-Z\.#-]+)(\()/,
  101. push: [{
  102. token: "punctuation.definition.object.end.smithy",
  103. regex: /\)/,
  104. next: "pop"
  105. }, {
  106. include: "#value"
  107. }, {
  108. include: "#object_inner"
  109. }, {
  110. defaultToken: "meta.structure.smithy"
  111. }]
  112. }],
  113. "#value": [{
  114. include: "#constant"
  115. }, {
  116. include: "#number"
  117. }, {
  118. include: "#string"
  119. }, {
  120. include: "#array"
  121. }, {
  122. include: "#object"
  123. }],
  124. "#array": [{
  125. token: "punctuation.definition.array.begin.smithy",
  126. regex: /\[/,
  127. push: [{
  128. token: "punctuation.definition.array.end.smithy",
  129. regex: /\]/,
  130. next: "pop"
  131. }, {
  132. include: "#comment"
  133. }, {
  134. include: "#value"
  135. }, {
  136. token: "punctuation.separator.array.smithy",
  137. regex: /,/
  138. }, {
  139. token: "invalid.illegal.expected-array-separator.smithy",
  140. regex: /[^\s\]]/
  141. }, {
  142. defaultToken: "meta.structure.array.smithy"
  143. }]
  144. }],
  145. "#constant": [{
  146. token: "constant.language.smithy",
  147. regex: /\b(?:true|false|null)\b/
  148. }],
  149. "#number": [{
  150. token: "constant.numeric.smithy",
  151. regex: /-?(?:0|[1-9]\d*)(?:(?:\.\d+)?(?:[eE][+-]?\d+)?)?/
  152. }],
  153. "#object": [{
  154. token: "punctuation.definition.dictionary.begin.smithy",
  155. regex: /\{/,
  156. push: [{
  157. token: "punctuation.definition.dictionary.end.smithy",
  158. regex: /\}/,
  159. next: "pop"
  160. }, {
  161. include: "#trait"
  162. }, {
  163. include: "#object_inner"
  164. }, {
  165. defaultToken: "meta.structure.dictionary.smithy"
  166. }]
  167. }],
  168. "#object_inner": [{
  169. include: "#comment"
  170. }, {
  171. include: "#string_key"
  172. }, {
  173. token: "punctuation.separator.dictionary.key-value.smithy",
  174. regex: /:/,
  175. push: [{
  176. token: "punctuation.separator.dictionary.pair.smithy",
  177. regex: /,|(?=\})/,
  178. next: "pop"
  179. }, {
  180. include: "#value"
  181. }, {
  182. token: "invalid.illegal.expected-dictionary-separator.smithy",
  183. regex: /[^\s,]/
  184. }, {
  185. defaultToken: "meta.structure.dictionary.value.smithy"
  186. }]
  187. }, {
  188. token: "invalid.illegal.expected-dictionary-separator.smithy",
  189. regex: /[^\s\}]/
  190. }],
  191. "#string_key": [{
  192. include: "#identifier_key"
  193. }, {
  194. include: "#dquote_key"
  195. }, {
  196. include: "#squote_key"
  197. }],
  198. "#identifier_key": [{
  199. token: "support.type.property-name.smithy",
  200. regex: /[A-Z-a-z0-9_\.#$-]+/
  201. }],
  202. "#dquote_key": [{
  203. include: "#dquote"
  204. }],
  205. "#squote_key": [{
  206. include: "#squote"
  207. }],
  208. "#string": [{
  209. include: "#textblock"
  210. }, {
  211. include: "#dquote"
  212. }, {
  213. include: "#squote"
  214. }, {
  215. include: "#identifier"
  216. }],
  217. "#textblock": [{
  218. token: "punctuation.definition.string.begin.smithy",
  219. regex: /"""/,
  220. push: [{
  221. token: "punctuation.definition.string.end.smithy",
  222. regex: /"""/,
  223. next: "pop"
  224. }, {
  225. token: "constant.character.escape.smithy",
  226. regex: /\\./
  227. }, {
  228. defaultToken: "string.quoted.double.smithy"
  229. }]
  230. }],
  231. "#dquote": [{
  232. token: "punctuation.definition.string.begin.smithy",
  233. regex: /"/,
  234. push: [{
  235. token: "punctuation.definition.string.end.smithy",
  236. regex: /"/,
  237. next: "pop"
  238. }, {
  239. token: "constant.character.escape.smithy",
  240. regex: /\\./
  241. }, {
  242. defaultToken: "string.quoted.double.smithy"
  243. }]
  244. }],
  245. "#squote": [{
  246. token: "punctuation.definition.string.begin.smithy",
  247. regex: /'/,
  248. push: [{
  249. token: "punctuation.definition.string.end.smithy",
  250. regex: /'/,
  251. next: "pop"
  252. }, {
  253. token: "constant.character.escape.smithy",
  254. regex: /\\./
  255. }, {
  256. defaultToken: "string.quoted.single.smithy"
  257. }]
  258. }],
  259. "#identifier": [{
  260. token: "storage.type.smithy",
  261. regex: /[A-Z-a-z_][A-Z-a-z0-9_\.#$-]*/
  262. }]
  263. };
  264. this.normalizeRules();
  265. };
  266. SmithyHighlightRules.metaData = {
  267. name: "Smithy",
  268. fileTypes: ["smithy"],
  269. scopeName: "source.smithy",
  270. foldingStartMarker: "(\\{|\\[)\\s*",
  271. foldingStopMarker: "\\s*(\\}|\\])"
  272. };
  273. oop.inherits(SmithyHighlightRules, TextHighlightRules);
  274. exports.SmithyHighlightRules = SmithyHighlightRules;
  275. });
  276. ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module){"use strict";
  277. var Range = require("../range").Range;
  278. var MatchingBraceOutdent = function () { };
  279. (function () {
  280. this.checkOutdent = function (line, input) {
  281. if (!/^\s+$/.test(line))
  282. return false;
  283. return /^\s*\}/.test(input);
  284. };
  285. this.autoOutdent = function (doc, row) {
  286. var line = doc.getLine(row);
  287. var match = line.match(/^(\s*\})/);
  288. if (!match)
  289. return 0;
  290. var column = match[1].length;
  291. var openBracePos = doc.findMatchingBracket({ row: row, column: column });
  292. if (!openBracePos || openBracePos.row == row)
  293. return 0;
  294. var indent = this.$getIndent(doc.getLine(openBracePos.row));
  295. doc.replace(new Range(row, 0, row, column - 1), indent);
  296. };
  297. this.$getIndent = function (line) {
  298. return line.match(/^\s*/)[0];
  299. };
  300. }).call(MatchingBraceOutdent.prototype);
  301. exports.MatchingBraceOutdent = MatchingBraceOutdent;
  302. });
  303. 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";
  304. var oop = require("../../lib/oop");
  305. var Range = require("../../range").Range;
  306. var BaseFoldMode = require("./fold_mode").FoldMode;
  307. var FoldMode = exports.FoldMode = function (commentRegex) {
  308. if (commentRegex) {
  309. this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start));
  310. this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end));
  311. }
  312. };
  313. oop.inherits(FoldMode, BaseFoldMode);
  314. (function () {
  315. this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
  316. this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
  317. this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/;
  318. this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
  319. this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
  320. this._getFoldWidgetBase = this.getFoldWidget;
  321. this.getFoldWidget = function (session, foldStyle, row) {
  322. var line = session.getLine(row);
  323. if (this.singleLineBlockCommentRe.test(line)) {
  324. if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
  325. return "";
  326. }
  327. var fw = this._getFoldWidgetBase(session, foldStyle, row);
  328. if (!fw && this.startRegionRe.test(line))
  329. return "start"; // lineCommentRegionStart
  330. return fw;
  331. };
  332. this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) {
  333. var line = session.getLine(row);
  334. if (this.startRegionRe.test(line))
  335. return this.getCommentRegionBlock(session, line, row);
  336. var match = line.match(this.foldingStartMarker);
  337. if (match) {
  338. var i = match.index;
  339. if (match[1])
  340. return this.openingBracketBlock(session, match[1], row, i);
  341. var range = session.getCommentFoldRange(row, i + match[0].length, 1);
  342. if (range && !range.isMultiLine()) {
  343. if (forceMultiline) {
  344. range = this.getSectionRange(session, row);
  345. }
  346. else if (foldStyle != "all")
  347. range = null;
  348. }
  349. return range;
  350. }
  351. if (foldStyle === "markbegin")
  352. return;
  353. var match = line.match(this.foldingStopMarker);
  354. if (match) {
  355. var i = match.index + match[0].length;
  356. if (match[1])
  357. return this.closingBracketBlock(session, match[1], row, i);
  358. return session.getCommentFoldRange(row, i, -1);
  359. }
  360. };
  361. this.getSectionRange = function (session, row) {
  362. var line = session.getLine(row);
  363. var startIndent = line.search(/\S/);
  364. var startRow = row;
  365. var startColumn = line.length;
  366. row = row + 1;
  367. var endRow = row;
  368. var maxRow = session.getLength();
  369. while (++row < maxRow) {
  370. line = session.getLine(row);
  371. var indent = line.search(/\S/);
  372. if (indent === -1)
  373. continue;
  374. if (startIndent > indent)
  375. break;
  376. var subRange = this.getFoldWidgetRange(session, "all", row);
  377. if (subRange) {
  378. if (subRange.start.row <= startRow) {
  379. break;
  380. }
  381. else if (subRange.isMultiLine()) {
  382. row = subRange.end.row;
  383. }
  384. else if (startIndent == indent) {
  385. break;
  386. }
  387. }
  388. endRow = row;
  389. }
  390. return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
  391. };
  392. this.getCommentRegionBlock = function (session, line, row) {
  393. var startColumn = line.search(/\s*$/);
  394. var maxRow = session.getLength();
  395. var startRow = row;
  396. var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
  397. var depth = 1;
  398. while (++row < maxRow) {
  399. line = session.getLine(row);
  400. var m = re.exec(line);
  401. if (!m)
  402. continue;
  403. if (m[1])
  404. depth--;
  405. else
  406. depth++;
  407. if (!depth)
  408. break;
  409. }
  410. var endRow = row;
  411. if (endRow > startRow) {
  412. return new Range(startRow, startColumn, endRow, line.length);
  413. }
  414. };
  415. }).call(FoldMode.prototype);
  416. });
  417. ace.define("ace/mode/smithy",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/smithy_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(require, exports, module){"use strict";
  418. var oop = require("../lib/oop");
  419. var TextMode = require("./text").Mode;
  420. var SmithyHighlightRules = require("./smithy_highlight_rules").SmithyHighlightRules;
  421. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  422. var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
  423. var CStyleFoldMode = require("./folding/cstyle").FoldMode;
  424. var Mode = function () {
  425. this.HighlightRules = SmithyHighlightRules;
  426. this.$outdent = new MatchingBraceOutdent();
  427. this.$behaviour = new CstyleBehaviour();
  428. this.foldingRules = new CStyleFoldMode();
  429. };
  430. oop.inherits(Mode, TextMode);
  431. (function () {
  432. this.lineCommentStart = "//";
  433. this.$quotes = { '"': '"' };
  434. this.checkOutdent = function (state, line, input) {
  435. return this.$outdent.checkOutdent(line, input);
  436. };
  437. this.autoOutdent = function (state, doc, row) {
  438. this.$outdent.autoOutdent(doc, row);
  439. };
  440. this.$id = "ace/mode/smithy";
  441. }).call(Mode.prototype);
  442. exports.Mode = Mode;
  443. }); (function() {
  444. ace.require(["ace/mode/smithy"], function(m) {
  445. if (typeof module == "object" && typeof exports == "object" && module) {
  446. module.exports = m;
  447. }
  448. });
  449. })();