Projekt

Obecné

Profil

Stáhnout (10.6 KB) Statistiky
| Větev: | Tag: | Revize:
1
ace.define("ace/mode/jssm_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 JSSMHighlightRules = 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.jssm"
19
            }],
20
            comment: "block comment"
21
        }, {
22
            token: "comment.line.jssm",
23
            regex: /\/\//,
24
            push: [{
25
                token: "comment.line.jssm",
26
                regex: /$/,
27
                next: "pop"
28
            }, {
29
                defaultToken: "comment.line.jssm"
30
            }],
31
            comment: "block comment"
32
        }, {
33
            token: "entity.name.function",
34
            regex: /\${/,
35
            push: [{
36
                token: "entity.name.function",
37
                regex: /}/,
38
                next: "pop"
39
            }, {
40
                defaultToken: "keyword.other"
41
            }],
42
            comment: "js outcalls"
43
        }, {
44
            token: "constant.numeric",
45
            regex: /[0-9]*\.[0-9]*\.[0-9]*/,
46
            comment: "semver"
47
        }, {
48
            token: "constant.language.jssmLanguage",
49
            regex: /graph_layout\s*:/,
50
            comment: "jssm language tokens"
51
        }, {
52
            token: "constant.language.jssmLanguage",
53
            regex: /machine_name\s*:/,
54
            comment: "jssm language tokens"
55
        }, {
56
            token: "constant.language.jssmLanguage",
57
            regex: /machine_version\s*:/,
58
            comment: "jssm language tokens"
59
        }, {
60
            token: "constant.language.jssmLanguage",
61
            regex: /jssm_version\s*:/,
62
            comment: "jssm language tokens"
63
        }, {
64
            token: "keyword.control.transition.jssmArrow.legal_legal",
65
            regex: /<->/,
66
            comment: "transitions"
67
        }, {
68
            token: "keyword.control.transition.jssmArrow.legal_none",
69
            regex: /<-/,
70
            comment: "transitions"
71
        }, {
72
            token: "keyword.control.transition.jssmArrow.none_legal",
73
            regex: /->/,
74
            comment: "transitions"
75
        }, {
76
            token: "keyword.control.transition.jssmArrow.main_main",
77
            regex: /<=>/,
78
            comment: "transitions"
79
        }, {
80
            token: "keyword.control.transition.jssmArrow.none_main",
81
            regex: /=>/,
82
            comment: "transitions"
83
        }, {
84
            token: "keyword.control.transition.jssmArrow.main_none",
85
            regex: /<=/,
86
            comment: "transitions"
87
        }, {
88
            token: "keyword.control.transition.jssmArrow.forced_forced",
89
            regex: /<~>/,
90
            comment: "transitions"
91
        }, {
92
            token: "keyword.control.transition.jssmArrow.none_forced",
93
            regex: /~>/,
94
            comment: "transitions"
95
        }, {
96
            token: "keyword.control.transition.jssmArrow.forced_none",
97
            regex: /<~/,
98
            comment: "transitions"
99
        }, {
100
            token: "keyword.control.transition.jssmArrow.legal_main",
101
            regex: /<-=>/,
102
            comment: "transitions"
103
        }, {
104
            token: "keyword.control.transition.jssmArrow.main_legal",
105
            regex: /<=->/,
106
            comment: "transitions"
107
        }, {
108
            token: "keyword.control.transition.jssmArrow.legal_forced",
109
            regex: /<-~>/,
110
            comment: "transitions"
111
        }, {
112
            token: "keyword.control.transition.jssmArrow.forced_legal",
113
            regex: /<~->/,
114
            comment: "transitions"
115
        }, {
116
            token: "keyword.control.transition.jssmArrow.main_forced",
117
            regex: /<=~>/,
118
            comment: "transitions"
119
        }, {
120
            token: "keyword.control.transition.jssmArrow.forced_main",
121
            regex: /<~=>/,
122
            comment: "transitions"
123
        }, {
124
            token: "constant.numeric.jssmProbability",
125
            regex: /[0-9]+%/,
126
            comment: "edge probability annotation"
127
        }, {
128
            token: "constant.character.jssmAction",
129
            regex: /\'[^']*\'/,
130
            comment: "action annotation"
131
        }, {
132
            token: "entity.name.tag.jssmLabel.doublequoted",
133
            regex: /\"[^"]*\"/,
134
            comment: "jssm label annotation"
135
        }, {
136
            token: "entity.name.tag.jssmLabel.atom",
137
            regex: /[a-zA-Z0-9_.+&()#@!?,]/,
138
            comment: "jssm label annotation"
139
        }]
140
    };
141
    
142
    this.normalizeRules();
