Debian Codegraph @

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

raw symbols SCIP
1 ace.define("ace/mode/hjson_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){/* This file was autogenerated from Hjson.tmLanguage (uuid: ) */
2 "use strict";
3 var oop = require("../lib/oop");
4 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
5 var HjsonHighlightRules = function () {
6 this.$rules = {
7 start: [{
8 include: "#comments"
9 }, {
10 include: "#rootObject"
11 }, {
12 include: "#value"
13 }],
14 "#array": [{
15 token: "paren.lparen",
16 regex: /\[/,
17 push: [{
18 token: "paren.rparen",
19 regex: /\]/,
20 next: "pop"
21 }, {
22 include: "#value"
23 }, {
24 include: "#comments"
25 }, {
26 token: "text",
27 regex: /,|$/
28 }, {
29 token: "invalid.illegal",
30 regex: /[^\s\]]/
31 }, {
32 defaultToken: "array"
33 }]
34 }],
35 "#comments": [{
36 token: [
37 "comment.punctuation",
38 "comment.line"
39 ],
40 regex: /(#)(.*$)/
41 }, {
42 token: "comment.punctuation",
43 regex: /\/\*/,
44 push: [{
45 token: "comment.punctuation",
46 regex: /\*\//,
47 next: "pop"
48 }, {
49 defaultToken: "comment.block"
50 }]
51 }, {
52 token: [
53 "comment.punctuation",
54 "comment.line"
55 ],
56 regex: /(\/\/)(.*$)/
57 }],
58 "#constant": [{
59 token: "constant",
60 regex: /\b(?:true|false|null)\b/
61 }],
62 "#keyname": [{
63 token: "keyword",
64 regex: /(?:[^,\{\[\}\]\s]+|"(?:[^"\\]|\\.)*")\s*(?=:)/
65 }],
66 "#mstring": [{
67 token: "string",
68 regex: /'''/,
69 push: [{
70 token: "string",
71 regex: /'''/,
72 next: "pop"
73 }, {
74 defaultToken: "string"
75 }]
76 }],
77 "#number": [{
78 token: "constant.numeric",
79 regex: /-?(?:0|[1-9]\d*)(?:(?:\.\d+)?(?:[eE][+-]?\d+)?)?/,
80 comment: "handles integer and decimal numbers"
81 }],
82 "#object": [{
83 token: "paren.lparen",
84 regex: /\{/,
85 push: [{
86 token: "paren.rparen",
87 regex: /\}/,
88 next: "pop"
89 }, {
90 include: "#keyname"
91 }, {
92 include: "#value"
93 }, {
94 token: "text",
95 regex: /:/
96 }, {
97 token: "text",
98 regex: /,/
99 }, {
100 defaultToken: "paren"
101 }]
102 }],
103 "#rootObject": [{
104 token: "paren",
105 regex: /(?=\s*(?:[^,\{\[\}\]\s]+|"(?:[^"\\]|\\.)*")\s*:)/,
106 push: [{
107 token: "paren.rparen",
108 regex: /---none---/,
109 next: "pop"
110 }, {
111 include: "#keyname"
112 }, {
113 include: "#value"
114 }, {
115 token: "text",
116 regex: /:/
117 }, {
118 token: "text",
119 regex: /,/
120 }, {
121 defaultToken: "paren"
122 }]
123 }],
124 "#string": [{
125 token: "string",
126 regex: /"/,
127 push: [{
128 token: "string",
129 regex: /"/,
130 next: "pop"
131 }, {
132 token: "constant.language.escape",
133 regex: /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/
134 }, {
135 token: "invalid.illegal",
136 regex: /\\./
137 }, {
138 defaultToken: "string"
139 }]
140 }],
141 "#ustring": [{
142 token: "string",
143 regex: /\b[^:,0-9\-\{\[\}\]\s].*$/
144 }],
145 "#value": [{
146 include: "#constant"
147 }, {
148 include: "#number"
149 }, {
150 include: "#string"
151 }, {
152 include: "#array"
153 }, {
154 include: "#object"
155 }, {
156 include: "#comments"
157 }, {
158 include: "#mstring"
159 }, {
160 include: "#ustring"
161 }]
162 };
163 this.normalizeRules();
164 };
165 HjsonHighlightRules.metaData = {
166 fileTypes: ["hjson"],
167 foldingStartMarker: "(?x: # turn on extended mode\n ^ # a line beginning with\n \\s* # some optional space\n [{\\[] # the start of an object or array\n (?! # but not followed by\n .* # whatever\n [}\\]] # and the close of an object or array\n ,? # an optional comma\n \\s* # some optional space\n $ # at the end of the line\n )\n | # ...or...\n [{\\[] # the start of an object or array\n \\s* # some optional space\n $ # at the end of the line\n )",
168 foldingStopMarker: "(?x: # turn on extended mode\n ^ # a line beginning with\n \\s* # some optional space\n [}\\]] # and the close of an object or array\n )",
169 keyEquivalent: "^~J",
170 name: "Hjson",
171 scopeName: "source.hjson"
172 };
173 oop.inherits(HjsonHighlightRules, TextHighlightRules);
174 exports.HjsonHighlightRules = HjsonHighlightRules;
175
176 });
177
178 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";
179 var oop = require("../../lib/oop");
180 var Range = require("../../range").Range;
181 var BaseFoldMode = require("./fold_mode").FoldMode;
182 var FoldMode = exports.FoldMode = function (commentRegex) {
183 if (commentRegex) {
184 this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start));
185 this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end));
186 }
187 };
188 oop.inherits(FoldMode, BaseFoldMode);
189 (function () {
190 this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
191 this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
192 this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/;
193 this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
194 this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
195 this._getFoldWidgetBase = this.getFoldWidget;
196 this.getFoldWidget = function (session, foldStyle, row) {
197 var line = session.getLine(row);
198 if (this.singleLineBlockCommentRe.test(line)) {
199 if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
200 return "";
201 }
202 var fw = this._getFoldWidgetBase(session, foldStyle, row);
203 if (!fw && this.startRegionRe.test(line))
204 return "start"; // lineCommentRegionStart
205 return fw;
206 };
207 this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) {
208 var line = session.getLine(row);
209 if (this.startRegionRe.test(line))
210 return this.getCommentRegionBlock(session, line, row);
211 var match = line.match(this.foldingStartMarker);
212 if (match) {
213 var i = match.index;
214 if (match[1])
215 return this.openingBracketBlock(session, match[1], row, i);
216 var range = session.getCommentFoldRange(row, i + match[0].length, 1);
217 if (range && !range.isMultiLine()) {
218 if (forceMultiline) {
219 range = this.getSectionRange(session, row);
220 }
221 else if (foldStyle != "all")
222 range = null;
223 }
224 return range;
225 }
226 if (foldStyle === "markbegin")
227 return;
228 var match = line.match(this.foldingStopMarker);
229 if (match) {
230 var i = match.index + match[0].length;
231 if (match[1])
232 return this.closingBracketBlock(session, match[1], row, i);
233 return session.getCommentFoldRange(row, i, -1);
234 }
235 };
236 this.getSectionRange = function (session, row) {
237 var line = session.getLine(row);
238 var startIndent = line.search(/\S/);
239 var startRow = row;
240 var startColumn = line.length;
241 row = row + 1;
242 var endRow = row;
243 var maxRow = session.getLength();
244 while (++row < maxRow) {
245 line = session.getLine(row);
246 var indent = line.search(/\S/);
247 if (indent === -1)
248 continue;
249 if (startIndent > indent)
250 break;
251 var subRange = this.getFoldWidgetRange(session, "all", row);
252 if (subRange) {
253 if (subRange.start.row <= startRow) {
254 break;
255 }
256 else if (subRange.isMultiLine()) {
257 row = subRange.end.row;
258 }
259 else if (startIndent == indent) {
260 break;
261 }
262 }
263 endRow = row;
264 }
265 return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
266 };
267 this.getCommentRegionBlock = function (session, line, row) {
268 var startColumn = line.search(/\s*$/);
269 var maxRow = session.getLength();
270 var startRow = row;
271 var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
272 var depth = 1;
273 while (++row < maxRow) {
274 line = session.getLine(row);
275 var m = re.exec(line);
276 if (!m)
277 continue;
278 if (m[1])
279 depth--;
280 else
281 depth++;
282 if (!depth)
283 break;
284 }
285 var endRow = row;
286 if (endRow > startRow) {
287 return new Range(startRow, startColumn, endRow, line.length);
288 }
289 };
290 }).call(FoldMode.prototype);
291
292 });
293
294 ace.define("ace/mode/hjson",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/hjson_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module){"use strict";
295 var oop = require("../lib/oop");
296 var TextMode = require("./text").Mode;
297 var HjsonHighlightRules = require("./hjson_highlight_rules").HjsonHighlightRules;
298 var FoldMode = require("./folding/cstyle").FoldMode;
299 var Mode = function () {
300 this.HighlightRules = HjsonHighlightRules;
301 this.foldingRules = new FoldMode();
302 };
303 oop.inherits(Mode, TextMode);
304 (function () {
305 this.lineCommentStart = "//";
306 this.blockComment = { start: "/*", end: "*/" };
307 this.$id = "ace/mode/hjson";
308 }).call(Mode.prototype);
309 exports.Mode = Mode;
310
311 }); (function() {
312 ace.require(["ace/mode/hjson"], function(m) {
313 if (typeof module == "object" && typeof exports == "object" && module) {
314 module.exports = m;
315 }
316 });
317 })();
318