corrade-nucleus-nucleons – Blame information for rev 20
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
20 | office | 1 | ace.define("ace/mode/clojure_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 | |||
8 | |||
9 | var ClojureHighlightRules = function() { |
||
10 | |||
11 | var builtinFunctions = ( |
||
12 | '* *1 *2 *3 *agent* *allow-unresolved-vars* *assert* *clojure-version* ' + |
||
13 | '*command-line-args* *compile-files* *compile-path* *e *err* *file* ' + |
||
14 | '*flush-on-newline* *in* *macro-meta* *math-context* *ns* *out* ' + |
||
15 | '*print-dup* *print-length* *print-level* *print-meta* *print-readably* ' + |
||
16 | '*read-eval* *source-path* *use-context-classloader* ' + |
||
17 | '*warn-on-reflection* + - -> ->> .. / < <= = ' + |
||
18 | '== > > >= >= accessor aclone ' + |
||
19 | 'add-classpath add-watch agent agent-errors aget alength alias all-ns ' + |
||
20 | 'alter alter-meta! alter-var-root amap ancestors and apply areduce ' + |
||
21 | 'array-map aset aset-boolean aset-byte aset-char aset-double aset-float ' + |
||
22 | 'aset-int aset-long aset-short assert assoc assoc! assoc-in associative? ' + |
||
23 | 'atom await await-for await1 bases bean bigdec bigint binding bit-and ' + |
||
24 | 'bit-and-not bit-clear bit-flip bit-not bit-or bit-set bit-shift-left ' + |
||
25 | 'bit-shift-right bit-test bit-xor boolean boolean-array booleans ' + |
||
26 | 'bound-fn bound-fn* butlast byte byte-array bytes cast char char-array ' + |
||
27 | 'char-escape-string char-name-string char? chars chunk chunk-append ' + |
||
28 | 'chunk-buffer chunk-cons chunk-first chunk-next chunk-rest chunked-seq? ' + |
||
29 | 'class class? clear-agent-errors clojure-version coll? comment commute ' + |
||
30 | 'comp comparator compare compare-and-set! compile complement concat cond ' + |
||
31 | 'condp conj conj! cons constantly construct-proxy contains? count ' + |
||
32 | 'counted? create-ns create-struct cycle dec decimal? declare definline ' + |
||
33 | 'defmacro defmethod defmulti defn defn- defonce defstruct delay delay? ' + |
||
34 | 'deliver deref derive descendants destructure disj disj! dissoc dissoc! ' + |
||
35 | 'distinct distinct? doall doc dorun doseq dosync dotimes doto double ' + |
||
36 | 'double-array doubles drop drop-last drop-while empty empty? ensure ' + |
||
37 | 'enumeration-seq eval even? every? false? ffirst file-seq filter find ' + |
||
38 | 'find-doc find-ns find-var first float float-array float? floats flush ' + |
||
39 | 'fn fn? fnext for force format future future-call future-cancel ' + |
||
40 | 'future-cancelled? future-done? future? gen-class gen-interface gensym ' + |
||
41 | 'get get-in get-method get-proxy-class get-thread-bindings get-validator ' + |
||
42 | 'hash hash-map hash-set identical? identity if-let if-not ifn? import ' + |
||
43 | 'in-ns inc init-proxy instance? int int-array integer? interleave intern ' + |
||
44 | 'interpose into into-array ints io! isa? iterate iterator-seq juxt key ' + |
||
45 | 'keys keyword keyword? last lazy-cat lazy-seq let letfn line-seq list ' + |
||
46 | 'list* list? load load-file load-reader load-string loaded-libs locking ' + |
||
47 | 'long long-array longs loop macroexpand macroexpand-1 make-array ' + |
||
48 | 'make-hierarchy map map? mapcat max max-key memfn memoize merge ' + |
||
49 | 'merge-with meta method-sig methods min min-key mod name namespace neg? ' + |
||
50 | 'newline next nfirst nil? nnext not not-any? not-empty not-every? not= ' + |
||
51 | 'ns ns-aliases ns-imports ns-interns ns-map ns-name ns-publics ' + |
||
52 | 'ns-refers ns-resolve ns-unalias ns-unmap nth nthnext num number? odd? ' + |
||
53 | 'or parents partial partition pcalls peek persistent! pmap pop pop! ' + |
||
54 | 'pop-thread-bindings pos? pr pr-str prefer-method prefers ' + |
||
55 | 'primitives-classnames print print-ctor print-doc print-dup print-method ' + |
||
56 | 'print-namespace-doc print-simple print-special-doc print-str printf ' + |
||
57 | 'println println-str prn prn-str promise proxy proxy-call-with-super ' + |
||
58 | 'proxy-mappings proxy-name proxy-super push-thread-bindings pvalues quot ' + |
||
59 | 'rand rand-int range ratio? rational? rationalize re-find re-groups ' + |
||
60 | 're-matcher re-matches re-pattern re-seq read read-line read-string ' + |
||
61 | 'reduce ref ref-history-count ref-max-history ref-min-history ref-set ' + |
||
62 | 'refer refer-clojure release-pending-sends rem remove remove-method ' + |
||
63 | 'remove-ns remove-watch repeat repeatedly replace replicate require ' + |
||
64 | 'reset! reset-meta! resolve rest resultset-seq reverse reversible? rseq ' + |
||
65 | 'rsubseq second select-keys send send-off seq seq? seque sequence ' + |
||
66 | 'sequential? set set-validator! set? short short-array shorts ' + |
||
67 | 'shutdown-agents slurp some sort sort-by sorted-map sorted-map-by ' + |
||
68 | 'sorted-set sorted-set-by sorted? special-form-anchor special-symbol? ' + |
||
69 | 'split-at split-with str stream? string? struct struct-map subs subseq ' + |
||
70 | 'subvec supers swap! symbol symbol? sync syntax-symbol-anchor take ' + |
||
71 | 'take-last take-nth take-while test the-ns time to-array to-array-2d ' + |
||
72 | 'trampoline transient tree-seq true? type unchecked-add unchecked-dec ' + |
||
73 | 'unchecked-divide unchecked-inc unchecked-multiply unchecked-negate ' + |
||
74 | 'unchecked-remainder unchecked-subtract underive unquote ' + |
||
75 | 'unquote-splicing update-in update-proxy use val vals var-get var-set ' + |
||
76 | 'var? vary-meta vec vector vector? when when-first when-let when-not ' + |
||
77 | 'while with-bindings with-bindings* with-in-str with-loading-context ' + |
||
78 | 'with-local-vars with-meta with-open with-out-str with-precision xml-seq ' + |
||
79 | 'zero? zipmap' |
||
80 | ); |
||
81 | |||
82 | var keywords = ('throw try var ' + |
||
83 | 'def do fn if let loop monitor-enter monitor-exit new quote recur set!' |
||
84 | ); |
||
85 | |||
86 | var buildinConstants = ("true false nil"); |
||
87 | |||
88 | var keywordMapper = this.createKeywordMapper({ |
||
89 | "keyword": keywords, |
||
90 | "constant.language": buildinConstants, |
||
91 | "support.function": builtinFunctions |
||
92 | }, "identifier", false, " "); |
||
93 | |||
94 | this.$rules = { |
||
95 | "start" : [ |
||
96 | { |
||
97 | token : "comment", |
||
98 | regex : ";.*$" |
||
99 | }, { |
||
100 | token : "keyword", //parens |
||
101 | regex : "[\\(|\\)]" |
||
102 | }, { |
||
103 | token : "keyword", //lists |
||
104 | regex : "[\\'\\(]" |
||
105 | }, { |
||
106 | token : "keyword", //vectors |
||
107 | regex : "[\\[|\\]]" |
||
108 | }, { |
||
109 | token : "keyword", //sets and maps |
||
110 | regex : "[\\{|\\}|\\#\\{|\\#\\}]" |
||
111 | }, { |
||
112 | token : "keyword", // ampersands |
||
113 | regex : '[\\&]' |
||
114 | }, { |
||
115 | token : "keyword", // metadata |
||
116 | regex : '[\\#\\^\\{]' |
||
117 | }, { |
||
118 | token : "keyword", // anonymous fn syntactic sugar |
||
119 | regex : '[\\%]' |
||
120 | }, { |
||
121 | token : "keyword", // deref reader macro |
||
122 | regex : '[@]' |
||
123 | }, { |
||
124 | token : "constant.numeric", // hex |
||
125 | regex : "0[xX][0-9a-fA-F]+\\b" |
||
126 | }, { |
||
127 | token : "constant.numeric", // float |
||
128 | regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" |
||
129 | }, { |
||
130 | token : "constant.language", |
||
131 | regex : '[!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+||=|!=|<=|>=|<>|<|>|!|&&]' |
||
132 | }, { |
||
133 | token : keywordMapper, |
||
134 | regex : "[a-zA-Z_$][a-zA-Z0-9_$\\-]*\\b" |
||
135 | }, { |
||
136 | token : "string", // single line |
||
137 | regex : '"', |
||
138 | next: "string" |
||
139 | }, { |
||
140 | token : "constant", // symbol |
||
141 | regex : /:[^()\[\]{}'"\^%`,;\s]+/ |
||
142 | }, { |
||
143 | token : "string.regexp", //Regular Expressions |
||
144 | regex : '/#"(?:\\.|(?:\\")|[^""\n])*"/g' |
||
145 | } |
||
146 | |||
147 | ], |
||
148 | "string" : [ |
||
149 | { |
||
150 | token : "constant.language.escape", |
||
151 | regex : "\\\\.|\\\\$" |
||
152 | }, { |
||
153 | token : "string", |
||
154 | regex : '[^"\\\\]+' |
||
155 | }, { |
||
156 | token : "string", |
||
157 | regex : '"', |
||
158 | next : "start" |
||
159 | } |
||
160 | ] |
||
161 | }; |
||
162 | }; |
||
163 | |||
164 | oop.inherits(ClojureHighlightRules, TextHighlightRules); |
||
165 | |||
166 | exports.ClojureHighlightRules = ClojureHighlightRules; |
||
167 | }); |
||
168 | |||
169 | ace.define("ace/mode/matching_parens_outdent",["require","exports","module","ace/range"], function(require, exports, module) { |
||
170 | "use strict"; |
||
171 | |||
172 | var Range = require("../range").Range; |
||
173 | |||
174 | var MatchingParensOutdent = function() {}; |
||
175 | |||
176 | (function() { |
||
177 | |||
178 | this.checkOutdent = function(line, input) { |
||
179 | if (! /^\s+$/.test(line)) |
||
180 | return false; |
||
181 | |||
182 | return /^\s*\)/.test(input); |
||
183 | }; |
||
184 | |||
185 | this.autoOutdent = function(doc, row) { |
||
186 | var line = doc.getLine(row); |
||
187 | var match = line.match(/^(\s*\))/); |
||
188 | |||
189 | if (!match) return 0; |
||
190 | |||
191 | var column = match[1].length; |
||
192 | var openBracePos = doc.findMatchingBracket({row: row, column: column}); |
||
193 | |||
194 | if (!openBracePos || openBracePos.row == row) return 0; |
||
195 | |||
196 | var indent = this.$getIndent(doc.getLine(openBracePos.row)); |
||
197 | doc.replace(new Range(row, 0, row, column-1), indent); |
||
198 | }; |
||
199 | |||
200 | this.$getIndent = function(line) { |
||
201 | var match = line.match(/^(\s+)/); |
||
202 | if (match) { |
||
203 | return match[1]; |
||
204 | } |
||
205 | |||
206 | return ""; |
||
207 | }; |
||
208 | |||
209 | }).call(MatchingParensOutdent.prototype); |
||
210 | |||
211 | exports.MatchingParensOutdent = MatchingParensOutdent; |
||
212 | }); |
||
213 | |||
214 | ace.define("ace/mode/clojure",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/clojure_highlight_rules","ace/mode/matching_parens_outdent"], function(require, exports, module) { |
||
215 | "use strict"; |
||
216 | |||
217 | var oop = require("../lib/oop"); |
||
218 | var TextMode = require("./text").Mode; |
||
219 | var ClojureHighlightRules = require("./clojure_highlight_rules").ClojureHighlightRules; |
||
220 | var MatchingParensOutdent = require("./matching_parens_outdent").MatchingParensOutdent; |
||
221 | |||
222 | var Mode = function() { |
||
223 | this.HighlightRules = ClojureHighlightRules; |
||
224 | this.$outdent = new MatchingParensOutdent(); |
||
225 | this.$behaviour = this.$defaultBehaviour; |
||
226 | }; |
||
227 | oop.inherits(Mode, TextMode); |
||
228 | |||
229 | (function() { |
||
230 | |||
231 | this.lineCommentStart = ";"; |
||
232 | this.minorIndentFunctions = ["defn", "defn-", "defmacro", "def", "deftest", "testing"]; |
||
233 | |||
234 | this.$toIndent = function(str) { |
||
235 | return str.split('').map(function(ch) { |
||
236 | if (/\s/.exec(ch)) { |
||
237 | return ch; |
||
238 | } else { |
||
239 | return ' '; |
||
240 | } |
||
241 | }).join(''); |
||
242 | }; |
||
243 | |||
244 | this.$calculateIndent = function(line, tab) { |
||
245 | var baseIndent = this.$getIndent(line); |
||
246 | var delta = 0; |
||
247 | var isParen, ch; |
||
248 | for (var i = line.length - 1; i >= 0; i--) { |
||
249 | ch = line[i]; |
||
250 | if (ch === '(') { |
||
251 | delta--; |
||
252 | isParen = true; |
||
253 | } else if (ch === '(' || ch === '[' || ch === '{') { |
||
254 | delta--; |
||
255 | isParen = false; |
||
256 | } else if (ch === ')' || ch === ']' || ch === '}') { |
||
257 | delta++; |
||
258 | } |
||
259 | if (delta < 0) { |
||
260 | break; |
||
261 | } |
||
262 | } |
||
263 | if (delta < 0 && isParen) { |
||
264 | i += 1; |
||
265 | var iBefore = i; |
||
266 | var fn = ''; |
||
267 | while (true) { |
||
268 | ch = line[i]; |
||
269 | if (ch === ' ' || ch === '\t') { |
||
270 | if(this.minorIndentFunctions.indexOf(fn) !== -1) { |
||
271 | return this.$toIndent(line.substring(0, iBefore - 1) + tab); |
||
272 | } else { |
||
273 | return this.$toIndent(line.substring(0, i + 1)); |
||
274 | } |
||
275 | } else if (ch === undefined) { |
||
276 | return this.$toIndent(line.substring(0, iBefore - 1) + tab); |
||
277 | } |
||
278 | fn += line[i]; |
||
279 | i++; |
||
280 | } |
||
281 | } else if(delta < 0 && !isParen) { |
||
282 | return this.$toIndent(line.substring(0, i+1)); |
||
283 | } else if(delta > 0) { |
||
284 | baseIndent = baseIndent.substring(0, baseIndent.length - tab.length); |
||
285 | return baseIndent; |
||
286 | } else { |
||
287 | return baseIndent; |
||
288 | } |
||
289 | }; |
||
290 | |||
291 | this.getNextLineIndent = function(state, line, tab) { |
||
292 | return this.$calculateIndent(line, tab); |
||
293 | }; |
||
294 | |||
295 | this.checkOutdent = function(state, line, input) { |
||
296 | return this.$outdent.checkOutdent(line, input); |
||
297 | }; |
||
298 | |||
299 | this.autoOutdent = function(state, doc, row) { |
||
300 | this.$outdent.autoOutdent(doc, row); |
||
301 | }; |
||
302 | |||
303 | this.$id = "ace/mode/clojure"; |
||
304 | }).call(Mode.prototype); |
||
305 | |||
306 | exports.Mode = Mode; |
||
307 | }); |