1
|
ace.define("ace/mode/fsharp_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function (require, exports, module) {
|
2
|
"use strict";
|
3
|
|
4
|
var oop = require("../lib/oop");
|
5
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
6
|
var FSharpHighlightRules = function () {
|
7
|
|
8
|
var keywordMapper = this.createKeywordMapper({
|
9
|
"variable": "this",
|
10
|
"keyword": 'abstract|assert|base|begin|class|default|delegate|done|downcast|downto|elif\
|
11
|
|else|exception|extern|false|finally|function|global|inherit|inline|interface|internal|lazy|match\
|
12
|
|member|module|mutable|namespace|open|or|override|private|public|rec|return|return!|select|static\
|
13
|
|struct|then|to|true|try|typeof|upcast|use|use!|val|void|when|while|with|yield|yield!|__SOURCE_DIRECTORY__\
|
14
|
|as|asr|land|lor|lsl|lsr|lxor|mod|sig|atomic|break|checked|component|const|constraint|constructor|continue\
|
15
|
|eager|event|external|fixed|functor|include|method|mixin|object|parallel|process|protected|pure|sealed|tailcall\
|
16
|
|trait|virtual|volatile|and|do|end|for|fun|if|in|let|let!|new|not|null|of|endif',
|
17
|
"constant": "true|false"
|
18
|
}, "identifier");
|
19
|
|
20
|
var floatNumber = "(?:(?:(?:(?:(?:(?:\\d+)?(?:\\.\\d+))|(?:(?:\\d+)\\.))|(?:\\d+))(?:[eE][+-]?\\d+))|(?:(?:(?:\\d+)?(?:\\.\\d+))|(?:(?:\\d+)\\.)))";
|
21
|
|
22
|
this.$rules = {
|
23
|
"start": [
|
24
|
{
|
25
|
token: "variable.classes",
|
26
|
regex: '\\[\\<[.]*\\>\\]'
|
27
|
},
|
28
|
{
|
29
|
token: "comment",
|
30
|
regex: '//.*$'
|
31
|
},
|
32
|
{
|
33
|
token: "comment.start",
|
34
|
regex: /\(\*(?!\))/,
|
35
|
push: "blockComment"
|
36
|
},
|
37
|
{
|
38
|
token: "string",
|
39
|
regex: "'.'"
|
40
|
},
|
41
|
{
|
42
|
token: "string",
|
43
|
regex: '"""',
|
44
|
next : [{
|
45
|
token : "constant.language.escape",
|
46
|
regex : /\\./,
|
47
|
next : "qqstring"
|
48
|
}, {
|
49
|
token : "string",
|
50
|
regex : '"""',
|
51
|
next : "start"
|
52
|
}, {
|
53
|
defaultToken: "string"
|
54
|
}]
|
55
|
},
|
56
|
{
|
57
|
token: "string",
|
58
|
regex: '"',
|
59
|
next : [{
|
60
|
token : "constant.language.escape",
|
61
|
regex : /\\./,
|
62
|
next : "qqstring"
|
63
|
}, {
|
64
|
token : "string",
|
65
|
regex : '"',
|
66
|
next : "start"
|
67
|
}, {
|
68
|
defaultToken: "string"
|
69
|
}]
|
70
|
},
|
71
|
{
|
72
|
token: ["verbatim.string", "string"],
|
73
|
regex: '(@?)(")',
|
74
|
stateName : "qqstring",
|
75
|
next : [{
|
76
|
token : "constant.language.escape",
|
77
|
regex : '""'
|
78
|
}, {
|
79
|
token : "string",
|
80
|
regex : '"',
|
81
|
next : "start"
|
82
|
}, {
|
83
|
defaultToken: "string"
|
84
|
}]
|
85
|
},
|
86
|
{
|
87
|
token: "constant.float",
|
88
|
regex: "(?:" + floatNumber + "|\\d+)[jJ]\\b"
|
89
|
},
|
90
|
{
|
91
|
token: "constant.float",
|
92
|
regex: floatNumber
|
93
|
},
|
94
|
{
|
95
|
token: "constant.integer",
|
96
|
regex: "(?:(?:(?:[1-9]\\d*)|(?:0))|(?:0[oO]?[0-7]+)|(?:0[xX][\\dA-Fa-f]+)|(?:0[bB][01]+))\\b"
|
97
|
},
|
98
|
{
|
99
|
token: ["keyword.type", "variable"],
|
100
|
regex: "(type\\s)([a-zA-Z0-9_$\-]*\\b)"
|
101
|
},
|
102
|
{
|
103
|
token: keywordMapper,
|
104
|
regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
105
|
},
|
106
|
{
|
107
|
token: "keyword.operator",
|
108
|
regex: "\\+\\.|\\-\\.|\\*\\.|\\/\\.|#|;;|\\+|\\-|\\*|\\*\\*\\/|\\/\\/|%|<<|>>|&|\\||\\^|~|<|>|<=|=>|==|!=|<>|<-|=|\\(\\*\\)"
|
109
|
},
|
110
|
{
|
111
|
token: "paren.lparen",
|
112
|
regex: "[[({]"
|
113
|
},
|
114
|
{
|
115
|
token: "paren.rparen",
|
116
|
regex: "[\\])}]"
|
117
|
}
|
118
|
],
|
119
|
blockComment: [{
|
120
|
regex: /\(\*\)/,
|
121
|
token: "comment"
|
122
|
}, {
|
123
|
regex: /\(\*(?!\))/,
|
124
|
token: "comment.start",
|
125
|
push: "blockComment"
|
126
|
}, {
|
127
|
regex: /\*\)/,
|
128
|
token: "comment.end",
|
129
|
next: "pop"
|
130
|
}, {
|
131
|
defaultToken: "comment"
|
132
|
}]
|
133
|
};
|
134
|
this.normalizeRules();
|
135
|
};
|
136
|
|
137
|
|
138
|
oop.inherits(FSharpHighlightRules, TextHighlightRules);
|
139
|
|
140
|
exports.FSharpHighlightRules = FSharpHighlightRules;
|
141
|
});
|
142
|
|
143
|
ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
|
144
|
"use strict";
|
145
|
|
146
|
var oop = require("../../lib/oop");
|
147
|
var Range = require("../../range").Range;
|
148
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
149
|
|
150
|
var FoldMode = exports.FoldMode = function(commentRegex) {
|
151
|
if (commentRegex) {
|
152
|
this.foldingStartMarker = new RegExp(
|
153
|
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
|
154
|
);
|
155
|
this.foldingStopMarker = new RegExp(
|
156
|
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
|
157
|
);
|
158
|
}
|
159
|
};
|
160
|
oop.inherits(FoldMode, BaseFoldMode);
|
161
|
|
162
|
(function() {
|
163
|
|
164
|
this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
|
165
|
this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
|
166
|
this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
|
167
|
this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
|
168
|
this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
|
169
|
this._getFoldWidgetBase = this.getFoldWidget;
|
170
|
this.getFoldWidget = function(session, foldStyle, row) {
|
171
|
var line = session.getLine(row);
|
172
|
|
173
|
if (this.singleLineBlockCommentRe.test(line)) {
|
174
|
if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
|
175
|
return "";
|
176
|
}
|
177
|
|
178
|
var fw = this._getFoldWidgetBase(session, foldStyle, row);
|
179
|
|
180
|
if (!fw && this.startRegionRe.test(line))
|
181
|
return "start"; // lineCommentRegionStart
|
182
|
|
183
|
return fw;
|
184
|
};
|
185
|
|
186
|
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
|
187
|
var line = session.getLine(row);
|
188
|
|
189
|
if (this.startRegionRe.test(line))
|
190
|
return this.getCommentRegionBlock(session, line, row);
|
191
|
|
192
|
var match = line.match(this.foldingStartMarker);
|
193
|
if (match) {
|
194
|
var i = match.index;
|
195
|
|
196
|
if (match[1])
|
197
|
return this.openingBracketBlock(session, match[1], row, i);
|
198
|
|
199
|
var range = session.getCommentFoldRange(row, i + match[0].length, 1);
|
200
|
|
201
|
if (range && !range.isMultiLine()) {
|
202
|
if (forceMultiline) {
|
203
|
range = this.getSectionRange(session, row);
|
204
|
} else if (foldStyle != "all")
|
205
|
range = null;
|
206
|
}
|
207
|
|
208
|
return range;
|
209
|
}
|
210
|
|
211
|
if (foldStyle === "markbegin")
|
212
|
return;
|
213
|
|
214
|
var match = line.match(this.foldingStopMarker);
|
215
|
if (match) {
|
216
|
var i = match.index + match[0].length;
|
217
|
|
218
|
if (match[1])
|
219
|
return this.closingBracketBlock(session, match[1], row, i);
|
220
|
|
221
|
return session.getCommentFoldRange(row, i, -1);
|
222
|
}
|
223
|
};
|
224
|
|
225
|
this.getSectionRange = function(session, row) {
|
226
|
var line = session.getLine(row);
|
227
|
var startIndent = line.search(/\S/);
|
228
|
var startRow = row;
|
229
|
var startColumn = line.length;
|
230
|
row = row + 1;
|
231
|
var endRow = row;
|
232
|
var maxRow = session.getLength();
|
233
|
while (++row < maxRow) {
|
234
|
line = session.getLine(row);
|
235
|
var indent = line.search(/\S/);
|
236
|
if (indent === -1)
|
237
|
continue;
|
238
|
if (startIndent > indent)
|
239
|
break;
|
240
|
var subRange = this.getFoldWidgetRange(session, "all", row);
|
241
|
|
242
|
if (subRange) {
|
243
|
if (subRange.start.row <= startRow) {
|
244
|
break;
|
245
|
} else if (subRange.isMultiLine()) {
|
246
|
row = subRange.end.row;
|
247
|
} else if (startIndent == indent) {
|
248
|
break;
|
249
|
}
|
250
|
}
|
251
|
endRow = row;
|
252
|
}
|
253
|
|
254
|
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
|
255
|
};
|
256
|
this.getCommentRegionBlock = function(session, line, row) {
|
257
|
var startColumn = line.search(/\s*$/);
|
258
|
var maxRow = session.getLength();
|
259
|
var startRow = row;
|
260
|
|
261
|
var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
|
262
|
var depth = 1;
|
263
|
while (++row < maxRow) {
|
264
|
line = session.getLine(row);
|
265
|
var m = re.exec(line);
|
266
|
if (!m) continue;
|
267
|
if (m[1]) depth--;
|
268
|
else depth++;
|
269
|
|
270
|
if (!depth) break;
|
271
|
}
|
272
|
|
273
|
var endRow = row;
|
274
|
if (endRow > startRow) {
|
275
|
return new Range(startRow, startColumn, endRow, line.length);
|
276
|
}
|
277
|
};
|
278
|
|
279
|
}).call(FoldMode.prototype);
|
280
|
|
281
|
});
|
282
|
|
283
|
ace.define("ace/mode/fsharp",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/fsharp_highlight_rules","ace/mode/folding/cstyle"], function (require, exports, module) {
|
284
|
"use strict";
|
285
|
|
286
|
var oop = require("../lib/oop");
|
287
|
var TextMode = require("./text").Mode;
|
288
|
var FSharpHighlightRules = require("./fsharp_highlight_rules").FSharpHighlightRules;
|
289
|
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
290
|
|
291
|
var Mode = function () {
|
292
|
TextMode.call(this);
|
293
|
this.HighlightRules = FSharpHighlightRules;
|
294
|
this.foldingRules = new CStyleFoldMode();
|
295
|
};
|
296
|
|
297
|
oop.inherits(Mode, TextMode);
|
298
|
|
299
|
|
300
|
(function () {
|
301
|
this.lineCommentStart = "//";
|
302
|
this.blockComment = {start: "(*", end: "*)", nestable: true};
|
303
|
|
304
|
|
305
|
this.$id = "ace/mode/fsharp";
|
306
|
}).call(Mode.prototype);
|
307
|
|
308
|
exports.Mode = Mode;
|
309
|
}); (function() {
|
310
|
ace.require(["ace/mode/fsharp"], function(m) {
|
311
|
if (typeof module == "object" && typeof exports == "object" && module) {
|
312
|
module.exports = m;
|
313
|
}
|
314
|
});
|
315
|
})();
|
316
|
|