Debian Codegraph @

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

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