corrade-nucleus-nucleons – Blame information for rev 20

Subversion Repositories:
Rev:
Rev Author Line No. Line
20 office 1 ace.define("ace/mode/rust_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 stringEscape = /\\(?:[nrt0'"\\]|x[\da-fA-F]{2}|u\{[\da-fA-F]{6}\})/.source;
8 var RustHighlightRules = function() {
9  
10 this.$rules = { start:
11 [ { token: 'variable.other.source.rust',
12 regex: '\'[a-zA-Z_][a-zA-Z0-9_]*(?![\\\'])' },
13 { token: 'string.quoted.single.source.rust',
14 regex: "'(?:[^'\\\\]|" + stringEscape + ")'" },
15 {
16 stateName: "bracketedComment",
17 onMatch : function(value, currentState, stack){
18 stack.unshift(this.next, value.length - 1, currentState);
19 return "string.quoted.raw.source.rust";
20 },
21 regex : /r#*"/,
22 next : [
23 {
24 onMatch : function(value, currentState, stack) {
25 var token = "string.quoted.raw.source.rust";
26 if (value.length >= stack[1]) {
27 if (value.length > stack[1])
28 token = "invalid";
29 stack.shift();
30 stack.shift();
31 this.next = stack.shift();
32 } else {
33 this.next = "";
34 }
35 return token;
36 },
37 regex : /"#*/,
38 next : "start"
39 }, {
40 defaultToken : "string.quoted.raw.source.rust"
41 }
42 ]
43 },
44 { token: 'string.quoted.double.source.rust',
45 regex: '"',
46 push:
47 [ { token: 'string.quoted.double.source.rust',
48 regex: '"',
49 next: 'pop' },
50 { token: 'constant.character.escape.source.rust',
51 regex: stringEscape },
52 { defaultToken: 'string.quoted.double.source.rust' } ] },
53 { token: [ 'keyword.source.rust', 'text', 'entity.name.function.source.rust' ],
54 regex: '\\b(fn)(\\s+)([a-zA-Z_][a-zA-Z0-9_]*)' },
55 { token: 'support.constant', regex: '\\b[a-zA-Z_][\\w\\d]*::' },
56 { token: 'keyword.source.rust',
57 regex: '\\b(?:abstract|alignof|as|box|break|continue|const|crate|do|else|enum|extern|for|final|if|impl|in|let|loop|macro|match|mod|move|mut|offsetof|override|priv|proc|pub|pure|ref|return|self|sizeof|static|struct|super|trait|type|typeof|unsafe|unsized|use|virtual|where|while|yield)\\b' },
58 { token: 'storage.type.source.rust',
59 regex: '\\b(?:Self|isize|usize|char|bool|u8|u16|u32|u64|u128|f16|f32|f64|i8|i16|i32|i64|i128|str|option|either|c_float|c_double|c_void|FILE|fpos_t|DIR|dirent|c_char|c_schar|c_uchar|c_short|c_ushort|c_int|c_uint|c_long|c_ulong|size_t|ptrdiff_t|clock_t|time_t|c_longlong|c_ulonglong|intptr_t|uintptr_t|off_t|dev_t|ino_t|pid_t|mode_t|ssize_t)\\b' },
60 { token: 'variable.language.source.rust', regex: '\\bself\\b' },
61  
62 { token: 'comment.line.doc.source.rust',
63 regex: '//!.*$' },
64 { token: 'comment.line.double-dash.source.rust',
65 regex: '//.*$' },
66 { token: 'comment.start.block.source.rust',
67 regex: '/\\*',
68 stateName: 'comment',
69 push:
70 [ { token: 'comment.start.block.source.rust',
71 regex: '/\\*',
72 push: 'comment' },
73 { token: 'comment.end.block.source.rust',
74 regex: '\\*/',
75 next: 'pop' },
76 { defaultToken: 'comment.block.source.rust' } ] },
77  
78 { token: 'keyword.operator',
79 regex: /\$|[-=]>|[-+%^=!&|<>]=?|[*/](?![*/])=?/ },
80 <> { token : "punctuation.operator", regex : /[?:,;.]/ },
81 <> { token : "paren.lparen", regex : /[\[({]/ },
82 <> { token : "paren.rparen", regex : /[\])}]/ },
83 <> { token: 'constant.language.source.rust',
84 <> regex: '\\b(?:true|false|Some|None|Ok|Err)\\b' },
85 <> { token: 'support.constant.source.rust',
86 <> regex: '\\b(?:EXIT_FAILURE|EXIT_SUCCESS|RAND_MAX|EOF|SEEK_SET|SEEK_CUR|SEEK_END|_IOFBF|_IONBF|_IOLBF|BUFSIZ|FOPEN_MAX|FILENAME_MAX|L_tmpnam|TMP_MAX|O_RDONLY|O_WRONLY|O_RDWR|O_APPEND|O_CREAT|O_EXCL|O_TRUNC|S_IFIFO|S_IFCHR|S_IFBLK|S_IFDIR|S_IFREG|S_IFMT|S_IEXEC|S_IWRITE|S_IREAD|S_IRWXU|S_IXUSR|S_IWUSR|S_IRUSR|F_OK|R_OK|W_OK|X_OK|STDIN_FILENO|STDOUT_FILENO|STDERR_FILENO)\\b' },
87 <> { token: 'meta.preprocessor.source.rust',
88 <> regex: '\\b\\w\\(\\w\\)*!|#\\[[\\w=\\(\\)_]+\\]\\b' },
89 <> { token: 'constant.numeric.source.rust',
90 <> regex: /\b(?:0x[a-fA-F0-9_]+|0o[0-7_]+|0b[01_]+|[0-9][0-9_]*(?!\.))(?:[iu](?:size|8|16|32|64|128))?\b/ },
91 <> { token: 'constant.numeric.source.rust',
92 <> regex: /\b(?:[0-9][0-9_]*)(?:\.[0-9][0-9_]*)?(?:[Ee][+-][0-9][0-9_]*)?(?:f32|f64)?\b/ } ] }
93  
94 <> this.normalizeRules();
95 <>};
96  
97 <>RustHighlightRules.metaData = { fileTypes: [ 'rs', 'rc' ],
98 <> foldingStartMarker: '^.*\\bfn\\s*(\\w+\\s*)?\\([^\\)]*\\)(\\s*\\{[^\\}]*)?\\s*$',
99 <> foldingStopMarker: '^\\s*\\}',
100 <> name: 'Rust',
101 <> scopeName: 'source.rust' }
102  
103  
104 <>oop.inherits(RustHighlightRules, TextHighlightRules);
105  
106 <>exports.RustHighlightRules = RustHighlightRules;
107 <>});
108  
109 <>ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
110 <>"use strict";
111  
112 <>var oop = require("../../lib/oop");
113 <>var Range = require("../../range").Range;
114 <>var BaseFoldMode = require("./fold_mode").FoldMode;
115  
116 <>var FoldMode = exports.FoldMode = function(commentRegex) {
117 <> if (commentRegex) {
118 <> this.foldingStartMarker = new RegExp(
119 <> this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
120 <> );
121 <> this.foldingStopMarker = new RegExp(
122 <> this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
123 <> );
124 <> }
125 <>};
126 <>oop.inherits(FoldMode, BaseFoldMode);
127  
128 <>(function() {
129  
130 <> this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
131 <> this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
132 <> this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
133 <> this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
134 <> this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
135 <> this._getFoldWidgetBase = this.getFoldWidget;
136 <> this.getFoldWidget = function(session, foldStyle, row) {
137 <> var line = session.getLine(row);
138  
139 <> if (this.singleLineBlockCommentRe.test(line)) {
140 <> if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
141 <> return "";
142 <> }
143  
144 <> var fw = this._getFoldWidgetBase(session, foldStyle, row);
145  
146 <> if (!fw && this.startRegionRe.test(line))
147 <> return "start"; // lineCommentRegionStart
148  
149 <> return fw;
150 <> };
151  
152 <> this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
153 <> var line = session.getLine(row);
154  
155 <> if (this.startRegionRe.test(line))
156 <> return this.getCommentRegionBlock(session, line, row);
157  
158 <> var match = line.match(this.foldingStartMarker);
159 <> if (match) {
160 <> var i = match.index;
161  
162 <> if (match[1])
163 <> return this.openingBracketBlock(session, match[1], row, i);
164  
165 <> var range = session.getCommentFoldRange(row, i + match[0].length, 1);
166  
167 <> if (range && !range.isMultiLine()) {
168 <> if (forceMultiline) {
169 <> range = this.getSectionRange(session, row);
170 <> } else if (foldStyle != "all")
171 <> range = null;
172 <> }
173  
174 <> return range;
175 <> }
176  
177 <> if (foldStyle === "markbegin")
178 <> return;
179  
180 <> var match = line.match(this.foldingStopMarker);
181 <> if (match) {
182 <> var i = match.index + match[0].length;
183  
184 <> if (match[1])
185 <> return this.closingBracketBlock(session, match[1], row, i);
186  
187 <> return session.getCommentFoldRange(row, i, -1);
188 <> }
189 <> };
190  
191 <> this.getSectionRange = function(session, row) {
192 <> var line = session.getLine(row);
193 <> var startIndent = line.search(/\S/);
194 <> var startRow = row;
195 <> var startColumn = line.length;
196 <> row = row + 1;
197 <> var endRow = row;
198 <> var maxRow = session.getLength();
199 <> while (++row < maxRow) {
200 <> line = session.getLine(row);
201 <> var indent = line.search(/\S/);
202 <> if (indent === -1)
203 <> continue;
204 <> if (startIndent > indent)
205 <> break;
206 <> var subRange = this.getFoldWidgetRange(session, "all", row);
207  
208 <> if (subRange) {
209 <> if (subRange.start.row <= startRow) {
210 <> break;
211 <> } else if (subRange.isMultiLine()) {
212 <> row = subRange.end.row;
213 <> } else if (startIndent == indent) {
214 <> break;
215 <> }
216 <> }
217 <> endRow = row;
218 <> }
219  
220 <> return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
221 <> };
222 <> this.getCommentRegionBlock = function(session, line, row) {
223 <> var startColumn = line.search(/\s*$/);
224 <> var maxRow = session.getLength();
225 <> var startRow = row;
226  
227 <> var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
228 <> var depth = 1;
229 <> while (++row < maxRow) {
230 <> line = session.getLine(row);
231 <> var m = re.exec(line);
232 <> if (!m) continue;
233 <> if (m[1]) depth--;
234 <> else depth++;
235  
236 <> if (!depth) break;
237 <> }
238  
239 <> var endRow = row;
240 <> if (endRow > startRow) {
241 <> return new Range(startRow, startColumn, endRow, line.length);
242 <> }
243 <> };
244  
245 <>}).call(FoldMode.prototype);
246  
247 <>});
248  
249 <>ace.define("ace/mode/rust",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/rust_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module) {
250 <>"use strict";
251  
252 <>var oop = require("../lib/oop");
253 <>var TextMode = require("./text").Mode;
254 <>var RustHighlightRules = require("./rust_highlight_rules").RustHighlightRules;
255 <>var FoldMode = require("./folding/cstyle").FoldMode;
256  
257 <>var Mode = function() {
258 <> this.HighlightRules = RustHighlightRules;
259 <> this.foldingRules = new FoldMode();
260 <> this.$behaviour = this.$defaultBehaviour;
261 <>};
262 <>oop.inherits(Mode, TextMode);
263  
264 <>(function() {
265 <> this.lineCommentStart = "//";
266 <> this.blockComment = {start: "/*", end: "*/", nestable: true};
267 <> this.$id = "ace/mode/rust";
268 <>}).call(Mode.prototype);
269  
270 <>exports.Mode = Mode;
271 <>});