1
|
ace.define("ace/mode/sparql_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 SPARQLHighlightRules = function() {
|
8
|
|
9
|
this.$rules = {
|
10
|
start: [{
|
11
|
include: "#comments"
|
12
|
}, {
|
13
|
include: "#strings"
|
14
|
}, {
|
15
|
include: "#string-language-suffixes"
|
16
|
}, {
|
17
|
include: "#string-datatype-suffixes"
|
18
|
}, {
|
19
|
include: "#logic-operators"
|
20
|
}, {
|
21
|
include: "#relative-urls"
|
22
|
}, {
|
23
|
include: "#xml-schema-types"
|
24
|
}, {
|
25
|
include: "#rdf-schema-types"
|
26
|
}, {
|
27
|
include: "#owl-types"
|
28
|
}, {
|
29
|
include: "#qnames"
|
30
|
}, {
|
31
|
include: "#keywords"
|
32
|
}, {
|
33
|
include: "#built-in-functions"
|
34
|
}, {
|
35
|
include: "#variables"
|
36
|
}, {
|
37
|
include: "#boolean-literal"
|
38
|
}, {
|
39
|
include: "#punctuation-operators"
|
40
|
}],
|
41
|
"#boolean-literal": [{
|
42
|
token: "constant.language.boolean.sparql",
|
43
|
regex: /true|false/
|
44
|
}],
|
45
|
"#built-in-functions": [{
|
46
|
token: "support.function.sparql",
|
47
|
regex: /[Aa][Bb][Ss]|[Aa][Vv][Gg]|[Bb][Nn][Oo][Dd][Ee]|[Bb][Oo][Uu][Nn][Dd]|[Cc][Ee][Ii][Ll]|[Cc][Oo][Aa][Ll][Ee][Ss][Cc][Ee]|[Cc][Oo][Nn][Cc][Aa][Tt]|[Cc][Oo][Nn][Tt][Aa][Ii][Nn][Ss]|[Cc][Oo][Uu][Nn][Tt]|[Dd][Aa][Tt][Aa][Tt][Yy][Pp][Ee]|[Dd][Aa][Yy]|[Ee][Nn][Cc][Oo][Dd][Ee]_[Ff][Oo][Rr]_[Uu][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][Xx]|[Rr][Ee][Dd][Uu][Cc][Ee][Dd]|[Ss][Ee][Ll][Ee][Cc][Tt]|[Ss][Ee][Pp][Aa][Rr][Aa][Tt][Oo][Rr]|[Ss][Ee][Rr][Vv][Ii][Cc][Ee]|[Ss][Ii][Ll][Ee][Nn][Tt]|[Tt][Oo]|[Uu][Nn][Dd][Ee][Ff]|[Uu][Nn][Ii][Oo][Nn]|[Uu][Ss][Ii][Nn][Gg]|[Vv][Aa][Ll][Uu][Ee][Ss]|[Ww][He][Ee][Rr][Ee]|[Ww][Ii][Tt][Hh]/
|
59
|
}],
|
60
|
"#logic-operators": [{
|
61
|
token: "keyword.operator.logical.sparql",
|
62
|
regex: /\|\||&&|=|!=|<|>|<=|>=|(?:^|!?\s)IN(?:!?\s|$)|(?:^|!?\s)NOT(?:!?\s|$)|-|\+|\*|\/|\!/
|
63
|
}],
|
64
|
"#owl-types": [{
|
65
|
token: "support.type.datatype.owl.sparql",
|
66
|
regex: /owl:[a-zA-Z]+/
|
67
|
}],
|
68
|
"#punctuation-operators": [{
|
69
|
token: "keyword.operator.punctuation.sparql",
|
70
|
regex: /;|,|\.|\(|\)|\{|\}|\|/
|
71
|
}],
|
72
|
"#qnames": [{
|
73
|
token: "entity.name.other.qname.sparql",
|
74
|
regex: /(?:[a-zA-Z][-_a-zA-Z0-9]*)?:(?:[_a-zA-Z][-_a-zA-Z0-9]*)?/
|
75
|
}],
|
76
|
"#rdf-schema-types": [{
|
77
|
token: "support.type.datatype.rdf.schema.sparql",
|
78
|
regex: /rdfs?:[a-zA-Z]+|(?:^|\s)a(?:\s|$)/
|
79
|
}],
|
80
|
"#relative-urls": [{
|
81
|
token: "string.quoted.other.relative.url.sparql",
|
82
|
regex: /</,
|
83
|
push: [{
|
84
|
token: "string.quoted.other.relative.url.sparql",
|
85
|
regex: />/,
|
86
|
next: "pop"
|
87
|
}, {
|
88
|
defaultToken: "string.quoted.other.relative.url.sparql"
|
89
|
}]
|
90
|
}],
|
91
|
"#string-datatype-suffixes": [{
|
92
|
token: "keyword.operator.datatype.suffix.sparql",
|
93
|
regex: /\^\^/
|
94
|
}],
|
95
|
"#string-language-suffixes": [{
|
96
|
token: [
|
97
|
"keyword.operator.language.suffix.sparql",
|
98
|
"constant.language.suffix.sparql"
|
99
|
],
|
100
|
regex: /(?!")(@)([a-z]+(?:\-[a-z0-9]+)*)/
|
101
|
}],
|
102
|
"#strings": [{
|
103
|
token: "string.quoted.triple.sparql",
|
104
|
regex: /"""/,
|
105
|
push: [{
|
106
|
token: "string.quoted.triple.sparql",
|
107
|
regex: /"""/,
|
108
|
next: "pop"
|
109
|
}, {
|
110
|
defaultToken: "string.quoted.triple.sparql"
|
111
|
}]
|
112
|
}, {
|
113
|
token: "string.quoted.double.sparql",
|
114
|
regex: /"/,
|
115
|
push: [{
|
116
|
token: "string.quoted.double.sparql",
|
117
|
regex: /"/,
|
118
|
next: "pop"
|
119
|
}, {
|
120
|
token: "invalid.string.newline",
|
121
|
regex: /$/
|
122
|
}, {
|
123
|
token: "constant.character.escape.sparql",
|
124
|
regex: /\\./
|
125
|
}, {
|
126
|
defaultToken: "string.quoted.double.sparql"
|
127
|
}]
|
128
|
}],
|
129
|
"#variables": [{
|
130
|
token: "variable.other.sparql",
|
131
|
regex: /(?:\?|\$)[-_a-zA-Z0-9]+/
|
132
|
}],
|
133
|
"#xml-schema-types": [{
|
134
|
token: "support.type.datatype.schema.sparql",
|
135
|
regex: /xsd?:[a-z][a-zA-Z]+/
|
136
|
}]
|
137
|
};
|
138
|
|
139
|
this.normalizeRules();
|
140
|
};
|
141
|
|
142
|
SPARQLHighlightRules.metaData = {
|
143
|
fileTypes: ["rq", "sparql"],
|
144
|
name: "SPARQL",
|
145
|
scopeName: "source.sparql"
|
146
|
};
|
147
|
|
148
|
|
149
|
oop.inherits(SPARQLHighlightRules, TextHighlightRules);
|
150
|
|
151
|
exports.SPARQLHighlightRules = SPARQLHighlightRules;
|
152
|
});
|
153
|
|
154
|
ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
|
155
|
"use strict";
|
156
|
|
157
|
var oop = require("../../lib/oop");
|
158
|
var Range = require("../../range").Range;
|
159
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
160
|
|
161
|
var FoldMode = exports.FoldMode = function(commentRegex) {
|
162
|
if (commentRegex) {
|
163
|
this.foldingStartMarker = new RegExp(
|
164
|
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
|
165
|
);
|
166
|
this.foldingStopMarker = new RegExp(
|
167
|
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
|
168
|
);
|
169
|
}
|
170
|
};
|
171
|
oop.inherits(FoldMode, BaseFoldMode);
|
172
|
|
173
|
(function() {
|
174
|
|
175
|
this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
|
176
|
this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
|
177
|
this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
|
178
|
this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
|
179
|
this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
|
180
|
this._getFoldWidgetBase = this.getFoldWidget;
|
181
|
this.getFoldWidget = function(session, foldStyle, row) {
|
182
|
var line = session.getLine(row);
|
183
|
|
184
|
if (this.singleLineBlockCommentRe.test(line)) {
|
185
|
if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
|
186
|
return "";
|
187
|
}
|
188
|
|
189
|
var fw = this._getFoldWidgetBase(session, foldStyle, row);
|
190
|
|
191
|
if (!fw && this.startRegionRe.test(line))
|
192
|
return "start"; // lineCommentRegionStart
|
193
|
|
194
|
return fw;
|
195
|
};
|
196
|
|
197
|
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
|
198
|
var line = session.getLine(row);
|
199
|
|
200
|
if (this.startRegionRe.test(line))
|
201
|
return this.getCommentRegionBlock(session, line, row);
|
202
|
|
203
|
var match = line.match(this.foldingStartMarker);
|
204
|
if (match) {
|
205
|
var i = match.index;
|
206
|
|
207
|
if (match[1])
|
208
|
return this.openingBracketBlock(session, match[1], row, i);
|
209
|
|
210
|
var range = session.getCommentFoldRange(row, i + match[0].length, 1);
|
211
|
|
212
|
if (range && !range.isMultiLine()) {
|
213
|
if (forceMultiline) {
|
214
|
range = this.getSectionRange(session, row);
|
215
|
} else if (foldStyle != "all")
|
216
|
range = null;
|
217
|
}
|
218
|
|
219
|
return range;
|
220
|
}
|
221
|
|
222
|
if (foldStyle === "markbegin")
|
223
|
return;
|
224
|
|
225
|
var match = line.match(this.foldingStopMarker);
|
226
|
if (match) {
|
227
|
var i = match.index + match[0].length;
|
228
|
|
229
|
if (match[1])
|
230
|
return this.closingBracketBlock(session, match[1], row, i);
|
231
|
|
232
|
return session.getCommentFoldRange(row, i, -1);
|
233
|
}
|
234
|
};
|
235
|
|
236
|
this.getSectionRange = function(session, row) {
|
237
|
var line = session.getLine(row);
|
238
|
var startIndent = line.search(/\S/);
|
239
|
var startRow = row;
|
240
|
var startColumn = line.length;
|
241
|
row = row + 1;
|
242
|
var endRow = row;
|
243
|
var maxRow = session.getLength();
|
244
|
while (++row < maxRow) {
|
245
|
line = session.getLine(row);
|
246
|
var indent = line.search(/\S/);
|
247
|
if (indent === -1)
|
248
|
continue;
|
249
|
if (startIndent > indent)
|
250
|
break;
|
251
|
var subRange = this.getFoldWidgetRange(session, "all", row);
|
252
|
|
253
|
if (subRange) {
|
254
|
if (subRange.start.row <= startRow) {
|
255
|
break;
|
256
|
} else if (subRange.isMultiLine()) {
|
257
|
row = subRange.end.row;
|
258
|
} else if (startIndent == indent) {
|
259
|
break;
|
260
|
}
|
261
|
}
|
262
|
endRow = row;
|
263
|
}
|
264
|
|
265
|
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
|
266
|
};
|
267
|
this.getCommentRegionBlock = function(session, line, row) {
|
268
|
var startColumn = line.search(/\s*$/);
|
269
|
var maxRow = session.getLength();
|
270
|
var startRow = row;
|
271
|
|
272
|
var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
|
273
|
var depth = 1;
|
274
|
while (++row < maxRow) {
|
275
|
line = session.getLine(row);
|
276
|
var m = re.exec(line);
|
277
|
if (!m) continue;
|
278
|
if (m[1]) depth--;
|
279
|
else depth++;
|
280
|
|
281
|
if (!depth) break;
|
282
|
}
|
283
|
|
284
|
var endRow = row;
|
285
|
if (endRow > startRow) {
|
286
|
return new Range(startRow, startColumn, endRow, line.length);
|
287
|
}
|
288
|
};
|
289
|
|
290
|
}).call(FoldMode.prototype);
|
291
|
|
292
|
});
|
293
|
|
294
|
ace.define("ace/mode/sparql",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/sparql_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module) {
|
295
|
"use strict";
|
296
|
|
297
|
var oop = require("../lib/oop");
|
298
|
var TextMode = require("./text").Mode;
|
299
|
var SPARQLHighlightRules = require("./sparql_highlight_rules").SPARQLHighlightRules;
|
300
|
var FoldMode = require("./folding/cstyle").FoldMode;
|
301
|
|
302
|
var Mode = function() {
|
303
|
this.HighlightRules = SPARQLHighlightRules;
|
304
|
this.foldingRules = new FoldMode();
|
305
|
};
|
306
|
oop.inherits(Mode, TextMode);
|
307
|
|
308
|
(function() {
|
309
|
this.$id = "ace/mode/sparql";
|
310
|
}).call(Mode.prototype);
|
311
|
|
312
|
exports.Mode = Mode;
|
313
|
}); (function() {
|
314
|
ace.require(["ace/mode/sparql"], function(m) {
|
315
|
if (typeof module == "object" && typeof exports == "object" && module) {
|
316
|
module.exports = m;
|
317
|
}
|
318
|
});
|
319
|
})();
|
320
|
|