Debian Codegraph @

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

raw symbols SCIP
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 });
314
315 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";
316 var oop = require("../../lib/oop");
317 var Range = require("../../range").Range;
318 var BaseFoldMode = require("./fold_mode").FoldMode;
319 var FoldMode = exports.FoldMode = function (commentRegex) {
320 if (commentRegex) {
321 this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start));
322 this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end));
323 }
324 };
325 oop.inherits(FoldMode, BaseFoldMode);
326 (function () {
327 this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
328 this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
329 this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/;
330 this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
331 this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
332 this._getFoldWidgetBase = this.getFoldWidget;
333 this.getFoldWidget = function (session, foldStyle, row) {
334 var line = session.getLine(row);
335 if (this.singleLineBlockCommentRe.test(line)) {
336 if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
337 return "";
338 }
339 var fw = this._getFoldWidgetBase(session, foldStyle, row);
340 if (!fw && this.startRegionRe.test(line))
341 return "start"; // lineCommentRegionStart
342 return fw;
343 };
344 this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) {
345 var line = session.getLine(row);
346 if (this.startRegionRe.test(line))
347 return this.getCommentRegionBlock(session, line, row);
348 var match = line.match(this.foldingStartMarker);
349 if (match) {
350 var i = match.index;
351 if (match[1])
352 return this.openingBracketBlock(session, match[1], row, i);
353 var range = session.getCommentFoldRange(row, i + match[0].length, 1);
354 if (range && !range.isMultiLine()) {
355 if (forceMultiline) {
356 range = this.getSectionRange(session, row);
357 }
358 else if (foldStyle != "all")
359 range = null;
360 }
361 return range;
362 }
363 if (foldStyle === "markbegin")
364 return;
365 var match = line.match(this.foldingStopMarker);
366 if (match) {
367 var i = match.index + match[0].length;
368 if (match[1])
369 return this.closingBracketBlock(session, match[1], row, i);
370 return session.getCommentFoldRange(row, i, -1);
371 }
372 };
373 this.getSectionRange = function (session, row) {
374 var line = session.getLine(row);
375 var startIndent = line.search(/\S/);
376 var startRow = row;
377 var startColumn = line.length;
378 row = row + 1;
379 var endRow = row;
380 var maxRow = session.getLength();
381 while (++row < maxRow) {
382 line = session.getLine(row);
383 var indent = line.search(/\S/);
384 if (indent === -1)
385 continue;
386 if (startIndent > indent)
387 break;
388 var subRange = this.getFoldWidgetRange(session, "all", row);
389 if (subRange) {
390 if (subRange.start.row <= startRow) {
391 break;
392 }
393 else if (subRange.isMultiLine()) {
394 row = subRange.end.row;
395 }
396 else if (startIndent == indent) {
397 break;
398 }
399 }
400 endRow = row;
401 }
402 return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
403 };
404 this.getCommentRegionBlock = function (session, line, row) {
405 var startColumn = line.search(/\s*$/);
406 var maxRow = session.getLength();
407 var startRow = row;
408 var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
409 var depth = 1;
410 while (++row < maxRow) {
411 line = session.getLine(row);
412 var m = re.exec(line);
413 if (!m)
414 continue;
415 if (m[1])
416 depth--;
417 else
418 depth++;
419 if (!depth)
420 break;
421 }
422 var endRow = row;
423 if (endRow > startRow) {
424 return new Range(startRow, startColumn, endRow, line.length);
425 }
426 };
427 }).call(FoldMode.prototype);
428
429 });
430
431 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){/*
432 THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
433 */
434 "use strict";
435 var oop = require("../lib/oop");
436 var TextMode = require("./text").Mode;
437 var PrismaHighlightRules = require("./prisma_highlight_rules").PrismaHighlightRules;
438 var FoldMode = require("./folding/cstyle").FoldMode;
439 var Mode = function () {
440 this.HighlightRules = PrismaHighlightRules;
441 this.foldingRules = new FoldMode();
442 };
443 oop.inherits(Mode, TextMode);
444 (function () {
445 this.lineCommentStart = "//";
446 this.$id = "ace/mode/prisma";
447 }).call(Mode.prototype);
448 exports.Mode = Mode;
449
450 }); (function() {
451 ace.require(["ace/mode/prisma"], function(m) {
452 if (typeof module == "object" && typeof exports == "object" && module) {
453 module.exports = m;
454 }
455 });
456 })();
457