Debian Codegraph @

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

raw symbols SCIP
1 ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module){"use strict";
2 var Range = require("../range").Range;
3 var MatchingBraceOutdent = function () { };
4 (function () {
5 this.checkOutdent = function (line, input) {
6 if (!/^\s+$/.test(line))
7 return false;
8 return /^\s*\}/.test(input);
9 };
10 this.autoOutdent = function (doc, row) {
11 var line = doc.getLine(row);
12 var match = line.match(/^(\s*\})/);
13 if (!match)
14 return 0;
15 var column = match[1].length;
16 var openBracePos = doc.findMatchingBracket({ row: row, column: column });
17 if (!openBracePos || openBracePos.row == row)
18 return 0;
19 var indent = this.$getIndent(doc.getLine(openBracePos.row));
20 doc.replace(new Range(row, 0, row, column - 1), indent);
21 };
22 this.$getIndent = function (line) {
23 return line.match(/^\s*/)[0];
24 };
25 }).call(MatchingBraceOutdent.prototype);
26 exports.MatchingBraceOutdent = MatchingBraceOutdent;
27
28 });
29
30 ace.define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict";
31 var oop = require("../lib/oop");
32 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
33 var DocCommentHighlightRules = function () {
34 this.$rules = {
35 "start": [
36 {
37 token: "comment.doc.tag",
38 regex: "@\\w+(?=\\s|$)"
39 }, DocCommentHighlightRules.getTagRule(), {
40 defaultToken: "comment.doc",
41 caseInsensitive: true
42 }
43 ]
44 };
45 };
46 oop.inherits(DocCommentHighlightRules, TextHighlightRules);
47 DocCommentHighlightRules.getTagRule = function (start) {
48 return {
49 token: "comment.doc.tag.storage.type",
50 regex: "\\b(?:TODO|FIXME|XXX|HACK)\\b"
51 };
52 };
53 DocCommentHighlightRules.getStartRule = function (start) {
54 return {
55 token: "comment.doc", // doc comment
56 regex: "\\/\\*(?=\\*)",
57 next: start
58 };
59 };
60 DocCommentHighlightRules.getEndRule = function (start) {
61 return {
62 token: "comment.doc", // closing comment
63 regex: "\\*\\/",
64 next: start
65 };
66 };
67 exports.DocCommentHighlightRules = DocCommentHighlightRules;
68
69 });
70
71 ace.define("ace/mode/dot_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules","ace/mode/doc_comment_highlight_rules"], function(require, exports, module){"use strict";
72 var oop = require("../lib/oop");
73 var lang = require("../lib/lang");
74 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
75 var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
76 var DotHighlightRules = function () {
77 var keywords = lang.arrayToMap(("strict|node|edge|graph|digraph|subgraph").split("|"));
78 var attributes = lang.arrayToMap(("damping|k|url|area|arrowhead|arrowsize|arrowtail|aspect|bb|bgcolor|center|charset|clusterrank|color|colorscheme|comment|compound|concentrate|constraint|decorate|defaultdist|dim|dimen|dir|diredgeconstraints|distortion|dpi|edgeurl|edgehref|edgetarget|edgetooltip|epsilon|esep|fillcolor|fixedsize|fontcolor|fontname|fontnames|fontpath|fontsize|forcelabels|gradientangle|group|headurl|head_lp|headclip|headhref|headlabel|headport|headtarget|headtooltip|height|href|id|image|imagepath|imagescale|label|labelurl|label_scheme|labelangle|labeldistance|labelfloat|labelfontcolor|labelfontname|labelfontsize|labelhref|labeljust|labelloc|labeltarget|labeltooltip|landscape|layer|layerlistsep|layers|layerselect|layersep|layout|len|levels|levelsgap|lhead|lheight|lp|ltail|lwidth|margin|maxiter|mclimit|mindist|minlen|mode|model|mosek|nodesep|nojustify|normalize|nslimit|nslimit1|ordering|orientation|outputorder|overlap|overlap_scaling|pack|packmode|pad|page|pagedir|pencolor|penwidth|peripheries|pin|pos|quadtree|quantum|rank|rankdir|ranksep|ratio|rects|regular|remincross|repulsiveforce|resolution|root|rotate|rotation|samehead|sametail|samplepoints|scale|searchsize|sep|shape|shapefile|showboxes|sides|size|skew|smoothing|sortv|splines|start|style|stylesheet|tailurl|tail_lp|tailclip|tailhref|taillabel|tailport|tailtarget|tailtooltip|target|tooltip|truecolor|vertices|viewport|voro_margin|weight|width|xlabel|xlp|z").split("|"));
79 this.$rules = {
80 "start": [
81 {
82 token: "comment",
83 regex: /\/\/.*$/
84 }, {
85 token: "comment",
86 regex: /#.*$/
87 }, {
88 token: "comment", // multi line comment
89 merge: true,
90 regex: /\/\*/,
91 next: "comment"
92 }, {
93 token: "string",
94 regex: "'(?=.)",
95 next: "qstring"
96 }, {
97 token: "string",
98 regex: '"(?=.)',
99 next: "qqstring"
100 }, {
101 token: "constant.numeric",
102 regex: /[+\-]?\d+(?:(?:\.\d*)?(?:[eE][+\-]?\d+)?)?\b/
103 }, {
104 token: "keyword.operator",
105 regex: /\+|=|\->/
106 }, {
107 token: "punctuation.operator",
108 regex: /,|;/
109 }, {
110 token: "paren.lparen",
111 regex: /[\[{]/
112 }, {
113 token: "paren.rparen",
114 regex: /[\]}]/
115 }, {
116 token: "comment",
117 regex: /^#!.*$/
118 }, {
119 token: function (value) {
120 if (keywords.hasOwnProperty(value.toLowerCase())) {
121 return "keyword";
122 }
123 else if (attributes.hasOwnProperty(value.toLowerCase())) {
124 return "variable";
125 }
126 else {
127 return "text";
128 }
129 },
130 regex: "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
131 }
132 ],
133 "comment": [
134 {
135 token: "comment", // closing comment
136 regex: "\\*\\/",
137 next: "start"
138 }, {
139 defaultToken: "comment"
140 }
141 ],
142 "qqstring": [
143 {
144 token: "string",
145 regex: '[^"\\\\]+',
146 merge: true
147 }, {
148 token: "string",
149 regex: "\\\\$",
150 next: "qqstring",
151 merge: true
152 }, {
153 token: "string",
154 regex: '"|$',
155 next: "start",
156 merge: true
157 }
158 ],
159 "qstring": [
160 {
161 token: "string",
162 regex: "[^'\\\\]+",
163 merge: true
164 }, {
165 token: "string",
166 regex: "\\\\$",
167 next: "qstring",
168 merge: true
169 }, {
170 token: "string",
171 regex: "'|$",
172 next: "start",
173 merge: true
174 }
175 ]
176 };
177 };
178 oop.inherits(DotHighlightRules, TextHighlightRules);
179 exports.DotHighlightRules = DotHighlightRules;
180
181 });
182
183 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";
184 var oop = require("../../lib/oop");
185 var Range = require("../../range").Range;
186 var BaseFoldMode = require("./fold_mode").FoldMode;
187 var FoldMode = exports.FoldMode = function (commentRegex) {
188 if (commentRegex) {
189 this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start));
190 this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end));
191 }
192 };
193 oop.inherits(FoldMode, BaseFoldMode);
194 (function () {
195 this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
196 this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
197 this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/;
198 this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
199 this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
200 this._getFoldWidgetBase = this.getFoldWidget;
201 this.getFoldWidget = function (session, foldStyle, row) {
202 var line = session.getLine(row);
203 if (this.singleLineBlockCommentRe.test(line)) {
204 if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
205 return "";
206 }
207 var fw = this._getFoldWidgetBase(session, foldStyle, row);
208 if (!fw && this.startRegionRe.test(line))
209 return "start"; // lineCommentRegionStart
210 return fw;
211 };
212 this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) {
213 var line = session.getLine(row);
214 if (this.startRegionRe.test(line))
215 return this.getCommentRegionBlock(session, line, row);
216 var match = line.match(this.foldingStartMarker);
217 if (match) {
218 var i = match.index;
219 if (match[1])
220 return this.openingBracketBlock(session, match[1], row, i);
221 var range = session.getCommentFoldRange(row, i + match[0].length, 1);
222 if (range && !range.isMultiLine()) {
223 if (forceMultiline) {
224 range = this.getSectionRange(session, row);
225 }
226 else if (foldStyle != "all")
227 range = null;
228 }
229 return range;
230 }
231 if (foldStyle === "markbegin")
232 return;
233 var match = line.match(this.foldingStopMarker);
234 if (match) {
235 var i = match.index + match[0].length;
236 if (match[1])
237 return this.closingBracketBlock(session, match[1], row, i);
238 return session.getCommentFoldRange(row, i, -1);
239 }
240 };
241 this.getSectionRange = function (session, row) {
242 var line = session.getLine(row);
243 var startIndent = line.search(/\S/);
244 var startRow = row;
245 var startColumn = line.length;
246 row = row + 1;
247 var endRow = row;
248 var maxRow = session.getLength();
249 while (++row < maxRow) {
250 line = session.getLine(row);
251 var indent = line.search(/\S/);
252 if (indent === -1)
253 continue;
254 if (startIndent > indent)
255 break;
256 var subRange = this.getFoldWidgetRange(session, "all", row);
257 if (subRange) {
258 if (subRange.start.row <= startRow) {
259 break;
260 }
261 else if (subRange.isMultiLine()) {
262 row = subRange.end.row;
263 }
264 else if (startIndent == indent) {
265 break;
266 }
267 }
268 endRow = row;
269 }
270 return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
271 };
272 this.getCommentRegionBlock = function (session, line, row) {
273 var startColumn = line.search(/\s*$/);
274 var maxRow = session.getLength();
275 var startRow = row;
276 var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
277 var depth = 1;
278 while (++row < maxRow) {
279 line = session.getLine(row);
280 var m = re.exec(line);
281 if (!m)
282 continue;
283 if (m[1])
284 depth--;
285 else
286 depth++;
287 if (!depth)
288 break;
289 }
290 var endRow = row;
291 if (endRow > startRow) {
292 return new Range(startRow, startColumn, endRow, line.length);
293 }
294 };
295 }).call(FoldMode.prototype);
296
297 });
298
299 ace.define("ace/mode/dot",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/matching_brace_outdent","ace/mode/dot_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module){"use strict";
300 var oop = require("../lib/oop");
301 var TextMode = require("./text").Mode;
302 var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
303 var DotHighlightRules = require("./dot_highlight_rules").DotHighlightRules;
304 var DotFoldMode = require("./folding/cstyle").FoldMode;
305 var Mode = function () {
306 this.HighlightRules = DotHighlightRules;
307 this.$outdent = new MatchingBraceOutdent();
308 this.foldingRules = new DotFoldMode();
309 this.$behaviour = this.$defaultBehaviour;
310 };
311 oop.inherits(Mode, TextMode);
312 (function () {
313 this.lineCommentStart = ["//", "#"];
314 this.blockComment = { start: "/*", end: "*/" };
315 this.getNextLineIndent = function (state, line, tab) {
316 var indent = this.$getIndent(line);
317 var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
318 var tokens = tokenizedLine.tokens;
319 var endState = tokenizedLine.state;
320 if (tokens.length && tokens[tokens.length - 1].type == "comment") {
321 return indent;
322 }
323 if (state == "start") {
324 var match = line.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/);
325 if (match) {
326 indent += tab;
327 }
328 }
329 return indent;
330 };
331 this.checkOutdent = function (state, line, input) {
332 return this.$outdent.checkOutdent(line, input);
333 };
334 this.autoOutdent = function (state, doc, row) {
335 this.$outdent.autoOutdent(doc, row);
336 };
337 this.$id = "ace/mode/dot";
338 }).call(Mode.prototype);
339 exports.Mode = Mode;
340
341 }); (function() {
342 ace.require(["ace/mode/dot"], function(m) {
343 if (typeof module == "object" && typeof exports == "object" && module) {
344 module.exports = m;
345 }
346 });
347 })();
348