c57721ccc0d5a41063560477b0bc7d02.js 17 KB

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