143
};
144

    
145
JSSMHighlightRules.metaData = {
146
    fileTypes: ["jssm", "jssm_state"],
147
    name: "JSSM",
148
    scopeName: "source.jssm"
149
};
150

    
151

    
152
oop.inherits(JSSMHighlightRules, TextHighlightRules);
153

    
154
exports.JSSMHighlightRules = JSSMHighlightRules;
155
});
156

    
157
ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
158
"use strict";
159

    
160
var oop = require("../../lib/oop");
161
var Range = require("../../range").Range;
162
var BaseFoldMode = require("./fold_mode").FoldMode;
163

    
164
var FoldMode = exports.FoldMode = function(commentRegex) {
165
    if (commentRegex) {
166
        this.foldingStartMarker = new RegExp(
167
            this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
168
        );
169
        this.foldingStopMarker = new RegExp(
170
            this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
171
        );
172
    }
173
};
174
oop.inherits(FoldMode, BaseFoldMode);
175

    
176
(function() {
177
    
178
    this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
179
    this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
180
    this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
181
    this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
182
    this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
183
    this._getFoldWidgetBase = this.getFoldWidget;
184
    this.getFoldWidget = function(session, foldStyle, row) {
185
        var line = session.getLine(row);
186
    
187
        if (this.singleLineBlockCommentRe.test(line)) {
188
            if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
189
                return "";
190
        }
191
    
192
        var fw = this._getFoldWidgetBase(session, foldStyle, row);
193
    
194
        if (!fw && this.startRegionRe.test(line))
195
            return "start"; // lineCommentRegionStart
196
    
197
        return fw;
198
    };
199

    
200
    this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
201
        var line = session.getLine(row);
202
        
203
        if (this.startRegionRe.test(line))
204
            return this.getCommentRegionBlock(session, line, row);
205
        
206
        var match = line.match(this.foldingStartMarker);
207
        if (match) {
208
            var i = match.index;
209

    
210
            if (match[1])
211
                return this.openingBracketBlock(session, match[1], row, i);
212
                
213
            var range = session.getCommentFoldRange(row, i + match[0].length, 1);
214
            
215
            if (range && !range.isMultiLine()) {
216
                if (forceMultiline) {
217
                    range = this.getSectionRange(session, row);
218
                } else if (foldStyle != "all")
219
                    range = null;
220
            }
221
            
222
            return range;
223
        }
224

    
225
        if (foldStyle === "markbegin")
226
            return;
227

    
228
        var match = line.match(this.foldingStopMarker);
229
        if (match) {
230
            var i = match.index + match[0].length;
231

    
232
            if (match[1])
233
                return this.closingBracketBlock(session, match[1], row, i);
234

    
235
            return session.getCommentFoldRange(row, i, -1);
236
        }
237
    };
238
    
239
    this.getSectionRange = function(session, row) {
240
        var line = session.getLine(row);
241
        var startIndent = line.search(/\S/);
242
        var startRow = row;
243
        var startColumn = line.length;
244
        row = row + 1;
245
        var endRow = row;
246
        var maxRow = session.getLength();
247
        while (++row < maxRow) {
248
            line = session.getLine(row);
249
            var indent = line.search(/\S/);
250
            if (indent === -1)
251
                continue;
252
            if  (startIndent > indent)
253
                break;
254
            var subRange = this.getFoldWidgetRange(session, "all", row);
255
            
256
            if (subRange) {
257
                if (subRange.start.row <= startRow) {
258
                    break;
259
                } else if (subRange.isMultiLine()) {
260
                    row = subRange.end.row;
261
                } else if (startIndent == indent) {
262
                    break;
263
                }
264
            }
265
            endRow = row;
266
        }
267
        
268
        return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
269
    };
270
    this.getCommentRegionBlock = function(session, line, row) {
271
        var startColumn = line.search(/\s*$/);
272
        var maxRow = session.getLength();
273
        var startRow = row;
274
        
275
        var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
276
        var depth = 1;
277
        while (++row < maxRow) {
278
            line = session.getLine(row);
279
            var m = re.exec(line);
280
            if (!m) continue;
281
            if (m[1]) depth--;
282
            else depth++;
283

    
284
            if (!depth) break;
285
        }
286

    
287
        var endRow = row;
288
        if (endRow > startRow) {
289
            return new Range(startRow, startColumn, endRow, line.length);
290
        }
291
    };
292

    
293
}).call(FoldMode.prototype);
294

    
295
});
296

    
297
ace.define("ace/mode/jssm",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/jssm_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module) {
298
"use strict";
299

    
300
var oop = require("../lib/oop");
301
var TextMode = require("./text").Mode;
302
var JSSMHighlightRules = require("./jssm_highlight_rules").JSSMHighlightRules;
303
var FoldMode = require("./folding/cstyle").FoldMode;
304

    
305
var Mode = function() {
306
    this.HighlightRules = JSSMHighlightRules;
307
    this.foldingRules = new FoldMode();
308
};
309
oop.inherits(Mode, TextMode);
310

    
311
(function() {
312
    this.lineCommentStart = "//";
313
    this.blockComment = {start: "/*", end: "*/"};
314
    this.$id = "ace/mode/jssm";
315
}).call(Mode.prototype);
316

    
317
exports.Mode = Mode;
318
});                (function() {
319
                    ace.require(["ace/mode/jssm"], function(m) {
320
                        if (typeof module == "object" && typeof exports == "object" && module) {
321
                            module.exports = m;
322
                        }
323
                    });
324
                })();
325
            
(101-101/244)