e86b459e406840ac8eaf63fcfcf817e5.js 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  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. 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";
  122. var oop = require("../../lib/oop");
  123. var Range = require("../../range").Range;
  124. var BaseFoldMode = require("./fold_mode").FoldMode;
  125. var FoldMode = exports.FoldMode = function (commentRegex) {
  126. if (commentRegex) {
  127. this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start));
  128. this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end));
  129. }
  130. };
  131. oop.inherits(FoldMode, BaseFoldMode);
  132. (function () {
  133. this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
  134. this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
  135. this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/;
  136. this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
  137. this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
  138. this._getFoldWidgetBase = this.getFoldWidget;
  139. this.getFoldWidget = function (session, foldStyle, row) {
  140. var line = session.getLine(row);
  141. if (this.singleLineBlockCommentRe.test(line)) {
  142. if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
  143. return "";
  144. }
  145. var fw = this._getFoldWidgetBase(session, foldStyle, row);
  146. if (!fw && this.startRegionRe.test(line))
  147. return "start"; // lineCommentRegionStart
  148. return fw;
  149. };
  150. this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) {
  151. var line = session.getLine(row);
  152. if (this.startRegionRe.test(line))
  153. return this.getCommentRegionBlock(session, line, row);
  154. var match = line.match(this.foldingStartMarker);
  155. if (match) {
  156. var i = match.index;
  157. if (match[1])
  158. return this.openingBracketBlock(session, match[1], row, i);
  159. var range = session.getCommentFoldRange(row, i + match[0].length, 1);
  160. if (range && !range.isMultiLine()) {
  161. if (forceMultiline) {
  162. range = this.getSectionRange(session, row);
  163. }
  164. else if (foldStyle != "all")
  165. range = null;
  166. }
  167. return range;
  168. }
  169. if (foldStyle === "markbegin")
  170. return;
  171. var match = line.match(this.foldingStopMarker);
  172. if (match) {
  173. var i = match.index + match[0].length;
  174. if (match[1])
  175. return this.closingBracketBlock(session, match[1], row, i);
  176. return session.getCommentFoldRange(row, i, -1);
  177. }
  178. };
  179. this.getSectionRange = function (session, row) {
  180. var line = session.getLine(row);
  181. var startIndent = line.search(/\S/);
  182. var startRow = row;
  183. var startColumn = line.length;
  184. row = row + 1;
  185. var endRow = row;
  186. var maxRow = session.getLength();
  187. while (++row < maxRow) {
  188. line = session.getLine(row);
  189. var indent = line.search(/\S/);
  190. if (indent === -1)
  191. continue;
  192. if (startIndent > indent)
  193. break;
  194. var subRange = this.getFoldWidgetRange(session, "all", row);
  195. if (subRange) {
  196. if (subRange.start.row <= startRow) {
  197. break;
  198. }
  199. else if (subRange.isMultiLine()) {
  200. row = subRange.end.row;
  201. }
  202. else if (startIndent == indent) {
  203. break;
  204. }
  205. }
  206. endRow = row;
  207. }
  208. return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
  209. };
  210. this.getCommentRegionBlock = function (session, line, row) {
  211. var startColumn = line.search(/\s*$/);
  212. var maxRow = session.getLength();
  213. var startRow = row;
  214. var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
  215. var depth = 1;
  216. while (++row < maxRow) {
  217. line = session.getLine(row);
  218. var m = re.exec(line);
  219. if (!m)
  220. continue;
  221. if (m[1])
  222. depth--;
  223. else
  224. depth++;
  225. if (!depth)
  226. break;
  227. }
  228. var endRow = row;
  229. if (endRow > startRow) {
  230. return new Range(startRow, startColumn, endRow, line.length);
  231. }
  232. };
  233. }).call(FoldMode.prototype);
  234. });
  235. 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){/*
  236. THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
  237. */
  238. "use strict";
  239. var oop = require("../lib/oop");
  240. var TextMode = require("./text").Mode;
  241. var TurtleHighlightRules = require("./turtle_highlight_rules").TurtleHighlightRules;
  242. var FoldMode = require("./folding/cstyle").FoldMode;
  243. var Mode = function () {
  244. this.HighlightRules = TurtleHighlightRules;
  245. this.foldingRules = new FoldMode();
  246. };
  247. oop.inherits(Mode, TextMode);
  248. (function () {
  249. this.$id = "ace/mode/turtle";
  250. }).call(Mode.prototype);
  251. exports.Mode = Mode;
  252. }); (function() {
  253. ace.require(["ace/mode/turtle"], function(m) {
  254. if (typeof module == "object" && typeof exports == "object" && module) {
  255. module.exports = m;
  256. }
  257. });
  258. })();