| 1 |
ace.define("ace/mode/latex_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict"; |
| 2 |
var oop = require("../lib/oop"); |
| 3 |
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; |
| 4 |
var LatexHighlightRules = function () { |
| 5 |
this.$rules = { |
| 6 |
"start": [{ |
| 7 |
token: "comment", |
| 8 |
regex: "%.*$" |
| 9 |
}, { |
| 10 |
token: ["keyword", "lparen", "variable.parameter", "rparen", "lparen", "storage.type", "rparen"], |
| 11 |
regex: "(\\\\(?:documentclass|usepackage|input))(?:(\\[)([^\\]]*)(\\]))?({)([^}]*)(})" |
| 12 |
}, { |
| 13 |
token: ["keyword", "lparen", "variable.parameter", "rparen"], |
| 14 |
regex: "(\\\\(?:label|v?ref|cite(?:[^{]*)))(?:({)([^}]*)(}))?" |
| 15 |
}, { |
| 16 |
token: ["storage.type", "lparen", "variable.parameter", "rparen"], |
| 17 |
regex: "(\\\\begin)({)(verbatim)(})", |
| 18 |
next: "verbatim" |
| 19 |
}, { |
| 20 |
token: ["storage.type", "lparen", "variable.parameter", "rparen"], |
| 21 |
regex: "(\\\\begin)({)(lstlisting)(})", |
| 22 |
next: "lstlisting" |
| 23 |
}, { |
| 24 |
token: ["storage.type", "lparen", "variable.parameter", "rparen"], |
| 25 |
regex: "(\\\\(?:begin|end))({)([\\w*]*)(})" |
| 26 |
}, { |
| 27 |
token: "storage.type", |
| 28 |
regex: /\\verb\b\*?/, |
| 29 |
next: [{ |
| 30 |
token: ["keyword.operator", "string", "keyword.operator"], |
| 31 |
regex: "(.)(.*?)(\\1|$)|", |
| 32 |
next: "start" |
| 33 |
}] |
| 34 |
}, { |
| 35 |
token: "storage.type", |
| 36 |
regex: "\\\\[a-zA-Z]+" |
| 37 |
}, { |
| 38 |
token: "lparen", |
| 39 |
regex: "[[({]" |
| 40 |
}, { |
| 41 |
token: "rparen", |
| 42 |
regex: "[\\])}]" |
| 43 |
}, { |
| 44 |
token: "constant.character.escape", |
| 45 |
regex: "\\\\[^a-zA-Z]?" |
| 46 |
}, { |
| 47 |
token: "string", |
| 48 |
regex: "\\${1,2}", |
| 49 |
next: "equation" |
| 50 |
}], |
| 51 |
"equation": [{ |
| 52 |
token: "comment", |
| 53 |
regex: "%.*$" |
| 54 |
}, { |
| 55 |
token: "string", |
| 56 |
regex: "\\${1,2}", |
| 57 |
next: "start" |
| 58 |
}, { |
| 59 |
token: "constant.character.escape", |
| 60 |
regex: "\\\\(?:[^a-zA-Z]|[a-zA-Z]+)" |
| 61 |
}, { |
| 62 |
token: "error", |
| 63 |
regex: "^\\s*$", |
| 64 |
next: "start" |
| 65 |
}, { |
| 66 |
defaultToken: "string" |
| 67 |
}], |
| 68 |
"verbatim": [{ |
| 69 |
token: ["storage.type", "lparen", "variable.parameter", "rparen"], |
| 70 |
regex: "(\\\\end)({)(verbatim)(})", |
| 71 |
next: "start" |
| 72 |
}, { |
| 73 |
defaultToken: "text" |
| 74 |
}], |
| 75 |
"lstlisting": [{ |
| 76 |
token: ["storage.type", "lparen", "variable.parameter", "rparen"], |
| 77 |
regex: "(\\\\end)({)(lstlisting)(})", |
| 78 |
next: "start" |
| 79 |
}, { |
| 80 |
defaultToken: "text" |
| 81 |
}] |
| 82 |
}; |
| 83 |
this.normalizeRules(); |
| 84 |
}; |
| 85 |
oop.inherits(LatexHighlightRules, TextHighlightRules); |
| 86 |
exports.LatexHighlightRules = LatexHighlightRules; |
| 87 |
|
| 88 |
}); |
| 89 |
|
| 90 |
ace.define("ace/mode/rdoc_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules","ace/mode/latex_highlight_rules"], function(require, exports, module){ |
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
"use strict"; |
| 123 |
var oop = require("../lib/oop"); |
| 124 |
var lang = require("../lib/lang"); |
| 125 |
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; |
| 126 |
var LaTeXHighlightRules = require("./latex_highlight_rules"); |
| 127 |
var RDocHighlightRules = function () { |
| 128 |
this.$rules = { |
| 129 |
"start": [ |
| 130 |
{ |
| 131 |
token: "comment", |
| 132 |
regex: "%.*$" |
| 133 |
}, { |
| 134 |
token: "text", |
| 135 |
regex: "\\\\[$&%#\\{\\}]" |
| 136 |
}, { |
| 137 |
token: "keyword", |
| 138 |
regex: "\\\\(?:name|alias|method|S3method|S4method|item|code|preformatted|kbd|pkg|var|env|option|command|author|email|url|source|cite|acronym|href|code|preformatted|link|eqn|deqn|keyword|usage|examples|dontrun|dontshow|figure|if|ifelse|Sexpr|RdOpts|inputencoding|usepackage)\\b", |
| 139 |
next: "nospell" |
| 140 |
}, { |
| 141 |
token: "keyword", |
| 142 |
regex: "\\\\(?:[a-zA-Z0-9]+|[^a-zA-Z0-9])" |
| 143 |
}, { |
| 144 |
token: "paren.keyword.operator", |
| 145 |
regex: "[[({]" |
| 146 |
}, { |
| 147 |
token: "paren.keyword.operator", |
| 148 |
regex: "[\\])}]" |
| 149 |
}, { |
| 150 |
token: "text", |
| 151 |
regex: "\\s+" |
| 152 |
} |
| 153 |
], |
| 154 |
"nospell": [ |
| 155 |
{ |
| 156 |
token: "comment", |
| 157 |
regex: "%.*$", |
| 158 |
next: "start" |
| 159 |
}, { |
| 160 |
token: "nospell.text", |
| 161 |
regex: "\\\\[$&%#\\{\\}]" |
| 162 |
}, { |
| 163 |
token: "keyword", |
| 164 |
regex: "\\\\(?:name|alias|method|S3method|S4method|item|code|preformatted|kbd|pkg|var|env|option|command|author|email|url|source|cite|acronym|href|code|preformatted|link|eqn|deqn|keyword|usage|examples|dontrun|dontshow|figure|if|ifelse|Sexpr|RdOpts|inputencoding|usepackage)\\b" |
| 165 |
}, { |
| 166 |
token: "keyword", |
| 167 |
regex: "\\\\(?:[a-zA-Z0-9]+|[^a-zA-Z0-9])", |
| 168 |
next: "start" |
| 169 |
}, { |
| 170 |
token: "paren.keyword.operator", |
| 171 |
regex: "[[({]" |
| 172 |
}, { |
| 173 |
token: "paren.keyword.operator", |
| 174 |
regex: "[\\])]" |
| 175 |
}, { |
| 176 |
token: "paren.keyword.operator", |
| 177 |
regex: "}", |
| 178 |
next: "start" |
| 179 |
}, { |
| 180 |
token: "nospell.text", |
| 181 |
regex: "\\s+" |
| 182 |
}, { |
| 183 |
token: "nospell.text", |
| 184 |
regex: "\\w+" |
| 185 |
} |
| 186 |
] |
| 187 |
}; |
| 188 |
}; |
| 189 |
oop.inherits(RDocHighlightRules, TextHighlightRules); |
| 190 |
exports.RDocHighlightRules = RDocHighlightRules; |
| 191 |
|
| 192 |
}); |
| 193 |
|
| 194 |
ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module){"use strict"; |
| 195 |
var Range = require("../range").Range; |
| 196 |
var MatchingBraceOutdent = function () { }; |
| 197 |
(function () { |
| 198 |
this.checkOutdent = function (line, input) { |
| 199 |
if (!/^\s+$/.test(line)) |
| 200 |
return false; |
| 201 |
return /^\s*\}/.test(input); |
| 202 |
}; |
| 203 |
this.autoOutdent = function (doc, row) { |
| 204 |
var line = doc.getLine(row); |
| 205 |
var match = line.match(/^(\s*\})/); |
| 206 |
if (!match) |
| 207 |
return 0; |
| 208 |
var column = match[1].length; |
| 209 |
var openBracePos = doc.findMatchingBracket({ row: row, column: column }); |
| 210 |
if (!openBracePos || openBracePos.row == row) |
| 211 |
return 0; |
| 212 |
var indent = this.$getIndent(doc.getLine(openBracePos.row)); |
| 213 |
doc.replace(new Range(row, 0, row, column - 1), indent); |
| 214 |
}; |
| 215 |
this.$getIndent = function (line) { |
| 216 |
return line.match(/^\s*/)[0]; |
| 217 |
}; |
| 218 |
}).call(MatchingBraceOutdent.prototype); |
| 219 |
exports.MatchingBraceOutdent = MatchingBraceOutdent; |
| 220 |
|
| 221 |
}); |
| 222 |
|
| 223 |
ace.define("ace/mode/rdoc",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/rdoc_highlight_rules","ace/mode/matching_brace_outdent"], function(require, exports, module){ |
| 224 |
|
| 225 |
|
| 226 |
|
| 227 |
|
| 228 |
|
| 229 |
|
| 230 |
|
| 231 |
|
| 232 |
|
| 233 |
|
| 234 |
|
| 235 |
|
| 236 |
|
| 237 |
|
| 238 |
|
| 239 |
|
| 240 |
|
| 241 |
|
| 242 |
|
| 243 |
|
| 244 |
|
| 245 |
|
| 246 |
|
| 247 |
|
| 248 |
|
| 249 |
|
| 250 |
|
| 251 |
|
| 252 |
|
| 253 |
|
| 254 |
|
| 255 |
|
| 256 |
|
| 257 |
|
| 258 |
|
| 259 |
|
| 260 |
"use strict"; |
| 261 |
var oop = require("../lib/oop"); |
| 262 |
var TextMode = require("./text").Mode; |
| 263 |
var RDocHighlightRules = require("./rdoc_highlight_rules").RDocHighlightRules; |
| 264 |
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; |
| 265 |
var Mode = function (suppressHighlighting) { |
| 266 |
this.HighlightRules = RDocHighlightRules; |
| 267 |
this.$outdent = new MatchingBraceOutdent(); |
| 268 |
this.$behaviour = this.$defaultBehaviour; |
| 269 |
}; |
| 270 |
oop.inherits(Mode, TextMode); |
| 271 |
(function () { |
| 272 |
this.getNextLineIndent = function (state, line, tab) { |
| 273 |
return this.$getIndent(line); |
| 274 |
}; |
| 275 |
this.$id = "ace/mode/rdoc"; |
| 276 |
}).call(Mode.prototype); |
| 277 |
exports.Mode = Mode; |
| 278 |
|
| 279 |
}); (function() { |
| 280 |
ace.require(["ace/mode/rdoc"], function(m) { |
| 281 |
if (typeof module == "object" && typeof exports == "object" && module) { |
| 282 |
module.exports = m; |
| 283 |
} |
| 284 |
}); |
| 285 |
})(); |
| 286 |
|