| 1 |
ace.define("ace/mode/folding/mixed",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode"], function(require, exports, module){"use strict"; |
| 2 |
var oop = require("../../lib/oop"); |
| 3 |
var BaseFoldMode = require("./fold_mode").FoldMode; |
| 4 |
var FoldMode = exports.FoldMode = function (defaultMode, subModes) { |
| 5 |
this.defaultMode = defaultMode; |
| 6 |
this.subModes = subModes; |
| 7 |
}; |
| 8 |
oop.inherits(FoldMode, BaseFoldMode); |
| 9 |
(function () { |
| 10 |
this.$getMode = function (state) { |
| 11 |
if (typeof state != "string") |
| 12 |
state = state[0]; |
| 13 |
for (var key in this.subModes) { |
| 14 |
if (state.indexOf(key) === 0) |
| 15 |
return this.subModes[key]; |
| 16 |
} |
| 17 |
return null; |
| 18 |
}; |
| 19 |
this.$tryMode = function (state, session, foldStyle, row) { |
| 20 |
var mode = this.$getMode(state); |
| 21 |
return (mode ? mode.getFoldWidget(session, foldStyle, row) : ""); |
| 22 |
}; |
| 23 |
this.getFoldWidget = function (session, foldStyle, row) { |
| 24 |
return (this.$tryMode(session.getState(row - 1), session, foldStyle, row) || |
| 25 |
this.$tryMode(session.getState(row), session, foldStyle, row) || |
| 26 |
this.defaultMode.getFoldWidget(session, foldStyle, row)); |
| 27 |
}; |
| 28 |
this.getFoldWidgetRange = function (session, foldStyle, row) { |
| 29 |
var mode = this.$getMode(session.getState(row - 1)); |
| 30 |
if (!mode || !mode.getFoldWidget(session, foldStyle, row)) |
| 31 |
mode = this.$getMode(session.getState(row)); |
| 32 |
if (!mode || !mode.getFoldWidget(session, foldStyle, row)) |
| 33 |
mode = this.defaultMode; |
| 34 |
return mode.getFoldWidgetRange(session, foldStyle, row); |
| 35 |
}; |
| 36 |
}).call(FoldMode.prototype); |
| 37 |
|
| 38 |
}); |
| 39 |
|
| 40 |
ace.define("ace/mode/folding/xml",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module){"use strict"; |
| 41 |
var oop = require("../../lib/oop"); |
| 42 |
var Range = require("../../range").Range; |
| 43 |
var BaseFoldMode = require("./fold_mode").FoldMode; |
| 44 |
var FoldMode = exports.FoldMode = function (voidElements, optionalEndTags) { |
| 45 |
BaseFoldMode.call(this); |
| 46 |
this.voidElements = voidElements || {}; |
| 47 |
this.optionalEndTags = oop.mixin({}, this.voidElements); |
| 48 |
if (optionalEndTags) |
| 49 |
oop.mixin(this.optionalEndTags, optionalEndTags); |
| 50 |
}; |
| 51 |
oop.inherits(FoldMode, BaseFoldMode); |
| 52 |
var Tag = function () { |
| 53 |
this.tagName = ""; |
| 54 |
this.closing = false; |
| 55 |
this.selfClosing = false; |
| 56 |
this.start = { row: 0, column: 0 }; |
| 57 |
this.end = { row: 0, column: 0 }; |
| 58 |
}; |
| 59 |
function is(token, type) { |
| 60 |
return token.type.lastIndexOf(type + ".xml") > -1; |
| 61 |
} |
| 62 |
(function () { |
| 63 |
this.getFoldWidget = function (session, foldStyle, row) { |
| 64 |
var tag = this._getFirstTagInLine(session, row); |
| 65 |
if (!tag) |
| 66 |
return this.getCommentFoldWidget(session, row); |
| 67 |
if (tag.closing || (!tag.tagName && tag.selfClosing)) |
| 68 |
return foldStyle === "markbeginend" ? "end" : ""; |
| 69 |
if (!tag.tagName || tag.selfClosing || this.voidElements.hasOwnProperty(tag.tagName.toLowerCase())) |
| 70 |
return ""; |
| 71 |
if (this._findEndTagInLine(session, row, tag.tagName, tag.end.column)) |
| 72 |
return ""; |
| 73 |
return "start"; |
| 74 |
}; |
| 75 |
this.getCommentFoldWidget = function (session, row) { |
| 76 |
if (/comment/.test(session.getState(row)) && /<!-/.test(session.getLine(row))) |
| 77 |
return "start"; |
| 78 |
return ""; |
| 79 |
}; |
| 80 |
this._getFirstTagInLine = function (session, row) { |
| 81 |
var tokens = session.getTokens(row); |
| 82 |
var tag = new Tag(); |
| 83 |
for (var i = 0; i < tokens.length; i++) { |
| 84 |
var token = tokens[i]; |
| 85 |
if (is(token, "tag-open")) { |
| 86 |
tag.end.column = tag.start.column + token.value.length; |
| 87 |
tag.closing = is(token, "end-tag-open"); |
| 88 |
token = tokens[++i]; |
| 89 |
if (!token) |
| 90 |
return null; |
| 91 |
tag.tagName = token.value; |
| 92 |
tag.end.column += token.value.length; |
| 93 |
for (i++; i < tokens.length; i++) { |
| 94 |
token = tokens[i]; |
| 95 |
tag.end.column += token.value.length; |
| 96 |
if (is(token, "tag-close")) { |
| 97 |
tag.selfClosing = token.value == '/>'; |
| 98 |
break; |
| 99 |
} |
| 100 |
} |
| 101 |
return tag; |
| 102 |
} |
| 103 |
else if (is(token, "tag-close")) { |
| 104 |
tag.selfClosing = token.value == '/>'; |
| 105 |
return tag; |
| 106 |
} |
| 107 |
tag.start.column += token.value.length; |
| 108 |
} |
| 109 |
return null; |
| 110 |
}; |
| 111 |
this._findEndTagInLine = function (session, row, tagName, startColumn) { |
| 112 |
var tokens = session.getTokens(row); |
| 113 |
var column = 0; |
| 114 |
for (var i = 0; i < tokens.length; i++) { |
| 115 |
var token = tokens[i]; |
| 116 |
column += token.value.length; |
| 117 |
if (column < startColumn) |
| 118 |
continue; |
| 119 |
if (is(token, "end-tag-open")) { |
| 120 |
token = tokens[i + 1]; |
| 121 |
if (token && token.value == tagName) |
| 122 |
return true; |
| 123 |
} |
| 124 |
} |
| 125 |
return false; |
| 126 |
}; |
| 127 |
this.getFoldWidgetRange = function (session, foldStyle, row) { |
| 128 |
var tags = session.getMatchingTags({ row: row, column: 0 }); |
| 129 |
if (tags) { |
| 130 |
return new Range(tags.openTag.end.row, tags.openTag.end.column, tags.closeTag.start.row, tags.closeTag.start.column); |
| 131 |
} |
| 132 |
else { |
| 133 |
return this.getCommentFoldWidget(session, row) |
| 134 |
&& session.getCommentFoldRange(row, session.getLine(row).length); |
| 135 |
} |
| 136 |
}; |
| 137 |
}).call(FoldMode.prototype); |
| 138 |
|
| 139 |
}); |
| 140 |
|
| 141 |
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"; |
| 142 |
var oop = require("../../lib/oop"); |
| 143 |
var Range = require("../../range").Range; |
| 144 |
var BaseFoldMode = require("./fold_mode").FoldMode; |
| 145 |
var FoldMode = exports.FoldMode = function (commentRegex) { |
| 146 |
if (commentRegex) { |
| 147 |
this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)); |
| 148 |
this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)); |
| 149 |
} |
| 150 |
}; |
| 151 |
oop.inherits(FoldMode, BaseFoldMode); |
| 152 |
(function () { |
| 153 |
this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/; |
| 154 |
this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/; |
| 155 |
this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/; |
| 156 |
this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/; |
| 157 |
this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/; |
| 158 |
this._getFoldWidgetBase = this.getFoldWidget; |
| 159 |
this.getFoldWidget = function (session, foldStyle, row) { |
| 160 |
var line = session.getLine(row); |
| 161 |
if (this.singleLineBlockCommentRe.test(line)) { |
| 162 |
if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line)) |
| 163 |
return ""; |
| 164 |
} |
| 165 |
var fw = this._getFoldWidgetBase(session, foldStyle, row); |
| 166 |
if (!fw && this.startRegionRe.test(line)) |
| 167 |
return "start"; |
| 168 |
return fw; |
| 169 |
}; |
| 170 |
this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) { |
| 171 |
var line = session.getLine(row); |
| 172 |
if (this.startRegionRe.test(line)) |
| 173 |
return this.getCommentRegionBlock(session, line, row); |
| 174 |
var match = line.match(this.foldingStartMarker); |
| 175 |
if (match) { |
| 176 |
var i = match.index; |
| 177 |
if (match[1]) |
| 178 |
return this.openingBracketBlock(session, match[1], row, i); |
| 179 |
var range = session.getCommentFoldRange(row, i + match[0].length, 1); |
| 180 |
if (range && !range.isMultiLine()) { |
| 181 |
if (forceMultiline) { |
| 182 |
range = this.getSectionRange(session, row); |
| 183 |
} |
| 184 |
else if (foldStyle != "all") |
| 185 |
range = null; |
| 186 |
} |
| 187 |
return range; |
| 188 |
} |
| 189 |
if (foldStyle === "markbegin") |
| 190 |
return; |
| 191 |
var match = line.match(this.foldingStopMarker); |
| 192 |
if (match) { |
| 193 |
var i = match.index + match[0].length; |
| 194 |
if (match[1]) |
| 195 |
return this.closingBracketBlock(session, match[1], row, i); |
| 196 |
return session.getCommentFoldRange(row, i, -1); |
| 197 |
} |
| 198 |
}; |
| 199 |
this.getSectionRange = function (session, row) { |
| 200 |
var line = session.getLine(row); |
| 201 |
var startIndent = line.search(/\S/); |
| 202 |
var startRow = row; |
| 203 |
var startColumn = line.length; |
| 204 |
row = row + 1; |
| 205 |
var endRow = row; |
| 206 |
var maxRow = session.getLength(); |
| 207 |
while (++row < maxRow) { |
| 208 |
line = session.getLine(row); |
| 209 |
var indent = line.search(/\S/); |
| 210 |
if (indent === -1) |
| 211 |
continue; |
| 212 |
if (startIndent > indent) |
| 213 |
break; |
| 214 |
var subRange = this.getFoldWidgetRange(session, "all", row); |
| 215 |
if (subRange) { |
| 216 |
if (subRange.start.row <= startRow) { |
| 217 |
break; |
| 218 |
} |
| 219 |
else if (subRange.isMultiLine()) { |
| 220 |
row = subRange.end.row; |
| 221 |
} |
| 222 |
else if (startIndent == indent) { |
| 223 |
break; |
| 224 |
} |
| 225 |
} |
| 226 |
endRow = row; |
| 227 |
} |
| 228 |
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length); |
| 229 |
}; |
| 230 |
this.getCommentRegionBlock = function (session, line, row) { |
| 231 |
var startColumn = line.search(/\s*$/); |
| 232 |
var maxRow = session.getLength(); |
| 233 |
var startRow = row; |
| 234 |
var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/; |
| 235 |
var depth = 1; |
| 236 |
while (++row < maxRow) { |
| 237 |
line = session.getLine(row); |
| 238 |
var m = re.exec(line); |
| 239 |
if (!m) |
| 240 |
continue; |
| 241 |
if (m[1]) |
| 242 |
depth--; |
| 243 |
else |
| 244 |
depth++; |
| 245 |
if (!depth) |
| 246 |
break; |
| 247 |
} |
| 248 |
var endRow = row; |
| 249 |
if (endRow > startRow) { |
| 250 |
return new Range(startRow, startColumn, endRow, line.length); |
| 251 |
} |
| 252 |
}; |
| 253 |
}).call(FoldMode.prototype); |
| 254 |
|
| 255 |
}); |
| 256 |
|
| 257 |
ace.define("ace/mode/folding/html",["require","exports","module","ace/lib/oop","ace/mode/folding/mixed","ace/mode/folding/xml","ace/mode/folding/cstyle"], function(require, exports, module){"use strict"; |
| 258 |
var oop = require("../../lib/oop"); |
| 259 |
var MixedFoldMode = require("./mixed").FoldMode; |
| 260 |
var XmlFoldMode = require("./xml").FoldMode; |
| 261 |
var CStyleFoldMode = require("./cstyle").FoldMode; |
| 262 |
var FoldMode = exports.FoldMode = function (voidElements, optionalTags) { |
| 263 |
MixedFoldMode.call(this, new XmlFoldMode(voidElements, optionalTags), { |
| 264 |
"js-": new CStyleFoldMode(), |
| 265 |
"css-": new CStyleFoldMode() |
| 266 |
}); |
| 267 |
}; |
| 268 |
oop.inherits(FoldMode, MixedFoldMode); |
| 269 |
|
| 270 |
}); |
| 271 |
|
| 272 |
ace.define("ace/mode/behaviour/xml",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"], function(require, exports, module){"use strict"; |
| 273 |
var oop = require("../../lib/oop"); |
| 274 |
var Behaviour = require("../behaviour").Behaviour; |
| 275 |
var TokenIterator = require("../../token_iterator").TokenIterator; |
| 276 |
var lang = require("../../lib/lang"); |
| 277 |
function is(token, type) { |
| 278 |
return token && token.type.lastIndexOf(type + ".xml") > -1; |
| 279 |
} |
| 280 |
var XmlBehaviour = function () { |
| 281 |
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) { |
| 282 |
if (text == '"' || text == "'") { |
| 283 |
var quote = text; |
| 284 |
var selected = session.doc.getTextRange(editor.getSelectionRange()); |
| 285 |
if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) { |
| 286 |
return { |
| 287 |
text: quote + selected + quote, |
| 288 |
selection: false |
| 289 |
}; |
| 290 |
} |
| 291 |
var cursor = editor.getCursorPosition(); |
| 292 |
var line = session.doc.getLine(cursor.row); |
| 293 |
var rightChar = line.substring(cursor.column, cursor.column + 1); |
| 294 |
var iterator = new TokenIterator(session, cursor.row, cursor.column); |
| 295 |
var token = iterator.getCurrentToken(); |
| 296 |
if (rightChar == quote && (is(token, "attribute-value") || is(token, "string"))) { |
| 297 |
return { |
| 298 |
text: "", |
| 299 |
selection: [1, 1] |
| 300 |
}; |
| 301 |
} |
| 302 |
if (!token) |
| 303 |
token = iterator.stepBackward(); |
| 304 |
if (!token) |
| 305 |
return; |
| 306 |
while (is(token, "tag-whitespace") || is(token, "whitespace")) { |
| 307 |
token = iterator.stepBackward(); |
| 308 |
} |
| 309 |
var rightSpace = !rightChar || rightChar.match(/\s/); |
| 310 |
if (is(token, "attribute-equals") && (rightSpace || rightChar == '>') || (is(token, "decl-attribute-equals") && (rightSpace || rightChar == '?'))) { |
| 311 |
return { |
| 312 |
text: quote + quote, |
| 313 |
selection: [1, 1] |
| 314 |
}; |
| 315 |
} |
| 316 |
} |
| 317 |
}); |
| 318 |
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) { |
| 319 |
var selected = session.doc.getTextRange(range); |
| 320 |
if (!range.isMultiLine() && (selected == '"' || selected == "'")) { |
| 321 |
var line = session.doc.getLine(range.start.row); |
| 322 |
var rightChar = line.substring(range.start.column + 1, range.start.column + 2); |
| 323 |
if (rightChar == selected) { |
| 324 |
range.end.column++; |
| 325 |
return range; |
| 326 |
} |
| 327 |
} |
| 328 |
}); |
| 329 |
this.add("autoclosing", "insertion", function (state, action, editor, session, text) { |
| 330 |
if (text == '>') { |
| 331 |
var position = editor.getSelectionRange().start; |
| 332 |
var iterator = new TokenIterator(session, position.row, position.column); |
| 333 |
var token = iterator.getCurrentToken() || iterator.stepBackward(); |
| 334 |
if (!token || !(is(token, "tag-name") || is(token, "tag-whitespace") || is(token, "attribute-name") || is(token, "attribute-equals") || is(token, "attribute-value"))) |
| 335 |
return; |
| 336 |
if (is(token, "reference.attribute-value")) |
| 337 |
return; |
| 338 |
if (is(token, "attribute-value")) { |
| 339 |
var tokenEndColumn = iterator.getCurrentTokenColumn() + token.value.length; |
| 340 |
if (position.column < tokenEndColumn) |
| 341 |
return; |
| 342 |
if (position.column == tokenEndColumn) { |
| 343 |
var nextToken = iterator.stepForward(); |
| 344 |
if (nextToken && is(nextToken, "attribute-value")) |
| 345 |
return; |
| 346 |
iterator.stepBackward(); |
| 347 |
} |
| 348 |
} |
| 349 |
if (/^\s*>/.test(session.getLine(position.row).slice(position.column))) |
| 350 |
return; |
| 351 |
while (!is(token, "tag-name")) { |
| 352 |
token = iterator.stepBackward(); |
| 353 |
if (token.value == "<") { |
| 354 |
token = iterator.stepForward(); |
| 355 |
break; |
| 356 |
} |
| 357 |
} |
| 358 |
var tokenRow = iterator.getCurrentTokenRow(); |
| 359 |
var tokenColumn = iterator.getCurrentTokenColumn(); |
| 360 |
if (is(iterator.stepBackward(), "end-tag-open")) |
| 361 |
return; |
| 362 |
var element = token.value; |
| 363 |
if (tokenRow == position.row) |
| 364 |
element = element.substring(0, position.column - tokenColumn); |
| 365 |
if (this.voidElements.hasOwnProperty(element.toLowerCase())) |
| 366 |
return; |
| 367 |
return { |
| 368 |
text: ">" + "</" + element + ">", |
| 369 |
selection: [1, 1] |
| 370 |
}; |
| 371 |
} |
| 372 |
}); |
| 373 |
this.add("autoindent", "insertion", function (state, action, editor, session, text) { |
| 374 |
if (text == "\n") { |
| 375 |
var cursor = editor.getCursorPosition(); |
| 376 |
var line = session.getLine(cursor.row); |
| 377 |
var iterator = new TokenIterator(session, cursor.row, cursor.column); |
| 378 |
var token = iterator.getCurrentToken(); |
| 379 |
if (token && token.type.indexOf("tag-close") !== -1) { |
| 380 |
if (token.value == "/>") |
| 381 |
return; |
| 382 |
while (token && token.type.indexOf("tag-name") === -1) { |
| 383 |
token = iterator.stepBackward(); |
| 384 |
} |
| 385 |
if (!token) { |
| 386 |
return; |
| 387 |
} |
| 388 |
var tag = token.value; |
| 389 |
var row = iterator.getCurrentTokenRow(); |
| 390 |
token = iterator.stepBackward(); |
| 391 |
if (!token || token.type.indexOf("end-tag") !== -1) { |
| 392 |
return; |
| 393 |
} |
| 394 |
if (this.voidElements && !this.voidElements[tag]) { |
| 395 |
var nextToken = session.getTokenAt(cursor.row, cursor.column + 1); |
| 396 |
var line = session.getLine(row); |
| 397 |
var nextIndent = this.$getIndent(line); |
| 398 |
var indent = nextIndent + session.getTabString(); |
| 399 |
if (nextToken && nextToken.value === "</") { |
| 400 |
return { |
| 401 |
text: "\n" + indent + "\n" + nextIndent, |
| 402 |
selection: [1, indent.length, 1, indent.length] |
| 403 |
}; |
| 404 |
} |
| 405 |
else { |
| 406 |
return { |
| 407 |
text: "\n" + indent |
| 408 |
}; |
| 409 |
} |
| 410 |
} |
| 411 |
} |
| 412 |
} |
| 413 |
}); |
| 414 |
}; |
| 415 |
oop.inherits(XmlBehaviour, Behaviour); |
| 416 |
exports.XmlBehaviour = XmlBehaviour; |
| 417 |
|
| 418 |
}); |
| 419 |
|
| 420 |
ace.define("ace/mode/html_completions",["require","exports","module","ace/token_iterator"], function(require, exports, module){"use strict"; |
| 421 |
var TokenIterator = require("../token_iterator").TokenIterator; |
| 422 |
var commonAttributes = [ |
| 423 |
"accesskey", |
| 424 |
"class", |
| 425 |
"contenteditable", |
| 426 |
"contextmenu", |
| 427 |
"dir", |
| 428 |
"draggable", |
| 429 |
"dropzone", |
| 430 |
"hidden", |
| 431 |
"id", |
| 432 |
"inert", |
| 433 |
"itemid", |
| 434 |
"itemprop", |
| 435 |
"itemref", |
| 436 |
"itemscope", |
| 437 |
"itemtype", |
| 438 |
"lang", |
| 439 |
"spellcheck", |
| 440 |
"style", |
| 441 |
"tabindex", |
| 442 |
"title", |
| 443 |
"translate" |
| 444 |
]; |
| 445 |
var eventAttributes = [ |
| 446 |
"onabort", |
| 447 |
"onblur", |
| 448 |
"oncancel", |
| 449 |
"oncanplay", |
| 450 |
"oncanplaythrough", |
| 451 |
"onchange", |
| 452 |
"onclick", |
| 453 |
"onclose", |
| 454 |
"oncontextmenu", |
| 455 |
"oncuechange", |
| 456 |
"ondblclick", |
| 457 |
"ondrag", |
| 458 |
"ondragend", |
| 459 |
"ondragenter", |
| 460 |
"ondragleave", |
| 461 |
"ondragover", |
| 462 |
"ondragstart", |
| 463 |
"ondrop", |
| 464 |
"ondurationchange", |
| 465 |
"onemptied", |
| 466 |
"onended", |
| 467 |
"onerror", |
| 468 |
"onfocus", |
| 469 |
"oninput", |
| 470 |
"oninvalid", |
| 471 |
"onkeydown", |
| 472 |
"onkeypress", |
| 473 |
"onkeyup", |
| 474 |
"onload", |
| 475 |
"onloadeddata", |
| 476 |
"onloadedmetadata", |
| 477 |
"onloadstart", |
| 478 |
"onmousedown", |
| 479 |
"onmousemove", |
| 480 |
"onmouseout", |
| 481 |
"onmouseover", |
| 482 |
"onmouseup", |
| 483 |
"onmousewheel", |
| 484 |
"onpause", |
| 485 |
"onplay", |
| 486 |
"onplaying", |
| 487 |
"onprogress", |
| 488 |
"onratechange", |
| 489 |
"onreset", |
| 490 |
"onscroll", |
| 491 |
"onseeked", |
| 492 |
"onseeking", |
| 493 |
"onselect", |
| 494 |
"onshow", |
| 495 |
"onstalled", |
| 496 |
"onsubmit", |
| 497 |
"onsuspend", |
| 498 |
"ontimeupdate", |
| 499 |
"onvolumechange", |
| 500 |
"onwaiting" |
| 501 |
]; |
| 502 |
var globalAttributes = commonAttributes.concat(eventAttributes); |
| 503 |
var attributeMap = { |
| 504 |
"a": { "href": 1, "target": { "_blank": 1, "top": 1 }, "ping": 1, "rel": { "nofollow": 1, "alternate": 1, "author": 1, "bookmark": 1, "help": 1, "license": 1, "next": 1, "noreferrer": 1, "prefetch": 1, "prev": 1, "search": 1, "tag": 1 }, "media": 1, "hreflang": 1, "type": 1 }, |
| 505 |
"abbr": {}, |
| 506 |
"address": {}, |
| 507 |
"area": { "shape": 1, "coords": 1, "href": 1, "hreflang": 1, "alt": 1, "target": 1, "media": 1, "rel": 1, "ping": 1, "type": 1 }, |
| 508 |
"article": { "pubdate": 1 }, |
| 509 |
"aside": {}, |
| 510 |
"audio": { "src": 1, "autobuffer": 1, "autoplay": { "autoplay": 1 }, "loop": { "loop": 1 }, "controls": { "controls": 1 }, "muted": { "muted": 1 }, "preload": { "auto": 1, "metadata": 1, "none": 1 } }, |
| 511 |
"b": {}, |
| 512 |
"base": { "href": 1, "target": 1 }, |
| 513 |
"bdi": {}, |
| 514 |
"bdo": {}, |
| 515 |
"blockquote": { "cite": 1 }, |
| 516 |
"body": { "onafterprint": 1, "onbeforeprint": 1, "onbeforeunload": 1, "onhashchange": 1, "onmessage": 1, "onoffline": 1, "onpopstate": 1, "onredo": 1, "onresize": 1, "onstorage": 1, "onundo": 1, "onunload": 1 }, |
| 517 |
"br": {}, |
| 518 |
"button": { "autofocus": 1, "disabled": { "disabled": 1 }, "form": 1, "formaction": 1, "formenctype": 1, "formmethod": 1, "formnovalidate": 1, "formtarget": 1, "name": 1, "value": 1, "type": { "button": 1, "submit": 1 } }, |
| 519 |
"canvas": { "width": 1, "height": 1 }, |
| 520 |
"caption": {}, |
| 521 |
"cite": {}, |
| 522 |
"code": {}, |
| 523 |
"col": { "span": 1 }, |
| 524 |
"colgroup": { "span": 1 }, |
| 525 |
"command": { "type": 1, "label": 1, "icon": 1, "disabled": 1, "checked": 1, "radiogroup": 1, "command": 1 }, |
| 526 |
"data": {}, |
| 527 |
"datalist": {}, |
| 528 |
"dd": {}, |
| 529 |
"del": { "cite": 1, "datetime": 1 }, |
| 530 |
"details": { "open": 1 }, |
| 531 |
"dfn": {}, |
| 532 |
"dialog": { "open": 1 }, |
| 533 |
"div": {}, |
| 534 |
"dl": {}, |
| 535 |
"dt": {}, |
| 536 |
"em": {}, |
| 537 |
"embed": { "src": 1, "height": 1, "width": 1, "type": 1 }, |
| 538 |
"fieldset": { "disabled": 1, "form": 1, "name": 1 }, |
| 539 |
"figcaption": {}, |
| 540 |
"figure": {}, |
| 541 |
"footer": {}, |
| 542 |
"form": { "accept-charset": 1, "action": 1, "autocomplete": 1, "enctype": { "multipart/form-data": 1, "application/x-www-form-urlencoded": 1 }, "method": { "get": 1, "post": 1 }, "name": 1, "novalidate": 1, "target": { "_blank": 1, "top": 1 } }, |
| 543 |
"h1": {}, |
| 544 |
"h2": {}, |
| 545 |
"h3": {}, |
| 546 |
"h4": {}, |
| 547 |
"h5": {}, |
| 548 |
"h6": {}, |
| 549 |
"head": {}, |
| 550 |
"header": {}, |
| 551 |
"hr": {}, |
| 552 |
"html": { "manifest": 1 }, |
| 553 |
"i": {}, |
| 554 |
"iframe": { "name": 1, "src": 1, "height": 1, "width": 1, "sandbox": { "allow-same-origin": 1, "allow-top-navigation": 1, "allow-forms": 1, "allow-scripts": 1 }, "seamless": { "seamless": 1 } }, |
| 555 |
"img": { "alt": 1, "src": 1, "height": 1, "width": 1, "usemap": 1, "ismap": 1 }, |
| 556 |
"input": { |
| 557 |
"type": { "text": 1, "password": 1, "hidden": 1, "checkbox": 1, "submit": 1, "radio": 1, "file": 1, "button": 1, "reset": 1, "image": 31, "color": 1, "date": 1, "datetime": 1, "datetime-local": 1, "email": 1, "month": 1, "number": 1, "range": 1, "search": 1, "tel": 1, "time": 1, "url": 1, "week": 1 }, |
| 558 |
"accept": 1, "alt": 1, "autocomplete": { "on": 1, "off": 1 }, "autofocus": { "autofocus": 1 }, "checked": { "checked": 1 }, "disabled": { "disabled": 1 }, "form": 1, "formaction": 1, "formenctype": { "application/x-www-form-urlencoded": 1, "multipart/form-data": 1, "text/plain": 1 }, "formmethod": { "get": 1, "post": 1 }, "formnovalidate": { "formnovalidate": 1 }, "formtarget": { "_blank": 1, "_self": 1, "_parent": 1, "_top": 1 }, "height": 1, "list": 1, "max": 1, "maxlength": 1, "min": 1, "multiple": { "multiple": 1 }, "name": 1, "pattern": 1, "placeholder": 1, "readonly": { "readonly": 1 }, "required": { "required": 1 }, "size": 1, "src": 1, "step": 1, "width": 1, "files": 1, "value": 1 |
| 559 |
}, |
| 560 |
"ins": { "cite": 1, "datetime": 1 }, |
| 561 |
"kbd": {}, |
| 562 |
"keygen": { "autofocus": 1, "challenge": { "challenge": 1 }, "disabled": { "disabled": 1 }, "form": 1, "keytype": { "rsa": 1, "dsa": 1, "ec": 1 }, "name": 1 }, |
| 563 |
"label": { "form": 1, "for": 1 }, |
| 564 |
"legend": {}, |
| 565 |
"li": { "value": 1 }, |
| 566 |
"link": { "href": 1, "hreflang": 1, "rel": { "stylesheet": 1, "icon": 1 }, "media": { "all": 1, "screen": 1, "print": 1 }, "type": { "text/css": 1, "image/png": 1, "image/jpeg": 1, "image/gif": 1 }, "sizes": 1 }, |
| 567 |
"main": {}, |
| 568 |
"map": { "name": 1 }, |
| 569 |
"mark": {}, |
| 570 |
"math": {}, |
| 571 |
"menu": { "type": 1, "label": 1 }, |
| 572 |
"meta": { "http-equiv": { "content-type": 1 }, "name": { "description": 1, "keywords": 1 }, "content": { "text/html; charset=UTF-8": 1 }, "charset": 1 }, |
| 573 |
"meter": { "value": 1, "min": 1, "max": 1, "low": 1, "high": 1, "optimum": 1 }, |
| 574 |
"nav": {}, |
| 575 |
"noscript": { "href": 1 }, |
| 576 |
"object": { "param": 1, "data": 1, "type": 1, "height": 1, "width": 1, "usemap": 1, "name": 1, "form": 1, "classid": 1 }, |
| 577 |
"ol": { "start": 1, "reversed": 1 }, |
| 578 |
"optgroup": { "disabled": 1, "label": 1 }, |
| 579 |
"option": { "disabled": 1, "selected": 1, "label": 1, "value": 1 }, |
| 580 |
"output": { "for": 1, "form": 1, "name": 1 }, |
| 581 |
"p": {}, |
| 582 |
"param": { "name": 1, "value": 1 }, |
| 583 |
"pre": {}, |
| 584 |
"progress": { "value": 1, "max": 1 }, |
| 585 |
"q": { "cite": 1 }, |
| 586 |
"rp": {}, |
| 587 |
"rt": {}, |
| 588 |
"ruby": {}, |
| 589 |
"s": {}, |
| 590 |
"samp": {}, |
| 591 |
"script": { "charset": 1, "type": { "text/javascript": 1 }, "src": 1, "defer": 1, "async": 1 }, |
| 592 |
"select": { "autofocus": 1, "disabled": 1, "form": 1, "multiple": { "multiple": 1 }, "name": 1, "size": 1, "readonly": { "readonly": 1 } }, |
| 593 |
"small": {}, |
| 594 |
"source": { "src": 1, "type": 1, "media": 1 }, |
| 595 |
"span": {}, |
| 596 |
"strong": {}, |
| 597 |
"style": { "type": 1, "media": { "all": 1, "screen": 1, "print": 1 }, "scoped": 1 }, |
| 598 |
"sub": {}, |
| 599 |
"sup": {}, |
| 600 |
"svg": {}, |
| 601 |
"table": { "summary": 1 }, |
| 602 |
"tbody": {}, |
| 603 |
"td": { "headers": 1, "rowspan": 1, "colspan": 1 }, |
| 604 |
"textarea": { "autofocus": { "autofocus": 1 }, "disabled": { "disabled": 1 }, "form": 1, "maxlength": 1, "name": 1, "placeholder": 1, "readonly": { "readonly": 1 }, "required": { "required": 1 }, "rows": 1, "cols": 1, "wrap": { "on": 1, "off": 1, "hard": 1, "soft": 1 } }, |
| 605 |
"tfoot": {}, |
| 606 |
"th": { "headers": 1, "rowspan": 1, "colspan": 1, "scope": 1 }, |
| 607 |
"thead": {}, |
| 608 |
"time": { "datetime": 1 }, |
| 609 |
"title": {}, |
| 610 |
"tr": {}, |
| 611 |
"track": { "kind": 1, "src": 1, "srclang": 1, "label": 1, "default": 1 }, |
| 612 |
"section": {}, |
| 613 |
"summary": {}, |
| 614 |
"u": {}, |
| 615 |
"ul": {}, |
| 616 |
"var": {}, |
| 617 |
"video": { "src": 1, "autobuffer": 1, "autoplay": { "autoplay": 1 }, "loop": { "loop": 1 }, "controls": { "controls": 1 }, "width": 1, "height": 1, "poster": 1, "muted": { "muted": 1 }, "preload": { "auto": 1, "metadata": 1, "none": 1 } }, |
| 618 |
"wbr": {} |
| 619 |
}; |
| 620 |
var elements = Object.keys(attributeMap); |
| 621 |
function is(token, type) { |
| 622 |
return token.type.lastIndexOf(type + ".xml") > -1; |
| 623 |
} |
| 624 |
function findTagName(session, pos) { |
| 625 |
var iterator = new TokenIterator(session, pos.row, pos.column); |
| 626 |
var token = iterator.getCurrentToken(); |
| 627 |
while (token && !is(token, "tag-name")) { |
| 628 |
token = iterator.stepBackward(); |
| 629 |
} |
| 630 |
if (token) |
| 631 |
return token.value; |
| 632 |
} |
| 633 |
function findAttributeName(session, pos) { |
| 634 |
var iterator = new TokenIterator(session, pos.row, pos.column); |
| 635 |
var token = iterator.getCurrentToken(); |
| 636 |
while (token && !is(token, "attribute-name")) { |
| 637 |
token = iterator.stepBackward(); |
| 638 |
} |
| 639 |
if (token) |
| 640 |
return token.value; |
| 641 |
} |
| 642 |
var HtmlCompletions = function () { |
| 643 |
}; |
| 644 |
(function () { |
| 645 |
this.getCompletions = function (state, session, pos, prefix) { |
| 646 |
var token = session.getTokenAt(pos.row, pos.column); |
| 647 |
if (!token) |
| 648 |
return []; |
| 649 |
if (is(token, "tag-name") || is(token, "tag-open") || is(token, "end-tag-open")) |
| 650 |
return this.getTagCompletions(state, session, pos, prefix); |
| 651 |
if (is(token, "tag-whitespace") || is(token, "attribute-name")) |
| 652 |
return this.getAttributeCompletions(state, session, pos, prefix); |
| 653 |
if (is(token, "attribute-value")) |
| 654 |
return this.getAttributeValueCompletions(state, session, pos, prefix); |
| 655 |
var line = session.getLine(pos.row).substr(0, pos.column); |
| 656 |
if (/&[a-z]*$/i.test(line)) |
| 657 |
return this.getHTMLEntityCompletions(state, session, pos, prefix); |
| 658 |
return []; |
| 659 |
}; |
| 660 |
this.getTagCompletions = function (state, session, pos, prefix) { |
| 661 |
return elements.map(function (element) { |
| 662 |
return { |
| 663 |
value: element, |
| 664 |
meta: "tag", |
| 665 |
score: 1000000 |
| 666 |
}; |
| 667 |
}); |
| 668 |
}; |
| 669 |
this.getAttributeCompletions = function (state, session, pos, prefix) { |
| 670 |
var tagName = findTagName(session, pos); |
| 671 |
if (!tagName) |
| 672 |
return []; |
| 673 |
var attributes = globalAttributes; |
| 674 |
if (tagName in attributeMap) { |
| 675 |
attributes = attributes.concat(Object.keys(attributeMap[tagName])); |
| 676 |
} |
| 677 |
return attributes.map(function (attribute) { |
| 678 |
return { |
| 679 |
caption: attribute, |
| 680 |
snippet: attribute + '="$0"', |
| 681 |
meta: "attribute", |
| 682 |
score: 1000000 |
| 683 |
}; |
| 684 |
}); |
| 685 |
}; |
| 686 |
this.getAttributeValueCompletions = function (state, session, pos, prefix) { |
| 687 |
var tagName = findTagName(session, pos); |
| 688 |
var attributeName = findAttributeName(session, pos); |
| 689 |
if (!tagName) |
| 690 |
return []; |
| 691 |
var values = []; |
| 692 |
if (tagName in attributeMap && attributeName in attributeMap[tagName] && typeof attributeMap[tagName][attributeName] === "object") { |
| 693 |
values = Object.keys(attributeMap[tagName][attributeName]); |
| 694 |
} |
| 695 |
return values.map(function (value) { |
| 696 |
return { |
| 697 |
caption: value, |
| 698 |
snippet: value, |
| 699 |
meta: "attribute value", |
| 700 |
score: 1000000 |
| 701 |
}; |
| 702 |
}); |
| 703 |
}; |
| 704 |
this.getHTMLEntityCompletions = function (state, session, pos, prefix) { |
| 705 |
var values = ['Aacute;', 'aacute;', 'Acirc;', 'acirc;', 'acute;', 'AElig;', 'aelig;', 'Agrave;', 'agrave;', 'alefsym;', 'Alpha;', 'alpha;', 'amp;', 'and;', 'ang;', 'Aring;', 'aring;', 'asymp;', 'Atilde;', 'atilde;', 'Auml;', 'auml;', 'bdquo;', 'Beta;', 'beta;', 'brvbar;', 'bull;', 'cap;', 'Ccedil;', 'ccedil;', 'cedil;', 'cent;', 'Chi;', 'chi;', 'circ;', 'clubs;', 'cong;', 'copy;', 'crarr;', 'cup;', 'curren;', 'Dagger;', 'dagger;', 'dArr;', 'darr;', 'deg;', 'Delta;', 'delta;', 'diams;', 'divide;', 'Eacute;', 'eacute;', 'Ecirc;', 'ecirc;', 'Egrave;', 'egrave;', 'empty;', 'emsp;', 'ensp;', 'Epsilon;', 'epsilon;', 'equiv;', 'Eta;', 'eta;', 'ETH;', 'eth;', 'Euml;', 'euml;', 'euro;', 'exist;', 'fnof;', 'forall;', 'frac12;', 'frac14;', 'frac34;', 'frasl;', 'Gamma;', 'gamma;', 'ge;', 'gt;', 'hArr;', 'harr;', 'hearts;', 'hellip;', 'Iacute;', 'iacute;', 'Icirc;', 'icirc;', 'iexcl;', 'Igrave;', 'igrave;', 'image;', 'infin;', 'int;', 'Iota;', 'iota;', 'iquest;', 'isin;', 'Iuml;', 'iuml;', 'Kappa;', 'kappa;', 'Lambda;', 'lambda;', 'lang;', 'laquo;', 'lArr;', 'larr;', 'lceil;', 'ldquo;', 'le;', 'lfloor;', 'lowast;', 'loz;', 'lrm;', 'lsaquo;', 'lsquo;', 'lt;', 'macr;', 'mdash;', 'micro;', 'middot;', 'minus;', 'Mu;', 'mu;', 'nabla;', 'nbsp;', 'ndash;', 'ne;', 'ni;', 'not;', 'notin;', 'nsub;', 'Ntilde;', 'ntilde;', 'Nu;', 'nu;', 'Oacute;', 'oacute;', 'Ocirc;', 'ocirc;', 'OElig;', 'oelig;', 'Ograve;', 'ograve;', 'oline;', 'Omega;', 'omega;', 'Omicron;', 'omicron;', 'oplus;', 'or;', 'ordf;', 'ordm;', 'Oslash;', 'oslash;', 'Otilde;', 'otilde;', 'otimes;', 'Ouml;', 'ouml;', 'para;', 'part;', 'permil;', 'perp;', 'Phi;', 'phi;', 'Pi;', 'pi;', 'piv;', 'plusmn;', 'pound;', 'Prime;', 'prime;', 'prod;', 'prop;', 'Psi;', 'psi;', 'quot;', 'radic;', 'rang;', 'raquo;', 'rArr;', 'rarr;', 'rceil;', 'rdquo;', 'real;', 'reg;', 'rfloor;', 'Rho;', 'rho;', 'rlm;', 'rsaquo;', 'rsquo;', 'sbquo;', 'Scaron;', 'scaron;', 'sdot;', 'sect;', 'shy;', 'Sigma;', 'sigma;', 'sigmaf;', 'sim;', 'spades;', 'sub;', 'sube;', 'sum;', 'sup;', 'sup1;', 'sup2;', 'sup3;', 'supe;', 'szlig;', 'Tau;', 'tau;', 'there4;', 'Theta;', 'theta;', 'thetasym;', 'thinsp;', 'THORN;', 'thorn;', 'tilde;', 'times;', 'trade;', 'Uacute;', 'uacute;', 'uArr;', 'uarr;', 'Ucirc;', 'ucirc;', 'Ugrave;', 'ugrave;', 'uml;', 'upsih;', 'Upsilon;', 'upsilon;', 'Uuml;', 'uuml;', 'weierp;', 'Xi;', 'xi;', 'Yacute;', 'yacute;', 'yen;', 'Yuml;', 'yuml;', 'Zeta;', 'zeta;', 'zwj;', 'zwnj;']; |
| 706 |
return values.map(function (value) { |
| 707 |
return { |
| 708 |
caption: value, |
| 709 |
snippet: value, |
| 710 |
meta: "html entity", |
| 711 |
score: 1000000 |
| 712 |
}; |
| 713 |
}); |
| 714 |
}; |
| 715 |
}).call(HtmlCompletions.prototype); |
| 716 |
exports.HtmlCompletions = HtmlCompletions; |
| 717 |
|
| 718 |
}); |
| 719 |
|
| 720 |
ace.define("ace/mode/jsdoc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict"; |
| 721 |
var oop = require("../lib/oop"); |
| 722 |
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; |
| 723 |
var JsDocCommentHighlightRules = function () { |
| 724 |
this.$rules = { |
| 725 |
"start": [ |
| 726 |
{ |
| 727 |
token: ["comment.doc.tag", "comment.doc.text", "lparen.doc"], |
| 728 |
regex: "(@(?:param|member|typedef|property|namespace|var|const|callback))(\\s*)({)", |
| 729 |
push: [ |
| 730 |
{ |
| 731 |
token: "lparen.doc", |
| 732 |
regex: "{", |
| 733 |
push: [ |
| 734 |
{ |
| 735 |
include: "doc-syntax" |
| 736 |
}, { |
| 737 |
token: "rparen.doc", |
| 738 |
regex: "}|(?=$)", |
| 739 |
next: "pop" |
| 740 |
} |
| 741 |
] |
| 742 |
}, { |
| 743 |
token: ["rparen.doc", "text.doc", "variable.parameter.doc", "lparen.doc", "variable.parameter.doc", "rparen.doc"], |
| 744 |
regex: /(})(\s*)(?:([\w=:\/\.]+)|(?:(\[)([\w=:\/\.]+)(\])))/, |
| 745 |
next: "pop" |
| 746 |
}, { |
| 747 |
token: "rparen.doc", |
| 748 |
regex: "}|(?=$)", |
| 749 |
next: "pop" |
| 750 |
}, { |
| 751 |
include: "doc-syntax" |
| 752 |
}, { |
| 753 |
defaultToken: "text.doc" |
| 754 |
} |
| 755 |
] |
| 756 |
}, { |
| 757 |
token: ["comment.doc.tag", "text.doc", "lparen.doc"], |
| 758 |
regex: "(@(?:returns?|yields|type|this|suppress|public|protected|private|package|modifies|" |
| 759 |
+ "implements|external|exception|throws|enum|define|extends))(\\s*)({)", |
| 760 |
push: [ |
| 761 |
{ |
| 762 |
token: "lparen.doc", |
| 763 |
regex: "{", |
| 764 |
push: [ |
| 765 |
{ |
| 766 |
include: "doc-syntax" |
| 767 |
}, { |
| 768 |
token: "rparen.doc", |
| 769 |
regex: "}|(?=$)", |
| 770 |
next: "pop" |
| 771 |
} |
| 772 |
] |
| 773 |
}, { |
| 774 |
token: "rparen.doc", |
| 775 |
regex: "}|(?=$)", |
| 776 |
next: "pop" |
| 777 |
}, { |
| 778 |
include: "doc-syntax" |
| 779 |
}, { |
| 780 |
defaultToken: "text.doc" |
| 781 |
} |
| 782 |
] |
| 783 |
}, { |
| 784 |
token: ["comment.doc.tag", "text.doc", "variable.parameter.doc"], |
| 785 |
regex: "(@(?:alias|memberof|instance|module|name|lends|namespace|external|this|template|" |
| 786 |
+ "requires|param|implements|function|extends|typedef|mixes|constructor|var|" |
| 787 |
+ "memberof\\!|event|listens|exports|class|constructs|interface|emits|fires|" |
| 788 |
+ "throws|const|callback|borrows|augments))(\\s+)(\\w[\\w#\.:\/~\"\\-]*)?" |
| 789 |
}, { |
| 790 |
token: ["comment.doc.tag", "text.doc", "variable.parameter.doc"], |
| 791 |
regex: "(@method)(\\s+)(\\w[\\w\.\\(\\)]*)" |
| 792 |
}, { |
| 793 |
token: "comment.doc.tag", |
| 794 |
regex: "@access\\s+(?:private|public|protected)" |
| 795 |
}, { |
| 796 |
token: "comment.doc.tag", |
| 797 |
regex: "@kind\\s+(?:class|constant|event|external|file|function|member|mixin|module|namespace|typedef)" |
| 798 |
}, { |
| 799 |
token: "comment.doc.tag", |
| 800 |
regex: "@\\w+(?=\\s|$)" |
| 801 |
}, |
| 802 |
JsDocCommentHighlightRules.getTagRule(), |
| 803 |
{ |
| 804 |
defaultToken: "comment.doc", |
| 805 |
caseInsensitive: true |
| 806 |
} |
| 807 |
], |
| 808 |
"doc-syntax": [{ |
| 809 |
token: "operator.doc", |
| 810 |
regex: /[|:]/ |
| 811 |
}, { |
| 812 |
token: "paren.doc", |
| 813 |
regex: /[\[\]]/ |
| 814 |
}] |
| 815 |
}; |
| 816 |
this.normalizeRules(); |
| 817 |
}; |
| 818 |
oop.inherits(JsDocCommentHighlightRules, TextHighlightRules); |
| 819 |
JsDocCommentHighlightRules.getTagRule = function (start) { |
| 820 |
return { |
| 821 |
token: "comment.doc.tag.storage.type", |
| 822 |
regex: "\\b(?:TODO|FIXME|XXX|HACK)\\b" |
| 823 |
}; |
| 824 |
}; |
| 825 |
JsDocCommentHighlightRules.getStartRule = function (start) { |
| 826 |
return { |
| 827 |
token: "comment.doc", |
| 828 |
regex: "\\/\\*(?=\\*)", |
| 829 |
next: start |
| 830 |
}; |
| 831 |
}; |
| 832 |
JsDocCommentHighlightRules.getEndRule = function (start) { |
| 833 |
return { |
| 834 |
token: "comment.doc", |
| 835 |
regex: "\\*\\/", |
| 836 |
next: start |
| 837 |
}; |
| 838 |
}; |
| 839 |
exports.JsDocCommentHighlightRules = JsDocCommentHighlightRules; |
| 840 |
|
| 841 |
}); |
| 842 |
|
| 843 |
ace.define("ace/mode/javascript_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/jsdoc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict"; |
| 844 |
var oop = require("../lib/oop"); |
| 845 |
var DocCommentHighlightRules = require("./jsdoc_comment_highlight_rules").JsDocCommentHighlightRules; |
| 846 |
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; |
| 847 |
var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*"; |
| 848 |
var JavaScriptHighlightRules = function (options) { |
| 849 |
var keywordMapper = this.createKeywordMapper({ |
| 850 |
"variable.language": "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|Symbol|" + |
| 851 |
"Namespace|QName|XML|XMLList|" + |
| 852 |
"ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" + |
| 853 |
"Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" + |
| 854 |
"Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + |
| 855 |
"SyntaxError|TypeError|URIError|" + |
| 856 |
"decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + |
| 857 |
"isNaN|parseFloat|parseInt|" + |
| 858 |
"JSON|Math|" + |
| 859 |
"this|arguments|prototype|window|document", |
| 860 |
"keyword": "const|yield|import|get|set|async|await|" + |
| 861 |
"break|case|catch|continue|default|delete|do|else|finally|for|function|" + |
| 862 |
"if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" + |
| 863 |
"__parent__|__count__|escape|unescape|with|__proto__|" + |
| 864 |
"class|enum|extends|super|export|implements|private|public|interface|package|protected|static|constructor", |
| 865 |
"storage.type": "const|let|var|function", |
| 866 |
"constant.language": "null|Infinity|NaN|undefined", |
| 867 |
"support.function": "alert", |
| 868 |
"constant.language.boolean": "true|false" |
| 869 |
}, "identifier"); |
| 870 |
var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void"; |
| 871 |
var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + |
| 872 |
"u[0-9a-fA-F]{4}|" + |
| 873 |
"u{[0-9a-fA-F]{1,6}}|" + |
| 874 |
"[0-2][0-7]{0,2}|" + |
| 875 |
"3[0-7][0-7]?|" + |
| 876 |
"[4-7][0-7]?|" + |
| 877 |
".)"; |
| 878 |
this.$rules = { |
| 879 |
"no_regex": [ |
| 880 |
DocCommentHighlightRules.getStartRule("doc-start"), |
| 881 |
comments("no_regex"), |
| 882 |
{ |
| 883 |
token: "string", |
| 884 |
regex: "'(?=.)", |
| 885 |
next: "qstring" |
| 886 |
}, { |
| 887 |
token: "string", |
| 888 |
regex: '"(?=.)', |
| 889 |
next: "qqstring" |
| 890 |
}, { |
| 891 |
token: "constant.numeric", |
| 892 |
regex: /0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/ |
| 893 |
}, { |
| 894 |
token: "constant.numeric", |
| 895 |
regex: /(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/ |
| 896 |
}, { |
| 897 |
token: [ |
| 898 |
"storage.type", "punctuation.operator", "support.function", |
| 899 |
"punctuation.operator", "entity.name.function", "text", "keyword.operator" |
| 900 |
], |
| 901 |
regex: "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe + ")(\\s*)(=)", |
| 902 |
next: "function_arguments" |
| 903 |
}, { |
| 904 |
token: [ |
| 905 |
"storage.type", "punctuation.operator", "entity.name.function", "text", |
| 906 |
"keyword.operator", "text", "storage.type", "text", "paren.lparen" |
| 907 |
], |
| 908 |
regex: "(" + identifierRe + ")(\\.)(" + identifierRe + ")(\\s*)(=)(\\s*)(function\\*?)(\\s*)(\\()", |
| 909 |
next: "function_arguments" |
| 910 |
}, { |
| 911 |
token: [ |
| 912 |
"entity.name.function", "text", "keyword.operator", "text", "storage.type", |
| 913 |
"text", "paren.lparen" |
| 914 |
], |
| 915 |
regex: "(" + identifierRe + ")(\\s*)(=)(\\s*)(function\\*?)(\\s*)(\\()", |
| 916 |
next: "function_arguments" |
| 917 |
}, { |
| 918 |
token: [ |
| 919 |
"storage.type", "punctuation.operator", "entity.name.function", "text", |
| 920 |
"keyword.operator", "text", |
| 921 |
"storage.type", "text", "entity.name.function", "text", "paren.lparen" |
| 922 |
], |
| 923 |
regex: "(" + identifierRe + ")(\\.)(" + identifierRe + ")(\\s*)(=)(\\s*)(function\\*?)(\\s+)(\\w+)(\\s*)(\\()", |
| 924 |
next: "function_arguments" |
| 925 |
}, { |
| 926 |
token: [ |
| 927 |
"storage.type", "text", "entity.name.function", "text", "paren.lparen" |
| 928 |
], |
| 929 |
regex: "(function\\*?)(\\s+)(" + identifierRe + ")(\\s*)(\\()", |
| 930 |
next: "function_arguments" |
| 931 |
}, { |
| 932 |
token: [ |
| 933 |
"entity.name.function", "text", "punctuation.operator", |
| 934 |
"text", "storage.type", "text", "paren.lparen" |
| 935 |
], |
| 936 |
regex: "(" + identifierRe + ")(\\s*)(:)(\\s*)(function\\*?)(\\s*)(\\()", |
| 937 |
next: "function_arguments" |
| 938 |
}, { |
| 939 |
token: [ |
| 940 |
"text", "text", "storage.type", "text", "paren.lparen" |
| 941 |
], |
| 942 |
regex: "(:)(\\s*)(function\\*?)(\\s*)(\\()", |
| 943 |
next: "function_arguments" |
| 944 |
}, { |
| 945 |
token: "keyword", |
| 946 |
regex: "from(?=\\s*('|\"))" |
| 947 |
}, { |
| 948 |
token: "keyword", |
| 949 |
regex: "(?:" + kwBeforeRe + ")\\b", |
| 950 |
next: "start" |
| 951 |
}, { |
| 952 |
token: "support.constant", |
| 953 |
regex: /that\b/ |
| 954 |
}, { |
| 955 |
token: ["storage.type", "punctuation.operator", "support.function.firebug"], |
| 956 |
regex: /(console)(\.)(warn|info|log|error|debug|time|trace|timeEnd|assert)\b/ |
| 957 |
}, { |
| 958 |
token: keywordMapper, |
| 959 |
regex: identifierRe |
| 960 |
}, { |
| 961 |
token: "punctuation.operator", |
| 962 |
regex: /[.](?![.])/, |
| 963 |
next: "property" |
| 964 |
}, { |
| 965 |
token: "storage.type", |
| 966 |
regex: /=>/, |
| 967 |
next: "start" |
| 968 |
}, { |
| 969 |
token: "keyword.operator", |
| 970 |
regex: /--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/, |
| 971 |
next: "start" |
| 972 |
}, { |
| 973 |
token: "punctuation.operator", |
| 974 |
regex: /[?:,;.]/, |
| 975 |
next: "start" |
| 976 |
}, { |
| 977 |
token: "paren.lparen", |
| 978 |
regex: /[\[({]/, |
| 979 |
next: "start" |
| 980 |
}, { |
| 981 |
token: "paren.rparen", |
| 982 |
regex: /[\])}]/ |
| 983 |
}, { |
| 984 |
token: "comment", |
| 985 |
regex: /^#!.*$/ |
| 986 |
} |
| 987 |
], |
| 988 |
property: [{ |
| 989 |
token: "text", |
| 990 |
regex: "\\s+" |
| 991 |
}, { |
| 992 |
token: [ |
| 993 |
"storage.type", "punctuation.operator", "entity.name.function", "text", |
| 994 |
"keyword.operator", "text", |
| 995 |
"storage.type", "text", "entity.name.function", "text", "paren.lparen" |
| 996 |
], |
| 997 |
regex: "(" + identifierRe + ")(\\.)(" + identifierRe + ")(\\s*)(=)(\\s*)(function\\*?)(?:(\\s+)(\\w+))?(\\s*)(\\()", |
| 998 |
next: "function_arguments" |
| 999 |
}, { |
| 1000 |
token: "punctuation.operator", |
| 1001 |
regex: /[.](?![.])/ |
| 1002 |
}, { |
| 1003 |
token: "support.function", |
| 1004 |
regex: /(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|lter|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward|rEach)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/ |
| 1005 |
}, { |
| 1006 |
token: "support.function.dom", |
| 1007 |
regex: /(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName|ClassName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/ |
| 1008 |
}, { |
| 1009 |
token: "support.constant", |
| 1010 |
regex: /(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/ |
| 1011 |
}, { |
| 1012 |
token: "identifier", |
| 1013 |
regex: identifierRe |
| 1014 |
}, { |
| 1015 |
regex: "", |
| 1016 |
token: "empty", |
| 1017 |
next: "no_regex" |
| 1018 |
} |
| 1019 |
], |
| 1020 |
"start": [ |
| 1021 |
DocCommentHighlightRules.getStartRule("doc-start"), |
| 1022 |
comments("start"), |
| 1023 |
{ |
| 1024 |
token: "string.regexp", |
| 1025 |
regex: "\\/", |
| 1026 |
next: "regex" |
| 1027 |
}, { |
| 1028 |
token: "text", |
| 1029 |
regex: "\\s+|^$", |
| 1030 |
next: "start" |
| 1031 |
}, { |
| 1032 |
token: "empty", |
| 1033 |
regex: "", |
| 1034 |
next: "no_regex" |
| 1035 |
} |
| 1036 |
], |
| 1037 |
"regex": [ |
| 1038 |
{ |
| 1039 |
token: "regexp.keyword.operator", |
| 1040 |
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" |
| 1041 |
}, { |
| 1042 |
token: "string.regexp", |
| 1043 |
regex: "/[sxngimy]*", |
| 1044 |
next: "no_regex" |
| 1045 |
}, { |
| 1046 |
token: "invalid", |
| 1047 |
regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/ |
| 1048 |
}, { |
| 1049 |
token: "constant.language.escape", |
| 1050 |
regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/ |
| 1051 |
}, { |
| 1052 |
token: "constant.language.delimiter", |
| 1053 |
regex: /\|/ |
| 1054 |
}, { |
| 1055 |
token: "constant.language.escape", |
| 1056 |
regex: /\[\^?/, |
| 1057 |
next: "regex_character_class" |
| 1058 |
}, { |
| 1059 |
token: "empty", |
| 1060 |
regex: "$", |
| 1061 |
next: "no_regex" |
| 1062 |
}, { |
| 1063 |
defaultToken: "string.regexp" |
| 1064 |
} |
| 1065 |
], |
| 1066 |
"regex_character_class": [ |
| 1067 |
{ |
| 1068 |
token: "regexp.charclass.keyword.operator", |
| 1069 |
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" |
| 1070 |
}, { |
| 1071 |
token: "constant.language.escape", |
| 1072 |
regex: "]", |
| 1073 |
next: "regex" |
| 1074 |
}, { |
| 1075 |
token: "constant.language.escape", |
| 1076 |
regex: "-" |
| 1077 |
}, { |
| 1078 |
token: "empty", |
| 1079 |
regex: "$", |
| 1080 |
next: "no_regex" |
| 1081 |
}, { |
| 1082 |
defaultToken: "string.regexp.charachterclass" |
| 1083 |
} |
| 1084 |
], |
| 1085 |
"default_parameter": [ |
| 1086 |
{ |
| 1087 |
token: "string", |
| 1088 |
regex: "'(?=.)", |
| 1089 |
push: [ |
| 1090 |
{ |
| 1091 |
token: "string", |
| 1092 |
regex: "'|$", |
| 1093 |
next: "pop" |
| 1094 |
}, { |
| 1095 |
include: "qstring" |
| 1096 |
} |
| 1097 |
] |
| 1098 |
}, { |
| 1099 |
token: "string", |
| 1100 |
regex: '"(?=.)', |
| 1101 |
push: [ |
| 1102 |
{ |
| 1103 |
token: "string", |
| 1104 |
regex: '"|$', |
| 1105 |
next: "pop" |
| 1106 |
}, { |
| 1107 |
include: "qqstring" |
| 1108 |
} |
| 1109 |
] |
| 1110 |
}, { |
| 1111 |
token: "constant.language", |
| 1112 |
regex: "null|Infinity|NaN|undefined" |
| 1113 |
}, { |
| 1114 |
token: "constant.numeric", |
| 1115 |
regex: /0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/ |
| 1116 |
}, { |
| 1117 |
token: "constant.numeric", |
| 1118 |
regex: /(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/ |
| 1119 |
}, { |
| 1120 |
token: "punctuation.operator", |
| 1121 |
regex: ",", |
| 1122 |
next: "function_arguments" |
| 1123 |
}, { |
| 1124 |
token: "text", |
| 1125 |
regex: "\\s+" |
| 1126 |
}, { |
| 1127 |
token: "punctuation.operator", |
| 1128 |
regex: "$" |
| 1129 |
}, { |
| 1130 |
token: "empty", |
| 1131 |
regex: "", |
| 1132 |
next: "no_regex" |
| 1133 |
} |
| 1134 |
], |
| 1135 |
"function_arguments": [ |
| 1136 |
comments("function_arguments"), |
| 1137 |
{ |
| 1138 |
token: "variable.parameter", |
| 1139 |
regex: identifierRe |
| 1140 |
}, { |
| 1141 |
token: "punctuation.operator", |
| 1142 |
regex: "," |
| 1143 |
}, { |
| 1144 |
token: "text", |
| 1145 |
regex: "\\s+" |
| 1146 |
}, { |
| 1147 |
token: "punctuation.operator", |
| 1148 |
regex: "$" |
| 1149 |
}, { |
| 1150 |
token: "empty", |
| 1151 |
regex: "", |
| 1152 |
next: "no_regex" |
| 1153 |
} |
| 1154 |
], |
| 1155 |
"qqstring": [ |
| 1156 |
{ |
| 1157 |
token: "constant.language.escape", |
| 1158 |
regex: escapedRe |
| 1159 |
}, { |
| 1160 |
token: "string", |
| 1161 |
regex: "\\\\$", |
| 1162 |
consumeLineEnd: true |
| 1163 |
}, { |
| 1164 |
token: "string", |
| 1165 |
regex: '"|$', |
| 1166 |
next: "no_regex" |
| 1167 |
}, { |
| 1168 |
defaultToken: "string" |
| 1169 |
} |
| 1170 |
], |
| 1171 |
"qstring": [ |
| 1172 |
{ |
| 1173 |
token: "constant.language.escape", |
| 1174 |
regex: escapedRe |
| 1175 |
}, { |
| 1176 |
token: "string", |
| 1177 |
regex: "\\\\$", |
| 1178 |
consumeLineEnd: true |
| 1179 |
}, { |
| 1180 |
token: "string", |
| 1181 |
regex: "'|$", |
| 1182 |
next: "no_regex" |
| 1183 |
}, { |
| 1184 |
defaultToken: "string" |
| 1185 |
} |
| 1186 |
] |
| 1187 |
}; |
| 1188 |
if (!options || !options.noES6) { |
| 1189 |
this.$rules.no_regex.unshift({ |
| 1190 |
regex: "[{}]", onMatch: function (val, state, stack) { |
| 1191 |
this.next = val == "{" ? this.nextState : ""; |
| 1192 |
if (val == "{" && stack.length) { |
| 1193 |
stack.unshift("start", state); |
| 1194 |
} |
| 1195 |
else if (val == "}" && stack.length) { |
| 1196 |
stack.shift(); |
| 1197 |
this.next = stack.shift(); |
| 1198 |
if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -1) |
| 1199 |
return "paren.quasi.end"; |
| 1200 |
} |
| 1201 |
return val == "{" ? "paren.lparen" : "paren.rparen"; |
| 1202 |
}, |
| 1203 |
nextState: "start" |
| 1204 |
}, { |
| 1205 |
token: "string.quasi.start", |
| 1206 |
regex: /`/, |
| 1207 |
push: [{ |
| 1208 |
token: "constant.language.escape", |
| 1209 |
regex: escapedRe |
| 1210 |
}, { |
| 1211 |
token: "paren.quasi.start", |
| 1212 |
regex: /\${/, |
| 1213 |
push: "start" |
| 1214 |
}, { |
| 1215 |
token: "string.quasi.end", |
| 1216 |
regex: /`/, |
| 1217 |
next: "pop" |
| 1218 |
}, { |
| 1219 |
defaultToken: "string.quasi" |
| 1220 |
}] |
| 1221 |
}, { |
| 1222 |
token: ["variable.parameter", "text"], |
| 1223 |
regex: "(" + identifierRe + ")(\\s*)(?=\\=>)" |
| 1224 |
}, { |
| 1225 |
token: "paren.lparen", |
| 1226 |
regex: "(\\()(?=.+\\s*=>)", |
| 1227 |
next: "function_arguments" |
| 1228 |
}, { |
| 1229 |
token: "variable.language", |
| 1230 |
regex: "(?:(?:(?:Weak)?(?:Set|Map))|Promise)\\b" |
| 1231 |
}); |
| 1232 |
this.$rules["function_arguments"].unshift({ |
| 1233 |
token: "keyword.operator", |
| 1234 |
regex: "=", |
| 1235 |
next: "default_parameter" |
| 1236 |
}, { |
| 1237 |
token: "keyword.operator", |
| 1238 |
regex: "\\.{3}" |
| 1239 |
}); |
| 1240 |
this.$rules["property"].unshift({ |
| 1241 |
token: "support.function", |
| 1242 |
regex: "(findIndex|repeat|startsWith|endsWith|includes|isSafeInteger|trunc|cbrt|log2|log10|sign|then|catch|" |
| 1243 |
+ "finally|resolve|reject|race|any|all|allSettled|keys|entries|isInteger)\\b(?=\\()" |
| 1244 |
}, { |
| 1245 |
token: "constant.language", |
| 1246 |
regex: "(?:MAX_SAFE_INTEGER|MIN_SAFE_INTEGER|EPSILON)\\b" |
| 1247 |
}); |
| 1248 |
if (!options || options.jsx != false) |
| 1249 |
JSX.call(this); |
| 1250 |
} |
| 1251 |
this.embedRules(DocCommentHighlightRules, "doc-", [DocCommentHighlightRules.getEndRule("no_regex")]); |
| 1252 |
this.normalizeRules(); |
| 1253 |
}; |
| 1254 |
oop.inherits(JavaScriptHighlightRules, TextHighlightRules); |
| 1255 |
function JSX() { |
| 1256 |
var tagRegex = identifierRe.replace("\\d", "\\d\\-"); |
| 1257 |
var jsxTag = { |
| 1258 |
onMatch: function (val, state, stack) { |
| 1259 |
var offset = val.charAt(1) == "/" ? 2 : 1; |
| 1260 |
if (offset == 1) { |
| 1261 |
if (state != this.nextState) |
| 1262 |
stack.unshift(this.next, this.nextState, 0); |
| 1263 |
else |
| 1264 |
stack.unshift(this.next); |
| 1265 |
stack[2]++; |
| 1266 |
} |
| 1267 |
else if (offset == 2) { |
| 1268 |
if (state == this.nextState) { |
| 1269 |
stack[1]--; |
| 1270 |
if (!stack[1] || stack[1] < 0) { |
| 1271 |
stack.shift(); |
| 1272 |
stack.shift(); |
| 1273 |
} |
| 1274 |
} |
| 1275 |
} |
| 1276 |
return [{ |
| 1277 |
type: "meta.tag.punctuation." + (offset == 1 ? "" : "end-") + "tag-open.xml", |
| 1278 |
value: val.slice(0, offset) |
| 1279 |
}, { |
| 1280 |
type: "meta.tag.tag-name.xml", |
| 1281 |
value: val.substr(offset) |
| 1282 |
}]; |
| 1283 |
}, |
| 1284 |
regex: "</?" + tagRegex + "", |
| 1285 |
next: "jsxAttributes", |
| 1286 |
nextState: "jsx" |
| 1287 |
}; |
| 1288 |
this.$rules.start.unshift(jsxTag); |
| 1289 |
var jsxJsRule = { |
| 1290 |
regex: "{", |
| 1291 |
token: "paren.quasi.start", |
| 1292 |
push: "start" |
| 1293 |
}; |
| 1294 |
this.$rules.jsx = [ |
| 1295 |
jsxJsRule, |
| 1296 |
jsxTag, |
| 1297 |
{ include: "reference" }, |
| 1298 |
{ defaultToken: "string" } |
| 1299 |
]; |
| 1300 |
this.$rules.jsxAttributes = [{ |
| 1301 |
token: "meta.tag.punctuation.tag-close.xml", |
| 1302 |
regex: "/?>", |
| 1303 |
onMatch: function (value, currentState, stack) { |
| 1304 |
if (currentState == stack[0]) |
| 1305 |
stack.shift(); |
| 1306 |
if (value.length == 2) { |
| 1307 |
if (stack[0] == this.nextState) |
| 1308 |
stack[1]--; |
| 1309 |
if (!stack[1] || stack[1] < 0) { |
| 1310 |
stack.splice(0, 2); |
| 1311 |
} |
| 1312 |
} |
| 1313 |
this.next = stack[0] || "start"; |
| 1314 |
return [{ type: this.token, value: value }]; |
| 1315 |
}, |
| 1316 |
nextState: "jsx" |
| 1317 |
}, |
| 1318 |
jsxJsRule, |
| 1319 |
comments("jsxAttributes"), |
| 1320 |
{ |
| 1321 |
token: "entity.other.attribute-name.xml", |
| 1322 |
regex: tagRegex |
| 1323 |
}, { |
| 1324 |
token: "keyword.operator.attribute-equals.xml", |
| 1325 |
regex: "=" |
| 1326 |
}, { |
| 1327 |
token: "text.tag-whitespace.xml", |
| 1328 |
regex: "\\s+" |
| 1329 |
}, { |
| 1330 |
token: "string.attribute-value.xml", |
| 1331 |
regex: "'", |
| 1332 |
stateName: "jsx_attr_q", |
| 1333 |
push: [ |
| 1334 |
{ token: "string.attribute-value.xml", regex: "'", next: "pop" }, |
| 1335 |
{ include: "reference" }, |
| 1336 |
{ defaultToken: "string.attribute-value.xml" } |
| 1337 |
] |
| 1338 |
}, { |
| 1339 |
token: "string.attribute-value.xml", |
| 1340 |
regex: '"', |
| 1341 |
stateName: "jsx_attr_qq", |
| 1342 |
push: [ |
| 1343 |
{ token: "string.attribute-value.xml", regex: '"', next: "pop" }, |
| 1344 |
{ include: "reference" }, |
| 1345 |
{ defaultToken: "string.attribute-value.xml" } |
| 1346 |
] |
| 1347 |
}, |
| 1348 |
jsxTag |
| 1349 |
]; |
| 1350 |
this.$rules.reference = [{ |
| 1351 |
token: "constant.language.escape.reference.xml", |
| 1352 |
regex: "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" |
| 1353 |
}]; |
| 1354 |
} |
| 1355 |
function comments(next) { |
| 1356 |
return [ |
| 1357 |
{ |
| 1358 |
token: "comment", |
| 1359 |
regex: /\/\*/, |
| 1360 |
next: [ |
| 1361 |
DocCommentHighlightRules.getTagRule(), |
| 1362 |
{ token: "comment", regex: "\\*\\/", next: next || "pop" }, |
| 1363 |
{ defaultToken: "comment", caseInsensitive: true } |
| 1364 |
] |
| 1365 |
}, { |
| 1366 |
token: "comment", |
| 1367 |
regex: "\\/\\/", |
| 1368 |
next: [ |
| 1369 |
DocCommentHighlightRules.getTagRule(), |
| 1370 |
{ token: "comment", regex: "$|^", next: next || "pop" }, |
| 1371 |
{ defaultToken: "comment", caseInsensitive: true } |
| 1372 |
] |
| 1373 |
} |
| 1374 |
]; |
| 1375 |
} |
| 1376 |
exports.JavaScriptHighlightRules = JavaScriptHighlightRules; |
| 1377 |
|
| 1378 |
}); |
| 1379 |
|
| 1380 |
ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module){"use strict"; |
| 1381 |
var Range = require("../range").Range; |
| 1382 |
var MatchingBraceOutdent = function () { }; |
| 1383 |
(function () { |
| 1384 |
this.checkOutdent = function (line, input) { |
| 1385 |
if (!/^\s+$/.test(line)) |
| 1386 |
return false; |
| 1387 |
return /^\s*\}/.test(input); |
| 1388 |
}; |
| 1389 |
this.autoOutdent = function (doc, row) { |
| 1390 |
var line = doc.getLine(row); |
| 1391 |
var match = line.match(/^(\s*\})/); |
| 1392 |
if (!match) |
| 1393 |
return 0; |
| 1394 |
var column = match[1].length; |
| 1395 |
var openBracePos = doc.findMatchingBracket({ row: row, column: column }); |
| 1396 |
if (!openBracePos || openBracePos.row == row) |
| 1397 |
return 0; |
| 1398 |
var indent = this.$getIndent(doc.getLine(openBracePos.row)); |
| 1399 |
doc.replace(new Range(row, 0, row, column - 1), indent); |
| 1400 |
}; |
| 1401 |
this.$getIndent = function (line) { |
| 1402 |
return line.match(/^\s*/)[0]; |
| 1403 |
}; |
| 1404 |
}).call(MatchingBraceOutdent.prototype); |
| 1405 |
exports.MatchingBraceOutdent = MatchingBraceOutdent; |
| 1406 |
|
| 1407 |
}); |
| 1408 |
|
| 1409 |
ace.define("ace/mode/javascript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/javascript_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(require, exports, module){"use strict"; |
| 1410 |
var oop = require("../lib/oop"); |
| 1411 |
var TextMode = require("./text").Mode; |
| 1412 |
var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; |
| 1413 |
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; |
| 1414 |
var WorkerClient = require("../worker/worker_client").WorkerClient; |
| 1415 |
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; |
| 1416 |
var CStyleFoldMode = require("./folding/cstyle").FoldMode; |
| 1417 |
var Mode = function () { |
| 1418 |
this.HighlightRules = JavaScriptHighlightRules; |
| 1419 |
this.$outdent = new MatchingBraceOutdent(); |
| 1420 |
this.$behaviour = new CstyleBehaviour(); |
| 1421 |
this.foldingRules = new CStyleFoldMode(); |
| 1422 |
}; |
| 1423 |
oop.inherits(Mode, TextMode); |
| 1424 |
(function () { |
| 1425 |
this.lineCommentStart = "//"; |
| 1426 |
this.blockComment = { start: "/*", end: "*/" }; |
| 1427 |
this.$quotes = { '"': '"', "'": "'", "`": "`" }; |
| 1428 |
this.$pairQuotesAfter = { |
| 1429 |
"`": /\w/ |
| 1430 |
}; |
| 1431 |
this.getNextLineIndent = function (state, line, tab) { |
| 1432 |
var indent = this.$getIndent(line); |
| 1433 |
var tokenizedLine = this.getTokenizer().getLineTokens(line, state); |
| 1434 |
var tokens = tokenizedLine.tokens; |
| 1435 |
var endState = tokenizedLine.state; |
| 1436 |
if (tokens.length && tokens[tokens.length - 1].type == "comment") { |
| 1437 |
return indent; |
| 1438 |
} |
| 1439 |
if (state == "start" || state == "no_regex") { |
| 1440 |
var match = line.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/); |
| 1441 |
if (match) { |
| 1442 |
indent += tab; |
| 1443 |
} |
| 1444 |
} |
| 1445 |
else if (state == "doc-start") { |
| 1446 |
if (endState == "start" || endState == "no_regex") { |
| 1447 |
return ""; |
| 1448 |
} |
| 1449 |
var match = line.match(/^\s*(\/?)\*/); |
| 1450 |
if (match) { |
| 1451 |
if (match[1]) { |
| 1452 |
indent += " "; |
| 1453 |
} |
| 1454 |
indent += "* "; |
| 1455 |
} |
| 1456 |
} |
| 1457 |
return indent; |
| 1458 |
}; |
| 1459 |
this.checkOutdent = function (state, line, input) { |
| 1460 |
return this.$outdent.checkOutdent(line, input); |
| 1461 |
}; |
| 1462 |
this.autoOutdent = function (state, doc, row) { |
| 1463 |
this.$outdent.autoOutdent(doc, row); |
| 1464 |
}; |
| 1465 |
this.createWorker = function (session) { |
| 1466 |
var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker"); |
| 1467 |
worker.attachToDocument(session.getDocument()); |
| 1468 |
worker.on("annotate", function (results) { |
| 1469 |
session.setAnnotations(results.data); |
| 1470 |
}); |
| 1471 |
worker.on("terminate", function () { |
| 1472 |
session.clearAnnotations(); |
| 1473 |
}); |
| 1474 |
return worker; |
| 1475 |
}; |
| 1476 |
this.$id = "ace/mode/javascript"; |
| 1477 |
this.snippetFileId = "ace/snippets/javascript"; |
| 1478 |
}).call(Mode.prototype); |
| 1479 |
exports.Mode = Mode; |
| 1480 |
|
| 1481 |
}); |
| 1482 |
|
| 1483 |
ace.define("ace/mode/css_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict"; |
| 1484 |
var oop = require("../lib/oop"); |
| 1485 |
var lang = require("../lib/lang"); |
| 1486 |
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; |
| 1487 |
var supportType = exports.supportType = "align-content|align-items|align-self|all|animation|animation-delay|animation-direction|animation-duration|animation-fill-mode|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|backface-visibility|background|background-attachment|background-blend-mode|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|border|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|bottom|box-shadow|box-sizing|caption-side|clear|clip|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|cursor|direction|display|empty-cells|filter|flex|flex-basis|flex-direction|flex-flow|flex-grow|flex-shrink|flex-wrap|float|font|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|hanging-punctuation|height|justify-content|left|letter-spacing|line-height|list-style|list-style-image|list-style-position|list-style-type|margin|margin-bottom|margin-left|margin-right|margin-top|max-height|max-width|max-zoom|min-height|min-width|min-zoom|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|order|outline|outline-color|outline-offset|outline-style|outline-width|overflow|overflow-x|overflow-y|padding|padding-bottom|padding-left|padding-right|padding-top|page-break-after|page-break-before|page-break-inside|perspective|perspective-origin|position|quotes|resize|right|tab-size|table-layout|text-align|text-align-last|text-decoration|text-decoration-color|text-decoration-line|text-decoration-style|text-indent|text-justify|text-overflow|text-shadow|text-transform|top|transform|transform-origin|transform-style|transition|transition-delay|transition-duration|transition-property|transition-timing-function|unicode-bidi|user-select|user-zoom|vertical-align|visibility|white-space|width|word-break|word-spacing|word-wrap|z-index"; |
| 1488 |
var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters"; |
| 1489 |
var supportConstant = exports.supportConstant = "absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|flex-end|flex-start|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero|zoom"; |
| 1490 |
var supportConstantColor = exports.supportConstantColor = "aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkgrey|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkslategrey|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dimgrey|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|grey|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgray|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightslategrey|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|rebeccapurple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|slategrey|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|violet|wheat|white|whitesmoke|yellow|yellowgreen"; |
| 1491 |
var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|cursive|fantasy|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace"; |
| 1492 |
var numRe = exports.numRe = "\\-?(?:(?:[0-9]+(?:\\.[0-9]+)?)|(?:\\.[0-9]+))"; |
| 1493 |
var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b"; |
| 1494 |
var pseudoClasses = exports.pseudoClasses = "(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b"; |
| 1495 |
var CssHighlightRules = function () { |
| 1496 |
var keywordMapper = this.createKeywordMapper({ |
| 1497 |
"support.function": supportFunction, |
| 1498 |
"support.constant": supportConstant, |
| 1499 |
"support.type": supportType, |
| 1500 |
"support.constant.color": supportConstantColor, |
| 1501 |
"support.constant.fonts": supportConstantFonts |
| 1502 |
}, "text", true); |
| 1503 |
this.$rules = { |
| 1504 |
"start": [{ |
| 1505 |
include: ["strings", "url", "comments"] |
| 1506 |
}, { |
| 1507 |
token: "paren.lparen", |
| 1508 |
regex: "\\{", |
| 1509 |
next: "ruleset" |
| 1510 |
}, { |
| 1511 |
token: "paren.rparen", |
| 1512 |
regex: "\\}" |
| 1513 |
}, { |
| 1514 |
token: "string", |
| 1515 |
regex: "@(?!viewport)", |
| 1516 |
next: "media" |
| 1517 |
}, { |
| 1518 |
token: "keyword", |
| 1519 |
regex: "#[a-z0-9-_]+" |
| 1520 |
}, { |
| 1521 |
token: "keyword", |
| 1522 |
regex: "%" |
| 1523 |
}, { |
| 1524 |
token: "variable", |
| 1525 |
regex: "\\.[a-z0-9-_]+" |
| 1526 |
}, { |
| 1527 |
token: "string", |
| 1528 |
regex: ":[a-z0-9-_]+" |
| 1529 |
}, { |
| 1530 |
token: "constant.numeric", |
| 1531 |
regex: numRe |
| 1532 |
}, { |
| 1533 |
token: "constant", |
| 1534 |
regex: "[a-z0-9-_]+" |
| 1535 |
}, { |
| 1536 |
caseInsensitive: true |
| 1537 |
}], |
| 1538 |
"media": [{ |
| 1539 |
include: ["strings", "url", "comments"] |
| 1540 |
}, { |
| 1541 |
token: "paren.lparen", |
| 1542 |
regex: "\\{", |
| 1543 |
next: "start" |
| 1544 |
}, { |
| 1545 |
token: "paren.rparen", |
| 1546 |
regex: "\\}", |
| 1547 |
next: "start" |
| 1548 |
}, { |
| 1549 |
token: "string", |
| 1550 |
regex: ";", |
| 1551 |
next: "start" |
| 1552 |
}, { |
| 1553 |
token: "keyword", |
| 1554 |
regex: "(?:media|supports|document|charset|import|namespace|media|supports|document" |
| 1555 |
+ "|page|font|keyframes|viewport|counter-style|font-feature-values" |
| 1556 |
+ "|swash|ornaments|annotation|stylistic|styleset|character-variant)" |
| 1557 |
}], |
| 1558 |
"comments": [{ |
| 1559 |
token: "comment", |
| 1560 |
regex: "\\/\\*", |
| 1561 |
push: [{ |
| 1562 |
token: "comment", |
| 1563 |
regex: "\\*\\/", |
| 1564 |
next: "pop" |
| 1565 |
}, { |
| 1566 |
defaultToken: "comment" |
| 1567 |
}] |
| 1568 |
}], |
| 1569 |
"ruleset": [{ |
| 1570 |
regex: "-(webkit|ms|moz|o)-", |
| 1571 |
token: "text" |
| 1572 |
}, { |
| 1573 |
token: "punctuation.operator", |
| 1574 |
regex: "[:;]" |
| 1575 |
}, { |
| 1576 |
token: "paren.rparen", |
| 1577 |
regex: "\\}", |
| 1578 |
next: "start" |
| 1579 |
}, { |
| 1580 |
include: ["strings", "url", "comments"] |
| 1581 |
}, { |
| 1582 |
token: ["constant.numeric", "keyword"], |
| 1583 |
regex: "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vmax|vmin|vm|vw|%)" |
| 1584 |
}, { |
| 1585 |
token: "constant.numeric", |
| 1586 |
regex: numRe |
| 1587 |
}, { |
| 1588 |
token: "constant.numeric", |
| 1589 |
regex: "#[a-f0-9]{6}" |
| 1590 |
}, { |
| 1591 |
token: "constant.numeric", |
| 1592 |
regex: "#[a-f0-9]{3}" |
| 1593 |
}, { |
| 1594 |
token: ["punctuation", "entity.other.attribute-name.pseudo-element.css"], |
| 1595 |
regex: pseudoElements |
| 1596 |
}, { |
| 1597 |
token: ["punctuation", "entity.other.attribute-name.pseudo-class.css"], |
| 1598 |
regex: pseudoClasses |
| 1599 |
}, { |
| 1600 |
include: "url" |
| 1601 |
}, { |
| 1602 |
token: keywordMapper, |
| 1603 |
regex: "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*" |
| 1604 |
}, { |
| 1605 |
caseInsensitive: true |
| 1606 |
}], |
| 1607 |
url: [{ |
| 1608 |
token: "support.function", |
| 1609 |
regex: "(?:url(:?-prefix)?|domain|regexp)\\(", |
| 1610 |
push: [{ |
| 1611 |
token: "support.function", |
| 1612 |
regex: "\\)", |
| 1613 |
next: "pop" |
| 1614 |
}, { |
| 1615 |
defaultToken: "string" |
| 1616 |
}] |
| 1617 |
}], |
| 1618 |
strings: [{ |
| 1619 |
token: "string.start", |
| 1620 |
regex: "'", |
| 1621 |
push: [{ |
| 1622 |
token: "string.end", |
| 1623 |
regex: "'|$", |
| 1624 |
next: "pop" |
| 1625 |
}, { |
| 1626 |
include: "escapes" |
| 1627 |
}, { |
| 1628 |
token: "constant.language.escape", |
| 1629 |
regex: /\\$/, |
| 1630 |
consumeLineEnd: true |
| 1631 |
}, { |
| 1632 |
defaultToken: "string" |
| 1633 |
}] |
| 1634 |
}, { |
| 1635 |
token: "string.start", |
| 1636 |
regex: '"', |
| 1637 |
push: [{ |
| 1638 |
token: "string.end", |
| 1639 |
regex: '"|$', |
| 1640 |
next: "pop" |
| 1641 |
}, { |
| 1642 |
include: "escapes" |
| 1643 |
}, { |
| 1644 |
token: "constant.language.escape", |
| 1645 |
regex: /\\$/, |
| 1646 |
consumeLineEnd: true |
| 1647 |
}, { |
| 1648 |
defaultToken: "string" |
| 1649 |
}] |
| 1650 |
}], |
| 1651 |
escapes: [{ |
| 1652 |
token: "constant.language.escape", |
| 1653 |
regex: /\\([a-fA-F\d]{1,6}|[^a-fA-F\d])/ |
| 1654 |
}] |
| 1655 |
}; |
| 1656 |
this.normalizeRules(); |
| 1657 |
}; |
| 1658 |
oop.inherits(CssHighlightRules, TextHighlightRules); |
| 1659 |
exports.CssHighlightRules = CssHighlightRules; |
| 1660 |
|
| 1661 |
}); |
| 1662 |
|
| 1663 |
ace.define("ace/mode/css_completions",["require","exports","module"], function(require, exports, module){"use strict"; |
| 1664 |
var propertyMap = { |
| 1665 |
"background": { "#$0": 1 }, |
| 1666 |
"background-color": { "#$0": 1, "transparent": 1, "fixed": 1 }, |
| 1667 |
"background-image": { "url('/$0')": 1 }, |
| 1668 |
"background-repeat": { "repeat": 1, "repeat-x": 1, "repeat-y": 1, "no-repeat": 1, "inherit": 1 }, |
| 1669 |
"background-position": { "bottom": 2, "center": 2, "left": 2, "right": 2, "top": 2, "inherit": 2 }, |
| 1670 |
"background-attachment": { "scroll": 1, "fixed": 1 }, |
| 1671 |
"background-size": { "cover": 1, "contain": 1 }, |
| 1672 |
"background-clip": { "border-box": 1, "padding-box": 1, "content-box": 1 }, |
| 1673 |
"background-origin": { "border-box": 1, "padding-box": 1, "content-box": 1 }, |
| 1674 |
"border": { "solid $0": 1, "dashed $0": 1, "dotted $0": 1, "#$0": 1 }, |
| 1675 |
"border-color": { "#$0": 1 }, |
| 1676 |
"border-style": { "solid": 2, "dashed": 2, "dotted": 2, "double": 2, "groove": 2, "hidden": 2, "inherit": 2, "inset": 2, "none": 2, "outset": 2, "ridged": 2 }, |
| 1677 |
"border-collapse": { "collapse": 1, "separate": 1 }, |
| 1678 |
"bottom": { "px": 1, "em": 1, "%": 1 }, |
| 1679 |
"clear": { "left": 1, "right": 1, "both": 1, "none": 1 }, |
| 1680 |
"color": { "#$0": 1, "rgb(#$00,0,0)": 1 }, |
| 1681 |
"cursor": { "default": 1, "pointer": 1, "move": 1, "text": 1, "wait": 1, "help": 1, "progress": 1, "n-resize": 1, "ne-resize": 1, "e-resize": 1, "se-resize": 1, "s-resize": 1, "sw-resize": 1, "w-resize": 1, "nw-resize": 1 }, |
| 1682 |
"display": { "none": 1, "block": 1, "inline": 1, "inline-block": 1, "table-cell": 1 }, |
| 1683 |
"empty-cells": { "show": 1, "hide": 1 }, |
| 1684 |
"float": { "left": 1, "right": 1, "none": 1 }, |
| 1685 |
"font-family": { "Arial": 2, "Comic Sans MS": 2, "Consolas": 2, "Courier New": 2, "Courier": 2, "Georgia": 2, "Monospace": 2, "Sans-Serif": 2, "Segoe UI": 2, "Tahoma": 2, "Times New Roman": 2, "Trebuchet MS": 2, "Verdana": 1 }, |
| 1686 |
"font-size": { "px": 1, "em": 1, "%": 1 }, |
| 1687 |
"font-weight": { "bold": 1, "normal": 1 }, |
| 1688 |
"font-style": { "italic": 1, "normal": 1 }, |
| 1689 |
"font-variant": { "normal": 1, "small-caps": 1 }, |
| 1690 |
"height": { "px": 1, "em": 1, "%": 1 }, |
| 1691 |
"left": { "px": 1, "em": 1, "%": 1 }, |
| 1692 |
"letter-spacing": { "normal": 1 }, |
| 1693 |
"line-height": { "normal": 1 }, |
| 1694 |
"list-style-type": { "none": 1, "disc": 1, "circle": 1, "square": 1, "decimal": 1, "decimal-leading-zero": 1, "lower-roman": 1, "upper-roman": 1, "lower-greek": 1, "lower-latin": 1, "upper-latin": 1, "georgian": 1, "lower-alpha": 1, "upper-alpha": 1 }, |
| 1695 |
"margin": { "px": 1, "em": 1, "%": 1 }, |
| 1696 |
"margin-right": { "px": 1, "em": 1, "%": 1 }, |
| 1697 |
"margin-left": { "px": 1, "em": 1, "%": 1 }, |
| 1698 |
"margin-top": { "px": 1, "em": 1, "%": 1 }, |
| 1699 |
"margin-bottom": { "px": 1, "em": 1, "%": 1 }, |
| 1700 |
"max-height": { "px": 1, "em": 1, "%": 1 }, |
| 1701 |
"max-width": { "px": 1, "em": 1, "%": 1 }, |
| 1702 |
"min-height": { "px": 1, "em": 1, "%": 1 }, |
| 1703 |
"min-width": { "px": 1, "em": 1, "%": 1 }, |
| 1704 |
"overflow": { "hidden": 1, "visible": 1, "auto": 1, "scroll": 1 }, |
| 1705 |
"overflow-x": { "hidden": 1, "visible": 1, "auto": 1, "scroll": 1 }, |
| 1706 |
"overflow-y": { "hidden": 1, "visible": 1, "auto": 1, "scroll": 1 }, |
| 1707 |
"padding": { "px": 1, "em": 1, "%": 1 }, |
| 1708 |
"padding-top": { "px": 1, "em": 1, "%": 1 }, |
| 1709 |
"padding-right": { "px": 1, "em": 1, "%": 1 }, |
| 1710 |
"padding-bottom": { "px": 1, "em": 1, "%": 1 }, |
| 1711 |
"padding-left": { "px": 1, "em": 1, "%": 1 }, |
| 1712 |
"page-break-after": { "auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1 }, |
| 1713 |
"page-break-before": { "auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1 }, |
| 1714 |
"position": { "absolute": 1, "relative": 1, "fixed": 1, "static": 1 }, |
| 1715 |
"right": { "px": 1, "em": 1, "%": 1 }, |
| 1716 |
"table-layout": { "fixed": 1, "auto": 1 }, |
| 1717 |
"text-decoration": { "none": 1, "underline": 1, "line-through": 1, "blink": 1 }, |
| 1718 |
"text-align": { "left": 1, "right": 1, "center": 1, "justify": 1 }, |
| 1719 |
"text-transform": { "capitalize": 1, "uppercase": 1, "lowercase": 1, "none": 1 }, |
| 1720 |
"top": { "px": 1, "em": 1, "%": 1 }, |
| 1721 |
"vertical-align": { "top": 1, "bottom": 1 }, |
| 1722 |
"visibility": { "hidden": 1, "visible": 1 }, |
| 1723 |
"white-space": { "nowrap": 1, "normal": 1, "pre": 1, "pre-line": 1, "pre-wrap": 1 }, |
| 1724 |
"width": { "px": 1, "em": 1, "%": 1 }, |
| 1725 |
"word-spacing": { "normal": 1 }, |
| 1726 |
"filter": { "alpha(opacity=$0100)": 1 }, |
| 1727 |
"text-shadow": { "$02px 2px 2px #777": 1 }, |
| 1728 |
"text-overflow": { "ellipsis-word": 1, "clip": 1, "ellipsis": 1 }, |
| 1729 |
"-moz-border-radius": 1, |
| 1730 |
"-moz-border-radius-topright": 1, |
| 1731 |
"-moz-border-radius-bottomright": 1, |
| 1732 |
"-moz-border-radius-topleft": 1, |
| 1733 |
"-moz-border-radius-bottomleft": 1, |
| 1734 |
"-webkit-border-radius": 1, |
| 1735 |
"-webkit-border-top-right-radius": 1, |
| 1736 |
"-webkit-border-top-left-radius": 1, |
| 1737 |
"-webkit-border-bottom-right-radius": 1, |
| 1738 |
"-webkit-border-bottom-left-radius": 1, |
| 1739 |
"-moz-box-shadow": 1, |
| 1740 |
"-webkit-box-shadow": 1, |
| 1741 |
"transform": { "rotate($00deg)": 1, "skew($00deg)": 1 }, |
| 1742 |
"-moz-transform": { "rotate($00deg)": 1, "skew($00deg)": 1 }, |
| 1743 |
"-webkit-transform": { "rotate($00deg)": 1, "skew($00deg)": 1 } |
| 1744 |
}; |
| 1745 |
var CssCompletions = function () { |
| 1746 |
}; |
| 1747 |
(function () { |
| 1748 |
this.completionsDefined = false; |
| 1749 |
this.defineCompletions = function () { |
| 1750 |
if (document) { |
| 1751 |
var style = document.createElement('c').style; |
| 1752 |
for (var i in style) { |
| 1753 |
if (typeof style[i] !== 'string') |
| 1754 |
continue; |
| 1755 |
var name = i.replace(/[A-Z]/g, function (x) { |
| 1756 |
return '-' + x.toLowerCase(); |
| 1757 |
}); |
| 1758 |
if (!propertyMap.hasOwnProperty(name)) |
| 1759 |
propertyMap[name] = 1; |
| 1760 |
} |
| 1761 |
} |
| 1762 |
this.completionsDefined = true; |
| 1763 |
}; |
| 1764 |
this.getCompletions = function (state, session, pos, prefix) { |
| 1765 |
if (!this.completionsDefined) { |
| 1766 |
this.defineCompletions(); |
| 1767 |
} |
| 1768 |
if (state === 'ruleset' || session.$mode.$id == "ace/mode/scss") { |
| 1769 |
var line = session.getLine(pos.row).substr(0, pos.column); |
| 1770 |
var inParens = /\([^)]*$/.test(line); |
| 1771 |
if (inParens) { |
| 1772 |
line = line.substr(line.lastIndexOf('(') + 1); |
| 1773 |
} |
| 1774 |
if (/:[^;]+$/.test(line)) { |
| 1775 |
/([\w\-]+):[^:]*$/.test(line); |
| 1776 |
return this.getPropertyValueCompletions(state, session, pos, prefix); |
| 1777 |
} |
| 1778 |
else { |
| 1779 |
return this.getPropertyCompletions(state, session, pos, prefix, inParens); |
| 1780 |
} |
| 1781 |
} |
| 1782 |
return []; |
| 1783 |
}; |
| 1784 |
this.getPropertyCompletions = function (state, session, pos, prefix, skipSemicolon) { |
| 1785 |
skipSemicolon = skipSemicolon || false; |
| 1786 |
var properties = Object.keys(propertyMap); |
| 1787 |
return properties.map(function (property) { |
| 1788 |
return { |
| 1789 |
caption: property, |
| 1790 |
snippet: property + ': $0' + (skipSemicolon ? '' : ';'), |
| 1791 |
meta: "property", |
| 1792 |
score: 1000000 |
| 1793 |
}; |
| 1794 |
}); |
| 1795 |
}; |
| 1796 |
this.getPropertyValueCompletions = function (state, session, pos, prefix) { |
| 1797 |
var line = session.getLine(pos.row).substr(0, pos.column); |
| 1798 |
var property = (/([\w\-]+):[^:]*$/.exec(line) || {})[1]; |
| 1799 |
if (!property) |
| 1800 |
return []; |
| 1801 |
var values = []; |
| 1802 |
if (property in propertyMap && typeof propertyMap[property] === "object") { |
| 1803 |
values = Object.keys(propertyMap[property]); |
| 1804 |
} |
| 1805 |
return values.map(function (value) { |
| 1806 |
return { |
| 1807 |
caption: value, |
| 1808 |
snippet: value, |
| 1809 |
meta: "property value", |
| 1810 |
score: 1000000 |
| 1811 |
}; |
| 1812 |
}); |
| 1813 |
}; |
| 1814 |
}).call(CssCompletions.prototype); |
| 1815 |
exports.CssCompletions = CssCompletions; |
| 1816 |
|
| 1817 |
}); |
| 1818 |
|
| 1819 |
ace.define("ace/mode/behaviour/css",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/mode/behaviour/cstyle","ace/token_iterator"], function(require, exports, module){"use strict"; |
| 1820 |
var oop = require("../../lib/oop"); |
| 1821 |
var Behaviour = require("../behaviour").Behaviour; |
| 1822 |
var CstyleBehaviour = require("./cstyle").CstyleBehaviour; |
| 1823 |
var TokenIterator = require("../../token_iterator").TokenIterator; |
| 1824 |
var CssBehaviour = function () { |
| 1825 |
this.inherit(CstyleBehaviour); |
| 1826 |
this.add("colon", "insertion", function (state, action, editor, session, text) { |
| 1827 |
if (text === ':' && editor.selection.isEmpty()) { |
| 1828 |
var cursor = editor.getCursorPosition(); |
| 1829 |
var iterator = new TokenIterator(session, cursor.row, cursor.column); |
| 1830 |
var token = iterator.getCurrentToken(); |
| 1831 |
if (token && token.value.match(/\s+/)) { |
| 1832 |
token = iterator.stepBackward(); |
| 1833 |
} |
| 1834 |
if (token && token.type === 'support.type') { |
| 1835 |
var line = session.doc.getLine(cursor.row); |
| 1836 |
var rightChar = line.substring(cursor.column, cursor.column + 1); |
| 1837 |
if (rightChar === ':') { |
| 1838 |
return { |
| 1839 |
text: '', |
| 1840 |
selection: [1, 1] |
| 1841 |
}; |
| 1842 |
} |
| 1843 |
if (/^(\s+[^;]|\s*$)/.test(line.substring(cursor.column))) { |
| 1844 |
return { |
| 1845 |
text: ':;', |
| 1846 |
selection: [1, 1] |
| 1847 |
}; |
| 1848 |
} |
| 1849 |
} |
| 1850 |
} |
| 1851 |
}); |
| 1852 |
this.add("colon", "deletion", function (state, action, editor, session, range) { |
| 1853 |
var selected = session.doc.getTextRange(range); |
| 1854 |
if (!range.isMultiLine() && selected === ':') { |
| 1855 |
var cursor = editor.getCursorPosition(); |
| 1856 |
var iterator = new TokenIterator(session, cursor.row, cursor.column); |
| 1857 |
var token = iterator.getCurrentToken(); |
| 1858 |
if (token && token.value.match(/\s+/)) { |
| 1859 |
token = iterator.stepBackward(); |
| 1860 |
} |
| 1861 |
if (token && token.type === 'support.type') { |
| 1862 |
var line = session.doc.getLine(range.start.row); |
| 1863 |
var rightChar = line.substring(range.end.column, range.end.column + 1); |
| 1864 |
if (rightChar === ';') { |
| 1865 |
range.end.column++; |
| 1866 |
return range; |
| 1867 |
} |
| 1868 |
} |
| 1869 |
} |
| 1870 |
}); |
| 1871 |
this.add("semicolon", "insertion", function (state, action, editor, session, text) { |
| 1872 |
if (text === ';' && editor.selection.isEmpty()) { |
| 1873 |
var cursor = editor.getCursorPosition(); |
| 1874 |
var line = session.doc.getLine(cursor.row); |
| 1875 |
var rightChar = line.substring(cursor.column, cursor.column + 1); |
| 1876 |
if (rightChar === ';') { |
| 1877 |
return { |
| 1878 |
text: '', |
| 1879 |
selection: [1, 1] |
| 1880 |
}; |
| 1881 |
} |
| 1882 |
} |
| 1883 |
}); |
| 1884 |
this.add("!important", "insertion", function (state, action, editor, session, text) { |
| 1885 |
if (text === '!' && editor.selection.isEmpty()) { |
| 1886 |
var cursor = editor.getCursorPosition(); |
| 1887 |
var line = session.doc.getLine(cursor.row); |
| 1888 |
if (/^\s*(;|}|$)/.test(line.substring(cursor.column))) { |
| 1889 |
return { |
| 1890 |
text: '!important', |
| 1891 |
selection: [10, 10] |
| 1892 |
}; |
| 1893 |
} |
| 1894 |
} |
| 1895 |
}); |
| 1896 |
}; |
| 1897 |
oop.inherits(CssBehaviour, CstyleBehaviour); |
| 1898 |
exports.CssBehaviour = CssBehaviour; |
| 1899 |
|
| 1900 |
}); |
| 1901 |
|
| 1902 |
ace.define("ace/mode/css",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/css_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/css_completions","ace/mode/behaviour/css","ace/mode/folding/cstyle"], function(require, exports, module){"use strict"; |
| 1903 |
var oop = require("../lib/oop"); |
| 1904 |
var TextMode = require("./text").Mode; |
| 1905 |
var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; |
| 1906 |
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; |
| 1907 |
var WorkerClient = require("../worker/worker_client").WorkerClient; |
| 1908 |
var CssCompletions = require("./css_completions").CssCompletions; |
| 1909 |
var CssBehaviour = require("./behaviour/css").CssBehaviour; |
| 1910 |
var CStyleFoldMode = require("./folding/cstyle").FoldMode; |
| 1911 |
var Mode = function () { |
| 1912 |
this.HighlightRules = CssHighlightRules; |
| 1913 |
this.$outdent = new MatchingBraceOutdent(); |
| 1914 |
this.$behaviour = new CssBehaviour(); |
| 1915 |
this.$completer = new CssCompletions(); |
| 1916 |
this.foldingRules = new CStyleFoldMode(); |
| 1917 |
}; |
| 1918 |
oop.inherits(Mode, TextMode); |
| 1919 |
(function () { |
| 1920 |
this.foldingRules = "cStyle"; |
| 1921 |
this.blockComment = { start: "/*", end: "*/" }; |
| 1922 |
this.getNextLineIndent = function (state, line, tab) { |
| 1923 |
var indent = this.$getIndent(line); |
| 1924 |
var tokens = this.getTokenizer().getLineTokens(line, state).tokens; |
| 1925 |
if (tokens.length && tokens[tokens.length - 1].type == "comment") { |
| 1926 |
return indent; |
| 1927 |
} |
| 1928 |
var match = line.match(/^.*\{\s*$/); |
| 1929 |
if (match) { |
| 1930 |
indent += tab; |
| 1931 |
} |
| 1932 |
return indent; |
| 1933 |
}; |
| 1934 |
this.checkOutdent = function (state, line, input) { |
| 1935 |
return this.$outdent.checkOutdent(line, input); |
| 1936 |
}; |
| 1937 |
this.autoOutdent = function (state, doc, row) { |
| 1938 |
this.$outdent.autoOutdent(doc, row); |
| 1939 |
}; |
| 1940 |
this.getCompletions = function (state, session, pos, prefix) { |
| 1941 |
return this.$completer.getCompletions(state, session, pos, prefix); |
| 1942 |
}; |
| 1943 |
this.createWorker = function (session) { |
| 1944 |
var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker"); |
| 1945 |
worker.attachToDocument(session.getDocument()); |
| 1946 |
worker.on("annotate", function (e) { |
| 1947 |
session.setAnnotations(e.data); |
| 1948 |
}); |
| 1949 |
worker.on("terminate", function () { |
| 1950 |
session.clearAnnotations(); |
| 1951 |
}); |
| 1952 |
return worker; |
| 1953 |
}; |
| 1954 |
this.$id = "ace/mode/css"; |
| 1955 |
this.snippetFileId = "ace/snippets/css"; |
| 1956 |
}).call(Mode.prototype); |
| 1957 |
exports.Mode = Mode; |
| 1958 |
|
| 1959 |
}); |
| 1960 |
|
| 1961 |
ace.define("ace/mode/xml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict"; |
| 1962 |
var oop = require("../lib/oop"); |
| 1963 |
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; |
| 1964 |
var XmlHighlightRules = function (normalize) { |
| 1965 |
var tagRegex = "[_:a-zA-Z\xc0-\uffff][-_:.a-zA-Z0-9\xc0-\uffff]*"; |
| 1966 |
this.$rules = { |
| 1967 |
start: [ |
| 1968 |
{ token: "string.cdata.xml", regex: "<\\!\\[CDATA\\[", next: "cdata" }, |
| 1969 |
{ |
| 1970 |
token: ["punctuation.instruction.xml", "keyword.instruction.xml"], |
| 1971 |
regex: "(<\\?)(" + tagRegex + ")", next: "processing_instruction" |
| 1972 |
}, |
| 1973 |
{ token: "comment.start.xml", regex: "<\\!--", next: "comment" }, |
| 1974 |
{ |
| 1975 |
token: ["xml-pe.doctype.xml", "xml-pe.doctype.xml"], |
| 1976 |
regex: "(<\\!)(DOCTYPE)(?=[\\s])", next: "doctype", caseInsensitive: true |
| 1977 |
}, |
| 1978 |
{ include: "tag" }, |
| 1979 |
{ token: "text.end-tag-open.xml", regex: "</" }, |
| 1980 |
{ token: "text.tag-open.xml", regex: "<" }, |
| 1981 |
{ include: "reference" }, |
| 1982 |
{ defaultToken: "text.xml" } |
| 1983 |
], |
| 1984 |
processing_instruction: [{ |
| 1985 |
token: "entity.other.attribute-name.decl-attribute-name.xml", |
| 1986 |
regex: tagRegex |
| 1987 |
}, { |
| 1988 |
token: "keyword.operator.decl-attribute-equals.xml", |
| 1989 |
regex: "=" |
| 1990 |
}, { |
| 1991 |
include: "whitespace" |
| 1992 |
}, { |
| 1993 |
include: "string" |
| 1994 |
}, { |
| 1995 |
token: "punctuation.xml-decl.xml", |
| 1996 |
regex: "\\?>", |
| 1997 |
next: "start" |
| 1998 |
}], |
| 1999 |
doctype: [ |
| 2000 |
{ include: "whitespace" }, |
| 2001 |
{ include: "string" }, |
| 2002 |
{ token: "xml-pe.doctype.xml", regex: ">", next: "start" }, |
| 2003 |
{ token: "xml-pe.xml", regex: "[-_a-zA-Z0-9:]+" }, |
| 2004 |
{ token: "punctuation.int-subset", regex: "\\[", push: "int_subset" } |
| 2005 |
], |
| 2006 |
int_subset: [{ |
| 2007 |
token: "text.xml", |
| 2008 |
regex: "\\s+" |
| 2009 |
}, { |
| 2010 |
token: "punctuation.int-subset.xml", |
| 2011 |
regex: "]", |
| 2012 |
next: "pop" |
| 2013 |
}, { |
| 2014 |
token: ["punctuation.markup-decl.xml", "keyword.markup-decl.xml"], |
| 2015 |
regex: "(<\\!)(" + tagRegex + ")", |
| 2016 |
push: [{ |
| 2017 |
token: "text", |
| 2018 |
regex: "\\s+" |
| 2019 |
}, |
| 2020 |
{ |
| 2021 |
token: "punctuation.markup-decl.xml", |
| 2022 |
regex: ">", |
| 2023 |
next: "pop" |
| 2024 |
}, |
| 2025 |
{ include: "string" }] |
| 2026 |
}], |
| 2027 |
cdata: [ |
| 2028 |
{ token: "string.cdata.xml", regex: "\\]\\]>", next: "start" }, |
| 2029 |
{ token: "text.xml", regex: "\\s+" }, |
| 2030 |
{ token: "text.xml", regex: "(?:[^\\]]|\\](?!\\]>))+" } |
| 2031 |
], |
| 2032 |
comment: [ |
| 2033 |
{ token: "comment.end.xml", regex: "-->", next: "start" }, |
| 2034 |
{ defaultToken: "comment.xml" } |
| 2035 |
], |
| 2036 |
reference: [{ |
| 2037 |
token: "constant.language.escape.reference.xml", |
| 2038 |
regex: "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" |
| 2039 |
}], |
| 2040 |
attr_reference: [{ |
| 2041 |
token: "constant.language.escape.reference.attribute-value.xml", |
| 2042 |
regex: "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" |
| 2043 |
}], |
| 2044 |
tag: [{ |
| 2045 |
token: ["meta.tag.punctuation.tag-open.xml", "meta.tag.punctuation.end-tag-open.xml", "meta.tag.tag-name.xml"], |
| 2046 |
regex: "(?:(<)|(</))((?:" + tagRegex + ":)?" + tagRegex + ")", |
| 2047 |
next: [ |
| 2048 |
{ include: "attributes" }, |
| 2049 |
{ token: "meta.tag.punctuation.tag-close.xml", regex: "/?>", next: "start" } |
| 2050 |
] |
| 2051 |
}], |
| 2052 |
tag_whitespace: [ |
| 2053 |
{ token: "text.tag-whitespace.xml", regex: "\\s+" } |
| 2054 |
], |
| 2055 |
whitespace: [ |
| 2056 |
{ token: "text.whitespace.xml", regex: "\\s+" } |
| 2057 |
], |
| 2058 |
string: [{ |
| 2059 |
token: "string.xml", |
| 2060 |
regex: "'", |
| 2061 |
push: [ |
| 2062 |
{ token: "string.xml", regex: "'", next: "pop" }, |
| 2063 |
{ defaultToken: "string.xml" } |
| 2064 |
] |
| 2065 |
}, { |
| 2066 |
token: "string.xml", |
| 2067 |
regex: '"', |
| 2068 |
push: [ |
| 2069 |
{ token: "string.xml", regex: '"', next: "pop" }, |
| 2070 |
{ defaultToken: "string.xml" } |
| 2071 |
] |
| 2072 |
}], |
| 2073 |
attributes: [{ |
| 2074 |
token: "entity.other.attribute-name.xml", |
| 2075 |
regex: tagRegex |
| 2076 |
}, { |
| 2077 |
token: "keyword.operator.attribute-equals.xml", |
| 2078 |
regex: "=" |
| 2079 |
}, { |
| 2080 |
include: "tag_whitespace" |
| 2081 |
}, { |
| 2082 |
include: "attribute_value" |
| 2083 |
}], |
| 2084 |
attribute_value: [{ |
| 2085 |
token: "string.attribute-value.xml", |
| 2086 |
regex: "'", |
| 2087 |
push: [ |
| 2088 |
{ token: "string.attribute-value.xml", regex: "'", next: "pop" }, |
| 2089 |
{ include: "attr_reference" }, |
| 2090 |
{ defaultToken: "string.attribute-value.xml" } |
| 2091 |
] |
| 2092 |
}, { |
| 2093 |
token: "string.attribute-value.xml", |
| 2094 |
regex: '"', |
| 2095 |
push: [ |
| 2096 |
{ token: "string.attribute-value.xml", regex: '"', next: "pop" }, |
| 2097 |
{ include: "attr_reference" }, |
| 2098 |
{ defaultToken: "string.attribute-value.xml" } |
| 2099 |
] |
| 2100 |
}] |
| 2101 |
}; |
| 2102 |
if (this.constructor === XmlHighlightRules) |
| 2103 |
this.normalizeRules(); |
| 2104 |
}; |
| 2105 |
(function () { |
| 2106 |
this.embedTagRules = function (HighlightRules, prefix, tag) { |
| 2107 |
this.$rules.tag.unshift({ |
| 2108 |
token: ["meta.tag.punctuation.tag-open.xml", "meta.tag." + tag + ".tag-name.xml"], |
| 2109 |
regex: "(<)(" + tag + "(?=\\s|>|$))", |
| 2110 |
next: [ |
| 2111 |
{ include: "attributes" }, |
| 2112 |
{ token: "meta.tag.punctuation.tag-close.xml", regex: "/?>", next: prefix + "start" } |
| 2113 |
] |
| 2114 |
}); |
| 2115 |
this.$rules[tag + "-end"] = [ |
| 2116 |
{ include: "attributes" }, |
| 2117 |
{ token: "meta.tag.punctuation.tag-close.xml", regex: "/?>", next: "start", |
| 2118 |
onMatch: function (value, currentState, stack) { |
| 2119 |
stack.splice(0); |
| 2120 |
return this.token; |
| 2121 |
} } |
| 2122 |
]; |
| 2123 |
this.embedRules(HighlightRules, prefix, [{ |
| 2124 |
token: ["meta.tag.punctuation.end-tag-open.xml", "meta.tag." + tag + ".tag-name.xml"], |
| 2125 |
regex: "(</)(" + tag + "(?=\\s|>|$))", |
| 2126 |
next: tag + "-end" |
| 2127 |
}, { |
| 2128 |
token: "string.cdata.xml", |
| 2129 |
regex: "<\\!\\[CDATA\\[" |
| 2130 |
}, { |
| 2131 |
token: "string.cdata.xml", |
| 2132 |
regex: "\\]\\]>" |
| 2133 |
}]); |
| 2134 |
}; |
| 2135 |
}).call(TextHighlightRules.prototype); |
| 2136 |
oop.inherits(XmlHighlightRules, TextHighlightRules); |
| 2137 |
exports.XmlHighlightRules = XmlHighlightRules; |
| 2138 |
|
| 2139 |
}); |
| 2140 |
|
| 2141 |
ace.define("ace/mode/html_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/css_highlight_rules","ace/mode/javascript_highlight_rules","ace/mode/xml_highlight_rules"], function(require, exports, module){"use strict"; |
| 2142 |
var oop = require("../lib/oop"); |
| 2143 |
var lang = require("../lib/lang"); |
| 2144 |
var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; |
| 2145 |
var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; |
| 2146 |
var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules; |
| 2147 |
var tagMap = lang.createMap({ |
| 2148 |
a: 'anchor', |
| 2149 |
button: 'form', |
| 2150 |
form: 'form', |
| 2151 |
img: 'image', |
| 2152 |
input: 'form', |
| 2153 |
label: 'form', |
| 2154 |
option: 'form', |
| 2155 |
script: 'script', |
| 2156 |
select: 'form', |
| 2157 |
textarea: 'form', |
| 2158 |
style: 'style', |
| 2159 |
table: 'table', |
| 2160 |
tbody: 'table', |
| 2161 |
td: 'table', |
| 2162 |
tfoot: 'table', |
| 2163 |
th: 'table', |
| 2164 |
tr: 'table' |
| 2165 |
}); |
| 2166 |
var HtmlHighlightRules = function () { |
| 2167 |
XmlHighlightRules.call(this); |
| 2168 |
this.addRules({ |
| 2169 |
attributes: [{ |
| 2170 |
include: "tag_whitespace" |
| 2171 |
}, { |
| 2172 |
token: "entity.other.attribute-name.xml", |
| 2173 |
regex: "[-_a-zA-Z0-9:.]+" |
| 2174 |
}, { |
| 2175 |
token: "keyword.operator.attribute-equals.xml", |
| 2176 |
regex: "=", |
| 2177 |
push: [{ |
| 2178 |
include: "tag_whitespace" |
| 2179 |
}, { |
| 2180 |
token: "string.unquoted.attribute-value.html", |
| 2181 |
regex: "[^<>='\"`\\s]+", |
| 2182 |
next: "pop" |
| 2183 |
}, { |
| 2184 |
token: "empty", |
| 2185 |
regex: "", |
| 2186 |
next: "pop" |
| 2187 |
}] |
| 2188 |
}, { |
| 2189 |
include: "attribute_value" |
| 2190 |
}], |
| 2191 |
tag: [{ |
| 2192 |
token: function (start, tag) { |
| 2193 |
var group = tagMap[tag]; |
| 2194 |
return ["meta.tag.punctuation." + (start == "<" ? "" : "end-") + "tag-open.xml", |
| 2195 |
"meta.tag" + (group ? "." + group : "") + ".tag-name.xml"]; |
| 2196 |
}, |
| 2197 |
regex: "(</?)([-_a-zA-Z0-9:.]+)", |
| 2198 |
next: "tag_stuff" |
| 2199 |
}], |
| 2200 |
tag_stuff: [ |
| 2201 |
{ include: "attributes" }, |
| 2202 |
{ token: "meta.tag.punctuation.tag-close.xml", regex: "/?>", next: "start" } |
| 2203 |
] |
| 2204 |
}); |
| 2205 |
this.embedTagRules(CssHighlightRules, "css-", "style"); |
| 2206 |
this.embedTagRules(new JavaScriptHighlightRules({ jsx: false }).getRules(), "js-", "script"); |
| 2207 |
if (this.constructor === HtmlHighlightRules) |
| 2208 |
this.normalizeRules(); |
| 2209 |
}; |
| 2210 |
oop.inherits(HtmlHighlightRules, XmlHighlightRules); |
| 2211 |
exports.HtmlHighlightRules = HtmlHighlightRules; |
| 2212 |
|
| 2213 |
}); |
| 2214 |
|
| 2215 |
ace.define("ace/mode/html",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text","ace/mode/javascript","ace/mode/css","ace/mode/html_highlight_rules","ace/mode/behaviour/xml","ace/mode/folding/html","ace/mode/html_completions","ace/worker/worker_client"], function(require, exports, module){"use strict"; |
| 2216 |
var oop = require("../lib/oop"); |
| 2217 |
var lang = require("../lib/lang"); |
| 2218 |
var TextMode = require("./text").Mode; |
| 2219 |
var JavaScriptMode = require("./javascript").Mode; |
| 2220 |
var CssMode = require("./css").Mode; |
| 2221 |
var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; |
| 2222 |
var XmlBehaviour = require("./behaviour/xml").XmlBehaviour; |
| 2223 |
var HtmlFoldMode = require("./folding/html").FoldMode; |
| 2224 |
var HtmlCompletions = require("./html_completions").HtmlCompletions; |
| 2225 |
var WorkerClient = require("../worker/worker_client").WorkerClient; |
| 2226 |
var voidElements = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "menuitem", "param", "source", "track", "wbr"]; |
| 2227 |
var optionalEndTags = ["li", "dt", "dd", "p", "rt", "rp", "optgroup", "option", "colgroup", "td", "th"]; |
| 2228 |
var Mode = function (options) { |
| 2229 |
this.fragmentContext = options && options.fragmentContext; |
| 2230 |
this.HighlightRules = HtmlHighlightRules; |
| 2231 |
this.$behaviour = new XmlBehaviour(); |
| 2232 |
this.$completer = new HtmlCompletions(); |
| 2233 |
this.createModeDelegates({ |
| 2234 |
"js-": JavaScriptMode, |
| 2235 |
"css-": CssMode |
| 2236 |
}); |
| 2237 |
this.foldingRules = new HtmlFoldMode(this.voidElements, lang.arrayToMap(optionalEndTags)); |
| 2238 |
}; |
| 2239 |
oop.inherits(Mode, TextMode); |
| 2240 |
(function () { |
| 2241 |
this.blockComment = { start: "<!--", end: "-->" }; |
| 2242 |
this.voidElements = lang.arrayToMap(voidElements); |
| 2243 |
this.getNextLineIndent = function (state, line, tab) { |
| 2244 |
return this.$getIndent(line); |
| 2245 |
}; |
| 2246 |
this.checkOutdent = function (state, line, input) { |
| 2247 |
return false; |
| 2248 |
}; |
| 2249 |
this.getCompletions = function (state, session, pos, prefix) { |
| 2250 |
return this.$completer.getCompletions(state, session, pos, prefix); |
| 2251 |
}; |
| 2252 |
this.createWorker = function (session) { |
| 2253 |
if (this.constructor != Mode) |
| 2254 |
return; |
| 2255 |
var worker = new WorkerClient(["ace"], "ace/mode/html_worker", "Worker"); |
| 2256 |
worker.attachToDocument(session.getDocument()); |
| 2257 |
if (this.fragmentContext) |
| 2258 |
worker.call("setOptions", [{ context: this.fragmentContext }]); |
| 2259 |
worker.on("error", function (e) { |
| 2260 |
session.setAnnotations(e.data); |
| 2261 |
}); |
| 2262 |
worker.on("terminate", function () { |
| 2263 |
session.clearAnnotations(); |
| 2264 |
}); |
| 2265 |
return worker; |
| 2266 |
}; |
| 2267 |
this.$id = "ace/mode/html"; |
| 2268 |
this.snippetFileId = "ace/snippets/html"; |
| 2269 |
}).call(Mode.prototype); |
| 2270 |
exports.Mode = Mode; |
| 2271 |
|
| 2272 |
}); |
| 2273 |
|
| 2274 |
ace.define("ace/mode/typescript_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/javascript_highlight_rules"], function(require, exports, module){ |
| 2275 |
|
| 2276 |
"use strict"; |
| 2277 |
var oop = require("../lib/oop"); |
| 2278 |
var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; |
| 2279 |
var TypeScriptHighlightRules = function (options) { |
| 2280 |
var tsRules = [ |
| 2281 |
{ |
| 2282 |
token: ["storage.type", "text", "entity.name.function.ts"], |
| 2283 |
regex: "(function)(\\s+)([a-zA-Z0-9\$_\u00a1-\uffff][a-zA-Z0-9\d\$_\u00a1-\uffff]*)" |
| 2284 |
}, |
| 2285 |
{ |
| 2286 |
token: "keyword", |
| 2287 |
regex: "(?:\\b(constructor|declare|interface|as|AS|public|private|extends|export|super|readonly|module|namespace|abstract|implements)\\b)" |
| 2288 |
}, |
| 2289 |
{ |
| 2290 |
token: ["keyword", "storage.type.variable.ts"], |
| 2291 |
regex: "(class|type)(\\s+[a-zA-Z0-9_?.$][\\w?.$]*)" |
| 2292 |
}, |
| 2293 |
{ |
| 2294 |
token: "keyword", |
| 2295 |
regex: "\\b(?:super|export|import|keyof|infer)\\b" |
| 2296 |
}, |
| 2297 |
{ |
| 2298 |
token: ["storage.type.variable.ts"], |
| 2299 |
regex: "(?:\\b(this\\.|string\\b|bool\\b|boolean\\b|number\\b|true\\b|false\\b|undefined\\b|any\\b|null\\b|(?:unique )?symbol\\b|object\\b|never\\b|enum\\b))" |
| 2300 |
} |
| 2301 |
]; |
| 2302 |
var JSRules = new JavaScriptHighlightRules({ jsx: (options && options.jsx) == true }).getRules(); |
| 2303 |
JSRules.no_regex = tsRules.concat(JSRules.no_regex); |
| 2304 |
this.$rules = JSRules; |
| 2305 |
}; |
| 2306 |
oop.inherits(TypeScriptHighlightRules, JavaScriptHighlightRules); |
| 2307 |
exports.TypeScriptHighlightRules = TypeScriptHighlightRules; |
| 2308 |
|
| 2309 |
}); |
| 2310 |
|
| 2311 |
ace.define("ace/mode/coffee_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict"; |
| 2312 |
var oop = require("../lib/oop"); |
| 2313 |
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; |
| 2314 |
oop.inherits(CoffeeHighlightRules, TextHighlightRules); |
| 2315 |
function CoffeeHighlightRules() { |
| 2316 |
var identifier = "[$A-Za-z_\\x7f-\\uffff][$\\w\\x7f-\\uffff]*"; |
| 2317 |
var keywords = ("this|throw|then|try|typeof|super|switch|return|break|by|continue|" + |
| 2318 |
"catch|class|in|instanceof|is|isnt|if|else|extends|for|own|" + |
| 2319 |
"finally|function|while|when|new|no|not|delete|debugger|do|loop|of|off|" + |
| 2320 |
"or|on|unless|until|and|yes|yield|export|import|default"); |
| 2321 |
var langConstant = ("true|false|null|undefined|NaN|Infinity"); |
| 2322 |
var illegal = ("case|const|function|var|void|with|enum|implements|" + |
| 2323 |
"interface|let|package|private|protected|public|static"); |
| 2324 |
var supportClass = ("Array|Boolean|Date|Function|Number|Object|RegExp|ReferenceError|String|" + |
| 2325 |
"Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + |
| 2326 |
"SyntaxError|TypeError|URIError|" + |
| 2327 |
"ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" + |
| 2328 |
"Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray"); |
| 2329 |
var supportFunction = ("Math|JSON|isNaN|isFinite|parseInt|parseFloat|encodeURI|" + |
| 2330 |
"encodeURIComponent|decodeURI|decodeURIComponent|String|"); |
| 2331 |
var variableLanguage = ("window|arguments|prototype|document"); |
| 2332 |
var keywordMapper = this.createKeywordMapper({ |
| 2333 |
"keyword": keywords, |
| 2334 |
"constant.language": langConstant, |
| 2335 |
"invalid.illegal": illegal, |
| 2336 |
"language.support.class": supportClass, |
| 2337 |
"language.support.function": supportFunction, |
| 2338 |
"variable.language": variableLanguage |
| 2339 |
}, "identifier"); |
| 2340 |
var functionRule = { |
| 2341 |
token: ["paren.lparen", "variable.parameter", "paren.rparen", "text", "storage.type"], |
| 2342 |
regex: /(?:(\()((?:"[^")]*?"|'[^')]*?'|\/[^\/)]*?\/|[^()"'\/])*?)(\))(\s*))?([\-=]>)/.source |
| 2343 |
}; |
| 2344 |
var stringEscape = /\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)/; |
| 2345 |
this.$rules = { |
| 2346 |
start: [ |
| 2347 |
{ |
| 2348 |
token: "constant.numeric", |
| 2349 |
regex: "(?:0x[\\da-fA-F]+|(?:\\d+(?:\\.\\d+)?|\\.\\d+)(?:[eE][+-]?\\d+)?)" |
| 2350 |
}, { |
| 2351 |
stateName: "qdoc", |
| 2352 |
token: "string", regex: "'''", next: [ |
| 2353 |
{ token: "string", regex: "'''", next: "start" }, |
| 2354 |
{ token: "constant.language.escape", regex: stringEscape }, |
| 2355 |
{ defaultToken: "string" } |
| 2356 |
] |
| 2357 |
}, { |
| 2358 |
stateName: "qqdoc", |
| 2359 |
token: "string", |
| 2360 |
regex: '"""', |
| 2361 |
next: [ |
| 2362 |
{ token: "string", regex: '"""', next: "start" }, |
| 2363 |
{ token: "paren.string", regex: '#{', push: "start" }, |
| 2364 |
{ token: "constant.language.escape", regex: stringEscape }, |
| 2365 |
{ defaultToken: "string" } |
| 2366 |
] |
| 2367 |
}, { |
| 2368 |
stateName: "qstring", |
| 2369 |
token: "string", regex: "'", next: [ |
| 2370 |
{ token: "string", regex: "'", next: "start" }, |
| 2371 |
{ token: "constant.language.escape", regex: stringEscape }, |
| 2372 |
{ defaultToken: "string" } |
| 2373 |
] |
| 2374 |
}, { |
| 2375 |
stateName: "qqstring", |
| 2376 |
token: "string.start", regex: '"', next: [ |
| 2377 |
{ token: "string.end", regex: '"', next: "start" }, |
| 2378 |
{ token: "paren.string", regex: '#{', push: "start" }, |
| 2379 |
{ token: "constant.language.escape", regex: stringEscape }, |
| 2380 |
{ defaultToken: "string" } |
| 2381 |
] |
| 2382 |
}, { |
| 2383 |
stateName: "js", |
| 2384 |
token: "string", regex: "`", next: [ |
| 2385 |
{ token: "string", regex: "`", next: "start" }, |
| 2386 |
{ token: "constant.language.escape", regex: stringEscape }, |
| 2387 |
{ defaultToken: "string" } |
| 2388 |
] |
| 2389 |
}, { |
| 2390 |
regex: "[{}]", onMatch: function (val, state, stack) { |
| 2391 |
this.next = ""; |
| 2392 |
if (val == "{" && stack.length) { |
| 2393 |
stack.unshift("start", state); |
| 2394 |
return "paren"; |
| 2395 |
} |
| 2396 |
if (val == "}" && stack.length) { |
| 2397 |
stack.shift(); |
| 2398 |
this.next = stack.shift() || ""; |
| 2399 |
if (this.next.indexOf("string") != -1) |
| 2400 |
return "paren.string"; |
| 2401 |
} |
| 2402 |
return "paren"; |
| 2403 |
} |
| 2404 |
}, { |
| 2405 |
token: "string.regex", |
| 2406 |
regex: "///", |
| 2407 |
next: "heregex" |
| 2408 |
}, { |
| 2409 |
token: "string.regex", |
| 2410 |
regex: /(?:\/(?![\s=])[^[\/\n\\]*(?:(?:\\[\s\S]|\[[^\]\n\\]*(?:\\[\s\S][^\]\n\\]*)*])[^[\/\n\\]*)*\/)(?:[imgy]{0,4})(?!\w)/ |
| 2411 |
}, { |
| 2412 |
token: "comment", |
| 2413 |
regex: "###(?!#)", |
| 2414 |
next: "comment" |
| 2415 |
}, { |
| 2416 |
token: "comment", |
| 2417 |
regex: "#.*" |
| 2418 |
}, { |
| 2419 |
token: ["punctuation.operator", "text", "identifier"], |
| 2420 |
regex: "(\\.)(\\s*)(" + illegal + ")" |
| 2421 |
}, { |
| 2422 |
token: "punctuation.operator", |
| 2423 |
regex: "\\.{1,3}" |
| 2424 |
}, { |
| 2425 |
token: ["keyword", "text", "language.support.class", |
| 2426 |
"text", "keyword", "text", "language.support.class"], |
| 2427 |
regex: "(class)(\\s+)(" + identifier + ")(?:(\\s+)(extends)(\\s+)(" + identifier + "))?" |
| 2428 |
}, { |
| 2429 |
token: ["entity.name.function", "text", "keyword.operator", "text"].concat(functionRule.token), |
| 2430 |
regex: "(" + identifier + ")(\\s*)([=:])(\\s*)" + functionRule.regex |
| 2431 |
}, |
| 2432 |
functionRule, |
| 2433 |
{ |
| 2434 |
token: "variable", |
| 2435 |
regex: "@(?:" + identifier + ")?" |
| 2436 |
}, { |
| 2437 |
token: keywordMapper, |
| 2438 |
regex: identifier |
| 2439 |
}, { |
| 2440 |
token: "punctuation.operator", |
| 2441 |
regex: "\\,|\\." |
| 2442 |
}, { |
| 2443 |
token: "storage.type", |
| 2444 |
regex: "[\\-=]>" |
| 2445 |
}, { |
| 2446 |
token: "keyword.operator", |
| 2447 |
regex: "(?:[-+*/%<>&|^!?=]=|>>>=?|\\-\\-|\\+\\+|::|&&=|\\|\\|=|<<=|>>=|\\?\\.|\\.{2,3}|[!*+-=><])" |
| 2448 |
}, { |
| 2449 |
token: "paren.lparen", |
| 2450 |
regex: "[({[]" |
| 2451 |
}, { |
| 2452 |
token: "paren.rparen", |
| 2453 |
regex: "[\\]})]" |
| 2454 |
}, { |
| 2455 |
token: "text", |
| 2456 |
regex: "\\s+" |
| 2457 |
} |
| 2458 |
], |
| 2459 |
heregex: [{ |
| 2460 |
token: "string.regex", |
| 2461 |
regex: '.*?///[imgy]{0,4}', |
| 2462 |
next: "start" |
| 2463 |
}, { |
| 2464 |
token: "comment.regex", |
| 2465 |
regex: "\\s+(?:#.*)?" |
| 2466 |
}, { |
| 2467 |
token: "string.regex", |
| 2468 |
regex: "\\S+" |
| 2469 |
}], |
| 2470 |
comment: [{ |
| 2471 |
token: "comment", |
| 2472 |
regex: '###', |
| 2473 |
next: "start" |
| 2474 |
}, { |
| 2475 |
defaultToken: "comment" |
| 2476 |
}] |
| 2477 |
}; |
| 2478 |
this.normalizeRules(); |
| 2479 |
} |
| 2480 |
exports.CoffeeHighlightRules = CoffeeHighlightRules; |
| 2481 |
|
| 2482 |
}); |
| 2483 |
|
| 2484 |
ace.define("ace/mode/stylus_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules","ace/mode/css_highlight_rules"], function(require, exports, module){ |
| 2485 |
|
| 2486 |
"use strict"; |
| 2487 |
var oop = require("../lib/oop"); |
| 2488 |
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; |
| 2489 |
var CssHighlightRules = require("./css_highlight_rules"); |
| 2490 |
var StylusHighlightRules = function () { |
| 2491 |
var keywordMapper = this.createKeywordMapper({ |
| 2492 |
"support.type": CssHighlightRules.supportType, |
| 2493 |
"support.function": CssHighlightRules.supportFunction, |
| 2494 |
"support.constant": CssHighlightRules.supportConstant, |
| 2495 |
"support.constant.color": CssHighlightRules.supportConstantColor, |
| 2496 |
"support.constant.fonts": CssHighlightRules.supportConstantFonts |
| 2497 |
}, "text", true); |
| 2498 |
this.$rules = { |
| 2499 |
start: [ |
| 2500 |
{ |
| 2501 |
token: "comment", |
| 2502 |
regex: /\/\/.*$/ |
| 2503 |
}, |
| 2504 |
{ |
| 2505 |
token: "comment", |
| 2506 |
regex: /\/\*/, |
| 2507 |
next: "comment" |
| 2508 |
}, |
| 2509 |
{ |
| 2510 |
token: ["entity.name.function.stylus", "text"], |
| 2511 |
regex: "^([-a-zA-Z_][-\\w]*)?(\\()" |
| 2512 |
}, |
| 2513 |
{ |
| 2514 |
token: ["entity.other.attribute-name.class.stylus"], |
| 2515 |
regex: "\\.-?[_a-zA-Z]+[_a-zA-Z0-9-]*" |
| 2516 |
}, |
| 2517 |
{ |
| 2518 |
token: ["entity.language.stylus"], |
| 2519 |
regex: "^ *&" |
| 2520 |
}, |
| 2521 |
{ |
| 2522 |
token: ["variable.language.stylus"], |
| 2523 |
regex: "(arguments)" |
| 2524 |
}, |
| 2525 |
{ |
| 2526 |
token: ["keyword.stylus"], |
| 2527 |
regex: "@[-\\w]+" |
| 2528 |
}, |
| 2529 |
{ |
| 2530 |
token: ["punctuation", "entity.other.attribute-name.pseudo-element.css"], |
| 2531 |
regex: CssHighlightRules.pseudoElements |
| 2532 |
}, { |
| 2533 |
token: ["punctuation", "entity.other.attribute-name.pseudo-class.css"], |
| 2534 |
regex: CssHighlightRules.pseudoClasses |
| 2535 |
}, |
| 2536 |
{ |
| 2537 |
token: ["entity.name.tag.stylus"], |
| 2538 |
regex: "(?:\\b)(a|abbr|acronym|address|area|article|aside|audio|b|base|big|blockquote|body|br|button|canvas|caption|cite|code|col|colgroup|datalist|dd|del|details|dfn|dialog|div|dl|dt|em|eventsource|fieldset|figure|figcaption|footer|form|frame|frameset|(?:h[1-6])|head|header|hgroup|hr|html|i|iframe|img|input|ins|kbd|label|legend|li|link|map|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|option|output|p|param|pre|progress|q|samp|script|section|select|small|span|strike|strong|style|sub|summary|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|tt|ul|var|video)(?:\\b)" |
| 2539 |
}, |
| 2540 |
{ |
| 2541 |
token: "constant.numeric", |
| 2542 |
regex: "#[a-fA-F0-9]{6}" |
| 2543 |
}, |
| 2544 |
{ |
| 2545 |
token: "constant.numeric", |
| 2546 |
regex: "#[a-fA-F0-9]{3}" |
| 2547 |
}, |
| 2548 |
{ |
| 2549 |
token: ["punctuation.definition.entity.stylus", "entity.other.attribute-name.id.stylus"], |
| 2550 |
regex: "(#)([a-zA-Z][a-zA-Z0-9_-]*)" |
| 2551 |
}, |
| 2552 |
{ |
| 2553 |
token: "meta.vendor-prefix.stylus", |
| 2554 |
regex: "-webkit-|-moz\\-|-ms-|-o-" |
| 2555 |
}, |
| 2556 |
{ |
| 2557 |
token: "keyword.control.stylus", |
| 2558 |
regex: "(?:!important|for|in|return|true|false|null|if|else|unless|return)\\b" |
| 2559 |
}, |
| 2560 |
{ |
| 2561 |
token: "keyword.operator.stylus", |
| 2562 |
regex: "!|~|\\+|-|(?:\\*)?\\*|\\/|%|(?:\\.)\\.\\.|<|>|(?:=|:|\\?|\\+|-|\\*|\\/|%|<|>)?=|!=" |
| 2563 |
}, |
| 2564 |
{ |
| 2565 |
token: "keyword.operator.stylus", |
| 2566 |
regex: "(?:in|is(?:nt)?|not)\\b" |
| 2567 |
}, |
| 2568 |
{ |
| 2569 |
token: "string", |
| 2570 |
regex: "'(?=.)", |
| 2571 |
next: "qstring" |
| 2572 |
}, { |
| 2573 |
token: "string", |
| 2574 |
regex: '"(?=.)', |
| 2575 |
next: "qqstring" |
| 2576 |
}, |
| 2577 |
{ |
| 2578 |
token: "constant.numeric", |
| 2579 |
regex: CssHighlightRules.numRe |
| 2580 |
}, |
| 2581 |
{ |
| 2582 |
token: "keyword", |
| 2583 |
regex: "(?:ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)\\b" |
| 2584 |
}, |
| 2585 |
{ |
| 2586 |
token: keywordMapper, |
| 2587 |
regex: "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*" |
| 2588 |
} |
| 2589 |
], |
| 2590 |
"comment": [ |
| 2591 |
{ |
| 2592 |
token: "comment", |
| 2593 |
regex: "\\*\\/", |
| 2594 |
next: "start" |
| 2595 |
}, { |
| 2596 |
defaultToken: "comment" |
| 2597 |
} |
| 2598 |
], |
| 2599 |
"qqstring": [ |
| 2600 |
{ |
| 2601 |
token: "string", |
| 2602 |
regex: '[^"\\\\]+' |
| 2603 |
}, |
| 2604 |
{ |
| 2605 |
token: "string", |
| 2606 |
regex: "\\\\$", |
| 2607 |
next: "qqstring" |
| 2608 |
}, |
| 2609 |
{ |
| 2610 |
token: "string", |
| 2611 |
regex: '"|$', |
| 2612 |
next: "start" |
| 2613 |
} |
| 2614 |
], |
| 2615 |
"qstring": [ |
| 2616 |
{ |
| 2617 |
token: "string", |
| 2618 |
regex: "[^'\\\\]+" |
| 2619 |
}, |
| 2620 |
{ |
| 2621 |
token: "string", |
| 2622 |
regex: "\\\\$", |
| 2623 |
next: "qstring" |
| 2624 |
}, |
| 2625 |
{ |
| 2626 |
token: "string", |
| 2627 |
regex: "'|$", |
| 2628 |
next: "start" |
| 2629 |
} |
| 2630 |
] |
| 2631 |
}; |
| 2632 |
}; |
| 2633 |
oop.inherits(StylusHighlightRules, TextHighlightRules); |
| 2634 |
exports.StylusHighlightRules = StylusHighlightRules; |
| 2635 |
|
| 2636 |
}); |
| 2637 |
|
| 2638 |
ace.define("ace/mode/scss_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules","ace/mode/css_highlight_rules"], function(require, exports, module){"use strict"; |
| 2639 |
var oop = require("../lib/oop"); |
| 2640 |
var lang = require("../lib/lang"); |
| 2641 |
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; |
| 2642 |
var CssHighlightRules = require("./css_highlight_rules"); |
| 2643 |
var ScssHighlightRules = function () { |
| 2644 |
var properties = lang.arrayToMap(CssHighlightRules.supportType.split("|")); |
| 2645 |
var functions = lang.arrayToMap(("hsl|hsla|rgb|rgba|url|attr|counter|counters|abs|adjust_color|adjust_hue|" + |
| 2646 |
"alpha|join|blue|ceil|change_color|comparable|complement|darken|desaturate|" + |
| 2647 |
"floor|grayscale|green|hue|if|invert|join|length|lighten|lightness|mix|" + |
| 2648 |
"nth|opacify|opacity|percentage|quote|red|round|saturate|saturation|" + |
| 2649 |
"scale_color|transparentize|type_of|unit|unitless|unquote").split("|")); |
| 2650 |
var constants = lang.arrayToMap(CssHighlightRules.supportConstant.split("|")); |
| 2651 |
var colors = lang.arrayToMap(CssHighlightRules.supportConstantColor.split("|")); |
| 2652 |
var keywords = lang.arrayToMap(("@mixin|@extend|@include|@import|@media|@debug|@warn|@if|@for|@each|@while|@else|@font-face|@-webkit-keyframes|if|and|!default|module|def|end|declare").split("|")); |
| 2653 |
var tags = lang.arrayToMap(("a|abbr|acronym|address|applet|area|article|aside|audio|b|base|basefont|bdo|" + |
| 2654 |
"big|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|" + |
| 2655 |
"command|datalist|dd|del|details|dfn|dir|div|dl|dt|em|embed|fieldset|" + |
| 2656 |
"figcaption|figure|font|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|" + |
| 2657 |
"header|hgroup|hr|html|i|iframe|img|input|ins|keygen|kbd|label|legend|li|" + |
| 2658 |
"link|map|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|" + |
| 2659 |
"option|output|p|param|pre|progress|q|rp|rt|ruby|s|samp|script|section|select|" + |
| 2660 |
"small|source|span|strike|strong|style|sub|summary|sup|table|tbody|td|" + |
| 2661 |
"textarea|tfoot|th|thead|time|title|tr|tt|u|ul|var|video|wbr|xmp").split("|")); |
| 2662 |
var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))"; |
| 2663 |
this.$rules = { |
| 2664 |
"start": [ |
| 2665 |
{ |
| 2666 |
token: "comment", |
| 2667 |
regex: "\\/\\/.*$" |
| 2668 |
}, |
| 2669 |
{ |
| 2670 |
token: "comment", |
| 2671 |
regex: "\\/\\*", |
| 2672 |
next: "comment" |
| 2673 |
}, { |
| 2674 |
token: "string", |
| 2675 |
regex: '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' |
| 2676 |
}, { |
| 2677 |
token: "string", |
| 2678 |
regex: '["].*\\\\$', |
| 2679 |
next: "qqstring" |
| 2680 |
}, { |
| 2681 |
token: "string", |
| 2682 |
regex: "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" |
| 2683 |
}, { |
| 2684 |
token: "string", |
| 2685 |
regex: "['].*\\\\$", |
| 2686 |
next: "qstring" |
| 2687 |
}, { |
| 2688 |
token: "constant.numeric", |
| 2689 |
regex: numRe + "(?:ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vmax|vmin|vm|vw|%)" |
| 2690 |
}, { |
| 2691 |
token: "constant.numeric", |
| 2692 |
regex: "#[a-f0-9]{6}" |
| 2693 |
}, { |
| 2694 |
token: "constant.numeric", |
| 2695 |
regex: "#[a-f0-9]{3}" |
| 2696 |
}, { |
| 2697 |
token: "constant.numeric", |
| 2698 |
regex: numRe |
| 2699 |
}, { |
| 2700 |
token: ["support.function", "string", "support.function"], |
| 2701 |
regex: "(url\\()(.*)(\\))" |
| 2702 |
}, { |
| 2703 |
token: function (value) { |
| 2704 |
if (properties.hasOwnProperty(value.toLowerCase())) |
| 2705 |
return "support.type"; |
| 2706 |
if (keywords.hasOwnProperty(value)) |
| 2707 |
return "keyword"; |
| 2708 |
else if (constants.hasOwnProperty(value)) |
| 2709 |
return "constant.language"; |
| 2710 |
else if (functions.hasOwnProperty(value)) |
| 2711 |
return "support.function"; |
| 2712 |
else if (colors.hasOwnProperty(value.toLowerCase())) |
| 2713 |
return "support.constant.color"; |
| 2714 |
else if (tags.hasOwnProperty(value.toLowerCase())) |
| 2715 |
return "variable.language"; |
| 2716 |
else |
| 2717 |
return "text"; |
| 2718 |
}, |
| 2719 |
regex: "\\-?[@a-z_][@a-z0-9_\\-]*" |
| 2720 |
}, { |
| 2721 |
token: "variable", |
| 2722 |
regex: "[a-z_\\-$][a-z0-9_\\-$]*\\b" |
| 2723 |
}, { |
| 2724 |
token: "variable.language", |
| 2725 |
regex: "#[a-z0-9-_]+" |
| 2726 |
}, { |
| 2727 |
token: "variable.language", |
| 2728 |
regex: "\\.[a-z0-9-_]+" |
| 2729 |
}, { |
| 2730 |
token: "variable.language", |
| 2731 |
regex: ":[a-z0-9-_]+" |
| 2732 |
}, { |
| 2733 |
token: "constant", |
| 2734 |
regex: "[a-z0-9-_]+" |
| 2735 |
}, { |
| 2736 |
token: "keyword.operator", |
| 2737 |
regex: "<|>|<=|>=|==|!=|-|%|#|\\+|\\$|\\+|\\*" |
| 2738 |
}, { |
| 2739 |
token: "paren.lparen", |
| 2740 |
regex: "[[({]" |
| 2741 |
}, { |
| 2742 |
token: "paren.rparen", |
| 2743 |
regex: "[\\])}]" |
| 2744 |
}, { |
| 2745 |
token: "text", |
| 2746 |
regex: "\\s+" |
| 2747 |
}, { |
| 2748 |
caseInsensitive: true |
| 2749 |
} |
| 2750 |
], |
| 2751 |
"comment": [ |
| 2752 |
{ |
| 2753 |
token: "comment", |
| 2754 |
regex: "\\*\\/", |
| 2755 |
next: "start" |
| 2756 |
}, { |
| 2757 |
defaultToken: "comment" |
| 2758 |
} |
| 2759 |
], |
| 2760 |
"qqstring": [ |
| 2761 |
{ |
| 2762 |
token: "string", |
| 2763 |
regex: '(?:(?:\\\\.)|(?:[^"\\\\]))*?"', |
| 2764 |
next: "start" |
| 2765 |
}, { |
| 2766 |
token: "string", |
| 2767 |
regex: '.+' |
| 2768 |
} |
| 2769 |
], |
| 2770 |
"qstring": [ |
| 2771 |
{ |
| 2772 |
token: "string", |
| 2773 |
regex: "(?:(?:\\\\.)|(?:[^'\\\\]))*?'", |
| 2774 |
next: "start" |
| 2775 |
}, { |
| 2776 |
token: "string", |
| 2777 |
regex: '.+' |
| 2778 |
} |
| 2779 |
] |
| 2780 |
}; |
| 2781 |
}; |
| 2782 |
oop.inherits(ScssHighlightRules, TextHighlightRules); |
| 2783 |
exports.ScssHighlightRules = ScssHighlightRules; |
| 2784 |
|
| 2785 |
}); |
| 2786 |
|
| 2787 |
ace.define("ace/mode/sass_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/scss_highlight_rules"], function(require, exports, module){"use strict"; |
| 2788 |
var oop = require("../lib/oop"); |
| 2789 |
var lang = require("../lib/lang"); |
| 2790 |
var ScssHighlightRules = require("./scss_highlight_rules").ScssHighlightRules; |
| 2791 |
var SassHighlightRules = function () { |
| 2792 |
ScssHighlightRules.call(this); |
| 2793 |
var start = this.$rules.start; |
| 2794 |
if (start[1].token == "comment") { |
| 2795 |
start.splice(1, 1, { |
| 2796 |
onMatch: function (value, currentState, stack) { |
| 2797 |
stack.unshift(this.next, -1, value.length - 2, currentState); |
| 2798 |
return "comment"; |
| 2799 |
}, |
| 2800 |
regex: /^\s*\/\*/, |
| 2801 |
next: "comment" |
| 2802 |
}, { |
| 2803 |
token: "error.invalid", |
| 2804 |
regex: "/\\*|[{;}]" |
| 2805 |
}, { |
| 2806 |
token: "support.type", |
| 2807 |
regex: /^\s*:[\w\-]+\s/ |
| 2808 |
}); |
| 2809 |
this.$rules.comment = [ |
| 2810 |
{ regex: /^\s*/, onMatch: function (value, currentState, stack) { |
| 2811 |
if (stack[1] === -1) |
| 2812 |
stack[1] = Math.max(stack[2], value.length - 1); |
| 2813 |
if (value.length <= stack[1]) { stack.shift(); |
| 2814 |
stack.shift(); |
| 2815 |
stack.shift(); |
| 2816 |
this.next = stack.shift(); |
| 2817 |
return "text"; |
| 2818 |
} |
| 2819 |
else { |
| 2820 |
this.next = ""; |
| 2821 |
return "comment"; |
| 2822 |
} |
| 2823 |
}, next: "start" }, |
| 2824 |
{ defaultToken: "comment" } |
| 2825 |
]; |
| 2826 |
} |
| 2827 |
}; |
| 2828 |
oop.inherits(SassHighlightRules, ScssHighlightRules); |
| 2829 |
exports.SassHighlightRules = SassHighlightRules; |
| 2830 |
|
| 2831 |
}); |
| 2832 |
|
| 2833 |
ace.define("ace/mode/less_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules","ace/mode/css_highlight_rules"], function(require, exports, module){"use strict"; |
| 2834 |
var oop = require("../lib/oop"); |
| 2835 |
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; |
| 2836 |
var CssHighlightRules = require('./css_highlight_rules'); |
| 2837 |
var LessHighlightRules = function () { |
| 2838 |
var keywordList = "@import|@media|@font-face|@keyframes|@-webkit-keyframes|@supports|" + |
| 2839 |
"@charset|@plugin|@namespace|@document|@page|@viewport|@-ms-viewport|" + |
| 2840 |
"or|and|when|not"; |
| 2841 |
var keywords = keywordList.split('|'); |
| 2842 |
var properties = CssHighlightRules.supportType.split('|'); |
| 2843 |
var keywordMapper = this.createKeywordMapper({ |
| 2844 |
"support.constant": CssHighlightRules.supportConstant, |
| 2845 |
"keyword": keywordList, |
| 2846 |
"support.constant.color": CssHighlightRules.supportConstantColor, |
| 2847 |
"support.constant.fonts": CssHighlightRules.supportConstantFonts |
| 2848 |
}, "identifier", true); |
| 2849 |
var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))"; |
| 2850 |
this.$rules = { |
| 2851 |
"start": [ |
| 2852 |
{ |
| 2853 |
token: "comment", |
| 2854 |
regex: "\\/\\/.*$" |
| 2855 |
}, |
| 2856 |
{ |
| 2857 |
token: "comment", |
| 2858 |
regex: "\\/\\*", |
| 2859 |
next: "comment" |
| 2860 |
}, { |
| 2861 |
token: "string", |
| 2862 |
regex: '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' |
| 2863 |
}, { |
| 2864 |
token: "string", |
| 2865 |
regex: "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" |
| 2866 |
}, { |
| 2867 |
token: ["constant.numeric", "keyword"], |
| 2868 |
regex: "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)" |
| 2869 |
}, { |
| 2870 |
token: "constant.numeric", |
| 2871 |
regex: "#[a-f0-9]{6}" |
| 2872 |
}, { |
| 2873 |
token: "constant.numeric", |
| 2874 |
regex: "#[a-f0-9]{3}" |
| 2875 |
}, { |
| 2876 |
token: "constant.numeric", |
| 2877 |
regex: numRe |
| 2878 |
}, { |
| 2879 |
token: ["support.function", "paren.lparen", "string", "paren.rparen"], |
| 2880 |
regex: "(url)(\\()(.*)(\\))" |
| 2881 |
}, { |
| 2882 |
token: ["support.function", "paren.lparen"], |
| 2883 |
regex: "(:extend|[a-z0-9_\\-]+)(\\()" |
| 2884 |
}, { |
| 2885 |
token: function (value) { |
| 2886 |
if (keywords.indexOf(value.toLowerCase()) > -1) |
| 2887 |
return "keyword"; |
| 2888 |
else |
| 2889 |
return "variable"; |
| 2890 |
}, |
| 2891 |
regex: "[@\\$][a-z0-9_\\-@\\$]*\\b" |
| 2892 |
}, { |
| 2893 |
token: "variable", |
| 2894 |
regex: "[@\\$]\\{[a-z0-9_\\-@\\$]*\\}" |
| 2895 |
}, { |
| 2896 |
token: function (first, second) { |
| 2897 |
if (properties.indexOf(first.toLowerCase()) > -1) { |
| 2898 |
return ["support.type.property", "text"]; |
| 2899 |
} |
| 2900 |
else { |
| 2901 |
return ["support.type.unknownProperty", "text"]; |
| 2902 |
} |
| 2903 |
}, |
| 2904 |
regex: "([a-z0-9-_]+)(\\s*:)" |
| 2905 |
}, { |
| 2906 |
token: "keyword", |
| 2907 |
regex: "&" |
| 2908 |
}, { |
| 2909 |
token: keywordMapper, |
| 2910 |
regex: "\\-?[@a-z_][@a-z0-9_\\-]*" |
| 2911 |
}, { |
| 2912 |
token: "variable.language", |
| 2913 |
regex: "#[a-z0-9-_]+" |
| 2914 |
}, { |
| 2915 |
token: "variable.language", |
| 2916 |
regex: "\\.[a-z0-9-_]+" |
| 2917 |
}, { |
| 2918 |
token: "variable.language", |
| 2919 |
regex: ":[a-z_][a-z0-9-_]*" |
| 2920 |
}, { |
| 2921 |
token: "constant", |
| 2922 |
regex: "[a-z0-9-_]+" |
| 2923 |
}, { |
| 2924 |
token: "keyword.operator", |
| 2925 |
regex: "<|>|<=|>=|=|!=|-|%|\\+|\\*" |
| 2926 |
}, { |
| 2927 |
token: "paren.lparen", |
| 2928 |
regex: "[[({]" |
| 2929 |
}, { |
| 2930 |
token: "paren.rparen", |
| 2931 |
regex: "[\\])}]" |
| 2932 |
}, { |
| 2933 |
token: "text", |
| 2934 |
regex: "\\s+" |
| 2935 |
}, { |
| 2936 |
caseInsensitive: true |
| 2937 |
} |
| 2938 |
], |
| 2939 |
"comment": [ |
| 2940 |
{ |
| 2941 |
token: "comment", |
| 2942 |
regex: "\\*\\/", |
| 2943 |
next: "start" |
| 2944 |
}, { |
| 2945 |
defaultToken: "comment" |
| 2946 |
} |
| 2947 |
] |
| 2948 |
}; |
| 2949 |
this.normalizeRules(); |
| 2950 |
}; |
| 2951 |
oop.inherits(LessHighlightRules, TextHighlightRules); |
| 2952 |
exports.LessHighlightRules = LessHighlightRules; |
| 2953 |
|
| 2954 |
}); |
| 2955 |
|
| 2956 |
ace.define("ace/mode/slim_highlight_rules",["require","exports","module","ace/config","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict"; |
| 2957 |
var modes = require("../config").$modes; |
| 2958 |
var oop = require("../lib/oop"); |
| 2959 |
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; |
| 2960 |
var SlimHighlightRules = function () { |
| 2961 |
this.$rules = { |
| 2962 |
"start": [ |
| 2963 |
{ |
| 2964 |
token: "keyword", |
| 2965 |
regex: /^(\s*)(\w+):\s*/, |
| 2966 |
onMatch: function (value, state, stack, line) { |
| 2967 |
var indent = /^\s*/.exec(line)[0]; |
| 2968 |
var m = value.match(/^(\s*)(\w+):/); |
| 2969 |
var language = m[2]; |
| 2970 |
if (!/^(javascript|ruby|coffee|markdown|css|scss|sass|less)$/.test(language)) |
| 2971 |
language = ""; |
| 2972 |
stack.unshift("language-embed", [], [indent, language], state); |
| 2973 |
return this.token; |
| 2974 |
}, |
| 2975 |
stateName: "language-embed", |
| 2976 |
next: [{ |
| 2977 |
token: "string", |
| 2978 |
regex: /^(\s*)/, |
| 2979 |
onMatch: function (value, state, stack, line) { |
| 2980 |
var indent = stack[2][0]; |
| 2981 |
if (indent.length >= value.length) { |
| 2982 |
stack.splice(0, 3); |
| 2983 |
this.next = stack.shift(); |
| 2984 |
return this.token; |
| 2985 |
} |
| 2986 |
this.next = ""; |
| 2987 |
return [{ type: "text", value: indent }]; |
| 2988 |
}, |
| 2989 |
next: "" |
| 2990 |
}, { |
| 2991 |
token: "string", |
| 2992 |
regex: /.+/, |
| 2993 |
onMatch: function (value, state, stack, line) { |
| 2994 |
var indent = stack[2][0]; |
| 2995 |
var language = stack[2][1]; |
| 2996 |
var embedState = stack[1]; |
| 2997 |
if (modes[language]) { |
| 2998 |
var data = modes[language].getTokenizer().getLineTokens(line.slice(indent.length), embedState.slice(0)); |
| 2999 |
stack[1] = data.state; |
| 3000 |
return data.tokens; |
| 3001 |
} |
| 3002 |
return this.token; |
| 3003 |
} |
| 3004 |
}] |
| 3005 |
}, |
| 3006 |
{ |
| 3007 |
token: 'constant.begin.javascript.filter.slim', |
| 3008 |
regex: '^(\\s*)():$' |
| 3009 |
}, { |
| 3010 |
token: 'constant.begin..filter.slim', |
| 3011 |
regex: '^(\\s*)(ruby):$' |
| 3012 |
}, { |
| 3013 |
token: 'constant.begin.coffeescript.filter.slim', |
| 3014 |
regex: '^(\\s*)():$' |
| 3015 |
}, { |
| 3016 |
token: 'constant.begin..filter.slim', |
| 3017 |
regex: '^(\\s*)(markdown):$' |
| 3018 |
}, { |
| 3019 |
token: 'constant.begin.css.filter.slim', |
| 3020 |
regex: '^(\\s*)():$' |
| 3021 |
}, { |
| 3022 |
token: 'constant.begin.scss.filter.slim', |
| 3023 |
regex: '^(\\s*)():$' |
| 3024 |
}, { |
| 3025 |
token: 'constant.begin..filter.slim', |
| 3026 |
regex: '^(\\s*)(sass):$' |
| 3027 |
}, { |
| 3028 |
token: 'constant.begin..filter.slim', |
| 3029 |
regex: '^(\\s*)(less):$' |
| 3030 |
}, { |
| 3031 |
token: 'constant.begin..filter.slim', |
| 3032 |
regex: '^(\\s*)(erb):$' |
| 3033 |
}, { |
| 3034 |
token: 'keyword.html.tags.slim', |
| 3035 |
regex: '^(\\s*)((:?\\*(\\w)+)|doctype html|abbr|acronym|address|applet|area|article|aside|audio|base|basefont|bdo|big|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|command|datalist|dd|del|details|dialog|dfn|dir|div|dl|dt|embed|fieldset|figure|font|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hgroup|hr|html|i|iframe|img|input|ins|keygen|kbd|label|legend|link|li|map|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|option|output|p|param|pre|progress|q|rp|rt|ruby|samp|script|section|select|small|source|span|strike|strong|style|sub|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|tt|ul|var|video|xmp|b|u|s|em|a)(?:([.#](\\w|\\.)+)+\\s?)?\\b' |
| 3036 |
}, { |
| 3037 |
token: 'keyword.slim', |
| 3038 |
regex: '^(\\s*)(?:([.#](\\w|\\.)+)+\\s?)' |
| 3039 |
}, { |
| 3040 |
token: "string", |
| 3041 |
regex: /^(\s*)('|\||\/|(\/!))\s*/, |
| 3042 |
onMatch: function (val, state, stack, line) { |
| 3043 |
var indent = /^\s*/.exec(line)[0]; |
| 3044 |
if (stack.length < 1) { |
| 3045 |
stack.push(this.next); |
| 3046 |
} |
| 3047 |
else { |
| 3048 |
stack[0] = "mlString"; |
| 3049 |
} |
| 3050 |
if (stack.length < 2) { |
| 3051 |
stack.push(indent.length); |
| 3052 |
} |
| 3053 |
else { |
| 3054 |
stack[1] = indent.length; |
| 3055 |
} |
| 3056 |
return this.token; |
| 3057 |
}, |
| 3058 |
next: "mlString" |
| 3059 |
}, { |
| 3060 |
token: 'keyword.control.slim', |
| 3061 |
regex: '^(\\s*)(\\-|==|=)', |
| 3062 |
push: [{ |
| 3063 |
token: 'control.end.slim', |
| 3064 |
regex: '$', |
| 3065 |
next: "pop" |
| 3066 |
}, { |
| 3067 |
include: "rubyline" |
| 3068 |
}, { |
| 3069 |
include: "misc" |
| 3070 |
}] |
| 3071 |
}, { |
| 3072 |
token: 'paren', |
| 3073 |
regex: '\\(', |
| 3074 |
push: [{ |
| 3075 |
token: 'paren', |
| 3076 |
regex: '\\)', |
| 3077 |
next: "pop" |
| 3078 |
}, { |
| 3079 |
include: "misc" |
| 3080 |
}] |
| 3081 |
}, { |
| 3082 |
token: 'paren', |
| 3083 |
regex: '\\[', |
| 3084 |
push: [{ |
| 3085 |
token: 'paren', |
| 3086 |
regex: '\\]', |
| 3087 |
next: "pop" |
| 3088 |
}, { |
| 3089 |
include: "misc" |
| 3090 |
}] |
| 3091 |
}, { |
| 3092 |
include: "misc" |
| 3093 |
} |
| 3094 |
], |
| 3095 |
"mlString": [{ |
| 3096 |
token: "indent", |
| 3097 |
regex: /^\s*/, |
| 3098 |
onMatch: function (val, state, stack) { |
| 3099 |
var curIndent = stack[1]; |
| 3100 |
if (curIndent >= val.length) { |
| 3101 |
this.next = "start"; |
| 3102 |
stack.splice(0); |
| 3103 |
} |
| 3104 |
else { |
| 3105 |
this.next = "mlString"; |
| 3106 |
} |
| 3107 |
return this.token; |
| 3108 |
}, |
| 3109 |
next: "start" |
| 3110 |
}, { |
| 3111 |
defaultToken: "string" |
| 3112 |
}], |
| 3113 |
"rubyline": [{ |
| 3114 |
token: "keyword.operator.ruby.embedded.slim", |
| 3115 |
regex: "(==|=)(<>|><|<'|'<|<|>)?|-" |
| 3116 |
}, { |
| 3117 |
token: "list.ruby.operators.slim", |
| 3118 |
regex: "(\\b)(for|in|do|if|else|elsif|unless|while|yield|not|and|or)\\b" |
| 3119 |
}, { |
| 3120 |
token: "string", |
| 3121 |
regex: "['](.)*?[']" |
| 3122 |
}, { |
| 3123 |
token: "string", |
| 3124 |
regex: "[\"](.)*?[\"]" |
| 3125 |
}], |
| 3126 |
"misc": [{ |
| 3127 |
token: 'class.variable.slim', |
| 3128 |
regex: '\\@([a-zA-Z_][a-zA-Z0-9_]*)\\b' |
| 3129 |
}, { |
| 3130 |
token: "list.meta.slim", |
| 3131 |
regex: "(\\b)(true|false|nil)(\\b)" |
| 3132 |
}, { |
| 3133 |
token: 'keyword.operator.equals.slim', |
| 3134 |
regex: '=' |
| 3135 |
}, { |
| 3136 |
token: "string", |
| 3137 |
regex: "['](.)*?[']" |
| 3138 |
}, { |
| 3139 |
token: "string", |
| 3140 |
regex: "[\"](.)*?[\"]" |
| 3141 |
}] |
| 3142 |
}; |
| 3143 |
this.normalizeRules(); |
| 3144 |
}; |
| 3145 |
oop.inherits(SlimHighlightRules, TextHighlightRules); |
| 3146 |
exports.SlimHighlightRules = SlimHighlightRules; |
| 3147 |
|
| 3148 |
}); |
| 3149 |
|
| 3150 |
ace.define("ace/mode/markdown_highlight_rules",["require","exports","module","ace/config","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules","ace/mode/html_highlight_rules"], function(require, exports, module){"use strict"; |
| 3151 |
var modes = require("../config").$modes; |
| 3152 |
var oop = require("../lib/oop"); |
| 3153 |
var lang = require("../lib/lang"); |
| 3154 |
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; |
| 3155 |
var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; |
| 3156 |
var escaped = function (ch) { |
| 3157 |
return "(?:[^" + lang.escapeRegExp(ch) + "\\\\]|\\\\.)*"; |
| 3158 |
}; |
| 3159 |
var MarkdownHighlightRules = function () { |
| 3160 |
HtmlHighlightRules.call(this); |
| 3161 |
var codeBlockStartRule = { |
| 3162 |
token: "support.function", |
| 3163 |
regex: /^\s*(```+[^`]*|~~~+[^~]*)$/, |
| 3164 |
onMatch: function (value, state, stack, line) { |
| 3165 |
var m = value.match(/^(\s*)([`~]+)(.*)/); |
| 3166 |
var language = /[\w-]+|$/.exec(m[3])[0]; |
| 3167 |
if (!modes[language]) |
| 3168 |
language = ""; |
| 3169 |
stack.unshift("githubblock", [], [m[1], m[2], language], state); |
| 3170 |
return this.token; |
| 3171 |
}, |
| 3172 |
next: "githubblock" |
| 3173 |
}; |
| 3174 |
var codeBlockRules = [{ |
| 3175 |
token: "support.function", |
| 3176 |
regex: ".*", |
| 3177 |
onMatch: function (value, state, stack, line) { |
| 3178 |
var embedState = stack[1]; |
| 3179 |
var indent = stack[2][0]; |
| 3180 |
var endMarker = stack[2][1]; |
| 3181 |
var language = stack[2][2]; |
| 3182 |
var m = /^(\s*)(`+|~+)\s*$/.exec(value); |
| 3183 |
if (m && m[1].length < indent.length + 3 |
| 3184 |
&& m[2].length >= endMarker.length && m[2][0] == endMarker[0]) { |
| 3185 |
stack.splice(0, 3); |
| 3186 |
this.next = stack.shift(); |
| 3187 |
return this.token; |
| 3188 |
} |
| 3189 |
this.next = ""; |
| 3190 |
if (language && modes[language]) { |
| 3191 |
var data = modes[language].getTokenizer().getLineTokens(value, embedState.slice(0)); |
| 3192 |
stack[1] = data.state; |
| 3193 |
return data.tokens; |
| 3194 |
} |
| 3195 |
return this.token; |
| 3196 |
} |
| 3197 |
}]; |
| 3198 |
this.$rules["start"].unshift({ |
| 3199 |
token: "empty_line", |
| 3200 |
regex: '^$', |
| 3201 |
next: "allowBlock" |
| 3202 |
}, { |
| 3203 |
token: "markup.heading.1", |
| 3204 |
regex: "^=+(?=\\s*$)" |
| 3205 |
}, { |
| 3206 |
token: "markup.heading.2", |
| 3207 |
regex: "^\\-+(?=\\s*$)" |
| 3208 |
}, { |
| 3209 |
token: function (value) { |
| 3210 |
return "markup.heading." + value.length; |
| 3211 |
}, |
| 3212 |
regex: /^#{1,6}(?=\s|$)/, |
| 3213 |
next: "header" |
| 3214 |
}, codeBlockStartRule, { |
| 3215 |
token: "string.blockquote", |
| 3216 |
regex: "^\\s*>\\s*(?:[*+-]|\\d+\\.)?\\s+", |
| 3217 |
next: "blockquote" |
| 3218 |
}, { |
| 3219 |
token: "constant", |
| 3220 |
regex: "^ {0,3}(?:(?:\\* ?){3,}|(?:\\- ?){3,}|(?:\\_ ?){3,})\\s*$", |
| 3221 |
next: "allowBlock" |
| 3222 |
}, { |
| 3223 |
token: "markup.list", |
| 3224 |
regex: "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+", |
| 3225 |
next: "listblock-start" |
| 3226 |
}, { |
| 3227 |
include: "basic" |
| 3228 |
}); |
| 3229 |
this.addRules({ |
| 3230 |
"basic": [{ |
| 3231 |
token: "constant.language.escape", |
| 3232 |
regex: /\\[\\`*_{}\[\]()#+\-.!]/ |
| 3233 |
}, { |
| 3234 |
token: "support.function", |
| 3235 |
regex: "(`+)(.*?[^`])(\\1)" |
| 3236 |
}, { |
| 3237 |
token: ["text", "constant", "text", "url", "string", "text"], |
| 3238 |
regex: "^([ ]{0,3}\\[)([^\\]]+)(\\]:\\s*)([^ ]+)(\\s*(?:[\"][^\"]+[\"])?(\\s*))$" |
| 3239 |
}, { |
| 3240 |
token: ["text", "string", "text", "constant", "text"], |
| 3241 |
regex: "(\\[)(" + escaped("]") + ")(\\]\\s*\\[)(" + escaped("]") + ")(\\])" |
| 3242 |
}, { |
| 3243 |
token: ["text", "string", "text", "markup.underline", "string", "text"], |
| 3244 |
regex: "(\\!?\\[)(" + |
| 3245 |
escaped("]") + |
| 3246 |
")(\\]\\()" + |
| 3247 |
'((?:[^\\)\\s\\\\]|\\\\.|\\s(?=[^"]))*)' + |
| 3248 |
'(\\s*"' + escaped('"') + '"\\s*)?' + |
| 3249 |
"(\\))" |
| 3250 |
}, { |
| 3251 |
token: "string.strong", |
| 3252 |
regex: "([*]{2}|[_]{2}(?=\\S))(.*?\\S[*_]*)(\\1)" |
| 3253 |
}, { |
| 3254 |
token: "string.emphasis", |
| 3255 |
regex: "([*]|[_](?=\\S))(.*?\\S[*_]*)(\\1)" |
| 3256 |
}, { |
| 3257 |
token: ["text", "url", "text"], |
| 3258 |
regex: "(<)(" + |
| 3259 |
"(?:https?|ftp|dict):[^'\">\\s]+" + |
| 3260 |
"|" + |
| 3261 |
"(?:mailto:)?[-.\\w]+\\@[-a-z0-9]+(?:\\.[-a-z0-9]+)*\\.[a-z]+" + |
| 3262 |
")(>)" |
| 3263 |
}], |
| 3264 |
"allowBlock": [ |
| 3265 |
{ token: "support.function", regex: "^ {4}.+", next: "allowBlock" }, |
| 3266 |
{ token: "empty_line", regex: '^$', next: "allowBlock" }, |
| 3267 |
{ token: "empty", regex: "", next: "start" } |
| 3268 |
], |
| 3269 |
"header": [{ |
| 3270 |
regex: "$", |
| 3271 |
next: "start" |
| 3272 |
}, { |
| 3273 |
include: "basic" |
| 3274 |
}, { |
| 3275 |
defaultToken: "heading" |
| 3276 |
}], |
| 3277 |
"listblock-start": [{ |
| 3278 |
token: "support.variable", |
| 3279 |
regex: /(?:\[[ x]\])?/, |
| 3280 |
next: "listblock" |
| 3281 |
}], |
| 3282 |
"listblock": [{ |
| 3283 |
token: "empty_line", |
| 3284 |
regex: "^$", |
| 3285 |
next: "start" |
| 3286 |
}, { |
| 3287 |
token: "markup.list", |
| 3288 |
regex: "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+", |
| 3289 |
next: "listblock-start" |
| 3290 |
}, { |
| 3291 |
include: "basic", noEscape: true |
| 3292 |
}, |
| 3293 |
codeBlockStartRule, |
| 3294 |
{ |
| 3295 |
defaultToken: "list" |
| 3296 |
}], |
| 3297 |
"blockquote": [{ |
| 3298 |
token: "empty_line", |
| 3299 |
regex: "^\\s*$", |
| 3300 |
next: "start" |
| 3301 |
}, { |
| 3302 |
token: "string.blockquote", |
| 3303 |
regex: "^\\s*>\\s*(?:[*+-]|\\d+\\.)?\\s+", |
| 3304 |
next: "blockquote" |
| 3305 |
}, { |
| 3306 |
include: "basic", noEscape: true |
| 3307 |
}, { |
| 3308 |
defaultToken: "string.blockquote" |
| 3309 |
}], |
| 3310 |
"githubblock": codeBlockRules |
| 3311 |
}); |
| 3312 |
this.normalizeRules(); |
| 3313 |
}; |
| 3314 |
oop.inherits(MarkdownHighlightRules, TextHighlightRules); |
| 3315 |
exports.MarkdownHighlightRules = MarkdownHighlightRules; |
| 3316 |
|
| 3317 |
}); |
| 3318 |
|
| 3319 |
ace.define("ace/mode/jade_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules","ace/mode/markdown_highlight_rules","ace/mode/scss_highlight_rules","ace/mode/less_highlight_rules","ace/mode/coffee_highlight_rules","ace/mode/javascript_highlight_rules"], function(require, exports, module){ |
| 3320 |
|
| 3321 |
|
| 3322 |
"use strict"; |
| 3323 |
var oop = require("../lib/oop"); |
| 3324 |
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; |
| 3325 |
var MarkdownHighlightRules = require("./markdown_highlight_rules").MarkdownHighlightRules; |
| 3326 |
var SassHighlightRules = require("./scss_highlight_rules").ScssHighlightRules; |
| 3327 |
var LessHighlightRules = require("./less_highlight_rules").LessHighlightRules; |
| 3328 |
var CoffeeHighlightRules = require("./coffee_highlight_rules").CoffeeHighlightRules; |
| 3329 |
var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; |
| 3330 |
function mixin_embed(tag, prefix) { |
| 3331 |
return { |
| 3332 |
token: "entity.name.function.jade", |
| 3333 |
regex: "^\\s*\\:" + tag, |
| 3334 |
next: prefix + "start" |
| 3335 |
}; |
| 3336 |
} |
| 3337 |
var JadeHighlightRules = function () { |
| 3338 |
var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + |
| 3339 |
"u[0-9a-fA-F]{4}|" + |
| 3340 |
"[0-2][0-7]{0,2}|" + |
| 3341 |
"3[0-6][0-7]?|" + |
| 3342 |
"37[0-7]?|" + |
| 3343 |
"[4-7][0-7]?|" + |
| 3344 |
".)"; |
| 3345 |
this.$rules = |
| 3346 |
{ |
| 3347 |
"start": [ |
| 3348 |
{ |
| 3349 |
token: "keyword.control.import.include.jade", |
| 3350 |
regex: "\\s*\\binclude\\b" |
| 3351 |
}, |
| 3352 |
{ |
| 3353 |
token: "keyword.other.doctype.jade", |
| 3354 |
regex: "^!!!\\s*(?:[a-zA-Z0-9-_]+)?" |
| 3355 |
}, |
| 3356 |
{ |
| 3357 |
onMatch: function (value, currentState, stack) { |
| 3358 |
stack.unshift(this.next, value.length - 2, currentState); |
| 3359 |
return "comment"; |
| 3360 |
}, |
| 3361 |
regex: /^\s*\/\//, |
| 3362 |
next: "comment_block" |
| 3363 |
}, |
| 3364 |
mixin_embed("markdown", "markdown-"), |
| 3365 |
mixin_embed("sass", "sass-"), |
| 3366 |
mixin_embed("less", "less-"), |
| 3367 |
mixin_embed("coffee", "coffee-"), |
| 3368 |
{ |
| 3369 |
token: ["storage.type.function.jade", |
| 3370 |
"entity.name.function.jade", |
| 3371 |
"punctuation.definition.parameters.begin.jade", |
| 3372 |
"variable.parameter.function.jade", |
| 3373 |
"punctuation.definition.parameters.end.jade" |
| 3374 |
], |
| 3375 |
regex: "^(\\s*mixin)( [\\w\\-]+)(\\s*\\()(.*?)(\\))" |
| 3376 |
}, |
| 3377 |
{ |
| 3378 |
token: ["storage.type.function.jade", "entity.name.function.jade"], |
| 3379 |
regex: "^(\\s*mixin)( [\\w\\-]+)" |
| 3380 |
}, |
| 3381 |
{ |
| 3382 |
token: "source.js.embedded.jade", |
| 3383 |
regex: "^\\s*(?:-|=|!=)", |
| 3384 |
next: "js-start" |
| 3385 |
}, |
| 3386 |
{ |
| 3387 |
token: "string.interpolated.jade", |
| 3388 |
regex: "[#!]\\{[^\\}]+\\}" |
| 3389 |
}, |
| 3390 |
{ |
| 3391 |
token: "meta.tag.any.jade", |
| 3392 |
regex: /^\s*(?!\w+:)(?:[\w-]+|(?=\.|#)])/, |
| 3393 |
next: "tag_single" |
| 3394 |
}, |
| 3395 |
{ |
| 3396 |
token: "suport.type.attribute.id.jade", |
| 3397 |
regex: "#\\w+" |
| 3398 |
}, |
| 3399 |
{ |
| 3400 |
token: "suport.type.attribute.class.jade", |
| 3401 |
regex: "\\.\\w+" |
| 3402 |
}, |
| 3403 |
{ |
| 3404 |
token: "punctuation", |
| 3405 |
regex: "\\s*(?:\\()", |
| 3406 |
next: "tag_attributes" |
| 3407 |
} |
| 3408 |
], |
| 3409 |
"comment_block": [ |
| 3410 |
{ regex: /^\s*(?:\/\/)?/, onMatch: function (value, currentState, stack) { |
| 3411 |
if (value.length <= stack[1]) { |
| 3412 |
if (value.slice(-1) == "/") { |
| 3413 |
stack[1] = value.length - 2; |
| 3414 |
this.next = ""; |
| 3415 |
return "comment"; |
| 3416 |
} |
| 3417 |
stack.shift(); |
| 3418 |
stack.shift(); |
| 3419 |
this.next = stack.shift(); |
| 3420 |
return "text"; |
| 3421 |
} |
| 3422 |
else { |
| 3423 |
this.next = ""; |
| 3424 |
return "comment"; |
| 3425 |
} |
| 3426 |
}, next: "start" }, |
| 3427 |
{ defaultToken: "comment" } |
| 3428 |
], |
| 3429 |
"tag_single": [ |
| 3430 |
{ |
| 3431 |
token: "entity.other.attribute-name.class.jade", |
| 3432 |
regex: "\\.[\\w-]+" |
| 3433 |
}, |
| 3434 |
{ |
| 3435 |
token: "entity.other.attribute-name.id.jade", |
| 3436 |
regex: "#[\\w-]+" |
| 3437 |
}, |
| 3438 |
{ |
| 3439 |
token: ["text", "punctuation"], |
| 3440 |
regex: "($)|((?!\\.|#|=|-))", |
| 3441 |
next: "start" |
| 3442 |
} |
| 3443 |
], |
| 3444 |
"tag_attributes": [ |
| 3445 |
{ |
| 3446 |
token: "string", |
| 3447 |
regex: "'(?=.)", |
| 3448 |
next: "qstring" |
| 3449 |
}, |
| 3450 |
{ |
| 3451 |
token: "string", |
| 3452 |
regex: '"(?=.)', |
| 3453 |
next: "qqstring" |
| 3454 |
}, |
| 3455 |
{ |
| 3456 |
token: ["entity.other.attribute-name.jade", "punctuation"], |
| 3457 |
regex: "([a-zA-Z:\\.-]+)(=)?", |
| 3458 |
next: "attribute_strings" |
| 3459 |
}, |
| 3460 |
{ |
| 3461 |
token: "punctuation", |
| 3462 |
regex: "\\)", |
| 3463 |
next: "start" |
| 3464 |
} |
| 3465 |
], |
| 3466 |
"attribute_strings": [ |
| 3467 |
{ |
| 3468 |
token: "string", |
| 3469 |
regex: "'(?=.)", |
| 3470 |
next: "qstring" |
| 3471 |
}, |
| 3472 |
{ |
| 3473 |
token: "string", |
| 3474 |
regex: '"(?=.)', |
| 3475 |
next: "qqstring" |
| 3476 |
}, |
| 3477 |
{ |
| 3478 |
token: "string", |
| 3479 |
regex: '(?=\\S)', |
| 3480 |
next: "tag_attributes" |
| 3481 |
} |
| 3482 |
], |
| 3483 |
"qqstring": [ |
| 3484 |
{ |
| 3485 |
token: "constant.language.escape", |
| 3486 |
regex: escapedRe |
| 3487 |
}, { |
| 3488 |
token: "string", |
| 3489 |
regex: '[^"\\\\]+' |
| 3490 |
}, { |
| 3491 |
token: "string", |
| 3492 |
regex: "\\\\$", |
| 3493 |
next: "qqstring" |
| 3494 |
}, { |
| 3495 |
token: "string", |
| 3496 |
regex: '"|$', |
| 3497 |
next: "tag_attributes" |
| 3498 |
} |
| 3499 |
], |
| 3500 |
"qstring": [ |
| 3501 |
{ |
| 3502 |
token: "constant.language.escape", |
| 3503 |
regex: escapedRe |
| 3504 |
}, { |
| 3505 |
token: "string", |
| 3506 |
regex: "[^'\\\\]+" |
| 3507 |
}, { |
| 3508 |
token: "string", |
| 3509 |
regex: "\\\\$", |
| 3510 |
next: "qstring" |
| 3511 |
}, { |
| 3512 |
token: "string", |
| 3513 |
regex: "'|$", |
| 3514 |
next: "tag_attributes" |
| 3515 |
} |
| 3516 |
] |
| 3517 |
}; |
| 3518 |
this.embedRules(JavaScriptHighlightRules, "js-", [{ |
| 3519 |
token: "text", |
| 3520 |
regex: ".$", |
| 3521 |
next: "start" |
| 3522 |
}]); |
| 3523 |
}; |
| 3524 |
oop.inherits(JadeHighlightRules, TextHighlightRules); |
| 3525 |
exports.JadeHighlightRules = JadeHighlightRules; |
| 3526 |
|
| 3527 |
}); |
| 3528 |
|
| 3529 |
ace.define("ace/mode/vue_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/css_highlight_rules","ace/mode/typescript_highlight_rules","ace/mode/coffee_highlight_rules","ace/mode/html_highlight_rules","ace/mode/javascript_highlight_rules","ace/mode/stylus_highlight_rules","ace/mode/sass_highlight_rules","ace/mode/scss_highlight_rules","ace/mode/less_highlight_rules","ace/tokenizer","ace/mode/slim_highlight_rules","ace/mode/jade_highlight_rules","ace/mode/javascript"], function(require, exports, module){"use strict"; |
| 3530 |
var __read = (this && this.__read) || function (o, n) { |
| 3531 |
var m = typeof Symbol === "function" && o[Symbol.iterator]; |
| 3532 |
if (!m) return o; |
| 3533 |
var i = m.call(o), r, ar = [], e; |
| 3534 |
try { |
| 3535 |
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); |
| 3536 |
} |
| 3537 |
catch (error) { e = { error: error }; } |
| 3538 |
finally { |
| 3539 |
try { |
| 3540 |
if (r && !r.done && (m = i["return"])) m.call(i); |
| 3541 |
} |
| 3542 |
finally { if (e) throw e.error; } |
| 3543 |
} |
| 3544 |
return ar; |
| 3545 |
}; |
| 3546 |
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { |
| 3547 |
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { |
| 3548 |
if (ar || !(i in from)) { |
| 3549 |
if (!ar) ar = Array.prototype.slice.call(from, 0, i); |
| 3550 |
ar[i] = from[i]; |
| 3551 |
} |
| 3552 |
} |
| 3553 |
return to.concat(ar || Array.prototype.slice.call(from)); |
| 3554 |
}; |
| 3555 |
var oop = require("../lib/oop"); |
| 3556 |
var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; |
| 3557 |
var TypeScriptHighlightRules = require("./typescript_highlight_rules").TypeScriptHighlightRules; |
| 3558 |
var CoffeeHighlightRules = require("./coffee_highlight_rules").CoffeeHighlightRules; |
| 3559 |
var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; |
| 3560 |
var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; |
| 3561 |
var StylusHighlightRules = require("./stylus_highlight_rules").StylusHighlightRules; |
| 3562 |
var SassHighlightRules = require("./sass_highlight_rules").SassHighlightRules; |
| 3563 |
var ScssHighlightRules = require("./scss_highlight_rules").ScssHighlightRules; |
| 3564 |
var LessHighlightRules = require("./less_highlight_rules").LessHighlightRules; |
| 3565 |
var Tokenizer = require("../tokenizer").Tokenizer; |
| 3566 |
var SlimHighlightRules = require("./slim_highlight_rules").SlimHighlightRules; |
| 3567 |
var JadeHighlightRules = require("./jade_highlight_rules").JadeHighlightRules; |
| 3568 |
var JavaScriptMode = require("./javascript").Mode; |
| 3569 |
var VueHighlightRules = function (options) { |
| 3570 |
this.embedLangRules = function (HighlightRules, tag, value, attribute) { |
| 3571 |
var condition = attribute ? "(?=[^>]*" + attribute + "\\s*=\\s*['\"]" + value + "['\"]))" : "(?=\\s|>|$))"; |
| 3572 |
this.$rules.start.unshift({ |
| 3573 |
token: ["meta.tag.punctuation.tag-open.xml", "meta.tag." + tag + ".tag-name.xml"], |
| 3574 |
regex: "(<)(" + tag + condition, |
| 3575 |
next: [ |
| 3576 |
{ |
| 3577 |
token: "meta.tag.punctuation.tag-close." + tag + ".xml", |
| 3578 |
regex: "/?>", |
| 3579 |
next: value + "-start" |
| 3580 |
}, { include: "attributes" } |
| 3581 |
] |
| 3582 |
}); |
| 3583 |
this.$rules[tag + "-end"] = [ |
| 3584 |
{ include: "attributes" }, { |
| 3585 |
token: "meta.tag.punctuation.tag-close.xml", |
| 3586 |
regex: "/?>", |
| 3587 |
next: "start", |
| 3588 |
onMatch: function (value, currentState, stack) { |
| 3589 |
stack.splice(0); |
| 3590 |
return this.token; |
| 3591 |
} |
| 3592 |
} |
| 3593 |
]; |
| 3594 |
this.embedRules(HighlightRules, value + "-", [ |
| 3595 |
{ |
| 3596 |
token: ["meta.tag.punctuation.end-tag-open.xml", "meta.tag." + tag + ".tag-name.xml"], |
| 3597 |
regex: "(</)(" + tag + "(?=\\s|>|$))", |
| 3598 |
next: tag + "-end" |
| 3599 |
}, { |
| 3600 |
token: "string.cdata.xml", |
| 3601 |
regex: "<\\!\\[CDATA\\[" |
| 3602 |
}, { |
| 3603 |
token: "string.cdata.xml", |
| 3604 |
regex: "\\]\\]>" |
| 3605 |
} |
| 3606 |
]); |
| 3607 |
}; |
| 3608 |
var vueRules = [ |
| 3609 |
{ |
| 3610 |
include: "vue-interpolations" |
| 3611 |
} |
| 3612 |
]; |
| 3613 |
var VueRules = new HtmlHighlightRules().getRules(); |
| 3614 |
VueRules.start = vueRules.concat(VueRules.start); |
| 3615 |
VueRules["vue-interpolations"] = [ |
| 3616 |
{ |
| 3617 |
token: "punctuation", |
| 3618 |
regex: /\{\{\{?/, |
| 3619 |
next: "js-interpolation-start" |
| 3620 |
} |
| 3621 |
]; |
| 3622 |
var self = this; |
| 3623 |
VueRules.tag_stuff.unshift({ |
| 3624 |
token: "string", |
| 3625 |
regex: /(?:\b(v-)|(:|@))([a-zA-Z\-.]+)(?:\:([a-zA-Z\-]+))?(?:\.([a-zA-Z\-]+))*(\s*)(=)(\s*)(["'])/, |
| 3626 |
onMatch: function (value, currentState, stack) { |
| 3627 |
var quote = value[value.length - 1]; |
| 3628 |
stack.unshift(quote, currentState); |
| 3629 |
var values = new RegExp(this.regex).exec(value); |
| 3630 |
if (!values) |
| 3631 |
return "text"; |
| 3632 |
var tokens = []; |
| 3633 |
var types = [ |
| 3634 |
"entity.other.attribute-name.xml", "punctuation.separator.key-value.xml", |
| 3635 |
"entity.other.attribute-name.xml", "entity.other.attribute-name.xml", "entity.other.attribute-name.xml", |
| 3636 |
"text", "punctuation.separator.key-value.xml", "text", "string" |
| 3637 |
]; |
| 3638 |
for (var i = 0, l = types.length; i < l; i++) { |
| 3639 |
if (values[i + 1]) |
| 3640 |
tokens[tokens.length] = { |
| 3641 |
type: types[i], |
| 3642 |
value: values[i + 1] |
| 3643 |
}; |
| 3644 |
} |
| 3645 |
return tokens; |
| 3646 |
}, |
| 3647 |
next: [ |
| 3648 |
{ |
| 3649 |
token: "string", |
| 3650 |
regex: /$/, |
| 3651 |
next: "tag_stuff" |
| 3652 |
}, { |
| 3653 |
token: "string", |
| 3654 |
regex: /.*/, |
| 3655 |
onMatch: function (value, currentState, stack, line) { |
| 3656 |
var quote = stack[0]; |
| 3657 |
var parts = value.split(quote); |
| 3658 |
var text = parts[0]; |
| 3659 |
this.next = ""; |
| 3660 |
if (parts.length > 1) { |
| 3661 |
stack.shift(); |
| 3662 |
var nextState = stack.shift(); |
| 3663 |
var currentData = new Tokenizer(self.$rules).getLineTokens(parts.slice(1).join(quote), nextState); |
| 3664 |
currentData.tokens.unshift({ |
| 3665 |
type: "string", |
| 3666 |
value: quote |
| 3667 |
}); |
| 3668 |
this.next = Array.isArray(currentData.state) ? currentData.state[currentData.state.length - 1] |
| 3669 |
: currentData.state; |
| 3670 |
} |
| 3671 |
var data = new JavaScriptMode().getTokenizer().getLineTokens(text, "start"); |
| 3672 |
var tokens = data.tokens; |
| 3673 |
if (currentData) { |
| 3674 |
tokens.push.apply(tokens, __spreadArray([], __read(currentData.tokens), false)); |
| 3675 |
} |
| 3676 |
return tokens; |
| 3677 |
} |
| 3678 |
} |
| 3679 |
] |
| 3680 |
}, { |
| 3681 |
token: "string", |
| 3682 |
regex: '"', |
| 3683 |
next: [ |
| 3684 |
{ |
| 3685 |
token: "string", |
| 3686 |
regex: '"|$', |
| 3687 |
next: "tag_stuff" |
| 3688 |
}, { |
| 3689 |
include: "vue-interpolations" |
| 3690 |
}, { |
| 3691 |
defaultToken: "string" |
| 3692 |
} |
| 3693 |
] |
| 3694 |
}, { |
| 3695 |
token: "string", |
| 3696 |
regex: "'", |
| 3697 |
next: [ |
| 3698 |
{ |
| 3699 |
token: "string", |
| 3700 |
regex: "'|$", |
| 3701 |
next: "tag_stuff" |
| 3702 |
}, { |
| 3703 |
include: "vue-interpolations" |
| 3704 |
}, { |
| 3705 |
defaultToken: "string" |
| 3706 |
} |
| 3707 |
] |
| 3708 |
}); |
| 3709 |
this.$rules = VueRules; |
| 3710 |
this.embedRules(JavaScriptHighlightRules, "js-interpolation-", [ |
| 3711 |
{ |
| 3712 |
token: "punctuation", |
| 3713 |
regex: /\}\}\}?/, |
| 3714 |
next: "start" |
| 3715 |
} |
| 3716 |
]); |
| 3717 |
this.embedLangRules(CssHighlightRules, "style", "css"); |
| 3718 |
this.embedLangRules(StylusHighlightRules, "style", "stylus", "lang"); |
| 3719 |
this.embedLangRules(SassHighlightRules, "style", "sass", "lang"); |
| 3720 |
this.embedLangRules(ScssHighlightRules, "style", "scss", "lang"); |
| 3721 |
this.embedLangRules(LessHighlightRules, "style", "less", "lang"); |
| 3722 |
this.embedLangRules(TypeScriptHighlightRules, "script", "ts", "lang"); |
| 3723 |
this.embedLangRules(CoffeeHighlightRules, "script", "coffee", "lang"); |
| 3724 |
this.embedLangRules(SlimHighlightRules, "template", "slm", "lang"); |
| 3725 |
this.embedLangRules(JadeHighlightRules, "template", "jade", "lang"); |
| 3726 |
this.embedLangRules(StylusHighlightRules, "template", "stylus", "lang"); |
| 3727 |
this.normalizeRules(); |
| 3728 |
}; |
| 3729 |
oop.inherits(VueHighlightRules, HtmlHighlightRules); |
| 3730 |
exports.VueHighlightRules = VueHighlightRules; |
| 3731 |
|
| 3732 |
}); |
| 3733 |
|
| 3734 |
ace.define("ace/mode/vue",["require","exports","module","ace/lib/oop","ace/mode/folding/html","ace/lib/lang","ace/mode/behaviour/xml","ace/mode/html_completions","ace/mode/html","ace/mode/vue_highlight_rules"], function(require, exports, module){"use strict"; |
| 3735 |
var oop = require("../lib/oop"); |
| 3736 |
var HtmlFoldMode = require("./folding/html").FoldMode; |
| 3737 |
var lang = require("../lib/lang"); |
| 3738 |
var XmlBehaviour = require("./behaviour/xml").XmlBehaviour; |
| 3739 |
var HtmlCompletions = require("./html_completions").HtmlCompletions; |
| 3740 |
var HTMLMode = require("./html").Mode; |
| 3741 |
var VueHighlightRules = require("./vue_highlight_rules").VueHighlightRules; |
| 3742 |
var voidElements = [ |
| 3743 |
"area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "menuitem", "param", "source", |
| 3744 |
"track", "wbr" |
| 3745 |
]; |
| 3746 |
var optionalEndTags = ["li", "dt", "dd", "p", "rt", "rp", "optgroup", "option", "colgroup", "td", "th"]; |
| 3747 |
var Mode = function () { |
| 3748 |
this.HighlightRules = VueHighlightRules; |
| 3749 |
this.foldingRules = new HtmlFoldMode(this.voidElements, lang.arrayToMap(optionalEndTags)); |
| 3750 |
this.$behaviour = new XmlBehaviour(); |
| 3751 |
this.$completer = new HtmlCompletions(); |
| 3752 |
}; |
| 3753 |
oop.inherits(Mode, HTMLMode); |
| 3754 |
(function () { |
| 3755 |
this.blockComment = { |
| 3756 |
start: "<!--", |
| 3757 |
end: "-->" |
| 3758 |
}; |
| 3759 |
this.voidElements = lang.arrayToMap(voidElements); |
| 3760 |
this.getCompletions = function (state, session, pos, prefix) { |
| 3761 |
return this.$completer.getCompletions(state, session, pos, prefix); |
| 3762 |
}; |
| 3763 |
this.$id = "ace/mode/vue"; |
| 3764 |
}).call(Mode.prototype); |
| 3765 |
exports.Mode = Mode; |
| 3766 |
|
| 3767 |
}); (function() { |
| 3768 |
ace.require(["ace/mode/vue"], function(m) { |
| 3769 |
if (typeof module == "object" && typeof exports == "object" && module) { |
| 3770 |
module.exports = m; |
| 3771 |
} |
| 3772 |
}); |
| 3773 |
})(); |
| 3774 |
|