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