corrade-nucleus-nucleons – Blame information for rev 20
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
20 | office | 1 | ace.define("ace/mode/julia_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 JuliaHighlightRules = function() { |
||
8 | |||
9 | this.$rules = { start: |
||
10 | [ { include: '#function_decl' }, |
||
11 | { include: '#function_call' }, |
||
12 | { include: '#type_decl' }, |
||
13 | { include: '#keyword' }, |
||
14 | { include: '#operator' }, |
||
15 | { include: '#number' }, |
||
16 | { include: '#string' }, |
||
17 | { include: '#comment' } ], |
||
18 | '#bracket': |
||
19 | [ { token: 'keyword.bracket.julia', |
||
20 | regex: '\\(|\\)|\\[|\\]|\\{|\\}|,' } ], |
||
21 | '#comment': |
||
22 | [ { token: |
||
23 | [ 'punctuation.definition.comment.julia', |
||
24 | 'comment.line.number-sign.julia' ], |
||
25 | regex: '(#)(?!\\{)(.*$)'} ], |
||
26 | '#function_call': |
||
27 | [ { token: [ 'support.function.julia', 'text' ], |
||
28 | regex: '([a-zA-Z0-9_]+!?)([\\w\\xff-\\u218e\\u2455-\\uffff]*\\()'} ], |
||
29 | '#function_decl': |
||
30 | [ { token: [ 'keyword.other.julia', 'meta.function.julia', |
||
31 | 'entity.name.function.julia', 'meta.function.julia','text' ], |
||
32 | regex: '(function|macro)(\\s*)([a-zA-Z0-9_\\{]+!?)([\\w\\xff-\\u218e\\u2455-\\uffff]*)([(\\\\{])'} ], |
||
33 | '#keyword': |
||
34 | [ { token: 'keyword.other.julia', |
||
35 | regex: '\\b(?:function|type|immutable|macro|quote|abstract|bitstype|typealias|module|baremodule|new)\\b' }, |
||
36 | { token: 'keyword.control.julia', |
||
37 | regex: '\\b(?:if|else|elseif|while|for|in|begin|let|end|do|try|catch|finally|return|break|continue)\\b' }, |
||
38 | { token: 'storage.modifier.variable.julia', |
||
39 | regex: '\\b(?:global|local|const|export|import|importall|using)\\b' }, |
||
40 | { token: 'variable.macro.julia', regex: '@[\\w\\xff-\\u218e\\u2455-\\uffff]+\\b' } ], |
||
41 | '#number': |
||
42 | [ { token: 'constant.numeric.julia', |
||
43 | regex: '\\b0(?:x|X)[0-9a-fA-F]*|(?:\\b[0-9]+\\.?[0-9]*|\\.[0-9]+)(?:(?:e|E)(?:\\+|-)?[0-9]*)?(?:im)?|\\bInf(?:32)?\\b|\\bNaN(?:32)?\\b|\\btrue\\b|\\bfalse\\b' } ], |
||
44 | '#operator': |
||
45 | [ { token: 'keyword.operator.update.julia', |
||
46 | regex: '=|:=|\\+=|-=|\\*=|/=|//=|\\.//=|\\.\\*=|\\\\=|\\.\\\\=|^=|\\.^=|%=|\\|=|&=|\\$=|<<=|>>=' }, |
||
47 | { token: 'keyword.operator.ternary.julia', regex: '\\?|:' }, |
||
48 | { token: 'keyword.operator.boolean.julia', |
||
49 | regex: '\\|\\||&&|!' }, |
||
50 | { token: 'keyword.operator.arrow.julia', regex: '->|<-|-->' }, |
||
51 | { token: 'keyword.operator.relation.julia', |
||
52 | regex: '>|<|>=|<=|==|!=|\\.>|\\.<|\\.>=|\\.>=|\\.==|\\.!=|\\.=|\\.!|<:|:>' }, |
||
53 | { token: 'keyword.operator.range.julia', regex: ':' }, |
||
54 | { token: 'keyword.operator.shift.julia', regex: '<<|>>' }, |
||
55 | { token: 'keyword.operator.bitwise.julia', regex: '\\||\\&|~' }, |
||
56 | { token: 'keyword.operator.arithmetic.julia', |
||
57 | regex: '\\+|-|\\*|\\.\\*|/|\\./|//|\\.//|%|\\.%|\\\\|\\.\\\\|\\^|\\.\\^' }, |
||
58 | { token: 'keyword.operator.isa.julia', regex: '::' }, |
||
59 | { token: 'keyword.operator.dots.julia', |
||
60 | regex: '\\.(?=[a-zA-Z])|\\.\\.+' }, |
||
61 | { token: 'keyword.operator.interpolation.julia', |
||
62 | regex: '\\$#?(?=.)' }, |
||
63 | { token: [ 'variable', 'keyword.operator.transposed-variable.julia' ], |
||
64 | regex: '([\\w\\xff-\\u218e\\u2455-\\uffff]+)((?:\'|\\.\')*\\.?\')' }, |
||
65 | { token: 'text', |
||
66 | regex: '\\[|\\('}, |
||
67 | { token: [ 'text', 'keyword.operator.transposed-matrix.julia' ], |
||
68 | regex: "([\\]\\)])((?:'|\\.')*\\.?')"} ], |
||
69 | '#string': |
||
70 | [ { token: 'punctuation.definition.string.begin.julia', |
||
71 | regex: '\'', |
||
72 | push: |
||
73 | [ { token: 'punctuation.definition.string.end.julia', |
||
74 | regex: '\'', |
||
75 | next: 'pop' }, |
||
76 | { include: '#string_escaped_char' }, |
||
77 | { defaultToken: 'string.quoted.single.julia' } ] }, |
||
78 | { token: 'punctuation.definition.string.begin.julia', |
||
79 | regex: '"', |
||
80 | push: |
||
81 | [ { token: 'punctuation.definition.string.end.julia', |
||
82 | regex: '"', |
||
83 | next: 'pop' }, |
||
84 | { include: '#string_escaped_char' }, |
||
85 | { defaultToken: 'string.quoted.double.julia' } ] }, |
||
86 | { token: 'punctuation.definition.string.begin.julia', |
||
87 | regex: '\\b[\\w\\xff-\\u218e\\u2455-\\uffff]+"', |
||
88 | push: |
||
89 | [ { token: 'punctuation.definition.string.end.julia', |
||
90 | regex: '"[\\w\\xff-\\u218e\\u2455-\\uffff]*', |
||
91 | next: 'pop' }, |
||
92 | { include: '#string_custom_escaped_char' }, |
||
93 | { defaultToken: 'string.quoted.custom-double.julia' } ] }, |
||
94 | { token: 'punctuation.definition.string.begin.julia', |
||
95 | regex: '`', |
||
96 | push: |
||
97 | [ { token: 'punctuation.definition.string.end.julia', |
||
98 | regex: '`', |
||
99 | next: 'pop' }, |
||
100 | { include: '#string_escaped_char' }, |
||
101 | { defaultToken: 'string.quoted.backtick.julia' } ] } ], |
||
102 | '#string_custom_escaped_char': [ { token: 'constant.character.escape.julia', regex: '\\\\"' } ], |
||
103 | '#string_escaped_char': |
||
104 | [ { token: 'constant.character.escape.julia', |
||
105 | regex: '\\\\(?:\\\\|[0-3]\\d{,2}|[4-7]\\d?|x[a-fA-F0-9]{,2}|u[a-fA-F0-9]{,4}|U[a-fA-F0-9]{,8}|.)' } ], |
||
106 | '#type_decl': |
||
107 | [ { token: |
||
108 | [ 'keyword.control.type.julia', |
||
109 | 'meta.type.julia', |
||
110 | 'entity.name.type.julia', |
||
111 | 'entity.other.inherited-class.julia', |
||
112 | 'punctuation.separator.inheritance.julia', |
||
113 | 'entity.other.inherited-class.julia' ], |
||
114 | regex: '(type|immutable)(\\s+)([a-zA-Z0-9_]+)(?:(\\s*)(<:)(\\s*[.a-zA-Z0-9_:]+))?' }, |
||
115 | { token: [ 'other.typed-variable.julia', 'support.type.julia' ], |
||
116 | regex: '([a-zA-Z0-9_]+)(::[a-zA-Z0-9_{}]+)' } ] } |
||
117 | |||
118 | this.normalizeRules(); |
||
119 | }; |
||
120 | |||
121 | JuliaHighlightRules.metaData = { fileTypes: [ 'jl' ], |
||
122 | firstLineMatch: '^#!.*\\bjulia\\s*$', |
||
123 | foldingStartMarker: '^\\s*(?:if|while|for|begin|function|macro|module|baremodule|type|immutable|let)\\b(?!.*\\bend\\b).*$', |
||
124 | foldingStopMarker: '^\\s*(?:end)\\b.*$', |
||
125 | name: 'Julia', |
||
126 | scopeName: 'source.julia' } |
||
127 | |||
128 | |||
129 | oop.inherits(JuliaHighlightRules, TextHighlightRules); |
||
130 | |||
131 | exports.JuliaHighlightRules = JuliaHighlightRules; |
||
132 | }); |
||
133 | |||
134 | ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) { |
||
135 | "use strict"; |
||
136 | |||
137 | var oop = require("../../lib/oop"); |
||
138 | var Range = require("../../range").Range; |
||
139 | var BaseFoldMode = require("./fold_mode").FoldMode; |
||
140 | |||
141 | var FoldMode = exports.FoldMode = function(commentRegex) { |
||
142 | if (commentRegex) { |
||
143 | this.foldingStartMarker = new RegExp( |
||
144 | this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) |
||
145 | ); |
||
146 | this.foldingStopMarker = new RegExp( |
||
147 | this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) |
||
148 | ); |
||
149 | } |
||
150 | }; |
||
151 | oop.inherits(FoldMode, BaseFoldMode); |
||
152 | |||
153 | (function() { |
||
154 | |||
155 | this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/; |
||
156 | this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/; |
||
157 | this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/; |
||
158 | this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/; |
||
159 | this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/; |
||
160 | this._getFoldWidgetBase = this.getFoldWidget; |
||
161 | this.getFoldWidget = function(session, foldStyle, row) { |
||
162 | var line = session.getLine(row); |
||
163 | |||
164 | if (this.singleLineBlockCommentRe.test(line)) { |
||
165 | if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line)) |
||
166 | return ""; |
||
167 | } |
||
168 | |||
169 | var fw = this._getFoldWidgetBase(session, foldStyle, row); |
||
170 | |||
171 | if (!fw && this.startRegionRe.test(line)) |
||
172 | return "start"; // lineCommentRegionStart |
||
173 | |||
174 | return fw; |
||
175 | }; |
||
176 | |||
177 | this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) { |
||
178 | var line = session.getLine(row); |
||
179 | |||
180 | if (this.startRegionRe.test(line)) |
||
181 | return this.getCommentRegionBlock(session, line, row); |
||
182 | |||
183 | var match = line.match(this.foldingStartMarker); |
||
184 | if (match) { |
||
185 | var i = match.index; |
||
186 | |||
187 | if (match[1]) |
||
188 | return this.openingBracketBlock(session, match[1], row, i); |
||
189 | |||
190 | var range = session.getCommentFoldRange(row, i + match[0].length, 1); |
||
191 | |||
192 | if (range && !range.isMultiLine()) { |
||
193 | if (forceMultiline) { |
||
194 | range = this.getSectionRange(session, row); |
||
195 | } else if (foldStyle != "all") |
||
196 | range = null; |
||
197 | } |
||
198 | |||
199 | return range; |
||
200 | } |
||
201 | |||
202 | if (foldStyle === "markbegin") |
||
203 | return; |
||
204 | |||
205 | var match = line.match(this.foldingStopMarker); |
||
206 | if (match) { |
||
207 | var i = match.index + match[0].length; |
||
208 | |||
209 | if (match[1]) |
||
210 | return this.closingBracketBlock(session, match[1], row, i); |
||
211 | |||
212 | return session.getCommentFoldRange(row, i, -1); |
||
213 | } |
||
214 | }; |
||
215 | |||
216 | this.getSectionRange = function(session, row) { |
||
217 | var line = session.getLine(row); |
||
218 | var startIndent = line.search(/\S/); |
||
219 | var startRow = row; |
||
220 | var startColumn = line.length; |
||
221 | row = row + 1; |
||
222 | var endRow = row; |
||
223 | var maxRow = session.getLength(); |
||
224 | while (++row < maxRow) { |
||
225 | line = session.getLine(row); |
||
226 | var indent = line.search(/\S/); |
||
227 | if (indent === -1) |
||
228 | continue; |
||
229 | if (startIndent > indent) |
||
230 | break; |
||
231 | var subRange = this.getFoldWidgetRange(session, "all", row); |
||
232 | |||
233 | if (subRange) { |
||
234 | if (subRange.start.row <= startRow) { |
||
235 | break; |
||
236 | } else if (subRange.isMultiLine()) { |
||
237 | row = subRange.end.row; |
||
238 | } else if (startIndent == indent) { |
||
239 | break; |
||
240 | } |
||
241 | } |
||
242 | endRow = row; |
||
243 | } |
||
244 | |||
245 | return new Range(startRow, startColumn, endRow, session.getLine(endRow).length); |
||
246 | }; |
||
247 | this.getCommentRegionBlock = function(session, line, row) { |
||
248 | var startColumn = line.search(/\s*$/); |
||
249 | var maxRow = session.getLength(); |
||
250 | var startRow = row; |
||
251 | |||
252 | var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/; |
||
253 | var depth = 1; |
||
254 | while (++row < maxRow) { |
||
255 | line = session.getLine(row); |
||
256 | var m = re.exec(line); |
||
257 | if (!m) continue; |
||
258 | if (m[1]) depth--; |
||
259 | else depth++; |
||
260 | |||
261 | if (!depth) break; |
||
262 | } |
||
263 | |||
264 | var endRow = row; |
||
265 | if (endRow > startRow) { |
||
266 | return new Range(startRow, startColumn, endRow, line.length); |
||
267 | } |
||
268 | }; |
||
269 | |||
270 | }).call(FoldMode.prototype); |
||
271 | |||
272 | }); |
||
273 | |||
274 | ace.define("ace/mode/julia",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/julia_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module) { |
||
275 | "use strict"; |
||
276 | |||
277 | var oop = require("../lib/oop"); |
||
278 | var TextMode = require("./text").Mode; |
||
279 | var JuliaHighlightRules = require("./julia_highlight_rules").JuliaHighlightRules; |
||
280 | var FoldMode = require("./folding/cstyle").FoldMode; |
||
281 | |||
282 | var Mode = function() { |
||
283 | this.HighlightRules = JuliaHighlightRules; |
||
284 | this.foldingRules = new FoldMode(); |
||
285 | this.$behaviour = this.$defaultBehaviour; |
||
286 | }; |
||
287 | oop.inherits(Mode, TextMode); |
||
288 | |||
289 | (function() { |
||
290 | this.lineCommentStart = "#"; |
||
291 | this.blockComment = ""; |
||
292 | this.$id = "ace/mode/julia"; |
||
293 | }).call(Mode.prototype); |
||
294 | |||
295 | exports.Mode = Mode; |
||
296 | }); |