| 1 |
ace.define("ace/mode/doc_comment_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 DocCommentHighlightRules = function () { |
| 5 |
this.$rules = { |
| 6 |
"start": [ |
| 7 |
{ |
| 8 |
token: "comment.doc.tag", |
| 9 |
regex: "@\\w+(?=\\s|$)" |
| 10 |
}, DocCommentHighlightRules.getTagRule(), { |
| 11 |
defaultToken: "comment.doc", |
| 12 |
caseInsensitive: true |
| 13 |
} |
| 14 |
] |
| 15 |
}; |
| 16 |
}; |
| 17 |
oop.inherits(DocCommentHighlightRules, TextHighlightRules); |
| 18 |
DocCommentHighlightRules.getTagRule = function (start) { |
| 19 |
return { |
| 20 |
token: "comment.doc.tag.storage.type", |
| 21 |
regex: "\\b(?:TODO|FIXME|XXX|HACK)\\b" |
| 22 |
}; |
| 23 |
}; |
| 24 |
DocCommentHighlightRules.getStartRule = function (start) { |
| 25 |
return { |
| 26 |
token: "comment.doc", |
| 27 |
regex: "\\/\\*(?=\\*)", |
| 28 |
next: start |
| 29 |
}; |
| 30 |
}; |
| 31 |
DocCommentHighlightRules.getEndRule = function (start) { |
| 32 |
return { |
| 33 |
token: "comment.doc", |
| 34 |
regex: "\\*\\/", |
| 35 |
next: start |
| 36 |
}; |
| 37 |
}; |
| 38 |
exports.DocCommentHighlightRules = DocCommentHighlightRules; |
| 39 |
|
| 40 |
}); |
| 41 |
|
| 42 |
ace.define("ace/mode/csharp_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict"; |
| 43 |
var oop = require("../lib/oop"); |
| 44 |
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; |
| 45 |
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; |
| 46 |
var CSharpHighlightRules = function () { |
| 47 |
var keywordMapper = this.createKeywordMapper({ |
| 48 |
"variable.language": "this", |
| 49 |
"keyword": "abstract|async|await|event|new|struct|as|explicit|null|switch|base|extern|object|this|bool|false|operator|throw|break|finally|out|true|byte|fixed|override|try|case|float|params|typeof|catch|for|private|uint|char|foreach|protected|ulong|checked|goto|public|unchecked|class|if|readonly|unsafe|const|implicit|ref|ushort|continue|in|return|using|decimal|int|sbyte|virtual|default|interface|sealed|volatile|delegate|internal|partial|short|void|do|is|sizeof|while|double|lock|stackalloc|else|long|static|enum|namespace|string|var|dynamic", |
| 50 |
"constant.language": "null|true|false" |
| 51 |
}, "identifier"); |
| 52 |
this.$rules = { |
| 53 |
"start": [ |
| 54 |
{ |
| 55 |
token: "comment", |
| 56 |
regex: "\\/\\/.*$" |
| 57 |
}, |
| 58 |
DocCommentHighlightRules.getStartRule("doc-start"), |
| 59 |
{ |
| 60 |
token: "comment", |
| 61 |
regex: "\\/\\*", |
| 62 |
next: "comment" |
| 63 |
}, { |
| 64 |
token: "string", |
| 65 |
regex: /'(?:.|\\(:?u[\da-fA-F]+|x[\da-fA-F]+|[tbrf'"n]))?'/ |
| 66 |
}, { |
| 67 |
token: "string", start: '"', end: '"|$', next: [ |
| 68 |
{ token: "constant.language.escape", regex: /\\(:?u[\da-fA-F]+|x[\da-fA-F]+|[tbrf'"n])/ }, |
| 69 |
{ token: "invalid", regex: /\\./ } |
| 70 |
] |
| 71 |
}, { |
| 72 |
token: "string", start: '@"', end: '"', next: [ |
| 73 |
{ token: "constant.language.escape", regex: '""' } |
| 74 |
] |
| 75 |
}, { |
| 76 |
token: "string", start: /\$"/, end: '"|$', next: [ |
| 77 |
{ token: "constant.language.escape", regex: /\\(:?$)|{{/ }, |
| 78 |
{ token: "constant.language.escape", regex: /\\(:?u[\da-fA-F]+|x[\da-fA-F]+|[tbrf'"n])/ }, |
| 79 |
{ token: "invalid", regex: /\\./ } |
| 80 |
] |
| 81 |
}, { |
| 82 |
token: "constant.numeric", |
| 83 |
regex: "0[xX][0-9a-fA-F]+\\b" |
| 84 |
}, { |
| 85 |
token: "constant.numeric", |
| 86 |
regex: "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" |
| 87 |
}, { |
| 88 |
token: "constant.language.boolean", |
| 89 |
regex: "(?:true|false)\\b" |
| 90 |
}, { |
| 91 |
token: keywordMapper, |
| 92 |
regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" |
| 93 |
}, { |
| 94 |
token: "keyword.operator", |
| 95 |
regex: "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" |
| 96 |
}, { |
| 97 |
token: "keyword", |
| 98 |
regex: "^\\s*#(if|else|elif|endif|define|undef|warning|error|line|region|endregion|pragma)" |
| 99 |
}, { |
| 100 |
token: "punctuation.operator", |
| 101 |
regex: "\\?|\\:|\\,|\\;|\\." |
| 102 |
}, { |
| 103 |
token: "paren.lparen", |
| 104 |
regex: "[[({]" |
| 105 |
}, { |
| 106 |
token: "paren.rparen", |
| 107 |
regex: "[\\])}]" |
| 108 |
}, { |
| 109 |
token: "text", |
| 110 |
regex: "\\s+" |
| 111 |
} |
| 112 |
], |
| 113 |
"comment": [ |
| 114 |
{ |
| 115 |
token: "comment", |
| 116 |
regex: "\\*\\/", |
| 117 |
next: "start" |
| 118 |
}, { |
| 119 |
defaultToken: "comment" |
| 120 |
} |
| 121 |
] |
| 122 |
}; |
| 123 |
this.embedRules(DocCommentHighlightRules, "doc-", [DocCommentHighlightRules.getEndRule("start")]); |
| 124 |
this.normalizeRules(); |
| 125 |
}; |
| 126 |
oop.inherits(CSharpHighlightRules, TextHighlightRules); |
| 127 |
exports.CSharpHighlightRules = CSharpHighlightRules; |
| 128 |
|
| 129 |
}); |
| 130 |
|
| 131 |
ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module){"use strict"; |
| 132 |
var Range = require("../range").Range; |
| 133 |
var MatchingBraceOutdent = function () { }; |
| 134 |
(function () { |
| 135 |
this.checkOutdent = function (line, input) { |
| 136 |
if (!/^\s+$/.test(line)) |
| 137 |
return false; |
| 138 |
return /^\s*\}/.test(input); |
| 139 |
}; |
| 140 |
this.autoOutdent = function (doc, row) { |
| 141 |
var line = doc.getLine(row); |
| 142 |
var match = line.match(/^(\s*\})/); |
| 143 |
if (!match) |
| 144 |
return 0; |
| 145 |
var column = match[1].length; |
| 146 |
var openBracePos = doc.findMatchingBracket({ row: row, column: column }); |
| 147 |
if (!openBracePos || openBracePos.row == row) |
| 148 |
return 0; |
| 149 |
var indent = this.$getIndent(doc.getLine(openBracePos.row)); |
| 150 |
doc.replace(new Range(row, 0, row, column - 1), indent); |
| 151 |
}; |
| 152 |
this.$getIndent = function (line) { |
| 153 |
return line.match(/^\s*/)[0]; |
| 154 |
}; |
| 155 |
}).call(MatchingBraceOutdent.prototype); |
| 156 |
exports.MatchingBraceOutdent = MatchingBraceOutdent; |
| 157 |
|
| 158 |
}); |
| 159 |
|
| 160 |
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"; |
| 161 |
var oop = require("../../lib/oop"); |
| 162 |
var Range = require("../../range").Range; |
| 163 |
var BaseFoldMode = require("./fold_mode").FoldMode; |
| 164 |
var FoldMode = exports.FoldMode = function (commentRegex) { |
| 165 |
if (commentRegex) { |
| 166 |
this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)); |
| 167 |
this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)); |
| 168 |
} |
| 169 |
}; |
| 170 |
oop.inherits(FoldMode, BaseFoldMode); |
| 171 |
(function () { |
| 172 |
this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/; |
| 173 |
this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/; |
| 174 |
this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/; |
| 175 |
this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/; |
| 176 |
this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/; |
| 177 |
this._getFoldWidgetBase = this.getFoldWidget; |
| 178 |
this.getFoldWidget = function (session, foldStyle, row) { |
| 179 |
var line = session.getLine(row); |
| 180 |
if (this.singleLineBlockCommentRe.test(line)) { |
| 181 |
if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line)) |
| 182 |
return ""; |
| 183 |
} |
| 184 |
var fw = this._getFoldWidgetBase(session, foldStyle, row); |
| 185 |
if (!fw && this.startRegionRe.test(line)) |
| 186 |
return "start"; |
| 187 |
return fw; |
| 188 |
}; |
| 189 |
this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) { |
| 190 |
var line = session.getLine(row); |
| 191 |
if (this.startRegionRe.test(line)) |
| 192 |
return this.getCommentRegionBlock(session, line, row); |
| 193 |
var match = line.match(this.foldingStartMarker); |
| 194 |
if (match) { |
| 195 |
var i = match.index; |
| 196 |
if (match[1]) |
| 197 |
return this.openingBracketBlock(session, match[1], row, i); |
| 198 |
var range = session.getCommentFoldRange(row, i + match[0].length, 1); |
| 199 |
if (range && !range.isMultiLine()) { |
| 200 |
if (forceMultiline) { |
| 201 |
range = this.getSectionRange(session, row); |
| 202 |
} |
| 203 |
else if (foldStyle != "all") |
| 204 |
range = null; |
| 205 |
} |
| 206 |
return range; |
| 207 |
} |
| 208 |
if (foldStyle === "markbegin") |
| 209 |
return; |
| 210 |
var match = line.match(this.foldingStopMarker); |
| 211 |
if (match) { |
| 212 |
var i = match.index + match[0].length; |
| 213 |
if (match[1]) |
| 214 |
return this.closingBracketBlock(session, match[1], row, i); |
| 215 |
return session.getCommentFoldRange(row, i, -1); |
| 216 |
} |
| 217 |
}; |
| 218 |
this.getSectionRange = function (session, row) { |
| 219 |
var line = session.getLine(row); |
| 220 |
var startIndent = line.search(/\S/); |
| 221 |
var startRow = row; |
| 222 |
var startColumn = line.length; |
| 223 |
row = row + 1; |
| 224 |
var endRow = row; |
| 225 |
var maxRow = session.getLength(); |
| 226 |
while (++row < maxRow) { |
| 227 |
line = session.getLine(row); |
| 228 |
var indent = line.search(/\S/); |
| 229 |
if (indent === -1) |
| 230 |
continue; |
| 231 |
if (startIndent > indent) |
| 232 |
break; |
| 233 |
var subRange = this.getFoldWidgetRange(session, "all", row); |
| 234 |
if (subRange) { |
| 235 |
if (subRange.start.row <= startRow) { |
| 236 |
break; |
| 237 |
} |
| 238 |
else if (subRange.isMultiLine()) { |
| 239 |
row = subRange.end.row; |
| 240 |
} |
| 241 |
else if (startIndent == indent) { |
| 242 |
break; |
| 243 |
} |
| 244 |
} |
| 245 |
endRow = row; |
| 246 |
} |
| 247 |
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length); |
| 248 |
}; |
| 249 |
this.getCommentRegionBlock = function (session, line, row) { |
| 250 |
var startColumn = line.search(/\s*$/); |
| 251 |
var maxRow = session.getLength(); |
| 252 |
var startRow = row; |
| 253 |
var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/; |
| 254 |
var depth = 1; |
| 255 |
while (++row < maxRow) { |
| 256 |
line = session.getLine(row); |
| 257 |
var m = re.exec(line); |
| 258 |
if (!m) |
| 259 |
continue; |
| 260 |
if (m[1]) |
| 261 |
depth--; |
| 262 |
else |
| 263 |
depth++; |
| 264 |
if (!depth) |
| 265 |
break; |
| 266 |
} |
| 267 |
var endRow = row; |
| 268 |
if (endRow > startRow) { |
| 269 |
return new Range(startRow, startColumn, endRow, line.length); |
| 270 |
} |
| 271 |
}; |
| 272 |
}).call(FoldMode.prototype); |
| 273 |
|
| 274 |
}); |
| 275 |
|
| 276 |
ace.define("ace/mode/folding/csharp",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/cstyle"], function(require, exports, module){"use strict"; |
| 277 |
var oop = require("../../lib/oop"); |
| 278 |
var Range = require("../../range").Range; |
| 279 |
var CFoldMode = require("./cstyle").FoldMode; |
| 280 |
var FoldMode = exports.FoldMode = function (commentRegex) { |
| 281 |
if (commentRegex) { |
| 282 |
this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)); |
| 283 |
this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)); |
| 284 |
} |
| 285 |
}; |
| 286 |
oop.inherits(FoldMode, CFoldMode); |
| 287 |
(function () { |
| 288 |
this.usingRe = /^\s*using \S/; |
| 289 |
this.getFoldWidgetRangeBase = this.getFoldWidgetRange; |
| 290 |
this.getFoldWidgetBase = this.getFoldWidget; |
| 291 |
this.getFoldWidget = function (session, foldStyle, row) { |
| 292 |
var fw = this.getFoldWidgetBase(session, foldStyle, row); |
| 293 |
if (!fw) { |
| 294 |
var line = session.getLine(row); |
| 295 |
if (/^\s*#region\b/.test(line)) |
| 296 |
return "start"; |
| 297 |
var usingRe = this.usingRe; |
| 298 |
if (usingRe.test(line)) { |
| 299 |
var prev = session.getLine(row - 1); |
| 300 |
var next = session.getLine(row + 1); |
| 301 |
if (!usingRe.test(prev) && usingRe.test(next)) |
| 302 |
return "start"; |
| 303 |
} |
| 304 |
} |
| 305 |
return fw; |
| 306 |
}; |
| 307 |
this.getFoldWidgetRange = function (session, foldStyle, row) { |
| 308 |
var range = this.getFoldWidgetRangeBase(session, foldStyle, row); |
| 309 |
if (range) |
| 310 |
return range; |
| 311 |
var line = session.getLine(row); |
| 312 |
if (this.usingRe.test(line)) |
| 313 |
return this.getUsingStatementBlock(session, line, row); |
| 314 |
if (/^\s*#region\b/.test(line)) |
| 315 |
return this.getRegionBlock(session, line, row); |
| 316 |
}; |
| 317 |
this.getUsingStatementBlock = function (session, line, row) { |
| 318 |
var startColumn = line.match(this.usingRe)[0].length - 1; |
| 319 |
var maxRow = session.getLength(); |
| 320 |
var startRow = row; |
| 321 |
var endRow = row; |
| 322 |
while (++row < maxRow) { |
| 323 |
line = session.getLine(row); |
| 324 |
if (/^\s*$/.test(line)) |
| 325 |
continue; |
| 326 |
if (!this.usingRe.test(line)) |
| 327 |
break; |
| 328 |
endRow = row; |
| 329 |
} |
| 330 |
if (endRow > startRow) { |
| 331 |
var endColumn = session.getLine(endRow).length; |
| 332 |
return new Range(startRow, startColumn, endRow, endColumn); |
| 333 |
} |
| 334 |
}; |
| 335 |
this.getRegionBlock = function (session, line, row) { |
| 336 |
var startColumn = line.search(/\s*$/); |
| 337 |
var maxRow = session.getLength(); |
| 338 |
var startRow = row; |
| 339 |
var re = /^\s*#(end)?region\b/; |
| 340 |
var depth = 1; |
| 341 |
while (++row < maxRow) { |
| 342 |
line = session.getLine(row); |
| 343 |
var m = re.exec(line); |
| 344 |
if (!m) |
| 345 |
continue; |
| 346 |
if (m[1]) |
| 347 |
depth--; |
| 348 |
else |
| 349 |
depth++; |
| 350 |
if (!depth) |
| 351 |
break; |
| 352 |
} |
| 353 |
var endRow = row; |
| 354 |
if (endRow > startRow) { |
| 355 |
return new Range(startRow, startColumn, endRow, line.length); |
| 356 |
} |
| 357 |
}; |
| 358 |
}).call(FoldMode.prototype); |
| 359 |
|
| 360 |
}); |
| 361 |
|
| 362 |
ace.define("ace/mode/csharp",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/csharp_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/folding/csharp"], function(require, exports, module){"use strict"; |
| 363 |
var oop = require("../lib/oop"); |
| 364 |
var TextMode = require("./text").Mode; |
| 365 |
var CSharpHighlightRules = require("./csharp_highlight_rules").CSharpHighlightRules; |
| 366 |
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; |
| 367 |
var CStyleFoldMode = require("./folding/csharp").FoldMode; |
| 368 |
var Mode = function () { |
| 369 |
this.HighlightRules = CSharpHighlightRules; |
| 370 |
this.$outdent = new MatchingBraceOutdent(); |
| 371 |
this.$behaviour = this.$defaultBehaviour; |
| 372 |
this.foldingRules = new CStyleFoldMode(); |
| 373 |
}; |
| 374 |
oop.inherits(Mode, TextMode); |
| 375 |
(function () { |
| 376 |
this.lineCommentStart = "//"; |
| 377 |
this.blockComment = { start: "/*", end: "*/" }; |
| 378 |
this.getNextLineIndent = function (state, line, tab) { |
| 379 |
var indent = this.$getIndent(line); |
| 380 |
var tokenizedLine = this.getTokenizer().getLineTokens(line, state); |
| 381 |
var tokens = tokenizedLine.tokens; |
| 382 |
if (tokens.length && tokens[tokens.length - 1].type == "comment") { |
| 383 |
return indent; |
| 384 |
} |
| 385 |
if (state == "start") { |
| 386 |
var match = line.match(/^.*[\{\(\[]\s*$/); |
| 387 |
if (match) { |
| 388 |
indent += tab; |
| 389 |
} |
| 390 |
} |
| 391 |
return indent; |
| 392 |
}; |
| 393 |
this.checkOutdent = function (state, line, input) { |
| 394 |
return this.$outdent.checkOutdent(line, input); |
| 395 |
}; |
| 396 |
this.autoOutdent = function (state, doc, row) { |
| 397 |
this.$outdent.autoOutdent(doc, row); |
| 398 |
}; |
| 399 |
this.createWorker = function (session) { |
| 400 |
return null; |
| 401 |
}; |
| 402 |
this.$id = "ace/mode/csharp"; |
| 403 |
}).call(Mode.prototype); |
| 404 |
exports.Mode = Mode; |
| 405 |
|
| 406 |
}); (function() { |
| 407 |
ace.require(["ace/mode/csharp"], function(m) { |
| 408 |
if (typeof module == "object" && typeof exports == "object" && module) { |
| 409 |
module.exports = m; |
| 410 |
} |
| 411 |
}); |
| 412 |
})(); |
| 413 |
|