| 1 |
ace.define("ace/mode/abc_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){ |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
"use strict"; |
| 11 |
var oop = require("../lib/oop"); |
| 12 |
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; |
| 13 |
var ABCHighlightRules = function () { |
| 14 |
this.$rules = { |
| 15 |
start: [ |
| 16 |
{ |
| 17 |
token: ['zupfnoter.information.comment.line.percentage', 'information.keyword', 'in formation.keyword.embedded'], |
| 18 |
regex: '(%%%%)(hn\\.[a-z]*)(.*)', |
| 19 |
comment: 'Instruction Comment' |
| 20 |
}, |
| 21 |
{ |
| 22 |
token: ['information.comment.line.percentage', 'information.keyword.embedded'], |
| 23 |
regex: '(%%)(.*)', |
| 24 |
comment: 'Instruction Comment' |
| 25 |
}, |
| 26 |
{ |
| 27 |
token: 'comment.line.percentage', |
| 28 |
regex: '%.*', |
| 29 |
comment: 'Comments' |
| 30 |
}, |
| 31 |
{ |
| 32 |
token: 'barline.keyword.operator', |
| 33 |
regex: '[\\[:]*[|:][|\\]:]*(?:\\[?[0-9]+)?|\\[[0-9]+', |
| 34 |
comment: 'Bar lines' |
| 35 |
}, |
| 36 |
{ |
| 37 |
token: ['information.keyword.embedded', 'information.argument.string.unquoted'], |
| 38 |
regex: '(\\[[A-Za-z]:)([^\\]]*\\])', |
| 39 |
comment: 'embedded Header lines' |
| 40 |
}, |
| 41 |
{ |
| 42 |
token: ['information.keyword', 'information.argument.string.unquoted'], |
| 43 |
regex: '^([A-Za-z]:)([^%\\\\]*)', |
| 44 |
comment: 'Header lines' |
| 45 |
}, |
| 46 |
{ |
| 47 |
token: ['text', 'entity.name.function', 'string.unquoted', 'text'], |
| 48 |
regex: '(\\[)([A-Z]:)(.*?)(\\])', |
| 49 |
comment: 'Inline fields' |
| 50 |
}, |
| 51 |
{ |
| 52 |
token: ['accent.constant.language', 'pitch.constant.numeric', 'duration.constant.numeric'], |
| 53 |
regex: '([\\^=_]*)([A-Ga-gz][,\']*)([0-9]*/*[><0-9]*)', |
| 54 |
comment: 'Notes' |
| 55 |
}, |
| 56 |
{ |
| 57 |
token: 'zupfnoter.jumptarget.string.quoted', |
| 58 |
regex: '[\\"!]\\^\\:.*?[\\"!]', |
| 59 |
comment: 'Zupfnoter jumptarget' |
| 60 |
}, { |
| 61 |
token: 'zupfnoter.goto.string.quoted', |
| 62 |
regex: '[\\"!]\\^\\@.*?[\\"!]', |
| 63 |
comment: 'Zupfnoter goto' |
| 64 |
}, |
| 65 |
{ |
| 66 |
token: 'zupfnoter.annotation.string.quoted', |
| 67 |
regex: '[\\"!]\\^\\!.*?[\\"!]', |
| 68 |
comment: 'Zupfnoter annoation' |
| 69 |
}, |
| 70 |
{ |
| 71 |
token: 'zupfnoter.annotationref.string.quoted', |
| 72 |
regex: '[\\"!]\\^\\#.*?[\\"!]', |
| 73 |
comment: 'Zupfnoter annotation reference' |
| 74 |
}, |
| 75 |
{ |
| 76 |
token: 'chordname.string.quoted', |
| 77 |
regex: '[\\"!]\\^.*?[\\"!]', |
| 78 |
comment: 'abc chord' |
| 79 |
}, |
| 80 |
{ |
| 81 |
token: 'string.quoted', |
| 82 |
regex: '[\\"!].*?[\\"!]', |
| 83 |
comment: 'abc annotation' |
| 84 |
} |
| 85 |
] |
| 86 |
}; |
| 87 |
this.normalizeRules(); |
| 88 |
}; |
| 89 |
ABCHighlightRules.metaData = { |
| 90 |
fileTypes: ['abc'], |
| 91 |
name: 'ABC', |
| 92 |
scopeName: 'text.abcnotation' |
| 93 |
}; |
| 94 |
oop.inherits(ABCHighlightRules, TextHighlightRules); |
| 95 |
exports.ABCHighlightRules = ABCHighlightRules; |
| 96 |
|
| 97 |
}); |
| 98 |
|
| 99 |
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"; |
| 100 |
var oop = require("../../lib/oop"); |
| 101 |
var Range = require("../../range").Range; |
| 102 |
var BaseFoldMode = require("./fold_mode").FoldMode; |
| 103 |
var FoldMode = exports.FoldMode = function (commentRegex) { |
| 104 |
if (commentRegex) { |
| 105 |
this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)); |
| 106 |
this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)); |
| 107 |
} |
| 108 |
}; |
| 109 |
oop.inherits(FoldMode, BaseFoldMode); |
| 110 |
(function () { |
| 111 |
this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/; |
| 112 |
this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/; |
| 113 |
this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/; |
| 114 |
this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/; |
| 115 |
this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/; |
| 116 |
this._getFoldWidgetBase = this.getFoldWidget; |
| 117 |
this.getFoldWidget = function (session, foldStyle, row) { |
| 118 |
var line = session.getLine(row); |
| 119 |
if (this.singleLineBlockCommentRe.test(line)) { |
| 120 |
if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line)) |
| 121 |
return ""; |
| 122 |
} |
| 123 |
var fw = this._getFoldWidgetBase(session, foldStyle, row); |
| 124 |
if (!fw && this.startRegionRe.test(line)) |
| 125 |
return "start"; |
| 126 |
return fw; |
| 127 |
}; |
| 128 |
this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) { |
| 129 |
var line = session.getLine(row); |
| 130 |
if (this.startRegionRe.test(line)) |
| 131 |
return this.getCommentRegionBlock(session, line, row); |
| 132 |
var match = line.match(this.foldingStartMarker); |
| 133 |
if (match) { |
| 134 |
var i = match.index; |
| 135 |
if (match[1]) |
| 136 |
return this.openingBracketBlock(session, match[1], row, i); |
| 137 |
var range = session.getCommentFoldRange(row, i + match[0].length, 1); |
| 138 |
if (range && !range.isMultiLine()) { |
| 139 |
if (forceMultiline) { |
| 140 |
range = this.getSectionRange(session, row); |
| 141 |
} |
| 142 |
else if (foldStyle != "all") |
| 143 |
range = null; |
| 144 |
} |
| 145 |
return range; |
| 146 |
} |
| 147 |
if (foldStyle === "markbegin") |
| 148 |
return; |
| 149 |
var match = line.match(this.foldingStopMarker); |
| 150 |
if (match) { |
| 151 |
var i = match.index + match[0].length; |
| 152 |
if (match[1]) |
| 153 |
return this.closingBracketBlock(session, match[1], row, i); |
| 154 |
return session.getCommentFoldRange(row, i, -1); |
| 155 |
} |
| 156 |
}; |
| 157 |
this.getSectionRange = function (session, row) { |
| 158 |
var line = session.getLine(row); |
| 159 |
var startIndent = line.search(/\S/); |
| 160 |
var startRow = row; |
| 161 |
var startColumn = line.length; |
| 162 |
row = row + 1; |
| 163 |
var endRow = row; |
| 164 |
var maxRow = session.getLength(); |
| 165 |
while (++row < maxRow) { |
| 166 |
line = session.getLine(row); |
| 167 |
var indent = line.search(/\S/); |
| 168 |
if (indent === -1) |
| 169 |
continue; |
| 170 |
if (startIndent > indent) |
| 171 |
break; |
| 172 |
var subRange = this.getFoldWidgetRange(session, "all", row); |
| 173 |
if (subRange) { |
| 174 |
if (subRange.start.row <= startRow) { |
| 175 |
break; |
| 176 |
} |
| 177 |
else if (subRange.isMultiLine()) { |
| 178 |
row = subRange.end.row; |
| 179 |
} |
| 180 |
else if (startIndent == indent) { |
| 181 |
break; |
| 182 |
} |
| 183 |
} |
| 184 |
endRow = row; |
| 185 |
} |
| 186 |
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length); |
| 187 |
}; |
| 188 |
this.getCommentRegionBlock = function (session, line, row) { |
| 189 |
var startColumn = line.search(/\s*$/); |
| 190 |
var maxRow = session.getLength(); |
| 191 |
var startRow = row; |
| 192 |
var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/; |
| 193 |
var depth = 1; |
| 194 |
while (++row < maxRow) { |
| 195 |
line = session.getLine(row); |
| 196 |
var m = re.exec(line); |
| 197 |
if (!m) |
| 198 |
continue; |
| 199 |
if (m[1]) |
| 200 |
depth--; |
| 201 |
else |
| 202 |
depth++; |
| 203 |
if (!depth) |
| 204 |
break; |
| 205 |
} |
| 206 |
var endRow = row; |
| 207 |
if (endRow > startRow) { |
| 208 |
return new Range(startRow, startColumn, endRow, line.length); |
| 209 |
} |
| 210 |
}; |
| 211 |
}).call(FoldMode.prototype); |
| 212 |
|
| 213 |
}); |
| 214 |
|
| 215 |
ace.define("ace/mode/abc",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/abc_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module){ |
| 216 |
|
| 217 |
|
| 218 |
"use strict"; |
| 219 |
var oop = require("../lib/oop"); |
| 220 |
var TextMode = require("./text").Mode; |
| 221 |
var ABCHighlightRules = require("./abc_highlight_rules").ABCHighlightRules; |
| 222 |
var FoldMode = require("./folding/cstyle").FoldMode; |
| 223 |
var Mode = function () { |
| 224 |
this.HighlightRules = ABCHighlightRules; |
| 225 |
this.foldingRules = new FoldMode(); |
| 226 |
this.$behaviour = this.$defaultBehaviour; |
| 227 |
}; |
| 228 |
oop.inherits(Mode, TextMode); |
| 229 |
(function () { |
| 230 |
this.lineCommentStart = "%"; |
| 231 |
this.$id = "ace/mode/abc"; |
| 232 |
this.snippetFileId = "ace/snippets/abc"; |
| 233 |
}).call(Mode.prototype); |
| 234 |
exports.Mode = Mode; |
| 235 |
|
| 236 |
}); (function() { |
| 237 |
ace.require(["ace/mode/abc"], function(m) { |
| 238 |
if (typeof module == "object" && typeof exports == "object" && module) { |
| 239 |
module.exports = m; |
| 240 |
} |
| 241 |
}); |
| 242 |
})(); |
| 243 |
|