1
define('ace/mode/dot', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/matching_brace_outdent', 'ace/mode/dot_highlight_rules', 'ace/mode/folding/cstyle'], function(require, exports, module) {
4
var oop = require("../lib/oop");
5
var TextMode = require("./text").Mode;
6
var Tokenizer = require("../tokenizer").Tokenizer;
7
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
8
var DotHighlightRules = require("./dot_highlight_rules").DotHighlightRules;
9
var DotFoldMode = require("./folding/cstyle").FoldMode;
11
var Mode = function() {
12
var highlighter = new DotHighlightRules();
13
this.$outdent = new MatchingBraceOutdent();
14
this.foldingRules = new DotFoldMode();
15
this.$tokenizer = new Tokenizer(highlighter.getRules());
17
oop.inherits(Mode, TextMode);
21
this.lineCommentStart = ["//", "#"];
22
this.blockComment = {start: "/*", end: "*/"};
24
this.getNextLineIndent = function(state, line, tab) {
25
var indent = this.$getIndent(line);
27
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
28
var tokens = tokenizedLine.tokens;
29
var endState = tokenizedLine.state;
31
if (tokens.length && tokens[tokens.length-1].type == "comment") {
35
if (state == "start") {
36
var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/);
45
this.checkOutdent = function(state, line, input) {
46
return this.$outdent.checkOutdent(line, input);
49
this.autoOutdent = function(state, doc, row) {
50
this.$outdent.autoOutdent(doc, row);
53
}).call(Mode.prototype);
58
define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
61
var Range = require("../range").Range;
63
var MatchingBraceOutdent = function() {};
67
this.checkOutdent = function(line, input) {
68
if (! /^\s+$/.test(line))
71
return /^\s*\}/.test(input);
74
this.autoOutdent = function(doc, row) {
75
var line = doc.getLine(row);
76
var match = line.match(/^(\s*\})/);
80
var column = match[1].length;
81
var openBracePos = doc.findMatchingBracket({row: row, column: column});
83
if (!openBracePos || openBracePos.row == row) return 0;
85
var indent = this.$getIndent(doc.getLine(openBracePos.row));
86
doc.replace(new Range(row, 0, row, column-1), indent);
89
this.$getIndent = function(line) {
90
return line.match(/^\s*/)[0];
93
}).call(MatchingBraceOutdent.prototype);
95
exports.MatchingBraceOutdent = MatchingBraceOutdent;
97
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) {
100
var oop = require("../lib/oop");
101
var lang = require("../lib/lang");
102
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
103
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
105
var DotHighlightRules = function() {
107
var keywords = lang.arrayToMap(
108
("strict|node|edge|graph|digraph|subgraph").split("|")
111
var attributes = lang.arrayToMap(
112
("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("|")
124
token : "comment", // multi line comment
137
token : "constant.numeric",
138
regex : /[+\-]?\d+(?:(?:\.\d*)?(?:[eE][+\-]?\d+)?)?\b/
140
token : "keyword.operator",
143
token : "punctuation.operator",
146
token : "paren.lparen",
149
token : "paren.rparen",
155
token: function(value) {
156
if (keywords.hasOwnProperty(value.toLowerCase())) {
159
else if (attributes.hasOwnProperty(value.toLowerCase())) {
166
regex: "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
171
token : "comment", // closing comment
176
token : "comment", // comment spanning whole line
218
oop.inherits(DotHighlightRules, TextHighlightRules);
220
exports.DotHighlightRules = DotHighlightRules;
224
define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
227
var oop = require("../lib/oop");
228
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
230
var DocCommentHighlightRules = function() {
234
token : "comment.doc.tag",
235
regex : "@[\\w\\d_]+" // TODO: fix email addresses
237
token : "comment.doc.tag",
240
defaultToken : "comment.doc"
245
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
247
DocCommentHighlightRules.getStartRule = function(start) {
249
token : "comment.doc", // doc comment
250
regex : "\\/\\*(?=\\*)",
255
DocCommentHighlightRules.getEndRule = function (start) {
257
token : "comment.doc", // closing comment
264
exports.DocCommentHighlightRules = DocCommentHighlightRules;
268
define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
271
var oop = require("../../lib/oop");
272
var Range = require("../../range").Range;
273
var BaseFoldMode = require("./fold_mode").FoldMode;
275
var FoldMode = exports.FoldMode = function(commentRegex) {
277
this.foldingStartMarker = new RegExp(
278
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
280
this.foldingStopMarker = new RegExp(
281
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
285
oop.inherits(FoldMode, BaseFoldMode);
289
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
290
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
292
this.getFoldWidgetRange = function(session, foldStyle, row) {
293
var line = session.getLine(row);
294
var match = line.match(this.foldingStartMarker);
299
return this.openingBracketBlock(session, match[1], row, i);
301
return session.getCommentFoldRange(row, i + match[0].length, 1);
304
if (foldStyle !== "markbeginend")
307
var match = line.match(this.foldingStopMarker);
309
var i = match.index + match[0].length;
312
return this.closingBracketBlock(session, match[1], row, i);
314
return session.getCommentFoldRange(row, i, -1);
318
}).call(FoldMode.prototype);