-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmode-cellscript.js
137 lines (130 loc) · 5.24 KB
/
mode-cellscript.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
ace.define("ace/mode/cellscript_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){/* This file was autogenerated from Assembly x86.tmLanguage (uuid: ) */
"use strict";
var oop = require("../lib/oop");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var cellscriptHighlightRules = function () {
this.$rules = {
start:
[
{
token: 'token keyword',
regex: /(=>|element|color|ifnot|if|at|rules)/
},
{
token: 'token color',
regex: /#[A-Fa-f0-9]{6}/
},
{
token: 'token constant direction',
regex: /DIR\.((UPLEFT|LEFTUP|DOWNLEFT|LEFTDOWN|UPRIGHT|RIGHTUP|DOWNRIGHT|RIGHTDOWN)|(UP|DOWN|LEFT|RIGHT|CROSS|PLUS|ANY|ALL|HORIZONTAL|VERTICAL))/
},
{
token: 'token numeric',
regex: /([0-9]+)|(\[[0-9]+..[0-9]+\])/
}
]
};
this.normalizeRules();
};
cellscriptHighlightRules.metaData = { fileTypes: ['cellscript'],
name: 'cellscript',
scopeName: 'source.cellscript' };
oop.inherits(cellscriptHighlightRules, TextHighlightRules);
exports.cellscriptHighlightRules = cellscriptHighlightRules;
});
ace.define("ace/mode/folding/coffee",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(require, exports, module){"use strict";
var oop = require("../../lib/oop");
var BaseFoldMode = require("./fold_mode").FoldMode;
var Range = require("../../range").Range;
var FoldMode = exports.FoldMode = function () { };
oop.inherits(FoldMode, BaseFoldMode);
(function () {
this.getFoldWidgetRange = function (session, foldStyle, row) {
var range = this.indentationBlock(session, row);
if (range)
return range;
var re = /\S/;
var line = session.getLine(row);
var startLevel = line.search(re);
if (startLevel == -1 || line[startLevel] != "#")
return;
var startColumn = line.length;
var maxRow = session.getLength();
var startRow = row;
var endRow = row;
while (++row < maxRow) {
line = session.getLine(row);
var level = line.search(re);
if (level == -1)
continue;
if (line[level] != "#")
break;
endRow = row;
}
if (endRow > startRow) {
var endColumn = session.getLine(endRow).length;
return new Range(startRow, startColumn, endRow, endColumn);
}
};
this.getFoldWidget = function (session, foldStyle, row) {
var line = session.getLine(row);
var indent = line.search(/\S/);
var next = session.getLine(row + 1);
var prev = session.getLine(row - 1);
var prevIndent = prev.search(/\S/);
var nextIndent = next.search(/\S/);
if (indent == -1) {
session.foldWidgets[row - 1] = prevIndent != -1 && prevIndent < nextIndent ? "start" : "";
return "";
}
if (prevIndent == -1) {
if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
session.foldWidgets[row - 1] = "";
session.foldWidgets[row + 1] = "";
return "start";
}
}
else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
if (session.getLine(row - 2).search(/\S/) == -1) {
session.foldWidgets[row - 1] = "start";
session.foldWidgets[row + 1] = "";
return "";
}
}
if (prevIndent != -1 && prevIndent < indent)
session.foldWidgets[row - 1] = "start";
else
session.foldWidgets[row - 1] = "";
if (indent < nextIndent)
return "start";
else
return "";
};
}).call(FoldMode.prototype);
});
ace.define("ace/mode/cellscript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/cellscript_highlight_rules","ace/mode/folding/coffee"], function(require, exports, module){/*
THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
*/
"use strict";
var oop = require("../lib/oop");
var TextMode = require("./text").Mode;
var cellscriptHighlightRules = require("./cellscript_highlight_rules").cellscriptHighlightRules;
var FoldMode = require("./folding/coffee").FoldMode;
var Mode = function () {
this.HighlightRules = cellscriptHighlightRules;
this.foldingRules = new FoldMode();
this.$behaviour = this.$defaultBehaviour;
};
oop.inherits(Mode, TextMode);
(function () {
this.lineCommentStart = [";"];
this.$id = "ace/mode/cellscript";
}).call(Mode.prototype);
exports.Mode = Mode;
}); (function() {
ace.require(["ace/mode/cellscript"], function(m) {
if (typeof module == "object" && typeof exports == "object" && module) {
module.exports = m;
}
});
})();