| 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/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module){"use strict"; |
| 112 |
var Range = require("../range").Range; |
| 113 |
var MatchingBraceOutdent = function () { }; |
| 114 |
(function () { |
| 115 |
this.checkOutdent = function (line, input) { |
| 116 |
if (!/^\s+$/.test(line)) |
| 117 |
return false; |
| 118 |
return /^\s*\}/.test(input); |
| 119 |
}; |
| 120 |
this.autoOutdent = function (doc, row) { |
| 121 |
var line = doc.getLine(row); |
| 122 |
var match = line.match(/^(\s*\})/); |
| 123 |
if (!match) |
| 124 |
return 0; |
| 125 |
var column = match[1].length; |
| 126 |
var openBracePos = doc.findMatchingBracket({ row: row, column: column }); |
| 127 |
if (!openBracePos || openBracePos.row == row) |
| 128 |
return 0; |
| 129 |
var indent = this.$getIndent(doc.getLine(openBracePos.row)); |
| 130 |
doc.replace(new Range(row, 0, row, column - 1), indent); |
| 131 |
}; |
| 132 |
this.$getIndent = function (line) { |
| 133 |
return line.match(/^\s*/)[0]; |
| 134 |
}; |
| 135 |
}).call(MatchingBraceOutdent.prototype); |
| 136 |
exports.MatchingBraceOutdent = MatchingBraceOutdent; |
| 137 |
|
| 138 |
}); |
| 139 |
|
| 140 |
ace.define("ace/mode/tex",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/text_highlight_rules","ace/mode/tex_highlight_rules","ace/mode/matching_brace_outdent"], function(require, exports, module){ |
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
|
| 165 |
|
| 166 |
|
| 167 |
|
| 168 |
|
| 169 |
|
| 170 |
|
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
"use strict"; |
| 178 |
var oop = require("../lib/oop"); |
| 179 |
var TextMode = require("./text").Mode; |
| 180 |
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; |
| 181 |
var TexHighlightRules = require("./tex_highlight_rules").TexHighlightRules; |
| 182 |
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; |
| 183 |
var Mode = function (suppressHighlighting) { |
| 184 |
if (suppressHighlighting) |
| 185 |
this.HighlightRules = TextHighlightRules; |
| 186 |
else |
| 187 |
this.HighlightRules = TexHighlightRules; |
| 188 |
this.$outdent = new MatchingBraceOutdent(); |
| 189 |
this.$behaviour = this.$defaultBehaviour; |
| 190 |
}; |
| 191 |
oop.inherits(Mode, TextMode); |
| 192 |
(function () { |
| 193 |
this.lineCommentStart = "%"; |
| 194 |
this.getNextLineIndent = function (state, line, tab) { |
| 195 |
return this.$getIndent(line); |
| 196 |
}; |
| 197 |
this.allowAutoInsert = function () { |
| 198 |
return false; |
| 199 |
}; |
| 200 |
this.$id = "ace/mode/tex"; |
| 201 |
this.snippetFileId = "ace/snippets/tex"; |
| 202 |
}).call(Mode.prototype); |
| 203 |
exports.Mode = Mode; |
| 204 |
|
| 205 |
}); (function() { |
| 206 |
ace.require(["ace/mode/tex"], function(m) { |
| 207 |
if (typeof module == "object" && typeof exports == "object" && module) { |
| 208 |
module.exports = m; |
| 209 |
} |
| 210 |
}); |
| 211 |
})(); |
| 212 |
|