1
|
ace.define("ace/mode/fsl_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
|
|
7
|
var FSLHighlightRules = function() {
|
8
|
|
9
|
this.$rules = {
|
10
|
start: [{
|
11
|
token: "punctuation.definition.comment.mn",
|
12
|
regex: /\/\*/,
|
13
|
push: [{
|
14
|
token: "punctuation.definition.comment.mn",
|
15
|
regex: /\*\//,
|
16
|
next: "pop"
|
17
|
}, {
|
18
|
defaultToken: "comment.block.fsl"
|
19
|
}]
|
20
|
}, {
|
21
|
token: "comment.line.fsl",
|
22
|
regex: /\/\//,
|
23
|
push: [{
|
24
|
token: "comment.line.fsl",
|
25
|
regex: /$/,
|
26
|
next: "pop"
|
27
|
}, {
|
28
|
defaultToken: "comment.line.fsl"
|
29
|
}]
|
30
|
}, {
|
31
|
token: "entity.name.function",
|
32
|
regex: /\${/,
|
33
|
push: [{
|
34
|
token: "entity.name.function",
|
35
|
regex: /}/,
|
36
|
next: "pop"
|
37
|
}, {
|
38
|
defaultToken: "keyword.other"
|
39
|
}],
|
40
|
comment: "js outcalls"
|
41
|
}, {
|
42
|
token: "constant.numeric",
|
43
|
regex: /[0-9]*\.[0-9]*\.[0-9]*/,
|
44
|
comment: "semver"
|
45
|
}, {
|
46
|
token: "constant.language.fslLanguage",
|
47
|
regex: "(?:"
|
48
|
+ "graph_layout|machine_name|machine_author|machine_license|machine_comment|machine_language"
|
49
|
+ "|machine_version|machine_reference|npm_name|graph_layout|on_init|on_halt|on_end|on_terminate|on_finalize|on_transition"
|
50
|
+ "|on_action|on_stochastic_action|on_legal|on_main|on_forced|on_validation|on_validation_failure|on_transition_refused|on_forced_transition_refused"
|
51
|
+ "|on_action_refused|on_enter|on_exit|start_states|end_states|terminal_states|final_states|fsl_version"
|
52
|
+ ")\\s*:"
|
53
|
}, {
|
54
|
token: "keyword.control.transition.fslArrow",
|
55
|
regex: /<->|<-|->|<=>|=>|<=|<~>|~>|<~|<-=>|<=->|<-~>|<~->|<=~>|<~=>/
|
56
|
}, {
|
57
|
token: "constant.numeric.fslProbability",
|
58
|
regex: /[0-9]+%/,
|
59
|
comment: "edge probability annotation"
|
60
|
}, {
|
61
|
token: "constant.character.fslAction",
|
62
|
regex: /\'[^']*\'/,
|
63
|
comment: "action annotation"
|
64
|
}, {
|
65
|
token: "string.quoted.double.fslLabel.doublequoted",
|
66
|
regex: /\"[^"]*\"/,
|
67
|
comment: "fsl label annotation"
|
68
|
}, {
|
69
|
token: "entity.name.tag.fslLabel.atom",
|
70
|
regex: /[a-zA-Z0-9_.+&()#@!?,]/,
|
71
|
comment: "fsl label annotation"
|
72
|
}]
|
73
|
};
|
74
|
|
75
|
this.normalizeRules();
|
76
|
};
|
77
|
|
78
|
FSLHighlightRules.metaData = {
|
79
|
fileTypes: ["fsl", "fsl_state"],
|
80
|
name: "FSL",
|
81
|
scopeName: "source.fsl"
|
82
|
};
|
83
|
|
84
|
|
85
|
oop.inherits(FSLHighlightRules, TextHighlightRules);
|
86
|
|
87
|
exports.FSLHighlightRules = FSLHighlightRules;
|
88
|
});
|
89
|
|
90
|
ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
|
91
|
"use strict";
|
92
|
|
93
|
var oop = require("../../lib/oop");
|
94
|
var Range = require("../../range").Range;
|
95
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
96
|
|
97
|
var FoldMode = exports.FoldMode = function(commentRegex) {
|
98
|
if (commentRegex) {
|
99
|
this.foldingStartMarker = new RegExp(
|
100
|
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
|
101
|
);
|
102
|
this.foldingStopMarker = new RegExp(
|
103
|
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
|
104
|
);
|
105
|
}
|
106
|
};
|
107
|
oop.inherits(FoldMode, BaseFoldMode);
|
108
|
|
109
|
(function() {
|
110
|
|
111
|
this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
|
112
|
this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
|
113
|
this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
|
114
|
this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
|
115
|
this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
|
116
|
this._getFoldWidgetBase = this.getFoldWidget;
|
117
|
this.getFoldWidget = function(session, foldStyle, row) {
|
118
|
var line = session.getLine(row);
|
119
|
|
120
|
if (this.singleLineBlockCommentRe.test(line)) {
|
121
|
if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
|
122
|
return "";
|
123
|
}
|
124
|
|
125
|
var fw = this._getFoldWidgetBase(session, foldStyle, row);
|
126
|
|
127
|
if (!fw && this.startRegionRe.test(line))
|
128
|
return "start"; // lineCommentRegionStart
|
129
|
|
130
|
return fw;
|
131
|
};
|
132
|
|
133
|
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
|
134
|
var line = session.getLine(row);
|
135
|
|
136
|
if (this.startRegionRe.test(line))
|
137
|
return this.getCommentRegionBlock(session, line, row);
|
138
|
|
139
|
var match = line.match(this.foldingStartMarker);
|
140
|
if (match) {
|
141
|
var i = match.index;
|
142
|
|
143
|
if (match[1])
|
144
|
return this.openingBracketBlock(session, match[1], row, i);
|
145
|
|
146
|
var range = session.getCommentFoldRange(row, i + match[0].length, 1);
|
147
|
|
148
|
if (range && !range.isMultiLine()) {
|
149
|
if (forceMultiline) {
|
150
|
range = this.getSectionRange(session, row);
|
151
|
} else if (foldStyle != "all")
|
152
|
range = null;
|
153
|
}
|
154
|
|
155
|
return range;
|
156
|
}
|
157
|
|
158
|
if (foldStyle === "markbegin")
|
159
|
return;
|
160
|
|
161
|
var match = line.match(this.foldingStopMarker);
|
162
|
if (match) {
|
163
|
var i = match.index + match[0].length;
|
164
|
|
165
|
if (match[1])
|
166
|
return this.closingBracketBlock(session, match[1], row, i);
|
167
|
|
168
|
return session.getCommentFoldRange(row, i, -1);
|
169
|
}
|
170
|
};
|
171
|
|
172
|
this.getSectionRange = function(session, row) {
|
173
|
var line = session.getLine(row);
|
174
|
var startIndent = line.search(/\S/);
|
175
|
var startRow = row;
|
176
|
var startColumn = line.length;
|
177
|
row = row + 1;
|
178
|
var endRow = row;
|
179
|
var maxRow = session.getLength();
|
180
|
while (++row < maxRow) {
|
181
|
line = session.getLine(row);
|
182
|
var indent = line.search(/\S/);
|
183
|
if (indent === -1)
|
184
|
continue;
|
185
|
if (startIndent > indent)
|
186
|
break;
|
187
|
var subRange = this.getFoldWidgetRange(session, "all", row);
|
188
|
|
189
|
if (subRange) {
|
190
|
if (subRange.start.row <= startRow) {
|
191
|
break;
|
192
|
} else if (subRange.isMultiLine()) {
|
193
|
row = subRange.end.row;
|
194
|
} else if (startIndent == indent) {
|
195
|
break;
|
196
|
}
|
197
|
}
|
198
|
endRow = row;
|
199
|
}
|
200
|
|
201
|
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
|
202
|
};
|
203
|
this.getCommentRegionBlock = function(session, line, row) {
|
204
|
var startColumn = line.search(/\s*$/);
|
205
|
var maxRow = session.getLength();
|
206
|
var startRow = row;
|
207
|
|
208
|
var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
|
209
|
var depth = 1;
|
210
|
while (++row < maxRow) {
|
211
|
line = session.getLine(row);
|
212
|
var m = re.exec(line);
|
213
|
if (!m) continue;
|
214
|
if (m[1]) depth--;
|
215
|
else depth++;
|
216
|
|
217
|
if (!depth) break;
|
218
|
}
|
219
|
|
220
|
var endRow = row;
|
221
|
if (endRow > startRow) {
|
222
|
return new Range(startRow, startColumn, endRow, line.length);
|
223
|
}
|
224
|
};
|
225
|
|
226
|
}).call(FoldMode.prototype);
|
227
|
|
228
|
});
|
229
|
|
230
|
ace.define("ace/mode/fsl",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/fsl_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module) {
|
231
|
"use strict";
|
232
|
|
233
|
var oop = require("../lib/oop");
|
234
|
var TextMode = require("./text").Mode;
|
235
|
var FSLHighlightRules = require("./fsl_highlight_rules").FSLHighlightRules;
|
236
|
var FoldMode = require("./folding/cstyle").FoldMode;
|
237
|
|
238
|
var Mode = function() {
|
239
|
this.HighlightRules = FSLHighlightRules;
|
240
|
this.foldingRules = new FoldMode();
|
241
|
};
|
242
|
oop.inherits(Mode, TextMode);
|
243
|
|
244
|
(function() {
|
245
|
this.lineCommentStart = "//";
|
246
|
this.blockComment = {start: "/*", end: "*/"};
|
247
|
this.$id = "ace/mode/fsl";
|
248
|
this.snippetFileId = "ace/snippets/fsl";
|
249
|
}).call(Mode.prototype);
|
250
|
|
251
|
exports.Mode = Mode;
|
252
|
}); (function() {
|
253
|
ace.require(["ace/mode/fsl"], function(m) {
|
254
|
if (typeof module == "object" && typeof exports == "object" && module) {
|
255
|
module.exports = m;
|
256
|
}
|
257
|
});
|
258
|
})();
|
259
|
|