| 1 |
ace.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 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
"use strict"; |
| 39 |
var oop = require("../lib/oop"); |
| 40 |
var lang = require("../lib/lang"); |
| 41 |
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; |
| 42 |
var TexHighlightRules = function (textClass) { |
| 43 |
if (!textClass) |
| 44 |
textClass = "text"; |
| 45 |
this.$rules = { |
| 46 |
"start": [ |
| 47 |
{ |
| 48 |
token: "comment", |
| 49 |
regex: "%.*$" |
| 50 |
}, { |
| 51 |
token: textClass, |
| 52 |
regex: "\\\\[$&%#\\{\\}]" |
| 53 |
}, { |
| 54 |
token: "keyword", |
| 55 |
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", |
| 56 |
next: "nospell" |
| 57 |
}, { |
| 58 |
token: "keyword", |
| 59 |
regex: "\\\\(?:[a-zA-Z0-9]+|[^a-zA-Z0-9])" |
| 60 |
}, { |
| 61 |
token: "paren.keyword.operator", |
| 62 |
regex: "[[({]" |
| 63 |
}, { |
| 64 |
token: "paren.keyword.operator", |
| 65 |
regex: "[\\])}]" |
| 66 |
}, { |
| 67 |
token: textClass, |
| 68 |
regex: "\\s+" |
| 69 |
} |
| 70 |
], |
| 71 |
"nospell": [ |
| 72 |
{ |
| 73 |
token: "comment", |
| 74 |
regex: "%.*$", |
| 75 |
next: "start" |
| 76 |
}, { |
| 77 |
token: "nospell." + textClass, |
| 78 |
regex: "\\\\[$&%#\\{\\}]" |
| 79 |
}, { |
| 80 |
token: "keyword", |
| 81 |
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" |
| 82 |
}, { |
| 83 |
token: "keyword", |
| 84 |
regex: "\\\\(?:[a-zA-Z0-9]+|[^a-zA-Z0-9])", |
| 85 |
next: "start" |
| 86 |
}, { |
| 87 |
token: "paren.keyword.operator", |
| 88 |
regex: "[[({]" |
| 89 |
}, { |
| 90 |
token: "paren.keyword.operator", |
| 91 |
regex: "[\\])]" |
| 92 |
}, { |
| 93 |
token: "paren.keyword.operator", |
| 94 |
regex: "}", |
| 95 |
next: "start" |
| 96 |
}, { |
| 97 |
token: "nospell." + textClass, |
| 98 |
regex: "\\s+" |
| 99 |
}, { |
| 100 |
token: "nospell." + textClass, |
| 101 |
regex: "\\w+" |
| 102 |
} |
| 103 |
] |
| 104 |
}; |
| 105 |
}; |
| 106 |
oop.inherits(TexHighlightRules, TextHighlightRules); |
| 107 |
exports.TexHighlightRules = TexHighlightRules; |
| 108 |
|
| 109 |
}); |
| 110 |
|
| 111 |
ace.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){ |
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
var oop = require("../lib/oop"); |
| 149 |
var lang = require("../lib/lang"); |
| 150 |
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; |
| 151 |
var TexHighlightRules = require("./tex_highlight_rules").TexHighlightRules; |
| 152 |
var RHighlightRules = function () { |
| 153 |
var keywords = lang.arrayToMap(("function|if|in|break|next|repeat|else|for|return|switch|while|try|tryCatch|stop|warning|require|library|attach|detach|source|setMethod|setGeneric|setGroupGeneric|setClass") |
| 154 |
.split("|")); |
| 155 |
var buildinConstants = lang.arrayToMap(("NULL|NA|TRUE|FALSE|T|F|Inf|NaN|NA_integer_|NA_real_|NA_character_|" + |
| 156 |
"NA_complex_").split("|")); |
| 157 |
this.$rules = { |
| 158 |
"start": [ |
| 159 |
{ |
| 160 |
token: "comment.sectionhead", |
| 161 |
regex: "#+(?!').*(?:----|====|####)\\s*$" |
| 162 |
}, |
| 163 |
{ |
| 164 |
token: "comment", |
| 165 |
regex: "#+'", |
| 166 |
next: "rd-start" |
| 167 |
}, |
| 168 |
{ |
| 169 |
token: "comment", |
| 170 |
regex: "#.*$" |
| 171 |
}, |
| 172 |
{ |
| 173 |
token: "string", |
| 174 |
regex: '["]', |
| 175 |
next: "qqstring" |
| 176 |
}, |
| 177 |
{ |
| 178 |
token: "string", |
| 179 |
regex: "[']", |
| 180 |
next: "qstring" |
| 181 |
}, |
| 182 |
{ |
| 183 |
token: "constant.numeric", |
| 184 |
regex: "0[xX][0-9a-fA-F]+[Li]?\\b" |
| 185 |
}, |
| 186 |
{ |
| 187 |
token: "constant.numeric", |
| 188 |
regex: "\\d+L\\b" |
| 189 |
}, |
| 190 |
{ |
| 191 |
token: "constant.numeric", |
| 192 |
regex: "\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d*)?i?\\b" |
| 193 |
}, |
| 194 |
{ |
| 195 |
token: "constant.numeric", |
| 196 |
regex: "\\.\\d+(?:[eE][+\\-]?\\d*)?i?\\b" |
| 197 |
}, |
| 198 |
{ |
| 199 |
token: "constant.language.boolean", |
| 200 |
regex: "(?:TRUE|FALSE|T|F)\\b" |
| 201 |
}, |
| 202 |
{ |
| 203 |
token: "identifier", |
| 204 |
regex: "`.*?`" |
| 205 |
}, |
| 206 |
{ |
| 207 |
onMatch: function (value) { |
| 208 |
if (keywords[value]) |
| 209 |
return "keyword"; |
| 210 |
else if (buildinConstants[value]) |
| 211 |
return "constant.language"; |
| 212 |
else if (value == '...' || value.match(/^\.\.\d+$/)) |
| 213 |
return "variable.language"; |
| 214 |
else |
| 215 |
return "identifier"; |
| 216 |
}, |
| 217 |
regex: "[a-zA-Z.][a-zA-Z0-9._]*\\b" |
| 218 |
}, |
| 219 |
{ |
| 220 |
token: "keyword.operator", |
| 221 |
regex: "%%|>=|<=|==|!=|\\->|<\\-|\\|\\||&&|=|\\+|\\-|\\*|/|\\^|>|<|!|&|\\||~|\\$|:" |
| 222 |
}, |
| 223 |
{ |
| 224 |
token: "keyword.operator", |
| 225 |
regex: "%.*?%" |
| 226 |
}, |
| 227 |
{ |
| 228 |
token: "paren.keyword.operator", |
| 229 |
regex: "[[({]" |
| 230 |
}, |
| 231 |
{ |
| 232 |
token: "paren.keyword.operator", |
| 233 |
regex: "[\\])}]" |
| 234 |
}, |
| 235 |
{ |
| 236 |
token: "text", |
| 237 |
regex: "\\s+" |
| 238 |
} |
| 239 |
], |
| 240 |
"qqstring": [ |
| 241 |
{ |
| 242 |
token: "string", |
| 243 |
regex: '(?:(?:\\\\.)|(?:[^"\\\\]))*?"', |
| 244 |
next: "start" |
| 245 |
}, |
| 246 |
{ |
| 247 |
token: "string", |
| 248 |
regex: '.+' |
| 249 |
} |
| 250 |
], |
| 251 |
"qstring": [ |
| 252 |
{ |
| 253 |
token: "string", |
| 254 |
regex: "(?:(?:\\\\.)|(?:[^'\\\\]))*?'", |
| 255 |
next: "start" |
| 256 |
}, |
| 257 |
{ |
| 258 |
token: "string", |
| 259 |
regex: '.+' |
| 260 |
} |
| 261 |
] |
| 262 |
}; |
| 263 |
var rdRules = new TexHighlightRules("comment").getRules(); |
| 264 |
for (var i = 0; i < rdRules["start"].length; i++) { |
| 265 |
rdRules["start"][i].token += ".virtual-comment"; |
| 266 |
} |
| 267 |
this.addRules(rdRules, "rd-"); |
| 268 |
this.$rules["rd-start"].unshift({ |
| 269 |
token: "text", |
| 270 |
regex: "^", |
| 271 |
next: "start" |
| 272 |
}); |
| 273 |
this.$rules["rd-start"].unshift({ |
| 274 |
token: "keyword", |
| 275 |
regex: "@(?!@)[^ ]*" |
| 276 |
}); |
| 277 |
this.$rules["rd-start"].unshift({ |
| 278 |
token: "comment", |
| 279 |
regex: "@@" |
| 280 |
}); |
| 281 |
this.$rules["rd-start"].push({ |
| 282 |
token: "comment", |
| 283 |
regex: "[^%\\\\[({\\])}]+" |
| 284 |
}); |
| 285 |
}; |
| 286 |
oop.inherits(RHighlightRules, TextHighlightRules); |
| 287 |
exports.RHighlightRules = RHighlightRules; |
| 288 |
|
| 289 |
}); |
| 290 |
|
| 291 |
ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module){"use strict"; |
| 292 |
var Range = require("../range").Range; |
| 293 |
var MatchingBraceOutdent = function () { }; |
| 294 |
(function () { |
| 295 |
this.checkOutdent = function (line, input) { |
| 296 |
if (!/^\s+$/.test(line)) |
| 297 |
return false; |
| 298 |
return /^\s*\}/.test(input); |
| 299 |
}; |
| 300 |
this.autoOutdent = function (doc, row) { |
| 301 |
var line = doc.getLine(row); |
| 302 |
var match = line.match(/^(\s*\})/); |
| 303 |
if (!match) |
| 304 |
return 0; |
| 305 |
var column = match[1].length; |
| 306 |
var openBracePos = doc.findMatchingBracket({ row: row, column: column }); |
| 307 |
if (!openBracePos || openBracePos.row == row) |
| 308 |
return 0; |
| 309 |
var indent = this.$getIndent(doc.getLine(openBracePos.row)); |
| 310 |
doc.replace(new Range(row, 0, row, column - 1), indent); |
| 311 |
}; |
| 312 |
this.$getIndent = function (line) { |
| 313 |
return line.match(/^\s*/)[0]; |
| 314 |
}; |
| 315 |
}).call(MatchingBraceOutdent.prototype); |
| 316 |
exports.MatchingBraceOutdent = MatchingBraceOutdent; |
| 317 |
|
| 318 |
}); |
| 319 |
|
| 320 |
ace.define("ace/mode/r",["require","exports","module","ace/unicode","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){ |
| 321 |
|
| 322 |
|
| 323 |
|
| 324 |
|
| 325 |
|
| 326 |
|
| 327 |
|
| 328 |
|
| 329 |
|
| 330 |
|
| 331 |
|
| 332 |
|
| 333 |
|
| 334 |
|
| 335 |
|
| 336 |
|
| 337 |
|
| 338 |
|
| 339 |
|
| 340 |
|
| 341 |
|
| 342 |
|
| 343 |
|
| 344 |
|
| 345 |
|
| 346 |
|
| 347 |
|
| 348 |
|
| 349 |
|
| 350 |
|
| 351 |
|
| 352 |
|
| 353 |
|
| 354 |
|
| 355 |
|
| 356 |
|
| 357 |
"use strict"; |
| 358 |
var unicode = require("../unicode"); |
| 359 |
var Range = require("../range").Range; |
| 360 |
var oop = require("../lib/oop"); |
| 361 |
var TextMode = require("./text").Mode; |
| 362 |
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; |
| 363 |
var RHighlightRules = require("./r_highlight_rules").RHighlightRules; |
| 364 |
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; |
| 365 |
var Mode = function () { |
| 366 |
this.HighlightRules = RHighlightRules; |
| 367 |
this.$outdent = new MatchingBraceOutdent(); |
| 368 |
this.$behaviour = this.$defaultBehaviour; |
| 369 |
}; |
| 370 |
oop.inherits(Mode, TextMode); |
| 371 |
(function () { |
| 372 |
this.lineCommentStart = "#"; |
| 373 |
this.tokenRe = new RegExp("^[" + unicode.wordChars + "._]+", "g"); |
| 374 |
this.nonTokenRe = new RegExp("^(?:[^" + unicode.wordChars + "._]|\s])+", "g"); |
| 375 |
this.$id = "ace/mode/r"; |
| 376 |
this.snippetFileId = "ace/snippets/r"; |
| 377 |
}).call(Mode.prototype); |
| 378 |
exports.Mode = Mode; |
| 379 |
|
| 380 |
}); (function() { |
| 381 |
ace.require(["ace/mode/r"], function(m) { |
| 382 |
if (typeof module == "object" && typeof exports == "object" && module) { |
| 383 |
module.exports = m; |
| 384 |
} |
| 385 |
}); |
| 386 |
})(); |
| 387 |
|