corrade-nucleus-nucleons – Blame information for rev 20

Subversion Repositories:
Rev:
Rev Author Line No. Line
20 office 1 define("ace/mode/tex_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"], function(require, exports, module) {
2 "use strict";
3  
4 var oop = require("../lib/oop");
5 var lang = require("../lib/lang");
6 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
7  
8 var TexHighlightRules = function(textClass) {
9  
10 if (!textClass)
11 textClass = "text";
12  
13 this.$rules = {
14 "start" : [
15 {
16 token : "comment",
17 regex : "%.*$"
18 }, {
19 token : textClass, // non-command
20 regex : "\\\\[$&%#\\{\\}]"
21 }, {
22 token : "keyword", // command
23 regex : "\\\\(?:documentclass|usepackage|newcounter|setcounter|addtocounter|value|arabic|stepcounter|newenvironment|renewenvironment|ref|vref|eqref|pageref|label|cite[a-zA-Z]*|tag|begin|end|bibitem)\\b",
24 next : "nospell"
25 }, {
26 token : "keyword", // command
27 regex : "\\\\(?:[a-zA-Z0-9]+|[^a-zA-Z0-9])"
28 }, {
29 token : "paren.keyword.operator",
30 regex : "[[({]"
31 }, {
32 token : "paren.keyword.operator",
33 regex : "[\\])}]"
34 }, {
35 token : textClass,
36 regex : "\\s+"
37 }
38 ],
39 "nospell" : [
40 {
41 token : "comment",
42 regex : "%.*$",
43 next : "start"
44 }, {
45 token : "nospell." + textClass, // non-command
46 regex : "\\\\[$&%#\\{\\}]"
47 }, {
48 token : "keyword", // command
49 regex : "\\\\(?:documentclass|usepackage|newcounter|setcounter|addtocounter|value|arabic|stepcounter|newenvironment|renewenvironment|ref|vref|eqref|pageref|label|cite[a-zA-Z]*|tag|begin|end|bibitem)\\b"
50 }, {
51 token : "keyword", // command
52 regex : "\\\\(?:[a-zA-Z0-9]+|[^a-zA-Z0-9])",
53 next : "start"
54 }, {
55 token : "paren.keyword.operator",
56 regex : "[[({]"
57 }, {
58 token : "paren.keyword.operator",
59 regex : "[\\])]"
60 }, {
61 token : "paren.keyword.operator",
62 regex : "}",
63 next : "start"
64 }, {
65 token : "nospell." + textClass,
66 regex : "\\s+"
67 }, {
68 token : "nospell." + textClass,
69 regex : "\\w+"
70 }
71 ]
72 };
73 };
74  
75 oop.inherits(TexHighlightRules, TextHighlightRules);
76  
77 exports.TexHighlightRules = TexHighlightRules;
78 });
79  
80 define("ace/mode/r_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules","ace/mode/tex_highlight_rules"], function(require, exports, module)
81 {
82  
83 var oop = require("../lib/oop");
84 var lang = require("../lib/lang");
85 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
86 var TexHighlightRules = require("./tex_highlight_rules").TexHighlightRules;
87  
88 var RHighlightRules = function()
89 {
90  
91 var keywords = lang.arrayToMap(
92 ("function|if|in|break|next|repeat|else|for|return|switch|while|try|tryCatch|stop|warning|require|library|attach|detach|source|setMethod|setGeneric|setGroupGeneric|setClass")
93 .split("|")
94 );
95  
96 var buildinConstants = lang.arrayToMap(
97 ("NULL|NA|TRUE|FALSE|T|F|Inf|NaN|NA_integer_|NA_real_|NA_character_|" +
98 "NA_complex_").split("|")
99 );
100  
101 this.$rules = {
102 "start" : [
103 {
104 token : "comment.sectionhead",
105 regex : "#+(?!').*(?:----|====|####)\\s*$"
106 },
107 {
108 token : "comment",
109 regex : "#+'",
110 next : "rd-start"
111 },
112 {
113 token : "comment",
114 regex : "#.*$"
115 },
116 {
117 token : "string", // multi line string start
118 regex : '["]',
119 next : "qqstring"
120 },
121 {
122 token : "string", // multi line string start
123 regex : "[']",
124 next : "qstring"
125 },
126 {
127 token : "constant.numeric", // hex
128 regex : "0[xX][0-9a-fA-F]+[Li]?\\b"
129 },
130 {
131 token : "constant.numeric", // explicit integer
132 regex : "\\d+L\\b"
133 },
134 {
135 token : "constant.numeric", // number
136 regex : "\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d*)?i?\\b"
137 },
138 {
139 token : "constant.numeric", // number with leading decimal
140 regex : "\\.\\d+(?:[eE][+\\-]?\\d*)?i?\\b"
141 },
142 {
143 token : "constant.language.boolean",
144 regex : "(?:TRUE|FALSE|T|F)\\b"
145 },
146 {
147 token : "identifier",
148 regex : "`.*?`"
149 },
150 {
151 onMatch : function(value) {
152 if (keywords[value])
153 return "keyword";
154 else if (buildinConstants[value])
155 return "constant.language";
156 else if (value == '...' || value.match(/^\.\.\d+$/))
157 return "variable.language";
158 else
159 return "identifier";
160 },
161 regex : "[a-zA-Z.][a-zA-Z0-9._]*\\b"
162 },
163 {
164 token : "keyword.operator",
165 regex : "%%|>=|<=|==|!=|\\->|<\\-|\\|\\||&&|=|\\+|\\-|\\*|/|\\^|>|<|!|&|\\||~|\\$|:"
166 },
167 {
168 token : "keyword.operator", // infix operators
169 regex : "%.*?%"
170 },
171 {
172 token : "paren.keyword.operator",
173 regex : "[[({]"
174 },
175 {
176 token : "paren.keyword.operator",
177 regex : "[\\])}]"
178 },
179 {
180 token : "text",
181 regex : "\\s+"
182 }
183 ],
184 "qqstring" : [
185 {
186 token : "string",
187 regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
188 next : "start"
189 },
190 {
191 token : "string",
192 regex : '.+'
193 }
194 ],
195 "qstring" : [
196 {
197 token : "string",
198 regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
199 next : "start"
200 },
201 {
202 token : "string",
203 regex : '.+'
204 }
205 ]
206 };
207  
208 var rdRules = new TexHighlightRules("comment").getRules();
209 for (var i = 0; i < rdRules["start"].length; i++) {
210 rdRules["start"][i].token += ".virtual-comment";
211 }
212  
213 this.addRules(rdRules, "rd-");
214 this.$rules["rd-start"].unshift({
215 token: "text",
216 regex: "^",
217 next: "start"
218 });
219 this.$rules["rd-start"].unshift({
220 token : "keyword",
221 regex : "@(?!@)[^ ]*"
222 });
223 this.$rules["rd-start"].unshift({
224 token : "comment",
225 regex : "@@"
226 });
227 this.$rules["rd-start"].push({
228 token : "comment",
229 regex : "[^%\\\\[({\\])}]+"
230 });
231 };
232  
233 oop.inherits(RHighlightRules, TextHighlightRules);
234  
235 exports.RHighlightRules = RHighlightRules;
236 });
237  
238 define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
239 "use strict";
240  
241 var Range = require("../range").Range;
242  
243 var MatchingBraceOutdent = function() {};
244  
245 (function() {
246  
247 this.checkOutdent = function(line, input) {
248 if (! /^\s+$/.test(line))
249 return false;
250  
251 return /^\s*\}/.test(input);
252 };
253  
254 this.autoOutdent = function(doc, row) {
255 var line = doc.getLine(row);
256 var match = line.match(/^(\s*\})/);
257  
258 if (!match) return 0;
259  
260 var column = match[1].length;
261 var openBracePos = doc.findMatchingBracket({row: row, column: column});
262  
263 if (!openBracePos || openBracePos.row == row) return 0;
264  
265 var indent = this.$getIndent(doc.getLine(openBracePos.row));
266 doc.replace(new Range(row, 0, row, column-1), indent);
267 };
268  
269 this.$getIndent = function(line) {
270 return line.match(/^\s*/)[0];
271 };
272  
273 }).call(MatchingBraceOutdent.prototype);
274  
275 exports.MatchingBraceOutdent = MatchingBraceOutdent;
276 });
277  
278 define("ace/mode/r",["require","exports","module","ace/range","ace/lib/oop","ace/mode/text","ace/mode/text_highlight_rules","ace/mode/r_highlight_rules","ace/mode/matching_brace_outdent"], function(require, exports, module) {
279 "use strict";
280  
281 var Range = require("../range").Range;
282 var oop = require("../lib/oop");
283 var TextMode = require("./text").Mode;
284 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
285 var RHighlightRules = require("./r_highlight_rules").RHighlightRules;
286 var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
287  
288 var Mode = function(){
289 this.HighlightRules = RHighlightRules;
290 this.$outdent = new MatchingBraceOutdent();
291 this.$behaviour = this.$defaultBehaviour;
292 };
293 oop.inherits(Mode, TextMode);
294  
295 (function()
296 {
297 this.lineCommentStart = "#";
298 this.$id = "ace/mode/r";
299 }).call(Mode.prototype);
300 exports.Mode = Mode;
301 });