9e7b410d51fc77840842aea653f8aee1.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. ace.define("ace/mode/logtalk_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){/* THIS FILE WAS AUTOGENERATED FROM Logtalk.tmLanguage (UUID: C11FA1F2-6EDB-11D9-8798-000A95DAA580) */
  2. "use strict";
  3. var oop = require("../lib/oop");
  4. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  5. var LogtalkHighlightRules = function () {
  6. this.$rules = { start: [{ token: 'punctuation.definition.comment.logtalk',
  7. regex: '/\\*',
  8. push: [{ token: 'punctuation.definition.comment.logtalk',
  9. regex: '\\*/',
  10. next: 'pop' },
  11. { defaultToken: 'comment.block.logtalk' }] },
  12. { todo: 'fix grouping',
  13. token: ['comment.line.percentage.logtalk',
  14. 'punctuation.definition.comment.logtalk'],
  15. regex: '%.*$\\n?' },
  16. { todo: 'fix grouping',
  17. token: ['storage.type.opening.logtalk',
  18. 'punctuation.definition.storage.type.logtalk'],
  19. regex: ':-\\s(?:object|protocol|category|module)(?=[(])' },
  20. { todo: 'fix grouping',
  21. token: ['storage.type.closing.logtalk',
  22. 'punctuation.definition.storage.type.logtalk'],
  23. regex: ':-\\send_(?:object|protocol|category)(?=[.])' },
  24. { caseInsensitive: false,
  25. token: 'storage.type.relations.logtalk',
  26. regex: '\\b(?:complements|extends|i(?:nstantiates|mp(?:orts|lements))|specializes)(?=[(])' },
  27. { caseInsensitive: false,
  28. todo: 'fix grouping',
  29. token: ['storage.modifier.others.logtalk',
  30. 'punctuation.definition.storage.modifier.logtalk'],
  31. regex: ':-\\s(?:e(?:lse|ndif)|built_in|dynamic|synchronized|threaded)(?=[.])' },
  32. { caseInsensitive: false,
  33. todo: 'fix grouping',
  34. token: ['storage.modifier.others.logtalk',
  35. 'punctuation.definition.storage.modifier.logtalk'],
  36. regex: ':-\\s(?:c(?:alls|oinductive)|e(?:lif|n(?:coding|sure_loaded)|xport)|i(?:f|n(?:clude|itialization|fo))|reexport|set_(?:logtalk|prolog)_flag|uses)(?=[(])' },
  37. { caseInsensitive: false,
  38. todo: 'fix grouping',
  39. token: ['storage.modifier.others.logtalk',
  40. 'punctuation.definition.storage.modifier.logtalk'],
  41. regex: ':-\\s(?:alias|info|d(?:ynamic|iscontiguous)|m(?:eta_(?:non_terminal|predicate)|ode|ultifile)|p(?:ublic|r(?:otected|ivate))|op|use(?:s|_module)|synchronized)(?=[(])' },
  42. { token: 'keyword.operator.message-sending.logtalk',
  43. regex: '(:|::|\\^\\^)' },
  44. { token: 'keyword.operator.external-call.logtalk',
  45. regex: '([{}])' },
  46. { token: 'keyword.operator.mode.logtalk', regex: '(\\?|@)' },
  47. { token: 'keyword.operator.comparison.term.logtalk',
  48. regex: '(@=<|@<|@>|@>=|==|\\\\==)' },
  49. { token: 'keyword.operator.comparison.arithmetic.logtalk',
  50. regex: '(=<|<|>|>=|=:=|=\\\\=)' },
  51. { token: 'keyword.operator.bitwise.logtalk',
  52. regex: '(<<|>>|/\\\\|\\\\/|\\\\)' },
  53. { token: 'keyword.operator.evaluable.logtalk',
  54. regex: '\\b(?:e|pi|div|mod|rem)\\b(?![-!(^~])' },
  55. { token: 'keyword.operator.evaluable.logtalk',
  56. regex: '(\\*\\*|\\+|-|\\*|/|//)' },
  57. { token: 'keyword.operator.misc.logtalk',
  58. regex: '(:-|!|\\\\+|,|;|-->|->|=|\\=|\\.|=\\.\\.|\\^|\\bas\\b|\\bis\\b)' },
  59. { caseInsensitive: false,
  60. token: 'support.function.evaluable.logtalk',
  61. regex: '\\b(a(bs|cos|sin|tan|tan2)|c(eiling|os)|div|exp|flo(at(_(integer|fractional)_part)?|or)|log|m(ax|in|od)|r(em|ound)|s(i(n|gn)|qrt)|t(an|runcate)|xor)(?=[(])' },
  62. { token: 'support.function.control.logtalk',
  63. regex: '\\b(?:true|fa(?:il|lse)|repeat|(?:instantiation|system)_error)\\b(?![-!(^~])' },
  64. { token: 'support.function.control.logtalk',
  65. regex: '\\b((?:type|domain|existence|permission|representation|evaluation|resource|syntax)_error)(?=[(])' },
  66. { token: 'support.function.control.logtalk',
  67. regex: '\\b(?:ca(?:ll|tch)|ignore|throw|once)(?=[(])' },
  68. { token: 'support.function.chars-and-bytes-io.logtalk',
  69. regex: '\\b(?:(?:get|p(?:eek|ut))_(c(?:har|ode)|byte)|nl)(?=[(])' },
  70. { token: 'support.function.chars-and-bytes-io.logtalk',
  71. regex: '\\bnl\\b' },
  72. { token: 'support.function.atom-term-processing.logtalk',
  73. regex: '\\b(?:atom_(?:length|c(?:hars|o(?:ncat|des)))|sub_atom|char_code|number_c(?:har|ode)s)(?=[(])' },
  74. { caseInsensitive: false,
  75. token: 'support.function.term-testing.logtalk',
  76. regex: '\\b(?:var|atom(ic)?|integer|float|c(?:allable|ompound)|n(?:onvar|umber)|ground|acyclic_term)(?=[(])' },
  77. { token: 'support.function.term-comparison.logtalk',
  78. regex: '\\b(compare)(?=[(])' },
  79. { token: 'support.function.term-io.logtalk',
  80. regex: '\\b(?:read(_term)?|write(?:q|_(?:canonical|term))?|(current_)?(?:char_conversion|op))(?=[(])' },
  81. { caseInsensitive: false,
  82. token: 'support.function.term-creation-and-decomposition.logtalk',
  83. regex: '\\b(arg|copy_term|functor|numbervars|term_variables)(?=[(])' },
  84. { caseInsensitive: false,
  85. token: 'support.function.term-unification.logtalk',
  86. regex: '\\b(subsumes_term|unify_with_occurs_check)(?=[(])' },
  87. { caseInsensitive: false,
  88. token: 'support.function.stream-selection-and-control.logtalk',
  89. regex: '\\b(?:(?:se|curren)t_(?:in|out)put|open|close|flush_output|stream_property|at_end_of_stream|set_stream_position)(?=[(])' },
  90. { token: 'support.function.stream-selection-and-control.logtalk',
  91. regex: '\\b(?:flush_output|at_end_of_stream)\\b' },
  92. { token: 'support.function.prolog-flags.logtalk',
  93. regex: '\\b((?:se|curren)t_prolog_flag)(?=[(])' },
  94. { token: 'support.function.compiling-and-loading.logtalk',
  95. regex: '\\b(logtalk_(?:compile|l(?:ibrary_path|oad|oad_context)|make(_target_action)?))(?=[(])' },
  96. { token: 'support.function.compiling-and-loading.logtalk',
  97. regex: '\\b(logtalk_make)\\b' },
  98. { caseInsensitive: false,
  99. token: 'support.function.event-handling.logtalk',
  100. regex: '\\b(?:(?:abolish|define)_events|current_event)(?=[(])' },
  101. { token: 'support.function.implementation-defined-hooks.logtalk',
  102. regex: '\\b(?:(?:create|current|set)_logtalk_flag|halt)(?=[(])' },
  103. { token: 'support.function.implementation-defined-hooks.logtalk',
  104. regex: '\\b(halt)\\b' },
  105. { token: 'support.function.sorting.logtalk',
  106. regex: '\\b((key)?(sort))(?=[(])' },
  107. { caseInsensitive: false,
  108. token: 'support.function.entity-creation-and-abolishing.logtalk',
  109. regex: '\\b((c(?:reate|urrent)|abolish)_(?:object|protocol|category))(?=[(])' },
  110. { caseInsensitive: false,
  111. token: 'support.function.reflection.logtalk',
  112. regex: '\\b((object|protocol|category)_property|co(mplements_object|nforms_to_protocol)|extends_(object|protocol|category)|imp(orts_category|lements_protocol)|(instantiat|specializ)es_class)(?=[(])' },
  113. { token: 'support.function.logtalk',
  114. regex: '\\b((?:for|retract)all)(?=[(])' },
  115. { caseInsensitive: false,
  116. token: 'support.function.execution-context.logtalk',
  117. regex: '\\b(?:context|parameter|se(?:lf|nder)|this)(?=[(])' },
  118. { token: 'support.function.database.logtalk',
  119. regex: '\\b(?:a(?:bolish|ssert(?:a|z))|clause|retract(all)?)(?=[(])' },
  120. { token: 'support.function.all-solutions.logtalk',
  121. regex: '\\b((?:bag|set)of|f(?:ind|or)all)(?=[(])' },
  122. { caseInsensitive: false,
  123. token: 'support.function.multi-threading.logtalk',
  124. regex: '\\b(threaded(_(call|once|ignore|exit|peek|wait|notify))?)(?=[(])' },
  125. { caseInsensitive: false,
  126. token: 'support.function.engines.logtalk',
  127. regex: '\\b(threaded_engine(_(create|destroy|self|next(?:_reified)?|yield|post|fetch))?)(?=[(])' },
  128. { caseInsensitive: false,
  129. token: 'support.function.reflection.logtalk',
  130. regex: '\\b(?:current_predicate|predicate_property)(?=[(])' },
  131. { token: 'support.function.event-handler.logtalk',
  132. regex: '\\b(?:before|after)(?=[(])' },
  133. { token: 'support.function.message-forwarding-handler.logtalk',
  134. regex: '\\b(forward)(?=[(])' },
  135. { token: 'support.function.grammar-rule.logtalk',
  136. regex: '\\b(?:expand_(?:goal|term)|(?:goal|term)_expansion|phrase)(?=[(])' },
  137. { token: 'punctuation.definition.string.begin.logtalk',
  138. regex: '\'',
  139. push: [{ token: 'constant.character.escape.logtalk',
  140. regex: '\\\\([\\\\abfnrtv"\']|(x[a-fA-F0-9]+|[0-7]+)\\\\)' },
  141. { token: 'punctuation.definition.string.end.logtalk',
  142. regex: '\'',
  143. next: 'pop' },
  144. { defaultToken: 'string.quoted.single.logtalk' }] },
  145. { token: 'punctuation.definition.string.begin.logtalk',
  146. regex: '"',
  147. push: [{ token: 'constant.character.escape.logtalk', regex: '\\\\.' },
  148. { token: 'punctuation.definition.string.end.logtalk',
  149. regex: '"',
  150. next: 'pop' },
  151. { defaultToken: 'string.quoted.double.logtalk' }] },
  152. { token: 'constant.numeric.logtalk',
  153. regex: '\\b(0b[0-1]+|0o[0-7]+|0x[0-9a-fA-F]+)\\b' },
  154. { token: 'constant.numeric.logtalk',
  155. regex: '\\b(0\'\\\\.|0\'.|0\'\'|0\'")' },
  156. { token: 'constant.numeric.logtalk',
  157. regex: '\\b(\\d+\\.?\\d*((e|E)(\\+|-)?\\d+)?)\\b' },
  158. { token: 'variable.other.logtalk',
  159. regex: '\\b([A-Z_][A-Za-z0-9_]*)\\b' }] };
  160. this.normalizeRules();
  161. };
  162. oop.inherits(LogtalkHighlightRules, TextHighlightRules);
  163. exports.LogtalkHighlightRules = LogtalkHighlightRules;
  164. });
  165. 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";
  166. var oop = require("../../lib/oop");
  167. var Range = require("../../range").Range;
  168. var BaseFoldMode = require("./fold_mode").FoldMode;
  169. var FoldMode = exports.FoldMode = function (commentRegex) {
  170. if (commentRegex) {
  171. this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start));
  172. this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end));
  173. }
  174. };
  175. oop.inherits(FoldMode, BaseFoldMode);
  176. (function () {
  177. this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
  178. this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
  179. this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/;
  180. this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
  181. this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
  182. this._getFoldWidgetBase = this.getFoldWidget;
  183. this.getFoldWidget = function (session, foldStyle, row) {
  184. var line = session.getLine(row);
  185. if (this.singleLineBlockCommentRe.test(line)) {
  186. if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
  187. return "";
  188. }
  189. var fw = this._getFoldWidgetBase(session, foldStyle, row);
  190. if (!fw && this.startRegionRe.test(line))
  191. return "start"; // lineCommentRegionStart
  192. return fw;
  193. };
  194. this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) {
  195. var line = session.getLine(row);
  196. if (this.startRegionRe.test(line))
  197. return this.getCommentRegionBlock(session, line, row);
  198. var match = line.match(this.foldingStartMarker);
  199. if (match) {
  200. var i = match.index;
  201. if (match[1])
  202. return this.openingBracketBlock(session, match[1], row, i);
  203. var range = session.getCommentFoldRange(row, i + match[0].length, 1);
  204. if (range && !range.isMultiLine()) {
  205. if (forceMultiline) {
  206. range = this.getSectionRange(session, row);
  207. }
  208. else if (foldStyle != "all")
  209. range = null;
  210. }
  211. return range;
  212. }
  213. if (foldStyle === "markbegin")
  214. return;
  215. var match = line.match(this.foldingStopMarker);
  216. if (match) {
  217. var i = match.index + match[0].length;
  218. if (match[1])
  219. return this.closingBracketBlock(session, match[1], row, i);
  220. return session.getCommentFoldRange(row, i, -1);
  221. }
  222. };
  223. this.getSectionRange = function (session, row) {
  224. var line = session.getLine(row);
  225. var startIndent = line.search(/\S/);
  226. var startRow = row;
  227. var startColumn = line.length;
  228. row = row + 1;
  229. var endRow = row;
  230. var maxRow = session.getLength();
  231. while (++row < maxRow) {
  232. line = session.getLine(row);
  233. var indent = line.search(/\S/);
  234. if (indent === -1)
  235. continue;
  236. if (startIndent > indent)
  237. break;
  238. var subRange = this.getFoldWidgetRange(session, "all", row);
  239. if (subRange) {
  240. if (subRange.start.row <= startRow) {
  241. break;
  242. }
  243. else if (subRange.isMultiLine()) {
  244. row = subRange.end.row;
  245. }
  246. else if (startIndent == indent) {
  247. break;
  248. }
  249. }
  250. endRow = row;
  251. }
  252. return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
  253. };
  254. this.getCommentRegionBlock = function (session, line, row) {
  255. var startColumn = line.search(/\s*$/);
  256. var maxRow = session.getLength();
  257. var startRow = row;
  258. var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
  259. var depth = 1;
  260. while (++row < maxRow) {
  261. line = session.getLine(row);
  262. var m = re.exec(line);
  263. if (!m)
  264. continue;
  265. if (m[1])
  266. depth--;
  267. else
  268. depth++;
  269. if (!depth)
  270. break;
  271. }
  272. var endRow = row;
  273. if (endRow > startRow) {
  274. return new Range(startRow, startColumn, endRow, line.length);
  275. }
  276. };
  277. }).call(FoldMode.prototype);
  278. });
  279. ace.define("ace/mode/logtalk",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/logtalk_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module){/*
  280. THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
  281. */
  282. "use strict";
  283. var oop = require("../lib/oop");
  284. var TextMode = require("./text").Mode;
  285. var Tokenizer = require("../tokenizer").Tokenizer;
  286. var LogtalkHighlightRules = require("./logtalk_highlight_rules").LogtalkHighlightRules;
  287. var FoldMode = require("./folding/cstyle").FoldMode;
  288. var Mode = function () {
  289. this.HighlightRules = LogtalkHighlightRules;
  290. this.foldingRules = new FoldMode();
  291. this.$behaviour = this.$defaultBehaviour;
  292. };
  293. oop.inherits(Mode, TextMode);
  294. (function () {
  295. this.lineCommentStart = "%";
  296. this.blockComment = { start: "/*", end: "*/" };
  297. this.$id = "ace/mode/logtalk";
  298. }).call(Mode.prototype);
  299. exports.Mode = Mode;
  300. }); (function() {
  301. ace.require(["ace/mode/logtalk"], function(m) {
  302. if (typeof module == "object" && typeof exports == "object" && module) {
  303. module.exports = m;
  304. }
  305. });
  306. })();