| 1 |
ace.define("ace/mode/alda_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){ |
| 2 |
"use strict"; |
| 3 |
var oop = require("../lib/oop"); |
| 4 |
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; |
| 5 |
var AldaHighlightRules = function () { |
| 6 |
this.$rules = { |
| 7 |
pitch: [{ |
| 8 |
token: "variable.parameter.operator.pitch.alda", |
| 9 |
regex: /(?:[+\-]+|\=)/ |
| 10 |
}, { |
| 11 |
token: "", |
| 12 |
regex: "", |
| 13 |
next: "timing" |
| 14 |
}], |
| 15 |
timing: [{ |
| 16 |
token: "string.quoted.operator.timing.alda", |
| 17 |
regex: /\d+(?:s|ms)?/ |
| 18 |
}, { |
| 19 |
token: "", |
| 20 |
regex: "", |
| 21 |
next: "start" |
| 22 |
}], |
| 23 |
start: [{ |
| 24 |
token: [ |
| 25 |
"constant.language.instrument.alda", |
| 26 |
"constant.language.instrument.alda", |
| 27 |
"meta.part.call.alda", |
| 28 |
"storage.type.nickname.alda", |
| 29 |
"meta.part.call.alda" |
| 30 |
], |
| 31 |
regex: /^([a-zA-Z]{2}[\w\-+\'()]*)((?:\s*\/\s*[a-zA-Z]{2}[\w\-+\'()]*)*)(?:(\s*)(\"[a-zA-Z]{2}[\w\-+\'()]*\"))?(\s*:)/ |
| 32 |
}, { |
| 33 |
token: [ |
| 34 |
"text", |
| 35 |
"entity.other.inherited-class.voice.alda", |
| 36 |
"text" |
| 37 |
], |
| 38 |
regex: /^(\s*)(V\d+)(:)/ |
| 39 |
}, { |
| 40 |
token: "comment.line.number-sign.alda", |
| 41 |
regex: /#.*$/ |
| 42 |
}, { |
| 43 |
token: "entity.name.function.pipe.measure.alda", |
| 44 |
regex: /\|/ |
| 45 |
}, { |
| 46 |
token: "comment.block.inline.alda", |
| 47 |
regex: /\(comment\b/, |
| 48 |
push: [{ |
| 49 |
token: "comment.block.inline.alda", |
| 50 |
regex: /\)/, |
| 51 |
next: "pop" |
| 52 |
}, { |
| 53 |
defaultToken: "comment.block.inline.alda" |
| 54 |
}] |
| 55 |
}, { |
| 56 |
token: "entity.name.function.marker.alda", |
| 57 |
regex: /%[a-zA-Z]{2}[\w\-+\'()]*/ |
| 58 |
}, { |
| 59 |
token: "entity.name.function.at-marker.alda", |
| 60 |
regex: /@[a-zA-Z]{2}[\w\-+\'()]*/ |
| 61 |
}, { |
| 62 |
token: "keyword.operator.octave-change.alda", |
| 63 |
regex: /\bo\d+\b/ |
| 64 |
}, { |
| 65 |
token: "keyword.operator.octave-shift.alda", |
| 66 |
regex: /[><]/ |
| 67 |
}, { |
| 68 |
token: "keyword.operator.repeat.alda", |
| 69 |
regex: /\*\s*\d+/ |
| 70 |
}, { |
| 71 |
token: "string.quoted.operator.timing.alda", |
| 72 |
regex: /[.]|r\d*(?:s|ms)?/ |
| 73 |
}, { |
| 74 |
token: "text", |
| 75 |
regex: /([cdefgab])/, |
| 76 |
next: "pitch" |
| 77 |
}, { |
| 78 |
token: "string.quoted.operator.timing.alda", |
| 79 |
regex: /~/, |
| 80 |
next: "timing" |
| 81 |
}, { |
| 82 |
token: "punctuation.section.embedded.cram.alda", |
| 83 |
regex: /\}/, |
| 84 |
next: "timing" |
| 85 |
}, { |
| 86 |
token: "constant.numeric.subchord.alda", |
| 87 |
regex: /\// |
| 88 |
}, { |
| 89 |
todo: { |
| 90 |
token: "punctuation.section.embedded.cram.alda", |
| 91 |
regex: /\{/, |
| 92 |
push: [{ |
| 93 |
token: "punctuation.section.embedded.cram.alda", |
| 94 |
regex: /\}/, |
| 95 |
next: "pop" |
| 96 |
}, { |
| 97 |
include: "$self" |
| 98 |
}] |
| 99 |
} |
| 100 |
}, { |
| 101 |
todo: { |
| 102 |
token: "keyword.control.sequence.alda", |
| 103 |
regex: /\[/, |
| 104 |
push: [{ |
| 105 |
token: "keyword.control.sequence.alda", |
| 106 |
regex: /\]/, |
| 107 |
next: "pop" |
| 108 |
}, { |
| 109 |
include: "$self" |
| 110 |
}] |
| 111 |
} |
| 112 |
}, { |
| 113 |
token: "meta.inline.clojure.alda", |
| 114 |
regex: /\(/, |
| 115 |
push: [{ |
| 116 |
token: "meta.inline.clojure.alda", |
| 117 |
regex: /\)/, |
| 118 |
next: "pop" |
| 119 |
}, { |
| 120 |
include: "source.clojure" |
| 121 |
}, { |
| 122 |
defaultToken: "meta.inline.clojure.alda" |
| 123 |
}] |
| 124 |
}] |
| 125 |
}; |
| 126 |
this.normalizeRules(); |
| 127 |
}; |
| 128 |
AldaHighlightRules.metaData = { |
| 129 |
scopeName: "source.alda", |
| 130 |
fileTypes: ["alda"], |
| 131 |
name: "Alda" |
| 132 |
}; |
| 133 |
oop.inherits(AldaHighlightRules, TextHighlightRules); |
| 134 |
exports.AldaHighlightRules = AldaHighlightRules; |
| 135 |
|
| 136 |
}); |
| 137 |
|
| 138 |
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"; |
| 139 |
var oop = require("../../lib/oop"); |
| 140 |
var Range = require("../../range").Range; |
| 141 |
var BaseFoldMode = require("./fold_mode").FoldMode; |
| 142 |
var FoldMode = exports.FoldMode = function (commentRegex) { |
| 143 |
if (commentRegex) { |
| 144 |
this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)); |
| 145 |
this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)); |
| 146 |
} |
| 147 |
}; |
| 148 |
oop.inherits(FoldMode, BaseFoldMode); |
| 149 |
(function () { |
| 150 |
this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/; |
| 151 |
this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/; |
| 152 |
this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/; |
| 153 |
this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/; |
| 154 |
this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/; |
| 155 |
this._getFoldWidgetBase = this.getFoldWidget; |
| 156 |
this.getFoldWidget = function (session, foldStyle, row) { |
| 157 |
var line = session.getLine(row); |
| 158 |
if (this.singleLineBlockCommentRe.test(line)) { |
| 159 |
if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line)) |
| 160 |
return ""; |
| 161 |
} |
| 162 |
var fw = this._getFoldWidgetBase(session, foldStyle, row); |
| 163 |
if (!fw && this.startRegionRe.test(line)) |
| 164 |
return "start"; |
| 165 |
return fw; |
| 166 |
}; |
| 167 |
this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) { |
| 168 |
var line = session.getLine(row); |
| 169 |
if (this.startRegionRe.test(line)) |
| 170 |
return this.getCommentRegionBlock(session, line, row); |
| 171 |
var match = line.match(this.foldingStartMarker); |
| 172 |
if (match) { |
| 173 |
var i = match.index; |
| 174 |
if (match[1]) |
| 175 |
return this.openingBracketBlock(session, match[1], row, i); |
| 176 |
var range = session.getCommentFoldRange(row, i + match[0].length, 1); |
| 177 |
if (range && !range.isMultiLine()) { |
| 178 |
if (forceMultiline) { |
| 179 |
range = this.getSectionRange(session, row); |
| 180 |
} |
| 181 |
else if (foldStyle != "all") |
| 182 |
range = null; |
| 183 |
} |
| 184 |
return range; |
| 185 |
} |
| 186 |
if (foldStyle === "markbegin") |
| 187 |
return; |
| 188 |
var match = line.match(this.foldingStopMarker); |
| 189 |
if (match) { |
| 190 |
var i = match.index + match[0].length; |
| 191 |
if (match[1]) |
| 192 |
return this.closingBracketBlock(session, match[1], row, i); |
| 193 |
return session.getCommentFoldRange(row, i, -1); |
| 194 |
} |
| 195 |
}; |
| 196 |
this.getSectionRange = function (session, row) { |
| 197 |
var line = session.getLine(row); |
| 198 |
var startIndent = line.search(/\S/); |
| 199 |
var startRow = row; |
| 200 |
var startColumn = line.length; |
| 201 |
row = row + 1; |
| 202 |
var endRow = row; |
| 203 |
var maxRow = session.getLength(); |
| 204 |
while (++row < maxRow) { |
| 205 |
line = session.getLine(row); |
| 206 |
var indent = line.search(/\S/); |
| 207 |
if (indent === -1) |
| 208 |
continue; |
| 209 |
if (startIndent > indent) |
| 210 |
break; |
| 211 |
var subRange = this.getFoldWidgetRange(session, "all", row); |
| 212 |
if (subRange) { |
| 213 |
if (subRange.start.row <= startRow) { |
| 214 |
break; |
| 215 |
} |
| 216 |
else if (subRange.isMultiLine()) { |
| 217 |
row = subRange.end.row; |
| 218 |
} |
| 219 |
else if (startIndent == indent) { |
| 220 |
break; |
| 221 |
} |
| 222 |
} |
| 223 |
endRow = row; |
| 224 |
} |
| 225 |
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length); |
| 226 |
}; |
| 227 |
this.getCommentRegionBlock = function (session, line, row) { |
| 228 |
var startColumn = line.search(/\s*$/); |
| 229 |
var maxRow = session.getLength(); |
| 230 |
var startRow = row; |
| 231 |
var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/; |
| 232 |
var depth = 1; |
| 233 |
while (++row < maxRow) { |
| 234 |
line = session.getLine(row); |
| 235 |
var m = re.exec(line); |
| 236 |
if (!m) |
| 237 |
continue; |
| 238 |
if (m[1]) |
| 239 |
depth--; |
| 240 |
else |
| 241 |
depth++; |
| 242 |
if (!depth) |
| 243 |
break; |
| 244 |
} |
| 245 |
var endRow = row; |
| 246 |
if (endRow > startRow) { |
| 247 |
return new Range(startRow, startColumn, endRow, line.length); |
| 248 |
} |
| 249 |
}; |
| 250 |
}).call(FoldMode.prototype); |
| 251 |
|
| 252 |
}); |
| 253 |
|
| 254 |
ace.define("ace/mode/alda",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/alda_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module){ |
| 255 |
|
| 256 |
|
| 257 |
"use strict"; |
| 258 |
var oop = require("../lib/oop"); |
| 259 |
var TextMode = require("./text").Mode; |
| 260 |
var AldaHighlightRules = require("./alda_highlight_rules").AldaHighlightRules; |
| 261 |
var FoldMode = require("./folding/cstyle").FoldMode; |
| 262 |
var Mode = function () { |
| 263 |
this.HighlightRules = AldaHighlightRules; |
| 264 |
this.foldingRules = new FoldMode(); |
| 265 |
}; |
| 266 |
oop.inherits(Mode, TextMode); |
| 267 |
(function () { |
| 268 |
this.$id = "ace/mode/alda"; |
| 269 |
}).call(Mode.prototype); |
| 270 |
exports.Mode = Mode; |
| 271 |
|
| 272 |
}); (function() { |
| 273 |
ace.require(["ace/mode/alda"], function(m) { |
| 274 |
if (typeof module == "object" && typeof exports == "object" && module) { |
| 275 |
module.exports = m; |
| 276 |
} |
| 277 |
}); |
| 278 |
})(); |
| 279 |
|