corrade-nucleus-nucleons – Blame information for rev 20

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