Debian Codegraph @

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

raw symbols SCIP
1 ace.define("ace/mode/turtle_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){/* This file was autogenerated from turtle.tmLanguage (uuid: ) */
2 "use strict";
3 var oop = require("../lib/oop");
4 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
5 var TurtleHighlightRules = function () {
6 this.$rules = {
7 start: [{
8 include: "#comments"
9 }, {
10 include: "#strings"
11 }, {
12 include: "#base-prefix-declarations"
13 }, {
14 include: "#string-language-suffixes"
15 }, {
16 include: "#string-datatype-suffixes"
17 }, {
18 include: "#relative-urls"
19 }, {
20 include: "#xml-schema-types"
21 }, {
22 include: "#rdf-schema-types"
23 }, {
24 include: "#owl-types"
25 }, {
26 include: "#qnames"
27 }, {
28 include: "#punctuation-operators"
29 }],
30 "#base-prefix-declarations": [{
31 token: "keyword.other.prefix.turtle",
32 regex: /@(?:base|prefix)/
33 }],
34 "#comments": [{
35 token: [
36 "punctuation.definition.comment.turtle",
37 "comment.line.hash.turtle"
38 ],
39 regex: /(#)(.*$)/
40 }],
41 "#owl-types": [{
42 token: "support.type.datatype.owl.turtle",
43 regex: /owl:[a-zA-Z]+/
44 }],
45 "#punctuation-operators": [{
46 token: "keyword.operator.punctuation.turtle",
47 regex: /;|,|\.|\(|\)|\[|\]/
48 }],
49 "#qnames": [{
50 token: "entity.name.other.qname.turtle",
51 regex: /(?:[a-zA-Z][-_a-zA-Z0-9]*)?:(?:[_a-zA-Z][-_a-zA-Z0-9]*)?/
52 }],
53 "#rdf-schema-types": [{
54 token: "support.type.datatype.rdf.schema.turtle",
55 regex: /rdfs?:[a-zA-Z]+|(?:^|\s)a(?:\s|$)/
56 }],
57 "#relative-urls": [{
58 token: "string.quoted.other.relative.url.turtle",
59 regex: /</,
60 push: [{
61 token: "string.quoted.other.relative.url.turtle",
62 regex: />/,
63 next: "pop"
64 }, {
65 defaultToken: "string.quoted.other.relative.url.turtle"
66 }]
67 }],
68 "#string-datatype-suffixes": [{
69 token: "keyword.operator.datatype.suffix.turtle",
70 regex: /\^\^/
71 }],
72 "#string-language-suffixes": [{
73 token: [
74 "keyword.operator.language.suffix.turtle",
75 "constant.language.suffix.turtle"
76 ],
77 regex: /(?!")(@)([a-z]+(?:\-[a-z0-9]+)*)/
78 }],
79 "#strings": [{
80 token: "string.quoted.triple.turtle",
81 regex: /"""/,
82 push: [{
83 token: "string.quoted.triple.turtle",
84 regex: /"""/,
85 next: "pop"
86 }, {
87 defaultToken: "string.quoted.triple.turtle"
88 }]
89 }, {
90 token: "string.quoted.double.turtle",
91 regex: /"/,
92 push: [{
93 token: "string.quoted.double.turtle",
94 regex: /"/,
95 next: "pop"
96 }, {
97 token: "invalid.string.newline",
98 regex: /$/
99 }, {
100 token: "constant.character.escape.turtle",
101 regex: /\\./
102 }, {
103 defaultToken: "string.quoted.double.turtle"
104 }]
105 }],
106 "#xml-schema-types": [{
107 token: "support.type.datatype.xml.schema.turtle",
108 regex: /xsd?:[a-z][a-zA-Z]+/
109 }]
110 };
111 this.normalizeRules();
112 };
113 TurtleHighlightRules.metaData = {
114 fileTypes: ["ttl", "nt"],
115 name: "Turtle",
116 scopeName: "source.turtle"
117 };
118 oop.inherits(TurtleHighlightRules, TextHighlightRules);
119 exports.TurtleHighlightRules = TurtleHighlightRules;
120
121 });
122
123 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";
124 var oop = require("../../lib/oop");
125 var Range = require("../../range").Range;
126 var BaseFoldMode = require("./fold_mode").FoldMode;
127 var FoldMode = exports.FoldMode = function (commentRegex) {
128 if (commentRegex) {
129 this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start));
130 this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end));
131 }
132 };
133 oop.inherits(FoldMode, BaseFoldMode);
134 (function () {
135 this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
136 this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
137 this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/;
138 this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
139 this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
140 this._getFoldWidgetBase = this.getFoldWidget;
141 this.getFoldWidget = function (session, foldStyle, row) {
142 var line = session.getLine(row);
143 if (this.singleLineBlockCommentRe.test(line)) {
144 if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
145 return "";
146 }
147 var fw = this._getFoldWidgetBase(session, foldStyle, row);
148 if (!fw && this.startRegionRe.test(line))
149 return "start"; // lineCommentRegionStart
150 return fw;
151 };
152 this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) {
153 var line = session.getLine(row);
154 if (this.startRegionRe.test(line))
155 return this.getCommentRegionBlock(session, line, row);
156 var match = line.match(this.foldingStartMarker);
157 if (match) {
158 var i = match.index;
159 if (match[1])
160 return this.openingBracketBlock(session, match[1], row, i);
161 var range = session.getCommentFoldRange(row, i + match[0].length, 1);
162 if (range && !range.isMultiLine()) {
163 if (forceMultiline) {
164 range = this.getSectionRange(session, row);
165 }
166 else if (foldStyle != "all")
167 range = null;
168 }
169 return range;
170 }
171 if (foldStyle === "markbegin")
172 return;
173 var match = line.match(this.foldingStopMarker);
174 if (match) {
175 var i = match.index + match[0].length;
176 if (match[1])
177 return this.closingBracketBlock(session, match[1], row, i);
178 return session.getCommentFoldRange(row, i, -1);
179 }
180 };
181 this.getSectionRange = function (session, row) {
182 var line = session.getLine(row);
183 var startIndent = line.search(/\S/);
184 var startRow = row;
185 var startColumn = line.length;
186 row = row + 1;
187 var endRow = row;
188 var maxRow = session.getLength();
189 while (++row < maxRow) {
190 line = session.getLine(row);
191 var indent = line.search(/\S/);
192 if (indent === -1)
193 continue;
194 if (startIndent > indent)
195 break;
196 var subRange = this.getFoldWidgetRange(session, "all", row);
197 if (subRange) {
198 if (subRange.start.row <= startRow) {
199 break;
200 }
201 else if (subRange.isMultiLine()) {
202 row = subRange.end.row;
203 }
204 else if (startIndent == indent) {
205 break;
206 }
207 }
208 endRow = row;
209 }
210 return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
211 };
212 this.getCommentRegionBlock = function (session, line, row) {
213 var startColumn = line.search(/\s*$/);
214 var maxRow = session.getLength();
215 var startRow = row;
216 var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
217 var depth = 1;
218 while (++row < maxRow) {
219 line = session.getLine(row);
220 var m = re.exec(line);
221 if (!m)
222 continue;
223 if (m[1])
224 depth--;
225 else
226 depth++;
227 if (!depth)
228 break;
229 }
230 var endRow = row;
231 if (endRow > startRow) {
232 return new Range(startRow, startColumn, endRow, line.length);
233 }
234 };
235 }).call(FoldMode.prototype);
236
237 });
238
239 ace.define("ace/mode/turtle",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/turtle_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module){/*
240 THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
241 */
242 "use strict";
243 var oop = require("../lib/oop");
244 var TextMode = require("./text").Mode;
245 var TurtleHighlightRules = require("./turtle_highlight_rules").TurtleHighlightRules;
246 var FoldMode = require("./folding/cstyle").FoldMode;
247 var Mode = function () {
248 this.HighlightRules = TurtleHighlightRules;
249 this.foldingRules = new FoldMode();
250 };
251 oop.inherits(Mode, TextMode);
252 (function () {
253 this.$id = "ace/mode/turtle";
254 }).call(Mode.prototype);
255 exports.Mode = Mode;
256
257 }); (function() {
258 ace.require(["ace/mode/turtle"], function(m) {
259 if (typeof module == "object" && typeof exports == "object" && module) {
260 module.exports = m;
261 }
262 });
263 })();
264