8a8a1644af027b4abdb3d6083c9955d8.js 13 KB

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