Debian Codegraph @

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

raw symbols SCIP
1 ace.define("ace/mode/jexl_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 JexlHighlightRules = function () {
5 var keywords = "return|var|function|and|or|not|if|for|while|do|continue|break";
6 var buildinConstants = "null";
7 var supportFunc = "empty|size|new";
8 var keywordMapper = this.createKeywordMapper({
9 "keyword": keywords,
10 "constant.language": buildinConstants,
11 "support.function": supportFunc
12 }, "identifier");
13 var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
14 "u[0-9a-fA-F]{4}|" + // unicode
15 "u{[0-9a-fA-F]{1,6}}|" + // es6 unicode
16 "|.)";
17 this.$rules = {
18 "start": [
19 {
20 token: "comment",
21 regex: "\\/\\/.*$"
22 }, {
23 token: "comment",
24 regex: "##.*$"
25 }, {
26 token: "comment", // multi line comment
27 regex: "\\/\\*",
28 next: "comment"
29 }, {
30 token: ["comment", "text"],
31 regex: "(#pragma)(\\s.*$)"
32 }, {
33 token: "string", // single line
34 regex: '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
35 }, {
36 token: "string", // single line
37 regex: "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
38 }, {
39 token: "string", // multi line string
40 regex: "`",
41 push: [
42 {
43 token: "constant.language.escape",
44 regex: escapedRe
45 }, {
46 token: "string",
47 regex: "`",
48 next: "pop"
49 }, {
50 token: "lparen", //interpolation
51 regex: "\\${",
52 push: [
53 {
54 token: "rparen",
55 regex: "}",
56 next: "pop"
57 }, {
58 include: "start"
59 }
60 ]
61 }, {
62 defaultToken: "string"
63 }
64 ]
65 }, {
66 token: "constant.numeric", // hex
67 regex: /0(?:[xX][0-9a-fA-F][0-9a-fA-F_]*|[bB][01][01_]*)[LlSsDdFfYy]?\b/
68 }, {
69 token: "constant.numeric", // float
70 regex: /[+-]?\d[\d_]*(?:(?:\.[\d_]*)?(?:[eE][+-]?[\d_]+)?)?[LlSsDdFfYy]?\b/
71 }, {
72 token: "constant.language.boolean",
73 regex: "(?:true|false)\\b"
74 }, {
75 token: "string.regexp",
76 regex: "~/",
77 push: [
78 {
79 token: "constant.language.escape",
80 regex: "\\\\/"
81 }, {
82 token: "string.regexp",
83 regex: "$|/",
84 next: "pop"
85 }, {
86 defaultToken: "string.regexp"
87 }
88 ]
89 }, {
90 token: keywordMapper,
91 regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
92 }, {
93 token: "keyword.operator",
94 regex: "&&|\\|\\||!|&|\\||\\^|~|\\?|:|\\?\\?|==|!=|<|<=|>|>=|=~|!~|=\\^|=\\$|!\\$|\\+|\\-|\\*|%|\\/|="
95 }, {
96 token: "lparen",
97 regex: "[[({]"
98 }, {
99 token: "rparen",
100 regex: "[\\])}]"
101 }, {
102 token: "text",
103 regex: "\\s+"
104 }, {
105 token: "punctuation",
106 regex: "[,.]"
107 }, {
108 token: "storage.type.annotation",
109 regex: "@[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
110 }
111 ],
112 "comment": [
113 {
114 token: "comment",
115 regex: "\\*\\/",
116 next: "start"
117 }, {
118 defaultToken: "comment"
119 }
120 ]
121 };
122 this.normalizeRules();
123 };
124 oop.inherits(JexlHighlightRules, TextHighlightRules);
125 exports.JexlHighlightRules = JexlHighlightRules;
126
127 });
128
129 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";
130 var oop = require("../../lib/oop");
131 var Range = require("../../range").Range;
132 var BaseFoldMode = require("./fold_mode").FoldMode;
133 var FoldMode = exports.FoldMode = function (commentRegex) {
134 if (commentRegex) {
135 this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start));
136 this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end));
137 }
138 };
139 oop.inherits(FoldMode, BaseFoldMode);
140 (function () {
141 this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
142 this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
143 this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/;
144 this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
145 this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
146 this._getFoldWidgetBase = this.getFoldWidget;
147 this.getFoldWidget = function (session, foldStyle, row) {
148 var line = session.getLine(row);
149 if (this.singleLineBlockCommentRe.test(line)) {
150 if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
151 return "";
152 }
153 var fw = this._getFoldWidgetBase(session, foldStyle, row);
154 if (!fw && this.startRegionRe.test(line))
155 return "start"; // lineCommentRegionStart
156 return fw;
157 };
158 this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) {
159 var line = session.getLine(row);
160 if (this.startRegionRe.test(line))
161 return this.getCommentRegionBlock(session, line, row);
162 var match = line.match(this.foldingStartMarker);
163 if (match) {
164 var i = match.index;
165 if (match[1])
166 return this.openingBracketBlock(session, match[1], row, i);
167 var range = session.getCommentFoldRange(row, i + match[0].length, 1);
168 if (range && !range.isMultiLine()) {
169 if (forceMultiline) {
170 range = this.getSectionRange(session, row);
171 }
172 else if (foldStyle != "all")
173 range = null;
174 }
175 return range;
176 }
177 if (foldStyle === "markbegin")
178 return;
179 var match = line.match(this.foldingStopMarker);
180 if (match) {
181 var i = match.index + match[0].length;
182 if (match[1])
183 return this.closingBracketBlock(session, match[1], row, i);
184 return session.getCommentFoldRange(row, i, -1);
185 }
186 };
187 this.getSectionRange = function (session, row) {
188 var line = session.getLine(row);
189 var startIndent = line.search(/\S/);
190 var startRow = row;
191 var startColumn = line.length;
192 row = row + 1;
193 var endRow = row;
194 var maxRow = session.getLength();
195 while (++row < maxRow) {
196 line = session.getLine(row);
197 var indent = line.search(/\S/);
198 if (indent === -1)
199 continue;
200 if (startIndent > indent)
201 break;
202 var subRange = this.getFoldWidgetRange(session, "all", row);
203 if (subRange) {
204 if (subRange.start.row <= startRow) {
205 break;
206 }
207 else if (subRange.isMultiLine()) {
208 row = subRange.end.row;
209 }
210 else if (startIndent == indent) {
211 break;
212 }
213 }
214 endRow = row;
215 }
216 return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
217 };
218 this.getCommentRegionBlock = function (session, line, row) {
219 var startColumn = line.search(/\s*$/);
220 var maxRow = session.getLength();
221 var startRow = row;
222 var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
223 var depth = 1;
224 while (++row < maxRow) {
225 line = session.getLine(row);
226 var m = re.exec(line);
227 if (!m)
228 continue;
229 if (m[1])
230 depth--;
231 else
232 depth++;
233 if (!depth)
234 break;
235 }
236 var endRow = row;
237 if (endRow > startRow) {
238 return new Range(startRow, startColumn, endRow, line.length);
239 }
240 };
241 }).call(FoldMode.prototype);
242
243 });
244
245 ace.define("ace/mode/jexl",["require","exports","module","ace/lib/oop","ace/mode/jexl_highlight_rules","ace/mode/text","ace/mode/folding/cstyle"], function(require, exports, module){"use strict";
246 var oop = require("../lib/oop");
247 var JexlHighlightRules = require("./jexl_highlight_rules").JexlHighlightRules;
248 var TextMode = require("./text").Mode;
249 var CStyleFoldMode = require("./folding/cstyle").FoldMode;
250 var Mode = function () {
251 this.HighlightRules = JexlHighlightRules;
252 this.$behaviour = this.$defaultBehaviour;
253 this.foldingRules = new CStyleFoldMode();
254 };
255 oop.inherits(Mode, TextMode);
256 (function () {
257 this.lineCommentStart = ["//", "##"];
258 this.blockComment = { start: "/*", end: "*/" };
259 this.$id = "ace/mode/jexl";
260 }).call(Mode.prototype);
261 exports.Mode = Mode;
262
263 }); (function() {
264 ace.require(["ace/mode/jexl"], function(m) {
265 if (typeof module == "object" && typeof exports == "object" && module) {
266 module.exports = m;
267 }
268 });
269 })();
270